summaryrefslogtreecommitdiff
path: root/examples/corelib
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-04-30 15:27:56 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-04-30 15:27:56 +0200
commitaa202ad09d3c9febef41dea2a0df2fe33ee9b5b8 (patch)
tree2cd21f2956f5165340eb4e12b90abbe8aceace83 /examples/corelib
parentc4eaf9cf8ab40258ca64e4bfc3717b957e9e8c13 (diff)
downloadfpGUI-aa202ad09d3c9febef41dea2a0df2fe33ee9b5b8.tar.xz
Updated Canvas Test demo to show that TfpgImage.ImageFromRect() does work.
Diffstat (limited to 'examples/corelib')
-rw-r--r--examples/corelib/canvastest/fpgcanvas.lpr16
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/corelib/canvastest/fpgcanvas.lpr b/examples/corelib/canvastest/fpgcanvas.lpr
index 972c87a9..9d0656e4 100644
--- a/examples/corelib/canvastest/fpgcanvas.lpr
+++ b/examples/corelib/canvastest/fpgcanvas.lpr
@@ -44,6 +44,7 @@ var
fnt: TfpgFont;
y: integer;
c: TfpgColor;
+ lImage: TfpgImage;
begin
// Testing Rectangles
Canvas.SetColor(clBlack);
@@ -142,15 +143,26 @@ begin
// Testing Bitmap painting
Canvas.DrawString(5, 180, 'Single BMP file:');
- Canvas.DrawString(300, 210, '(mask enabled for all images)');
+ Canvas.DrawString(310, 210, '(mask enabled for all images)');
Canvas.DrawImage(150, 180, bmp);
Canvas.DrawString(5, 210, 'Parts of BMP file:');
Canvas.DrawImagePart(150, 210, bmp, 0, 0, 32, 21);
Canvas.DrawImagePart(190, 210, bmp, 32, 0, 32, 21);
Canvas.DrawImagePart(230, 210, bmp, 64, 0, 32, 21);
+ // create image from an image
+ r.SetRect(32, 0, 32, 21); // second button in image
+ lImage := bmp.ImageFromRect(r);
+ try
+ lImage.CreateMaskFromSample(0, 0);
+ lImage.UpdateImage;
+ Canvas.DrawImage(270, 215, lImage);
+ finally
+ lImage.Free;
+ end;
- Canvas.StretchDraw(150, 240, 300, 50, bmp);
+ // Testing Bitmap strechdraw
+ Canvas.StretchDraw(150, 240, 300, 50, bmp);
Canvas.DrawImage(150, 300, dst);
Canvas.StretchDraw(180, 300, 70, 70, dst);
Canvas.StretchDraw(265, 300, 230, 25, bmp);