737 |
gint bits_per_sample = 8; |
gint bits_per_sample = 8; |
738 |
gboolean has_alpha = TRUE; |
gboolean has_alpha = TRUE; |
739 |
gint total_channels = 4; |
gint total_channels = 4; |
740 |
jint i, px; |
jint i; |
741 |
|
|
742 |
gdk_threads_enter(); |
gdk_threads_enter(); |
743 |
if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return NULL; } |
if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return NULL; } |
766 |
|
|
767 |
native_pixels= gdk_pixbuf_get_pixels (buf); |
native_pixels= gdk_pixbuf_get_pixels (buf); |
768 |
|
|
769 |
|
#ifndef WORDS_BIGENDIAN |
770 |
/* NOTE: The pixels we got in the pixbuf are stored |
/* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */ |
771 |
in reversed order. i.e 0xBBGGRRAA. |
for (i=0; i<width * height; i++) |
772 |
We need to convert them to 0xAARRGGBB. */ |
{ |
773 |
|
native_pixels[i] = SWAPU32 ((unsigned)native_pixels[i]); |
|
for (i=0; i<width * height; i++) |
|
|
{ |
|
|
|
|
|
/* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */ |
|
|
|
|
|
px = native_pixels[i]; |
|
|
px = ((px >> 24) & 0xff) | ((px << 8) & 0xffffff00); |
|
|
px = ((px >> 8) & 0x00ff00ff) | ((px << 8) & 0xff00ff00); |
|
|
px = ((px >> 16) & 0x0000ffff) | ((px << 16) & 0xffff0000); |
|
|
native_pixels[i] = px; |
|
|
|
|
774 |
} |
} |
775 |
|
#endif |
776 |
java_pixels = (*env) -> NewIntArray (env, width * height); |
java_pixels = (*env) -> NewIntArray (env, width * height); |
777 |
|
|
778 |
(*env)->SetIntArrayRegion(env, java_pixels, |
(*env)->SetIntArrayRegion(env, java_pixels, |