Hi, I´m creating a program that has a button to open a picture, and to display it on the same form, (later I want to do pixel manipulation on the image), but when I compile it gives me a external sigsegv error.can you help me?
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil,LResources, Forms, Controls, Graphics, Dialogs, ExtDlgs,
StdCtrls, BGRABitmap, BGRABitmapTypes;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
OpenPictureDialog1: TOpenPictureDialog;
procedure Button1Click(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
image: TBGRABitmap;
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1; filename:AnsiString;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
filename := OpenPictureDialog1.FileName;
image:= TBGRABitmap.Create(filename);
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
image.Draw(Canvas,220,240,True);
image.Free;
end;
end.