I tried running this on a new machine (MacBook Pro with Windows 7 on VirtualBox). I'm having trouble reproducing errors, but am still not able to get this to run. On Windows 7 (64 bit) it is now compiling, but I get a blank form. On Mac 10.11.5 I get a blue rectangle instead of the expected red.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls,
BGRABitmap, BGRABitmapTypes;
type
{ TForm1 }
TForm1 = class(TForm)
PaintBox1: TPaintBox;
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ private declarations }
fBmp: TBGRABitmap;
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var
w, h: integer;
tsp: TBGRAPixel;
begin
tsp := BGRA($00, $00, $00, $00);
w := PaintBox1.Width;
h := PaintBox1.Height;
fBmp := TBGRABitmap.Create(w, h);
fBmp.FillRect(0, 0, w-1, h-1, cssWhite, dmSet);
fBmp.FillRect(0, 0, w-1, h-1, cssRed, dmDrawWithTransparency);
fBmp.Rectangle(0, 0, w-1, h-1, cssBlack, tsp, dmDrawWithTransparency);
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
fBmp.Draw(PaintBox1.Canvas, 1, 1, true);
end;
end.
See attached project.
I appreciate any suggestions.
Cheers,
VTwin