summaryrefslogtreecommitdiff
path: root/src/corelib/fpgfx.pas
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-11-29 21:03:18 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-11-29 21:03:18 +0000
commitb15bb57682a856c0db4723d1fba749a1d2df6b95 (patch)
treef3b16fc3a50c72c6f9bf486934d4b7d66a5f626f /src/corelib/fpgfx.pas
parent709237f47fd404fc163ca5f2d7532f08647a9e05 (diff)
downloadfpGUI-b15bb57682a856c0db4723d1fba749a1d2df6b95.tar.xz
* New overloaded method ImageFromRect in TfpgImage.
* Created a PaintPartScaledImage in prototypes which will be used for Bitmap based theming.
Diffstat (limited to 'src/corelib/fpgfx.pas')
-rw-r--r--src/corelib/fpgfx.pas25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/corelib/fpgfx.pas b/src/corelib/fpgfx.pas
index bd6d15d5..31c0800c 100644
--- a/src/corelib/fpgfx.pas
+++ b/src/corelib/fpgfx.pas
@@ -118,7 +118,8 @@ type
TfpgImage = class(TfpgImageImpl)
public
- function ImageFromRect(var ARect: TRect): TfpgImage;
+ function ImageFromRect(var ARect: TRect): TfpgImage; overload;
+ function ImageFromRect(var ARect: TfpgRect): TfpgImage; overload;
end;
@@ -1280,6 +1281,28 @@ begin
end;
end;
+function TfpgImage.ImageFromRect(var ARect: TfpgRect): TfpgImage;
+var
+ x, y: TfpgCoord;
+ ix, iy: TfpgCoord;
+begin
+ Result := TfpgImage.Create;
+ Result.AllocateImage(ColorDepth, ARect.Width, ARect.Height);
+ Result.UpdateImage;
+
+ iy := -1;
+ for y := ARect.Top to ARect.Bottom do
+ begin
+ Inc(iy);
+ ix := -1;
+ for x := ARect.Left to ARect.Right do
+ begin
+ Inc(ix);
+ Result.Colors[ix, iy] := Colors[x, y];
+ end;
+ end;
+end;
+
initialization
uApplication := nil;
fpgTimers := nil;