Re: [gtk-list] Easy way to reverse a gtk_pixmap?




On Fri, 22 Oct 1999, Pedro Morais wrote:
> 
> Is there any easy way to (temporarily) reverse a gtk_pixmap; that is, every
> white pixel becomes black and every black pixel becomes white.
> 

Not really - in general, if you want to manipulate or transform image data
then a pixmap is a poor choice (GdkPixmap is a server-side image,
GtkPixmap is a widget that displays it; the pixels are _not_ in your
process's address space!). 

If you did want to do it, the procedure would be something like the
build_disabled_pixmap() routine in gtkpixmap.c, that is, you suck the
pixmap into a GdkImage (client side image data) then manipulate it.

An RGB buffer combined with GdkRGB (or one of the heavy-duty graphics
libraries like OpenGL/GtkGLArea) is the best way to approach pixel
manipulation.

However that is likely to be overkill; the simplest solution for this
trivial case is probably to have two different images and swap them out.

Havoc




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