gint ydest,
gint width,
gint height);
+static void gdk_pixmap_draw_pixbuf (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPixbuf *pixbuf,
+ gint src_x,
+ gint src_y,
+ gint dest_x,
+ gint dest_y,
+ gint width,
+ gint height,
+ GdkRgbDither dither,
+ gint x_dither,
+ gint y_dither);
+
static void gdk_pixmap_real_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
-static GdkImage* gdk_pixmap_get_image (GdkDrawable *drawable,
- gint x,
- gint y,
- gint width,
- gint height);
-
+static GdkImage* gdk_pixmap_copy_to_image (GdkDrawable *drawable,
+ GdkImage *image,
+ gint src_x,
+ gint src_y,
+ gint dest_x,
+ gint dest_y,
+ gint width,
+ gint height);
static GdkVisual* gdk_pixmap_real_get_visual (GdkDrawable *drawable);
static gint gdk_pixmap_real_get_depth (GdkDrawable *drawable);
object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
"GdkPixmap",
- &object_info);
+ &object_info, 0);
}
return object_type;
drawable_class->draw_lines = gdk_pixmap_draw_lines;
drawable_class->draw_glyphs = gdk_pixmap_draw_glyphs;
drawable_class->draw_image = gdk_pixmap_draw_image;
+ drawable_class->_draw_pixbuf = gdk_pixmap_draw_pixbuf;
drawable_class->get_depth = gdk_pixmap_real_get_depth;
drawable_class->get_size = gdk_pixmap_real_get_size;
drawable_class->set_colormap = gdk_pixmap_real_set_colormap;
drawable_class->get_colormap = gdk_pixmap_real_get_colormap;
drawable_class->get_visual = gdk_pixmap_real_get_visual;
- drawable_class->get_image = gdk_pixmap_get_image;
+ drawable_class->_copy_to_image = gdk_pixmap_copy_to_image;
}
static void
width, height);
}
+static void
+gdk_pixmap_draw_pixbuf (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPixbuf *pixbuf,
+ gint src_x,
+ gint src_y,
+ gint dest_x,
+ gint dest_y,
+ gint width,
+ gint height,
+ GdkRgbDither dither,
+ gint x_dither,
+ gint y_dither)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ _gdk_draw_pixbuf (private->impl, gc, pixbuf,
+ src_x, src_y, dest_x, dest_y, width, height,
+ dither, x_dither, y_dither);
+}
+
static void
gdk_pixmap_real_get_size (GdkDrawable *drawable,
gint *width,
}
static GdkImage*
-gdk_pixmap_get_image (GdkDrawable *drawable,
- gint x,
- gint y,
- gint width,
- gint height)
+gdk_pixmap_copy_to_image (GdkDrawable *drawable,
+ GdkImage *image,
+ gint src_x,
+ gint src_y,
+ gint dest_x,
+ gint dest_y,
+ gint width,
+ gint height)
{
g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL);
- return gdk_drawable_get_image (((GdkPixmapObject*)drawable)->impl,
- x, y, width, height);
+ return _gdk_drawable_copy_to_image (((GdkPixmapObject*)drawable)->impl,
+ image,
+ src_x, src_y, dest_x, dest_y,
+ width, height);
+}
+
+static GdkBitmap *
+make_solid_mask (gint width, gint height)
+{
+ GdkBitmap *bitmap;
+ GdkGC *gc;
+ GdkGCValues gc_values;
+
+ bitmap = gdk_pixmap_new (NULL, width, height, 1);
+
+ gc_values.foreground.pixel = 1;
+ gc = gdk_gc_new_with_values (bitmap, &gc_values, GDK_GC_FOREGROUND);
+
+ gdk_draw_rectangle (bitmap, gc, TRUE, 0, 0, width, height);
+
+ gdk_gc_unref (gc);
+
+ return bitmap;
}
#define PACKED_COLOR(c) ((((c)->red & 0xff) << 8) | ((c)->green & 0xff) | ((c)->blue >> 8))
if (mask)
gdk_pixbuf_render_pixmap_and_mask (pixbuf, NULL, mask, 128);
+ if (mask && !*mask)
+ *mask = make_solid_mask (gdk_pixbuf_get_width (pixbuf),
+ gdk_pixbuf_get_height (pixbuf));
+
return pixmap;
}
return NULL;
pixmap = gdk_pixmap_colormap_new_from_pixbuf (colormap, mask, transparent_color, pixbuf);
- gdk_pixbuf_unref (pixbuf);
+ gdk_pixbuf_unref (pixbuf);
+
return pixmap;
}
return NULL;
pixmap = gdk_pixmap_colormap_new_from_pixbuf (colormap, mask, transparent_color, pixbuf);
+
gdk_pixbuf_unref (pixbuf);
return pixmap;