[SOLVED] CopyRect issue? lazarus / 39-Graphics ---------------------------------------------------------------------- JasonLugg · 2017-08-22 11:23 Hi All and thx in advance. I am coding a little sprite editor app but am having problems with CopyRect. When I do the following: SprSheetImg.Canvas.CopyRect(Rect(504,441,576,504),ClipBoardPanel.Canva s, rect(4,4,76,67) ); It works correctly. However, when the SrcRect & DestRect are calculated as below: SprSheetImg.Canvas.CopyRect(RectToPaste,ClipBoardPanel.Canvas, RectToCopy); It does not 'copy' correctly, even though in debugging both tRects hold the correct values? Any ideas why this may be? ---------------------------------------------------------------------- taazz · 2017-08-22 12:25 that is not possible. If you take in to account that 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  Rect(504,441,576,504) is a call to a function that returns a rect that makes it a calculated rect as well. There is no way that the two calls showcased here are equivalent if they do not create the same results. ---------------------------------------------------------------------- JasonLugg · 2017-08-24 08:15 I get what you are saying and agree about rect(t,l,r,b) calling a function. However when I hard code the numbers in, it works however,when the rects are calculated, i.e CopyRect & PasteRect are filled elsewhere (the values in them are correct as I have debugged them and stepped thru to check the vals) it does  not 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     if PopUpPaste.Enabled then     begin      //Calculate the rectangle for the paste to space       RectToPaste:=CalcCurrentSprRect();       //For debugging purposes      Edit6.Text:=inttostr(RectToPaste.Left)+' ,'+inttostr(RectToPaste.Top)+','+inttostr(RectToPaste.Right)+','+intto str(RectToPaste.Bottom);       //This WORKS!       //SprSheetImg.Canva s.CopyRect(Rect(504,441,576,504),ClipBoardPanel.Canvas, rect(4,4,76,67) );       //THIS DOES NOT?       SprSheetImg.Canvas.CopyRect(RectToPaste, ClipBoardPanel.Canvas, rect(4,4,76,67) );       //Explode the pasted image       ActSizeExploded();       ActSizeToSpriteSheet(iSpriteNumber);       SprSheetImg.Refresh;     end; ---------------------------------------------------------------------- Blaazen · 2017-08-24 11:19 QuoteI get what you are saying and agree about rect(t,l,r,b) calling a function.Correct order is Left, Top, Right, Bottom. I agree with taazz. It seems to some overlook or something dumb. ---------------------------------------------------------------------- JasonLugg · 2017-08-29 18:38 As mostly is the case...it was my error! Thanks for you help!