Drawing on Windows VS GTK2 (Linux) lazarus / 39-Graphics ---------------------------------------------------------------------- groundcad · 2015-09-01 13:55 Hi I developed a 2D CAD software (http://www.groundcad.com/) using lazarus 1.4.2 I am using LCL only. The version 0.3.1 is stable on windows 32 xp/7 with no problems in the drawing. Actually, I ported my software to linux(32) mint 17.2. and I used Lazarus 1.4.2 configured on GTK2. On linux If I zoomed In (+) my drawing, I get a duplicated lines in my canavs ! What is the problem in gtk2 ? ---------------------------------------------------------------------- marcov · 2015-09-01 14:25 Do you only draw in the paint event? That is the most common failure with non windows widgetsets. ---------------------------------------------------------------------- groundcad · 2015-09-01 14:36 thank you Markov for your replay I used  paintbmp  : Bitmap ;             paintbox   : TPaintbox; I draw in the canvas of paintbmp I refresh The painbox by the procedure procedure Tmainform.paintboxPaint(Sender: TObject); begin   paintbox.Canvas.Draw(0,0,paintbmp); end; Can you explain to me where is problem in gtk2 or qt4(not tested) ? ---------------------------------------------------------------------- derek.john.evans · 2015-09-01 16:21 Quote from: marcov on September 01, 2015, 04:25:48 pmDo you only draw in the paint event? That is the most common failure with non windows widgetsets. I think what marcov is asking, is, are you triggering a refresh using paintboxPaint(paintbox) or are you calling paintbox.invalidate; *EDIT* BTW. Ya, CAD looks really cool. ---------------------------------------------------------------------- groundcad · 2015-09-01 17:37 Yes I call the procedure paintboxPaint(sender) after the drawing in the canvas of my bmp also I test using paintbox.Invalidate same problem. In windows,I dont have a problem ,  if i zoom In or zoom out my drawing. But in linux 32 (mint 17.2) with lazarus 1.4.2 configured on gtk2. I have a duplicated entities in my drawing, if I make a maximum zoom. I check my code many times ? show the picture. ---------------------------------------------------------------------- zamtmn · 2015-09-01 17:43 I understand nothing. Please give a screenshot of how it should look right, and how it looks wrong. Also, make a minimum code of the problem, but the working and compiled ---------------------------------------------------------------------- groundcad · 2015-09-01 17:57 In my software I used              paintbmp  : Bitmap ;             paintbox   : TPaintbox;  I draw in the canvas of paintbmp.  I refresh The painbox by the procedure  procedure Tmainform.paintboxPaint(Sender: TObject);  begin    paintbox.Canvas.Draw(0,0,paintbmp);  end; In Windows 32  xp / 7  (Lazarus 1.4.2), I dont have a problem In Linux 32 mint 17.2 (Lazarus 1.4.2 with GTK2 ) , When I make a maximum zoom in (+) in, I get a duplicated entities in my drawing,  Why ? ---------------------------------------------------------------------- derek.john.evans · 2015-09-01 18:31 Mmmm, looks like integer overflow. (or, at least beyond the range provide by GTK) ---------------------------------------------------------------------- zamtmn · 2015-09-01 20:07 I tried groundcad on GTK. Yes, it is similar to overflow. Primitives are not duplicated, it is other primitives, that should not be visible. Look at the screenshot, the blue line must stay somewhere far to the right, and should not be visible. Check the formulas by which you believe zoom. Generally you need to do check visible primitives and draw only what is visible. This will help to avoid this and greatly accelerate your program ---------------------------------------------------------------------- groundcad · 2015-09-01 20:34 Thank you Mr Zamtmn Before the drawing,  I will check if an entity is inside the screen. ---------------------------------------------------------------------- zamtmn · 2015-09-02 08:52 You're welcome. Need more CAD programs in FPC\Lazarus, great and diverse