[Lazarus] Image Copy and Load Fail.
최경식
me357159 at naver.com
Thu Feb 25 12:42:23 CET 2016
-----Original Message-----
From: "Mattias Gaertner"<nc-gaertnma at netcologne.de>
To: <lazarus at lists.lazarus.freepascal.org>;
Cc:
Sent: 2016-02-25 (목) 19:57:19
Subject: Re: [Lazarus] Image Copy and Load Fail.
On Thu, 25 Feb 2016 19:28:57 +0900 (KST)
최경식 <me357159 at naver.com> wrote:
>[...]
> procedure TForm1.Button3Click(Sender: TObject);
> var
> ImagetoSave : TImage;
> begin
> ImagetoSave := TImage.Create(Self);
A TImage is a visual control that uses a graphic (e.g. a TBitmap) to
paint.
If you only need a memory image use TBitmap directly instead.
This copies pixels (not attributes):
var
ImagetoSave : TBitmap;
begin
ImagetoSave := TBitmap.Create(Self);
with ImagetoSave do
begin
PixelFormat := pf32bit;
SetSize(Image1.Width,Image1.Height);
Canvas.CopyRect(Rect(0,0,Image1.Width,Image1.Height),
Image1.Picture.Bitmap.Canvas,
Rect(0,0,Image1.Width,Image1.Height));
end;
ImagetoSave.SaveToFile('/home/user/Image/copycreate.bmp');
FileListBox1.UpdateFileList;
end;
> procedure TForm1.FileListBox1Change(Sender: TObject);
> begin
> if FileListBox1.ItemIndex <> -1 then
> begin
> //Loading
> Image3.Picture.bitmap.TransParentColor := clGreen; //Valuable!
Hint:
If you also want to copy attributes like TransparentColor, use
ImagetoSave.Assign(Image1.Picture.Bitmap);
Mattias
--
Thank you.
But the problem still occurs.
I set the size to 4200 * 900 -> copy -> re-set the size.
My platform is ARM-linux and OS is Lubuntu, Lazarus 1.0.10+dpkg (I tested newest version with same problem..)
_______________________________________________
Lazarus mailing list
Lazarus at lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160225/74e17013/attachment-0003.html>
More information about the Lazarus
mailing list