usage of gdk_pixbuf_scale_simple ?



Hi!

        I seem to be doing something wrong with gdk_pixbuf_scale_simple, because
I'm sure it's not *this* broken... 

        I'm simply trying to scale a bitmap. I've read the docs
as much as I can, and always get black bitmaps returned. can't find any
good examples of its use, either. Here's what I'm doing..

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        (incoming pic is 720x480x24 in 'workbuf')

        #define BITSPERSAMPLE 24
        GdkPixbuf *destpix,*srcpix;
        guchar *pixels;

        srcpix=gdk_pixbuf_new_from_data(workbuf,GDK_COLORSPACE_RGB,FALSE,
            BITSPERSAMPLE/3,
            inh->width, inh->height, 0, NULL,NULL);
        destpix=gdk_pixbuf_scale_simple(srcpix, 352,240,GDK_INTERP_NEAREST);
        pixels=gdk_pixbuf_get_pixels(destpix);
        memcpy(workbuf,pixels,(352*BITSPERSAMPLE/8)*240);
        gdk_pixbuf_unref(destpix);
        gdk_pixbuf_unref(srcpix);
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

at this point, workbuf is completely black.
I know that the results aren't really going to be correct unless rowstride
is 0, in which case it is here. but I'd at least expect to see *something*
no matter what.

would someone be kind enough to point out what I'm doing wrong?
thank you!!!

-paulb

===========================================================================
paulb oasis-software com         "I'm fuzzy on this whole good/bad thing" 
paulb foobox com                                          -Dr. Peter Venkman




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