unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
BGRAGraphicControl, BGRABitmap, BGRABitmapTypes, BCTypes;
type
{ TForm1 }
TForm1 = class(TForm)
BGRAGraphicControl1: TBGRAGraphicControl;
Button1: TButton;
procedure BGRAGraphicControl1Paint(Sender: TObject);
procedure BGRAGraphicControl1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
procedure Button1Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
public
end;
var
Form1: TForm1;
TheImage : TBGRABitmap;
//TheImage : TBitmap;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
TheImage := TBGRABitmap.Create('test.jpg');
BGRAGraphicControl1.width:=TheImage.width;
BGRAGraphicControl1.height:=TheImage.height;
BGRAGraphicControl1.Assign(TheImage); {<-- ERROR - Can't Assign image}
//TheImage := TBGRABitmap.Create;
//TheImage.LoadFromFile('test.jpg');
//TheImage.Canvas.FillRect(0,0,TheImage.Width,TheImage.Height);
//TheImage.SetSize(BGRAGraphicControl1.Width, BGRAGraphicControl1.Height);
//BGRAGraphicControl1.Canvas.Brush.Style:=bsClear;
//BGRAGraphicControl1.Canvas.Brush.Style:=bsClear;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
TheImage.Free;
end;
procedure TForm1.BGRAGraphicControl1Paint(Sender: TObject);
begin
if assigned(TheImage) then
begin
TheImage.Draw(Canvas,0,0,false); //true makes it opaque - false makes transparent
//BGRAGraphicControl1.Canvas.Draw(0,0,true);
end;
end;
procedure TForm1.BGRAGraphicControl1Redraw(Sender: TObject; Bitmap: TBGRABitmap
);
begin
//if assigned(TheImage) then
//TheImage.FillTransparent
end;
end.
[\code]