Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-04

TArrow, help for graph primitives needed

7 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen

Regarding issue:
21117: Can not change background Color of TArrow
http://bugs.freepascal.org/view.php?id=21117

I tested the patch from Tomasz Wieckowski and it works. The improvement affected only Windows and I wanted to turn it into a cross-platform solution.
It seemed easy because the used graph functions are already cross-platform. FillRect and FillRgn are these functions.

I made the code as a widgetset default implementation, TWSArrow. You must compile Lazarus with "NewArrow" define to test it. With "NewArrow" all widgetsets use this default implementation. Earlier there was specialized implementation for Windows, WinCE and QT.

Unfortunately it only works on Windows. FillRgn does not work with GTK2 and it crashes with QT. Apparently it is not properly implemented.
Could somebody graphics oriented please look at TWSArrow and maybe fix it.

Later the code should move out from widgetset bindings. None of the widgetsets have a native "arrow" widget. The code always used graphics primitives to draw it.

Juha

Reply by email

Unknown author
to Juha Manninen

2013/4/30 Juha Manninen :

The arrow size grows from 0 to 50% of the TrackBar's scale but then stops growing. Why?
arrowSize1 := min(w,h) - 2; etc.

I did this because must keep proportion/space for width and heigh. You should instreas both trackbar's for large size
Unfortunately, I can not help with graphics functions in gtk2,qt.

Tomek

Reply by email

zeljko
to Juha Manninen: Regarding issue: 21117: Can not change background Color of TArrow…
Juha Manninen wrote
Unfortunately it only works on Windows. FillRgn does not work with GTK2 and it crashes with QT. Apparently it is not properly implemented.

Is there any test unit or something similar to check implementation of FillRgn ?

Show quoted text 5 lines
Could somebody graphics oriented please look at TWSArrow and maybe fix it. Later the code should move out from widgetset bindings. None of the widgetsets have a native "arrow" widget. The code always used graphics primitives to draw it.

So, TWSArrow can be removed at all ?

z.

Reply by email

zeljko
to Juha Manninen: Regarding issue: 21117: Can not change background Color of TArrow…
Juha Manninen wrote
Unfortunately it only works on Windows. FillRgn does not work with GTK2 and it crashes with QT. Apparently it is not properly implemented. Could somebody graphics oriented please look at TWSArrow and maybe fix it.

Ok, I've fixed Qt so it does not crash, but before commit: it seem that there's typo in newarrow define (drawArrow function). When you call FillRgn() you call it with Pen.Reference.Handle, instead of Brush.Reference.Handle of canvas, so that's one of the reasons why qt crashes (brush is NULL). MSDN says that 3rd param should be brush , not pen.

z.

Reply by email

zeljko
to zeljko
zeljko wrote 14 lines
On 04/30/2013 12:11 PM, Juha Manninen wrote: > Unfortunately it only works on Windows. FillRgn does not work with > GTK2 and it crashes with QT. Apparently it is not properly > implemented. > Could somebody graphics oriented please look at TWSArrow and maybe fix > it. Ok, I've fixed Qt so it does not crash, but before commit: it seem that there's typo in newarrow define (drawArrow function). When you call FillRgn() you call it with Pen.Reference.Handle, instead of Brush.Reference.Handle of canvas, so that's one of the reasons why qt crashes (brush is NULL). MSDN says that 3rd param should be brush , not pen.

Yes, there's nothing to touch in gtk2 or qt. Your new code should be fixed. 1.Must change Pen.Reference to Brush.Reference
2.Must change color of brush to eg. clBlack
3.Must reset brush style to old style/color
So, we should decide to use ACanvas.Brush (and change it's properties, but restore it after FillRgn) or create new brush , use it for FillRgn, and then destroy it.

And then arrows are ok.

z.

Reply by email