Send to list.

- John Hobbs

[EMAIL PROTECTED]

---------- Forwarded message ----------
From: simba simba <[EMAIL PROTECTED]>
Date: Mon, Sep 29, 2008 at 2:24 PM
Subject: Re: How to display an image array?
To: John Hobbs <[EMAIL PROTECTED]>


Thanks.

I tried to convert gray image to RGB first and then display it. it works
although not convenient.

sim


On Mon, Sep 29, 2008 at 10:57 AM, John Hobbs <[EMAIL PROTECTED]> wrote:

> I've never used any gray scale images before, but I think the colorspace is
> the issue. In the gdk-pixbuf docs it says: "This enumeration defines the
> color spaces that are supported by the gdk-pixbuf library. Currently only
> RGB is supported." [1]
>
> I realize it is far from optimal, but can you just convert up to rgb?  Your
> other choice is Cairo maybe, but that doesn't look very likely either, same
> issue. [2]
>
> Don't know what to say except I'd probably just convert up.  Anyone else
> have ideas?
>
> - John Hobbs
>
> [EMAIL PROTECTED]
>
> [1]
> http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-gdk-pixbuf.html#GdkColorspace
> [2]
> http://www.cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t
>
>
> On Sat, Sep 27, 2008 at 11:22 PM, simba simba <[EMAIL PROTECTED]>wrote:
>
>> Thanks John:
>>
>> I am using Gdk::Pixbuf::create_from_data(), it seems good except for some
>> one channel gray images.
>>
>> I have an array guint8 * data corresponds to a image, each pixel has
>> 8-bits (1 BYTE), when I use
>> create_from_data(), the show image is weired. it is duplicated 3 times.
>>
>> Gdk::Pixbuf::create_from_data(
>>      (guint8*) data,
>>      Gdk::COLORSPACE_RGB,
>>      false,
>>      depth,
>>      width,
>>      height,
>>      width);
>>
>> Any sugguestion for  this?
>>
>> sim
>>
>>
>> On Fri, Sep 26, 2008 at 4:10 PM, John Hobbs <[EMAIL PROTECTED]> wrote:
>>
>>> Don't know if this will help, but here is a snippet I use to draw
>>> straight onto the Gdk::Window  (screen is a Gtk::Image in this case)
>>>
>>> <snip>
>>> screen.get_window()->draw_rgb_image(
>>>      screen.get_style()->get_bg_gc(Gtk::STATE_NORMAL),
>>>      0,
>>>      0,
>>>      width,
>>>      height,
>>>      Gdk::RGB_DITHER_NONE,
>>>      (const guchar*) data,
>>>      width*3
>>> );
>>> </snip>
>>>
>>> And here's one I use with pixbuf...
>>>
>>> <snip>
>>> Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create_from_data(
>>>      (guint8*) data,
>>>      Gdk::COLORSPACE_RGB,
>>>      false,
>>>      depth,
>>>      width,
>>>      height,
>>>      width*3
>>> );
>>> </snip>
>>>
>>> Not sure if they are the "right" way to do it, but they work for me.
>>>
>>> - John Hobbs
>>>
>>> [EMAIL PROTECTED]
>>>
>>> On Fri, Sep 26, 2008 at 2:57 PM, simba simba <[EMAIL PROTECTED]>wrote:
>>>
>>>> Hi dear all:
>>>>
>>>> Now I have a image array, char * data. I know this array's length(
>>>> image's width and height) and array's format( RGB 32bits for a pixel or
>>>> Grayscale leve 8bits for a pixel).
>>>>
>>>> My question is how can I display this image array by using gtkmm?
>>>>
>>>> I have tried using Gtk::Pixbuf  pixbuf.create_from_data().
>>>>
>>>> But it is not good for me. Is there any example codes?
>>>>
>>>> Thanks a lot!!
>>>>
>>>> simba
>>>>
>>>> _______________________________________________
>>>> gtkmm-list mailing list
>>>> [email protected]
>>>> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>>>>
>>>>
>>>
>>> _______________________________________________
>>> gtkmm-list mailing list
>>> [email protected]
>>> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>>>
>>>
>>
>
> _______________________________________________
> gtkmm-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to