Re: Can I get the raw array to image data?



Hi,

On 1/1/06, Gnaural <gnaural users sourceforge net> wrote:
In Win32, I often used dibsections, because they
allowed me to directly access bitmap data directly,
process it, then "blit" that data simply and
efficiently to the screen (via bitblt). Basically,
each bitmap created as a dibsection could be accessed
as a simple array, allowing me to do three things I
want:

I think you need the gdkpixbuf library, if you've not found it:

  http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/index.html

It lets you make RGB or RGBA client-side arrays which you can process
with simple C functions. It has routines to render these arrays to the
screen (including automatic double buffering) with optional scaling.
You can load and save in various formats, and you can capture from the
display into one of these things.

It can be fast. If you are running a local application and your
display is 24 or 32 bits per pixel and you have a good driver for your
card, you will get a hardware bitblt (perhaps one copy operation to
get the data into a shared memory segment?). In other cases (perhaps a
remote 16 bit display), it will be slower.

It will also be rather slow if you want to animate widgets. You'll be
fetching the rendered widget from the display, processesing it and
sending it back again. Probably not a good idea :-( It will work OK
for an image display area though (eg. GtkDrawingArea or GtkImage).

There's also Cairo, gtk's new PDF-alike drawing API. Of course that's
vectors rather than bitmaps, but it might be interesting.

  http://cairographics.org

John



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