mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 15:40:41 +02:00
examples lazintfimage: paint bitmaps inside paint event, qt and carbon do not support paint outside of paint event.
git-svn-id: trunk@35477 -
This commit is contained in:
parent
2b9b562c24
commit
c369edc334
@ -50,7 +50,7 @@
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="9"/>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<SrcPath Value="$(LazarusDir)\lcl;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)"/>
|
||||
|
@ -9,7 +9,8 @@ object Form1: TForm1
|
||||
ClientWidth = 498
|
||||
OnCreate = Form1Create
|
||||
OnDestroy = Form1Destroy
|
||||
LCLVersion = '0.9.25'
|
||||
OnPaint = FormPaint
|
||||
LCLVersion = '0.9.31'
|
||||
object Button1: TButton
|
||||
Left = 85
|
||||
Height = 25
|
||||
|
@ -21,7 +21,9 @@ type
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure Form1Create(Sender: TObject);
|
||||
procedure Form1Destroy(Sender: TObject);
|
||||
procedure FormPaint(Sender: TObject);
|
||||
private
|
||||
FKind: Byte; // 1 = FadeIn 2 = Rotate
|
||||
procedure FadeIn(ABitmap: TBitmap; x, y: integer);
|
||||
procedure Rotate(ABitmap: TBitmap; aCanvas : TCanvas; x, y, Angle : integer);
|
||||
|
||||
@ -40,16 +42,19 @@ implementation
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
begin
|
||||
FadeIn(SampleBitmapABitmap,120,120);
|
||||
FKind := 1;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button2Click(Sender: TObject);
|
||||
begin
|
||||
Rotate(SampleBitmapABitmap,Canvas,120,120,StrToIntDef(Edit1.Text,90));
|
||||
FKind := 2;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TForm1.Form1Create(Sender: TObject);
|
||||
begin
|
||||
FKind := 0;
|
||||
SampleBitmapABitmap:=TBitmap.Create;
|
||||
SampleBitmapABitmap.LoadFromFile(SetDirSeparators('../../images/LazarusForm.bmp'));
|
||||
end;
|
||||
@ -59,6 +64,16 @@ begin
|
||||
SampleBitmapABitmap.Free;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormPaint(Sender: TObject);
|
||||
begin
|
||||
if FKind = 1 then
|
||||
FadeIn(SampleBitmapABitmap,120,120)
|
||||
else
|
||||
if FKind = 2 then
|
||||
Rotate(SampleBitmapABitmap,Canvas,120,120,StrToIntDef(Edit1.Text,90));
|
||||
FKind := 0;
|
||||
end;
|
||||
|
||||
procedure TForm1.FadeIn(ABitmap: TBitmap; x, y: integer);
|
||||
var
|
||||
SrcIntfImg, TempIntfImg: TLazIntfImage;
|
||||
|
Loading…
Reference in New Issue
Block a user