Can I get the raw array to image data?



I'm posting here because a lot of the Windows apps I'd
like to port to GTK depend on graphical steps that I
simply don't know how to do in GTK, and I know that
many of you have a great deal of Win32 experience and
probably know what I am getting at better than I can
even find the words to describe.

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:

1) write generic C functions that are not windows
specific (requiring only a pointer to the first
element and image dimensions to process data)

2) speed-optimize my image processing routines using
array tricks

3) animate the rendering by alternately "blitting"
from the two different sets of array data (i.e., do
animation with double-buffering)

Is there something like dibsections in GTK that can do
these three steps?

For example, let's take the basic GTK window created
by the helloworld.c example:

/*===========*/
#include <gtk/gtk.h>
int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    gtk_init (&argc, &argv);
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_show  (window);
    gtk_main ();
    return 0;
}
/*===========*/


What would I need to add to that so that I could:

- Create the GTK equivalent of two "truecolor" (24 or
32-bit) offscreen dibsections that I can use as
buffers to be alternately blitted to that window (or
whatever the proper container within that window would
be for animated graphics).

- Get access to the bits (preferably as an int array,
but chars are OK too) of those two offscreen bitmaps
for processing

- Blit the data in those offscreen bitmats to the
window.

Thanks much for any tips you may have, even if you can
just point me in the right direction. I've found that
much of the problem in learning these sorts of things
is just figuring out what equivalent concepts are
called; I hope that's the case here.



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