Re: GTK+ >> Cocoa Native Port



Hi,

I'm trying to implement this function : _gdk_quartz_copy_to_image (gdkimage-quartz.c)

I would like to know if it is possible to get the pixels table from a GdkPixmap structure ?

this is the code :

GdkImage *
_gdk_quartz_copy_to_image (GdkDrawable *drawable,
			   GdkImage    *image,
			   gint         src_x,
			   gint         src_y,
			   gint         dest_x,
			   gint         dest_y,
			   gint         width,
			   gint         height)
{
	/* FIXME: Implement */

	// Image Creation

	image = g_object_new (gdk_image_get_type (), NULL);

	image->width = width;
	image->height = height;

image->byte_order = (G_BYTE_ORDER == G_LITTLE_ENDIAN) ? GDK_LSB_FIRST : GDK_MSB_FIRST;

	image->bpp = 4;
	image->bpl = image->width * image->bpp;
	image->bits_per_pixel = image->bpp * 8;

	// Get the Visual

	GdkColormap *colormap = gdk_drawable_get_colormap (drawable);

	if(colormap != NULL)
	{
		image->visual = gdk_colormap_get_visual (colormap);
	}

	// Get the depth

	image->depth = GDK_PIXMAP_OBJECT (drawable)->depth;

	// Get the pixels ???

	image->mem = g_malloc (image->bpl * image->height);
	memset (image->mem, 0x00, image->bpl * image->height);

	image->mem = gdk_pixbuf_get_pixels (GDK_PIXBUF (drawable));

	return image;
}

I think that drawable is a GdkPixmap structure, so I cant do GDK_PIXBUF (drawable), but is there a function to get the pixbuf from a pixmap ?





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