summaryrefslogtreecommitdiff
path: root/examples/gui
diff options
context:
space:
mode:
Diffstat (limited to 'examples/gui')
-rw-r--r--examples/gui/imgtest/bitmaptest.lpi5
-rw-r--r--examples/gui/imgtest/bitmaptest.lpr29
2 files changed, 17 insertions, 17 deletions
diff --git a/examples/gui/imgtest/bitmaptest.lpi b/examples/gui/imgtest/bitmaptest.lpi
index af74913a..24ccafc2 100644
--- a/examples/gui/imgtest/bitmaptest.lpi
+++ b/examples/gui/imgtest/bitmaptest.lpi
@@ -1,15 +1,14 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="/"/>
- <Version Value="6"/>
+ <Version Value="7"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
+ <LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value="./"/>
<TargetFileExt Value=""/>
<Title Value="bitmaptest"/>
</General>
diff --git a/examples/gui/imgtest/bitmaptest.lpr b/examples/gui/imgtest/bitmaptest.lpr
index 010ff886..898b7c61 100644
--- a/examples/gui/imgtest/bitmaptest.lpr
+++ b/examples/gui/imgtest/bitmaptest.lpr
@@ -19,8 +19,7 @@ type
TMainForm = class(TfpgForm)
private
img: TfpgImage;
- protected
- procedure HandlePaint; override;
+ procedure FormPaint(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -29,22 +28,21 @@ type
{ TMainForm }
-procedure TMainForm.HandlePaint;
+procedure TMainForm.FormPaint(Sender: TObject);
var
i, j: integer;
begin
- Canvas.BeginDraw; // activate double buffering in time.
-// inherited HandlePaint;
- img.Free;
- img := TfpgImage.Create;
- img.AllocateImage(32, 256, 256);
- img.UpdateImage;
- // populate the bitmap with pretty colors :-)
- for j := 0 to 255 do
- for i := 0 to 255 do
- PLongWord(img.ImageData)[j * 256 + i] := (i shl 16) or (j shl 8);
+ if not Assigned(img) then // we only need to create the image once
+ begin
+ img := TfpgImage.Create;
+ img.AllocateImage(32, 256, 256);
+ // populate the bitmap with pretty colors :-)
+ for j := 0 to 255 do
+ for i := 0 to 255 do
+ PLongWord(img.ImageData)[j * 256 + i] := (i shl 16) or (j shl 8);
+ img.UpdateImage; // now only do we allocate OS resources
+ end;
Canvas.DrawImage(0, 0, img);
- Canvas.EndDraw;
end;
constructor TMainForm.Create(AOwner: TComponent);
@@ -52,6 +50,9 @@ begin
inherited Create(AOwner);
SetPosition(100, 100, 256, 256);
WindowTitle := 'fpGUI Bitmap Test';
+ WindowPosition := wpOneThirdDown;
+ Sizeable := False;
+ OnPaint := @FormPaint;
end;
destructor TMainForm.Destroy;