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:
zeljko 2012-02-19 11:35:21 +00:00
parent 2b9b562c24
commit c369edc334
3 changed files with 20 additions and 4 deletions

View File

@ -50,7 +50,7 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="9"/>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<SrcPath Value="$(LazarusDir)\lcl;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)"/>

View File

@ -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

View File

@ -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;