Recent

Author Topic: Drawing on Windows VS GTK2 (Linux)  (Read 6215 times)

groundcad

  • Newbie
  • Posts: 6
Drawing on Windows VS GTK2 (Linux)
« on: September 01, 2015, 03:55:48 pm »
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

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: Drawing on Windows VS GTK2 (Linux)
« Reply #1 on: September 01, 2015, 04:25:48 pm »
Do you only draw in the paint event? That is the most common failure with non windows widgetsets.

groundcad

  • Newbie
  • Posts: 6
Re: Drawing on Windows VS GTK2 (Linux)
« Reply #2 on: September 01, 2015, 04:36:11 pm »
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

  • Guest
Re: Drawing on Windows VS GTK2 (Linux)
« Reply #3 on: September 01, 2015, 06:21:21 pm »
Do 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

  • Newbie
  • Posts: 6
Re: Drawing on Windows VS GTK2 (Linux)
« Reply #4 on: September 01, 2015, 07:37:53 pm »
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

  • Hero Member
  • *****
  • Posts: 594
Re: Drawing on Windows VS GTK2 (Linux)
« Reply #5 on: September 01, 2015, 07:43:36 pm »
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

  • Newbie
  • Posts: 6
Re: Drawing on Windows VS GTK2 (Linux)
« Reply #6 on: September 01, 2015, 07:57:40 pm »
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

  • Guest
Re: Drawing on Windows VS GTK2 (Linux)
« Reply #7 on: September 01, 2015, 08:31:22 pm »
Mmmm, looks like integer overflow. (or, at least beyond the range provide by GTK)

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Drawing on Windows VS GTK2 (Linux)
« Reply #8 on: September 01, 2015, 10:07:03 pm »
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

  • Newbie
  • Posts: 6
Re: Drawing on Windows VS GTK2 (Linux)
« Reply #9 on: September 01, 2015, 10:34:39 pm »
Thank you Mr Zamtmn
Before the drawing,  I will check if an entity is inside the screen.
 

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Drawing on Windows VS GTK2 (Linux)
« Reply #10 on: September 02, 2015, 10:52:14 am »
You're welcome. Need more CAD programs in FPC\Lazarus, great and diverse  :)

 

TinyPortal © 2005-2018