Re: need some pointers

Lauris Kaplinski <[email protected]> Thu, 04 Mar 2004 23:00:18 +0200
Newsgroups gmane.comp.graphics.sodipodi
Message-ID <[email protected]>
Hello!

Nononono :-)
Better do not try it, the result will be ugly and sodipodi
canvas is not directly usable for Gdk drawing - it is
doable, but you end with lot more work than needed.

I'd suggest attaching the problem in the following way:

a) Look at helper/canvas-bpath.*
   It is SPCanvas item that draws (antialiased) bezier
   paths.
b) Add non-antialiased XOR mode to it
c) For drawing XOR mode, look at libnr/nr-pixblock-path.*
   There is code to draw colored non-aa bezier paths. Just
   change the code to draw xor instead.
Actually you can cheat, and implement XOR only for
R8G8B8 pixblocks, as SPCanvas draws only onto such. The 'real'
display engine (NRArena), that is used to draw SVG, as opposed
to controls, uses other color modes too, but for XOR-ed
control path they are not needed.

Best wishes,
Lauris Kaplinski

markus hammer kirjutas K, 03.03.2004 kell 17:54:
> ok i got the source now here and looked up where the select tool has its
> mouse_over. i now want to hang in a visual feedback of the path under
> the select tool at GDK_ENTER_NOTIFY and GDK_LEAVE_NOTIFY in the file
> select_context.c
> 
> the only show stopper i am now at is how to display specified path as an
> XOR'ed overlay to the whole canvas. i found some functions in the gdk
> library that seem usefull.
> 
> ######
> 
> void        gdk_region_xor                  (GdkRegion *source1,
>                                              GdkRegion *source2);
> 
> Sets the area of source1 to the exclusive-OR of the areas of source1 and
> source2. The resulting area is the set of pixels contained in one or the
> other of the two sources but not in both.
> 
> ###### and ######
> 
> GdkRegion*  gdk_region_polygon              (GdkPoint *points,
>                                              gint npoints,
>                                              GdkFillRule fill_rule);
> 
> Creates a new GdkRegion using the polygon defined by a number of points.
> points :an array of GdkPoint structs. npoints :	the number of elements
> in the points array. fill_rule :specifies which pixels are included in
> the region when the polygon overlaps itself. Returns :a new GdkRegion
> based on the given polygon. 
> 
> ######
> 
> ok and now my plan is to somehow get this to be able to be used by
> sodipodi, i am sure an own function is appropriate here. i just dont
> know how to get the ArtBpath converted into a gdk_region. maybe someone
> can help me on this one.
> 
> markus



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click