I am using TBGRABitmap, but when I use one of the procedures I get an error that it expects TBitmap rather than TBGRABitmap.
PrevFrameImage:=TBGRABitmap.Create;
PrevSubImage:=TBGRABitmap.Create;
. . . .
Later, I input PrevSubImage into another TBGRABitmap like this:
CharMatrix.SubBmp.Canvas.Draw(0,0,PrevSubImage);
CutRect := CharMatrix.CutValidRect(CharMatrix.SubBmp, 1);
VobProcess.ReallySkip := False;
ImageVideo.Canvas.Draw(0,0,PrevFrameImage);
The error refers to CharMatrix.SubBmp.Canvas.Draw:
unit21.pas(643,59) Error: Incompatible type for arg no. 3: Got "TBGRAGtkBitmap", expected "TGraphic"
Under the Class -- CharMatrix, SubBmp is created like this:
TCharacterMatrix = Class
. . . .
SubBmp : TBGRABitmap;
. . . .
end;
implementation
constructor TCharacterMatrix.Create;overload;
begin
. . . .
SubBmp := TBGRABitmap.Create;
. . . .
end;
CharMatrix is an instance of the TCharacterMatrix Class. I make extensive use of SubBmp within this class in numerous methods. The place where is the error is made is an input point in the form where CharMatrix has the bitmap introduced.
Following the error, the following note is found:
canvas.inc(20,19) Hint: Found declaration: Draw(LongInt;LongInt;TGraphic);
Shouldn't that refer to BGRACanvas? I would think that BGRABitmap uses BGRACanvas. Am I missing something?
The note is referring to the TCanvas methods:
procedure TCanvas.Draw(X, Y: Integer; SrcGraphic: TGraphic);
var
ARect: TRect;
begin
if not Assigned(SrcGraphic) then exit;
ARect:=Bounds(X,Y,SrcGraphic.Width,SrcGraphic.Height);
StretchDraw(ARect,SrcGraphic);
end;
If it was pointed to TBGRACanvas, it should refer to:
procedure TBGRACanvas.Draw(X, Y: Integer; SrcBitmap: TBGRACustomBitmap);
begin
FBitmap.PutImage(X,Y,SrcBitmap,dmDrawWithTransparency);
end;
or maybe:
procedure TBGRAGtkBitmap.Draw(ACanvas: TCanvas; x, y: integer; Opaque: boolean);
begin
if self = nil then
exit;
if Opaque then
DrawOpaque(ACanvas, Rect(X, Y, X + Width, Y + Height))
else
DrawTransparent(ACanvas, Rect(X, Y, X + Width, Y + Height));
end;
procedure TBGRAGtkBitmap.Draw(ACanvas: TCanvas; Rect: TRect; Opaque: boolean);
begin
if self = nil then
exit;
if Opaque then
DrawOpaque(ACanvas, Rect)
else
DrawTransparent(ACanvas, Rect);
end;
As you can see these refer to TCanvas.
I am using Kubuntu 16.04 LTS 64bit. FPC 3.0.1 (fixes branch) Lazarus 1.6.1 (fixes branch).