Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-08 Thread Felipe Monteiro de Carvalho
Some more changes I'd like to propose. It seams that Rectangle is not TCanvas compatible: procedure TFPPixelCanvas.DoRectangle (const Bounds:TRect); A rectangle over (0, 0, 10, 10) should not include the pixels line with x=10 and y=10 but instead go only to x=9 and y=9, it is considered that the

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-08 Thread michael . vancanneyt
On Thu, 8 Dec 2011, Felipe Monteiro de Carvalho wrote: Some more changes I'd like to propose. It seams that Rectangle is not TCanvas compatible: procedure TFPPixelCanvas.DoRectangle (const Bounds:TRect); A rectangle over (0, 0, 10, 10) should not include the pixels line with x=10 and y=10

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-08 Thread Felipe Monteiro de Carvalho
On Thu, Dec 8, 2011 at 9:33 AM, michael.vancann...@wisa.be wrote: Yes, but changing this will break existing code ? Yes, it cannot do both at the same time, unless we add a property PaintLikeTCanvas or something like that. -- Felipe Monteiro de Carvalho

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-08 Thread michael . vancanneyt
On Thu, 8 Dec 2011, Felipe Monteiro de Carvalho wrote: On Thu, Dec 8, 2011 at 9:33 AM, michael.vancann...@wisa.be wrote: Yes, but changing this will break existing code ? Yes, it cannot do both at the same time, unless we add a property PaintLikeTCanvas or something like that. Hm. I

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-08 Thread Hans-Peter Diettrich
michael.vancann...@wisa.be schrieb: Yes, but changing this will break existing code ? Such code can be considered broken, deserves an fix anyhow. Yes, it cannot do both at the same time, unless we add a property PaintLikeTCanvas or something like that. Hm. I would reverse the property.

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-08 Thread Felipe Monteiro de Carvalho
On Thu, Dec 8, 2011 at 11:49 AM, Hans-Peter Diettrich drdiettri...@aol.com wrote: I'd suggest that you use the TCanvas conventions, before you run into well known pitfalls. E.g. an empty rectangle should be (x,y, x,y), while a single pixel should be (x,y, x+1,y+1). The Width is Right-Left,

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-08 Thread Hans-Peter Diettrich
Felipe Monteiro de Carvalho schrieb: Yes, in the case of the rectangle drawing I think it was a typo by who implemented the current rectangle in fcl-image, I have done various similar typos in my coding and they don't mean I really wanted to redefine rectangle. But the TCanvas line is trully

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread Felipe Monteiro de Carvalho
On Wed, Dec 7, 2011 at 8:06 AM, Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote: Indeed good idea, I am implementing like that with slightly different names (TFPCustomRegion and IsPointInRegion). commited, I did not mention anything from Clip in the name of the region

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread michael . vancanneyt
On Wed, 7 Dec 2011, Felipe Monteiro de Carvalho wrote: On Wed, Dec 7, 2011 at 8:06 AM, Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote: Indeed good idea, I am implementing like that with slightly different names (TFPCustomRegion and IsPointInRegion). commited, I did not

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread zeljko
On Wednesday 07 of December 2011 09:05:21 Felipe Monteiro de Carvalho wrote: I also joined zeljko's idea. If the region is not rectangular and you It's not my idea ,I've just explained how it works in qt :) read the property ClipRect, it will return the bounding rectangle of the region.

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread michael . vancanneyt
On Wed, 7 Dec 2011, Felipe Monteiro de Carvalho wrote: On Wed, Nov 30, 2011 at 10:35 AM, michael.vancann...@wisa.be wrote: Good basics. What about the following: Create TBaseClipRegion with abstract method PointIsInRegion(P : TPoint) (and maybe some others, like line intersections or so).

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread Felipe Monteiro de Carvalho
On Wed, Dec 7, 2011 at 9:45 AM, michael.vancann...@wisa.be wrote: At first sight I would think this is not a good proposal, because it was a conscious decision to do it the way it is done now. But first please explain what you mean with This way TCanvas could override them more cleanly

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread Felipe Monteiro de Carvalho
On top of that the drawing routines in TFPCustomCanvas are not single-liners calling DoSomething, for example: procedure TFPCustomCanvas.Ellipse (const Bounds:TRect); var p,b,dp,db,pb : boolean; begin p := Pen.style psClear; b := Brush.style bsClear; pb := false; dp:=False; db:=False;

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread Felipe Monteiro de Carvalho
On Wed, Dec 7, 2011 at 9:28 AM, zeljko zel...@holobit.net wrote: Note that xxx_boundingRect() functions of qt are marked as slow (I guess it's case when you deal with eg 1000 rects in region and you must calculate lower TopLeft and high BottomRight) in their docs, I hope that we'll have faster

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread Hans-Peter Diettrich
Felipe Monteiro de Carvalho schrieb: On Wed, Dec 7, 2011 at 9:28 AM, zeljko zel...@holobit.net wrote: Note that xxx_boundingRect() functions of qt are marked as slow (I guess it's case when you deal with eg 1000 rects in region and you must calculate lower TopLeft and high BottomRight) in their

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread michael . vancanneyt
On Wed, 7 Dec 2011, Hans-Peter Diettrich wrote: Felipe Monteiro de Carvalho schrieb: On Wed, Dec 7, 2011 at 9:28 AM, zeljko zel...@holobit.net wrote: Note that xxx_boundingRect() functions of qt are marked as slow (I guess it's case when you deal with eg 1000 rects in region and you must

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread Felipe Monteiro de Carvalho
On Wed, Dec 7, 2011 at 11:27 AM, Hans-Peter Diettrich drdiettri...@aol.com wrote: IMO the fastest implementation paints everything to a bitmap, then masks the painting with the region. This should be faster than clipping every single drawing primitve. Please prove with test cases which take

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread Felipe Monteiro de Carvalho
On Wed, Dec 7, 2011 at 11:54 AM, Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote: ummm, not sure if this is really faster because you need to move memory 2 times. Actually 3 times, because first you would need to copy the existing image to the temp bitmap (to support alpha

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-07 Thread Hans-Peter Diettrich
Felipe Monteiro de Carvalho schrieb: On Wed, Dec 7, 2011 at 11:27 AM, Hans-Peter Diettrich drdiettri...@aol.com wrote: IMO the fastest implementation paints everything to a bitmap, then masks the painting with the region. This should be faster than clipping every single drawing primitve.

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-12-06 Thread Felipe Monteiro de Carvalho
On Wed, Nov 30, 2011 at 10:35 AM, michael.vancann...@wisa.be wrote: Good basics. What about the following: Create TBaseClipRegion with abstract method PointIsInRegion(P : TPoint) (and maybe some others, like line intersections or so). Indeed good idea, I am implementing like that with

[fpc-devel] TFPCustomCanvas Expanded Clipping

2011-11-30 Thread Felipe Monteiro de Carvalho
Hello, I am facing a problem with clipping in TFPCustomCanvas because it has these properties: property ClipRect : TRect read GetClipRect write SetClipRect; property Clipping : boolean read GetClipping write SetClipping; Which obviously is not extensible for non-rectangular formats. I

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-11-30 Thread michael . vancanneyt
On Wed, 30 Nov 2011, Felipe Monteiro de Carvalho wrote: Hello, I am facing a problem with clipping in TFPCustomCanvas because it has these properties: property ClipRect : TRect read GetClipRect write SetClipRect; property Clipping : boolean read GetClipping write SetClipping; Which

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-11-30 Thread zeljko
On Wednesday 30 of November 2011 10:35:59 michael.vancann...@wisa.be wrote: Create TBaseClipRegion with abstract method PointIsInRegion(P : TPoint) (and maybe some others, like line intersections or so). Create a descendent TRectClipRegion with property ClipRect: TRect. It can implement the

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-11-30 Thread michael . vancanneyt
On Wed, 30 Nov 2011, zeljko wrote: On Wednesday 30 of November 2011 10:35:59 michael.vancann...@wisa.be wrote: Create TBaseClipRegion with abstract method PointIsInRegion(P : TPoint) (and maybe some others, like line intersections or so). Create a descendent TRectClipRegion with property

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-11-30 Thread Sven Barth
Am 30.11.2011 13:33, schrieb Hans-Peter Diettrich: Felipe Monteiro de Carvalho schrieb: I am facing a problem with clipping in TFPCustomCanvas because it has these properties: property ClipRect : TRect read GetClipRect write SetClipRect; property Clipping : boolean read GetClipping write

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-11-30 Thread Felipe Monteiro de Carvalho
On Wed, Nov 30, 2011 at 1:33 PM, Hans-Peter Diettrich drdiettri...@aol.com wrote: What's the purpose of your clipper? I use/will use the same clipper (lcl/lazregions.pas) for a multitude of purposes: 1 To prevent subcontrols from painting outside their area in LCL-CustomDrawn 2 To implement

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-11-30 Thread Thaddy
A region is not a rect. A rect is a special case of a region. The question was about the rect. There are region manipulators Xplatform, I think. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-11-30 Thread Hans-Peter Diettrich
Sven Barth schrieb: I'm not sure how far non-rectangular clipping regions are supported by all widgetsets, and wouldn't rely on such a capability. You are aware that TFPCustomCanvas can be used for widgetset independant canvases as well? Also Felipe said that he'll need it for his

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-11-30 Thread Mattias Gaertner
  Hans-Peter Diettrich drdiettri...@aol.com hat am 30. November 2011 um 15:24 geschrieben: Sven Barth schrieb: I'm not sure how far non-rectangular clipping regions are supported by all widgetsets, and wouldn't rely on such a capability. You are aware that TFPCustomCanvas can be

Re: [fpc-devel] TFPCustomCanvas Expanded Clipping

2011-11-30 Thread Felipe Monteiro de Carvalho
On Wed, Nov 30, 2011 at 3:24 PM, Hans-Peter Diettrich drdiettri...@aol.com wrote: What's the purpose of defining a clipping region, when the drawing pritives don't respect it? The clipping region is enforced in: procedure SetColor (x,y:integer; const AValue:TFPColor); override; Probably not