var
LCLImg: TBitmap;
Fcanvas : TFPcustomCanvas;
image : TFPCustomImage;
begin
.............................
........................
LCLImg.Canvas.CopyRect(x,y,Fcanvas,Trect); <--is not work , procedure existing in the list... :-\
.......
......
end.
TRect is a type, you need to pass a variable of type TRect, likeI do....?
procedure TForm1.Button1Click(Sender: TObject);
var
LCLImg: TBitmap;
FCLcanvas : TFPcustomCanvas;
FCLimg: TFPCustomImage;
R: TRect;
begin
R := Rect(1,2,3,4);
{FCL}
FCLimg := TFPMemoryImage.Create (100,100);
FCLcanvas := TFPImageCanvas.Create (FCLimg);
{LCL}
LCLImg := TBitmap.Create;
LCLImg.Width:=100;
LCLImg.Height:=100;
FCLcanvas.Ellipse (10,10, 90,90);
{Compiler stops here}
LCLImg.Canvas.CopyRect(0,0,FCLcanvas,Rect(1,2,3,4));
{I tried CopyRect(0,0,FCLcanvas,R); }
FCLcanvas.Free;
FCLimg.Free;
LCLImg.Free;
end;
unit1.pas(51,46) Warning: Constructing a class "TFPImageCanvas" with abstract method "DoCopyRect"
unit1.pas(51,46) Warning: Constructing a class "TFPImageCanvas" with abstract method "DoDraw"
unit1.pas(61,54) Error: Wrong number of parameters specified for call to "CopyRect"
canvas.inc(110,19) Hint: Found declaration: TCanvas.CopyRect(const TRect,TCanvas,const TRect);
unit1.pas(76) Fatal: There were 1 errors compiling module, stopping
Hint: Found declaration: TCanvas.CopyRect(const TRect,TCanvas,const TRect);Isn't that clear enough? Compare with your code:
LCLImg.Canvas.CopyRect(0,0,FCLcanvas,Rect(1,2,3,4));
You pass 4 arguments, while it expects 3 with the first one being a TRect as well as the third.
You pass 4 arguments, while it expects 3 with the first one being a TRect as well as the third.
procedure CopyRect(const Dest: TRect; SrcCanvas: TCanvas; const Source: TRect); virtual;
procedure CopyRect (x,y:integer; canvas:TFPCustomCanvas; SourceRect:TRect);
Thanks for the answer
I do not know how to put the color code just like you :-X :-X
I'm with you on thisQuoteYou pass 4 arguments, while it expects 3 with the first one being a TRect as well as the third.
The menu that appears when you type the dots after the Tbitmap.Canvas.<--
There are two types of procedure
1-LCL
In unit "Graphics" at line (961) a new class Named TCanvas Derived from TFPCustomCanvas
Public proceduresCode: [Select]procedure CopyRect(const Dest: TRect; SrcCanvas: TCanvas; const Source: TRect); virtual;
Here requires 3 arguments.......
2-FCL
In unit "FPCanvas" at line (192) You will find there TFPCustomCanvas = class(TPersistent)
Public procedures....link to FPCanvas.inc line(583)Code: [Select]procedure CopyRect (x,y:integer; canvas:TFPCustomCanvas; SourceRect:TRect);
Here requires 4 arguments.......
1-X,
2-Y,
3-TFPCustomCanvas
4-TRect
I've changed the coordinates x,y With ' Tpoint ' , Of course,the compiler does not accept
The comma Between X and Y is the problem ...
Putting random parameters to functions won't help you. Why a TPoint ? if you look at the first declaration you see as first parameter "Dest: TRect;" thats not a Tpoint, but a TRect.
Anyway what you see here is method overloading.
(I was trying to explain what happens, but removed that text since what you do should work imo)
Since you use TFPImageCanvas, the compiler should find the overloaded TFPCustomCanvas.CopyRect and use that, but somehow it refuses to find it. (in objfpc mode you don't need the overload directive)
Does the following work: