Sign in Join

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

Mailing lists / fpc-devel / 2011-01

TFPCustomCanvas drawing routines

8 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Felipe Monteiro de Carvalho

Hello,

I am extending the converter of FPVectorial to Canvas, but I got stuck at the lack of drawing methods in TFPCustomCanvas. It lacks Arc, Chord, PolyBezier, etc.

The end point being that it gets really hard to use TFPCustomCanvas, the easiest solution being simply dropping support for it and going for TCanvas instead.

Should more drawing routines be added at least as stubs?

thanks,

Felipe Monteiro de Carvalho

Reply by email

Mattias Gaertner
to Felipe Monteiro de Carvalho

 
 

Felipe Monteiro de Carvalho hat am 26.
Januar 2011 um 16:45 geschrieben:

Show quoted text 9 lines
Hello, I am extending the converter of FPVectorial to Canvas, but I got stuck at the lack of drawing methods in TFPCustomCanvas. It lacks Arc, Chord, PolyBezier, etc. The end point being that it gets really hard to use TFPCustomCanvas, the easiest solution being simply dropping support for it and going for TCanvas instead. 

The Bezier functions of TCanvas are implemented platform independent in the LCL. It should not be hard to port/move them to fpimage.  

 

Should more drawing routines be added at least as stubs?

Mattias

Reply by email

Unknown author
to Felipe Monteiro de Carvalho: I am extending the converter of FPVectorial to Canvas, but I got stuck at the lack of…
Felipe Monteiro de Carvalho wrote 11 lines
Hello, I am extending the converter of FPVectorial to Canvas, but I got stuck at the lack of drawing methods in TFPCustomCanvas. It lacks Arc, Chord, PolyBezier, etc. The end point being that it gets really hard to use TFPCustomCanvas, the easiest solution being simply dropping support for it and going for TCanvas instead. Should more drawing routines be added at least as stubs?

Yes, feel free to do so. If TCanvas has actual routines for them, maybe you can copy the implementation as well.

Michael.

Reply by email

Unknown author
to Mattias Gaertner:     Felipe Monteiro de Carvalho hat am 26. Januar 2011 um 16:45 geschrieben: The…
Mattias Gaertner wrote 17 lines
    Felipe Monteiro de Carvalho hat am 26. Januar 2011 um 16:45 geschrieben: > Hello, > > I am extending the converter of FPVectorial to Canvas, but I got stuck > at the lack of drawing methods in TFPCustomCanvas. It lacks Arc, > Chord, PolyBezier, etc. > > The end point being that it gets really hard to use TFPCustomCanvas, > the easiest solution being simply dropping support for it and going > for TCanvas instead.  The Bezier functions of TCanvas are implemented platform independent in the LCL. It should not be hard to port/move them to fpimage.

You beat me to it :)

Michael.

Reply by email

Felipe Monteiro de Carvalho
to Unknown author

Ok, good =)

One thing, however, should't the drawing routines in TFPCustomCanvas be virtual?

The LCL seams to simply hide them at the moment. Overriding is more usual, isn't it?

Felipe Monteiro de Carvalho

Reply by email

Unknown author
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 6 lines
Ok, good =) One thing, however, should't the drawing routines in TFPCustomCanvas be virtual? The LCL seams to simply hide them at the moment. Overriding is more usual, isn't it?

Send me a proposal in private if you want.

Michael.

Reply by email

Felipe Monteiro de Carvalho
to Unknown author

Hello,

I decided to put the patch here since it is so small.

It is rather trivial, just adds a bunch of virtual markers and some methods with empty implementations, as to make them optional. I think the behavior looks ok for me, if the sub-class doesn't implement the method, no operation is performed.

If some methods can be implemented based on other ones, great, but this should be a separate commit.

Later Lazarus would need to be adapted, maybe now with ifdefs or else after fpc 3.0 gets released.

Felipe Monteiro de Carvalho

Reply by email

Luiz Americo Pereira Camara
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 8 lines
Hello, I decided to put the patch here since it is so small. It is rather trivial, just adds a bunch of virtual markers and some methods with empty implementations, as to make them optional. I think the behavior looks ok for me, if the sub-class doesn't implement the method, no operation is performed.

I would suggest to take the opportunity and put const before string parameters so the compiler can generate better code.

Luiz

Show quoted text 11 lines
If some methods can be implemented based on other ones, great, but this should be a separate commit. Later Lazarus would need to be adapted, maybe now with ifdefs or else after fpc 3.0 gets released. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email