Re: Converting a GdkPixmap to a rgb_buf
- From: Rob Alblas <r alblas demon nl>
- To: gtk-app-devel-list gnome org
- Subject: Re: Converting a GdkPixmap to a rgb_buf
- Date: Tue, 14 Nov 2000 19:32:47 +0100
Antony Stace wrote:
Hi Folks
How can I convert a GdkPixmap to the correct format that
gdk_draw_rgb_image() accepts as input. It is a matrix of type guchar,
but I don't know how to make this matrix.
I think you can't. You have to fill the guchar array yourself
(pixel-by-pixel). See the docs, gdk-gdkrgb.html.
This problem is related to the "How to add strings using GdkRGB" problem
I sent 2 times, with little response.
I think it is just not possible; you have to do everything youself to
fill the guchar array with what you want.
I have made functions myself to set a pixel (see end of this mail), a
line and a string (though the last one I am not very happy with, because
it uses just 1 built-in font).
void draw_rgbpoint(guchar *rgbbuf,int width,
GdkColor *clr,
int x,int y)
{
int yoffset=y*width*3;
rgbbuf[yoffset+3*x+0]=clr->red;
rgbbuf[yoffset+3*x+1]=clr->green;
rgbbuf[yoffset+3*x+2]=clr->blue;
}
Rob.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]