Re: GnomeCanvas and inverting Y cooordinates



Are you using the correct colormap/visual for the canvas?  If it is a
normal canvas, you should call the following before creating the canvas:
  gtk_widget_push_colormap(gdk_imlib_get_colormap());
  gtk_widget_push_visual(gdk_imlib_get_visual());


If it is an antialiased canvas, call:
  gtk_widget_push_colormap(gdk_rgb_get_cmap());
  gtk_widget_push_visual(gdk_rgb_get_visual());

You could probably call one of these at the start of your program so that
all widgets use this colormap/visual.

James.

--
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/


On Tue, 9 Nov 1999 kschumacher@uswest.net wrote:

> Thanks for the reply.  
> 
> Your code inverted the Y coordinate perfectly, but it appears that
> the colors become very wierd on both an anti-aliased and normal
> canvas.  It looks to me like solid filled polygons become kind 
> of rainbow filled, and if I move the polygons they cycle through
> colors.  Arrow heads become sort of fuzzy - it looks like 50% of
> the arrow head takes on the background color and the rest becomes
> something else.  It also cycles colors when moved.
> 
> So, any suggestions (cutdown on the caffiene may be accurate but
> in this case it probably isn't the problem).
> 
> Thanks again,
> Kent
> 
> >I think applying the transformation to the root group sounds correct. You 
> >get the root canvas item group with gnome_canvas_get_root(). Now 
> >GnomeCanvasItemGroup's are GnomeCanvasItem's, so you can use 
> >gnome_canvas_item_affine_relative(). You would use something like: 
> 
> >GnomeCanvasGroup *root = gnome_canvas_root(GNOME_CANVAS(canvas)); 
> >   double flip[6] = { 1, 0, 0, -1, 0, 0 }; 
> >
> >   gnome_canvas_item_affine_relative(GNOME_CANVAS_ITEM(root), flip); 
> 
> >Now use gnome_canvas_set_scroll_region() to set the area to draw (using 
> >the untransformed coordinate system). 
> 
> >James. 
> >
> >--
> >Email: james@daa.com.au
> >WWW:   http://www.daa.com.au/~james/
> >
> >On Thu, 4 Nov 1999 kschumacher@uswest.net wrote:
> >> Is there a simple way to invert the behavior of
> >> Y coordinates in GnomeCanvas.
> >> 
> >> In postscript I would use a transform matrix something
> >> like [1 0 0 -1 0 -height] (might be wrong - I haven't
> >> written postscript this decade).  Is this what an
> >> affine is?  If I apply that affine to the root group
> >> will that do what I want?  (And of course, how do I
> >> apply an affine to a root group, it that's the thing
> >> to do).  Grin?
>  
> 
> 
> -- 
>         FAQ: Frequently-Asked Questions at http://www.gnome.org/gnomefaq
>          To unsubscribe: mail gnome-list-request@gnome.org with 
>                        "unsubscribe" as the Subject.
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]