delphi bitmap position manipulation

  

I’ve this event to draw on a bitmap :

procedure TForm1.Button1Click(Sender: TObject);
var
SrcBmp,MyBitmap: TBitmap;
MyRect: TRectF;
begin
SrcBmp:=TBitmap.CreateFromFile(‘android.png’);
try
MyBitmap := TBitmap.CreateFromFile(‘fav.png’);
try
MyRect.Left :=0;
MyRect.Top := 0;
MyRect.Bottom := MyBitmap.Height;
MyRect.Right := MyBitmap.Width;

SrcBmp.Canvas.BeginScene() ;
SrcBmp.Canvas.DrawBitmap(MyBitmap,MyRect
,MyRect, 50);
SrcBmp.Canvas.EndScene;
finally
MyBitmap.Free;
end;

Image1.Bitmap.Assign(SrcBmp);

finally
SrcBmp.Free;
end;
end;

The Result is :

But what i want to get is this result :

I tried to decrease the MyRect.Left and MyRect.Top , but that didn’t give the 2nd result .

PS: the fav.png dimensions is 16×16 .

Many thanks

Comments are closed.