summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;