[Lazarus] Image Copy and Load Fail.
최경식
me357159 at naver.com
Thu Feb 25 11:28:57 CET 2016
hello everyone.
I Loaded successfully after saving that i drawn.
But i load fail after saving that i copied. (please see below code)
This situation occurs in accordance with copy size.
Below it is my code and i written some comments.
[My code]
procedure TForm1.Button2Click(Sender: TObject);
begin
//Drawing
Image1.Picture.bitmap.PixelFormat := pf32bit; //Valuable!
Image1.Picture.bitmap.SetSize(Image1.Width,Image1.Height);
Image1.Picture.Bitmap.Canvas.TextOut(0,0,'test');
Image1.Invalidate; //
Image1.Picture.Bitmap.SaveToFile('/home/user/Image/drawing.bmp');
FileListBox1.UpdateFileList;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
ImagetoSave : TImage;
begin
ImagetoSave := TImage.Create(Self);
with ImagetoSave.Picture.Bitmap do
begin
PixelFormat := pf32bit;
SetSize(500,900); // this is where a problem is caused. if these size numbers are large, the problem occurrence, otherwise the problems does not occur.
ImagetoSave.Width := Width;
ImagetoSave.Height:= Height;
Canvas.CopyRect(Rect(0,0,Image1.Width,Image1.Height),
Image1.Picture.Bitmap.Canvas,
Rect(0,0,Image1.Width,Image1.Height));
SetSize(Image1.Width,Image1.Height);
ImagetoSave.Width := Width;
ImagetoSave.Height:= Height;
end;
ImagetoSave.Picture.Bitmap.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!
Image3.Picture.bitmap.LoadFromFile(FileListBox1.FileName);
Image3.Width := Image3.Picture.bitmap.Width;
Image3.Height := Image3.Picture.bitmap.Height;
end;
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160225/d602398b/attachment-0002.html>
More information about the Lazarus
mailing list