Reading Pixels property of TBitMap raises FPImageException
Original Reporter info from Mantis: shiraishi
-
Reporter name:
Original Reporter info from Mantis: shiraishi
- Reporter name:
Description:
The following code raises an FPImageException Invalid Size on Lazarus 1.0 or 1.0.2 on Mac(Intel).
c:=bitmap1.Canvas.Pixels[2,2];
Lazarus 0.9.30.4 Mac Carbon or Lazarus 1.0.2 Windows do not cause such an error.
The whole code of the unit is as follows.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
Buttons, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
BitBtn1: TBitBtn;
Label1: TLabel;
PaintBox1: TPaintBox;
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure PaintBox1Paint(Sender: TObject);
private
bitmap1:TBitmap;
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
bitmap1:=TBitmap.Create;
bitmap1.Width:=PaintBox1.Width;
bitmap1.Height:=PaintBox1.Height;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
bitmap1.Free;
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
PaintBox1.Canvas.Draw(0,0,BitMap1);
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
c:integer;
begin
bitmap1.Canvas.Pixels[2,2]:=clred;
c:=bitmap1.Canvas.Pixels[2,2];
Label1.Caption:=IntToStr(c and $FFFFFF);
repaint;
end;
end.
Steps to reproduce:
Run project1 and click BitBtn1.
Mantis conversion info:
- Mantis ID: 23112
- OS: OS-X
- OS Build: 10.6.8
- Platform: Mac (intel)
- Version: 1.0.2
- Fixed in version: 1.3 (SVN)
- Fixed in revision: 45346 (#208579db)
- Monitored by: » shiraishi (shiraishi)
- Target version: 1.4