How to draw bitmaps?
- From: Reed Lawson <reedlawson yahoo com>
- To: 'gtk' <gtk-app-devel-list gnome org>
- Subject: How to draw bitmaps?
- Date: Mon, 27 Oct 2003 08:28:07 -0800 (PST)
Hi. I am new to GTK and I am trying to use
gdk_draw_bitmap(). My bike_bits is a bit map
in XBM format. I have my configure event
set up like this:
--------------------------8<---------------------------
static GdkBitmap *bitmap = NULL;
static gboolean
configure_event( GtkWidget *widget, GdkEventConfigure
*event )
{
if (bitmap)
g_object_unref (bitmap);
bitmap = gdk_bitmap_create_from_data
(widget->window,
bike_bits,
widget->allocation.width,
widget->allocation.height);
printf("configure_event %x\n", (unsigned
int)bitmap);
return TRUE;
}
--------------------------8<---------------------------
That seems to work fine. But I get an error in my
expose event when I try to run gdk_draw_bitmap()
--------------------------8<---------------------------
static gboolean
expose_event(GtkWidget *widget, GdkEventExpose *event)
{
gdk_draw_bitmap(widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
bitmap,
event->area.x, event->area.y,
event->area.x, event->area.y,
event->area.width,
event->area.height);
printf("expose_event\n");
return FALSE;
}
--------------------------8<---------------------------
I get this:
--------------------------8<---------------------------
configure_event 808b250
The program 'lcdd' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter
attributes)'.
(Details: serial 251 error_code 8 request_code 62
minor_code 0)
--------------------------8<---------------------------
Is this the proper GC to call gdk_draw_bitmap() with?
Can anyone see anything obviously wrong here?
Where is the docs on what these error codes mean?
Thanks,
=====
Reed Lawson
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]