Re: help with pixmaps



The gdk_draw_* routines draw onto a GdkWindow, which is a wrapper for an X
window.  Almost every widget has a GdkWindow, except for a few small ones
like GtkLabel, where they draw on their parent's window.  A GtkDrawingArea
widget is a good widget for directly drawing onto, since you will not
mess around with the what the widget draws.

After the widget is realised, the GTK_WIDGET(wid)->window attribute will
be set to the GdkWindow for the object.  You can then draw on the window.

You will want to connect to the expose_event signal, as the contents of a
GdkWindow must be redrawn when it is exposed.  Alternatively, you could
create a GdkPixmap (an offscreen buffer.  It can be drawn on with the
gdk_draw_* routines, but you don't need to worry about exposure details),
do all you drawing on that and do a gdk_draw_pixmap() to draw the pixmap
to the window on exposures.

James.

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


On Tue, 24 Aug 1999, Sri Ramkrishna wrote:

> 
> I'm trying to make a "readerboard" panel applet.  I've been looking at the
> GNOME API and I have some questions.  Looking at applets like gtcd which
> has does some things similar to what I want to do (ie use a xpm as a
> fontmap).  What it looks like I need to use is gdk_draw_pixmap and
> gdk_draw_rectangle is what I want.  However, I'm completely clueless on
> how exactly this works if I use GnomePixmap.  There are a number of
> questions:
> 
> 1) gdk_draw_pixmap requires a gdkwindow type as it's first parameter,
> unfortunately, if I use gnome_app_new, do I use this as my window
> parameter?  How do I use a gdkwindow if al I have is "myapp =
> gnome_app_new(yadda, yadda);"??
> 
> 2)There seems to be no documentation on gdk_draw_pixmap in fact there
> seems to be no documentation on any gdk_draw_* functions.  Does anybody
> know where this is located?
> 
> 3) Is there any tips/sample code that will replace a character with it's
> xpm counterpart?  
> 
> Most of the code I've seen in the applet section are all using straight
> gtk/gdk.  But if you try to plan straight Gnome API there doesn't seem to
> give you enough primitives here.  We seem to have numerous functions that
> will convert a xpm to a pixmap, in gdk, gtk, and in gnome.  Which is the
> right one to use for GNOME only?
> 
> I've looked through allt he archives (archives seriously needs a search
> feature, so does developer.gnome.org)  I can't seem to answer this
> question.  Can anybody help me here?  Thanks!
> 
> 	sri
> 
> 
> ---------------------------------------------------------------------------
> Sri Ramkrishna         /|\ Unix is very user friendly, its just very picky
> email: sri@aracnet.com -|- on who it is friendly to. -- Unknown? 
> phone: 503-356-1078    \|/ 
> ---------------------------------------------------------------------------
>                         |
> 
> 
> 
> 
> -- 
> To unsubscribe: mail gnome-devel-list-request@gnome.org with "unsubscribe"
> as the Subject.
> 



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