Re: problem with drawing 32bit image to 16bit screen (works with 32/24 bit screen)
- From: Patrick Sung <phsung ualberta ca>
- To: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: problem with drawing 32bit image to 16bit screen (works with 32/24 bit screen)
- Date: Mon, 17 Sep 2001 15:58:03 -0600
Owen Taylor wrote:
Patrick Sung <phsung ualberta ca> writes:
Havoc Pennington wrote:
Patrick Sung <phsung ualberta ca> writes:
I was trying to draw a 32bit color image to both a 24bit system and
16 bit systems. I got the 24bit system works but not the 16 bit
systems. It seems that gdk isn't reading my 32bit color image
properly because I got an image displayed twice adjacent to each
other (on the 16bit system).
Can you send us a small test case? This should certainly work.
I can do it, but for now I can give you more information.
The data comes from an XImage object (which some library is
providing). I read off the XImage.data to get to the real data. I
also read the other fields in the XImage struct. The following is the
printf of those fields:
width:[640] height:[482]
depth:[24] bytes per line:[2560], bits_per_pixel:[32]
image format:[2] (That's XYPixmap, but I don't think it makes any
difference, unless it say it is a bitmap)
bitmap_unit:[32]
bitmap_pad:[32]
Both the system give me the same XImage data.
I'm a little confused here. An XImage is typically a way of
representing data as stored on the screen. It sounds like this
library is reusing XImage in a rather peculiar way to store
it's own data. It's a little hard to say what exactly it is
putting in there and whether that corresponds to what
gdk_draw_rgb_32_image().
The library is written for a video capture card, and they primarily
provide Windows API but they have ported some (important but low level)
part of the library to Linux, and this is the only way I can get the
image without screwing up the screen (the direct video memory write).
It looks peculiar to me either, I will try to look into the buffer
using GDB and if there is no clue at all I will try a test buffer.
btw, the screen output of the 16bit system has different color (they
are not entirely black and white (yes, I am taking b/w image using
32bit of color ;) )
The call I used to draw the RGB image is:
gdk_draw_rgb_32_image (draw_area->window,
draw_area->style->bg_gc[GTK_STATE_NORMAL],
0,0,640,482,
GDK_RGB_DITHER_NONE,
buffer,
640*4);
draw_area is the gtk_drawing_area.
Is that the *right way* to provide the GDKDrawable and GC to the function?
They shouldn't matter much. This call looks reasonable, but I'm
guessing the buffer has data in a different format than what
gdk_draw_rgb_32_image() expects. What I'd try doing is writing
some code to make simple example image (say black and white stripes)
and trying drawing that with gdk_draw_rgb_32_image() and see
if that works.
Regards,
Patrick
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]