Mixing Between FCL and LCL lazarus / 39-Graphics ---------------------------------------------------------------------- benohb · 2010-12-27 23:19 Hello How is it going I meet I'm computer screen without a result Problem Code: [Select]var LCLImg: TBitmap; Fcanvas : TFPcustomCanvas; image : TFPCustomImage; begin ............................. ........................ LCLImg.Canvas.CopyRect(x,y,Fcanvas,Trect);  <--is not work , procedure existing in the list... :-\ ....... ...... end. I know the object is derived TCanvas = class(TFPCustomCanvas) I hope you help me to copy TFPCustomCanvas to TCanvas Without use TFPCustomImageWriter or loops At least the possibility ---------------------------------------------------------------------- Marc · 2010-12-28 10:40 TRect is a type, you need to pass a variable of type TRect, like Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  R: TRect;begin  ...  R := Rect(1,2,3,4);  LCLImg.Canvas.CopyRect(x,y,Fcanvas,R);    // or directly  LCLImg.Canvas.CopyRect(x,y,Fcanvas,Rect(1,2,3,4));    ...end; ---------------------------------------------------------------------- benohb · 2010-12-28 22:19 Thanks for the answer I do not know how to put the color code just like you  QuoteTRect is a type, you need to pass a variable of type TRect, like I do....? Code: [Select]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;              Compiler message Code: [Select]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 The problem is in the transfer of TFPcustomCanvas type to Timage.canvas  and Contrary Any solutions ---------------------------------------------------------------------- Leledumbo · 2010-12-29 03:40 QuoteHint: Found declaration: TCanvas.CopyRect(const TRect,TCanvas,const TRect);Isn't that clear enough? Compare with your code: Code: [Select]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. ---------------------------------------------------------------------- benohb · 2010-12-29 06:24 I'm with you on this QuoteYou 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 procedures Code: [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 ...   , And more clarity   Try copying TFPcustomCanvas  to  Tcanvas  or Tbitmap.canvas ---------------------------------------------------------------------- Marc · 2010-12-29 10:55 Quote from: benohb on December 28, 2010, 11:19:02 pmThanks for the answer I do not know how to put the color code just like you  instead of '['code']' use  '['code=pascal']' Quote from: benohb on December 29, 2010, 07:24:05 amI'm with you on this QuoteYou 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 procedures Code: [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:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ...TFPCustomCanvas(LCLImg.Canvas).CopyRect(0,0,FCLcanvas,R);... ---------------------------------------------------------------------- benohb · 2010-12-30 04:36 QuotePutting 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: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Thank you