From c11466bafe6ff2785122ad9c976f1290cdcfdfa5 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 19 Jan 2009 22:39:52 +0000 Subject: [PATCH] PainterExamples added Ctrl+P: printing git-svn-id: svn://ultimatepp.org/upp/trunk@787 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- examples/PainterExamples/Lion.cpp | 2 +- examples/PainterExamples/StrokeBug.cpp | 6 +++--- examples/PainterExamples/main.cpp | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/examples/PainterExamples/Lion.cpp b/examples/PainterExamples/Lion.cpp index 6eb95eec7..c8f85487a 100644 --- a/examples/PainterExamples/Lion.cpp +++ b/examples/PainterExamples/Lion.cpp @@ -213,7 +213,7 @@ void PaintLion(Painter& sw) for(int i = 0; i < 10; i++) { sw.Begin(); - sw.Opacity(1 - (i + 1) / 10.0); + sw.Opacity(0.5); sw.Translate(600, 200); sw.Rotate(i / 10.0 * M_2PI); sw.Rectangle(0, 0, 200, 500) diff --git a/examples/PainterExamples/StrokeBug.cpp b/examples/PainterExamples/StrokeBug.cpp index 6010d4736..84c587b22 100644 --- a/examples/PainterExamples/StrokeBug.cpp +++ b/examples/PainterExamples/StrokeBug.cpp @@ -4,11 +4,11 @@ void StrokeBug(Painter& sw) { - const char *txt = "GR";//ADIENT TEXT"; + const char *txt = "GRM";//ADIENT TEXT"; Font fnt = Arial(100).Bold(); Size tsz = GetTextSize(txt, fnt); - sw.Scale(-4, 4); - sw.Translate(-300, 0); + sw.Scale(3, 3); +// sw.Translate(-300, 0); sw.Text(100, 100, txt, fnt) .Stroke(10, 100, 100, Blue(), 100 + tsz.cx, 100, LtRed()) .Stroke(0.25, White()); diff --git a/examples/PainterExamples/main.cpp b/examples/PainterExamples/main.cpp index c53ebda35..10831787c 100644 --- a/examples/PainterExamples/main.cpp +++ b/examples/PainterExamples/main.cpp @@ -26,6 +26,20 @@ struct App : TopWindow { SplitterFrame split; ArrayCtrl list; + virtual bool Key(dword key, int count) + { + if(key == K_CTRL_P) { + PaintingPainter sw(1000, 1000); + sw.Clear(White()); + if(list.IsCursor()) + Examples()[list.GetCursor()].example(sw); + PrinterJob pb; + if(pb.Execute()) + pb.GetDraw().DrawPainting(0, 0, 4000, 4000, sw); + } + return TopWindow::Key(key, count); + } + virtual void Paint(Draw& w) { ImageBuffer ib(GetSize());