I’m still inexperienced at Delphi for Android, but I keep hitting brick walls.
My latest problem is using TBitmap.CopyFromBitmap()
in Delphi 12 CE.
When I use it, the destination bitmap seems to be cleared and then the bitmap section is copied correctly.
In the simple example, I have two bitmaps of different colors (yellow and purple), and pressing the button copies a small block from the right image to the left. Note how the yellow disappears.
Please tell me why I am battling with such a trivial task.
unit testUnit;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects,
FMX.Controls.Presentation, FMX.StdCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Image2: TImage;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.Button1Click(Sender: TObject);
var
r:Trect;
begin
r:=trect.Create(50,50,100,100);
image1.Bitmap.CopyFromBitmap(image2.bitmap,r,100,150);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
image1.bitmap.SetSize(300,300);
image1.bitmap.Canvas.BeginScene;
image1.bitmap.Canvas.Clear($ffff00);
image1.bitmap.Canvas.EndScene;
image2.bitmap.SetSize(300,300);
image2.bitmap.Canvas.BeginScene;
image2.bitmap.Canvas.Clear($ff00ff);
image2.bitmap.Canvas.EndScene;
end;
end.
3