mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-04 15:40:27 +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>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="9"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<SrcPath Value="$(LazarusDir)\lcl;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)"/>
|
<SrcPath Value="$(LazarusDir)\lcl;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)"/>
|
||||||
|
@ -9,7 +9,8 @@ object Form1: TForm1
|
|||||||
ClientWidth = 498
|
ClientWidth = 498
|
||||||
OnCreate = Form1Create
|
OnCreate = Form1Create
|
||||||
OnDestroy = Form1Destroy
|
OnDestroy = Form1Destroy
|
||||||
LCLVersion = '0.9.25'
|
OnPaint = FormPaint
|
||||||
|
LCLVersion = '0.9.31'
|
||||||
object Button1: TButton
|
object Button1: TButton
|
||||||
Left = 85
|
Left = 85
|
||||||
Height = 25
|
Height = 25
|
||||||
|
@ -21,7 +21,9 @@ type
|
|||||||
procedure Button2Click(Sender: TObject);
|
procedure Button2Click(Sender: TObject);
|
||||||
procedure Form1Create(Sender: TObject);
|
procedure Form1Create(Sender: TObject);
|
||||||
procedure Form1Destroy(Sender: TObject);
|
procedure Form1Destroy(Sender: TObject);
|
||||||
|
procedure FormPaint(Sender: TObject);
|
||||||
private
|
private
|
||||||
|
FKind: Byte; // 1 = FadeIn 2 = Rotate
|
||||||
procedure FadeIn(ABitmap: TBitmap; x, y: integer);
|
procedure FadeIn(ABitmap: TBitmap; x, y: integer);
|
||||||
procedure Rotate(ABitmap: TBitmap; aCanvas : TCanvas; x, y, Angle : integer);
|
procedure Rotate(ABitmap: TBitmap; aCanvas : TCanvas; x, y, Angle : integer);
|
||||||
|
|
||||||
@ -40,16 +42,19 @@ implementation
|
|||||||
|
|
||||||
procedure TForm1.Button1Click(Sender: TObject);
|
procedure TForm1.Button1Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FadeIn(SampleBitmapABitmap,120,120);
|
FKind := 1;
|
||||||
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.Button2Click(Sender: TObject);
|
procedure TForm1.Button2Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Rotate(SampleBitmapABitmap,Canvas,120,120,StrToIntDef(Edit1.Text,90));
|
FKind := 2;
|
||||||
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.Form1Create(Sender: TObject);
|
procedure TForm1.Form1Create(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
FKind := 0;
|
||||||
SampleBitmapABitmap:=TBitmap.Create;
|
SampleBitmapABitmap:=TBitmap.Create;
|
||||||
SampleBitmapABitmap.LoadFromFile(SetDirSeparators('../../images/LazarusForm.bmp'));
|
SampleBitmapABitmap.LoadFromFile(SetDirSeparators('../../images/LazarusForm.bmp'));
|
||||||
end;
|
end;
|
||||||
@ -59,6 +64,16 @@ begin
|
|||||||
SampleBitmapABitmap.Free;
|
SampleBitmapABitmap.Free;
|
||||||
end;
|
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);
|
procedure TForm1.FadeIn(ABitmap: TBitmap; x, y: integer);
|
||||||
var
|
var
|
||||||
SrcIntfImg, TempIntfImg: TLazIntfImage;
|
SrcIntfImg, TempIntfImg: TLazIntfImage;
|
||||||
|
Loading…
Reference in New Issue
Block a user