99 |
JNIEnv *env; |
JNIEnv *env; |
100 |
union env_union e; |
union env_union e; |
101 |
jint stride_bytes, stride_pixels, n_channels, n_pixels; |
jint stride_bytes, stride_pixels, n_channels, n_pixels; |
102 |
int i, px; |
int i; |
103 |
jintArray jpixels; |
jintArray jpixels; |
104 |
jint *java_pixels; |
jint *java_pixels; |
105 |
guchar *gdk_pixels; |
guchar *gdk_pixels; |
129 |
gdk_pixels + (y * stride_bytes), |
gdk_pixels + (y * stride_bytes), |
130 |
(height * stride_bytes)); |
(height * stride_bytes)); |
131 |
|
|
132 |
|
#ifndef WORDS_BIGENDIAN |
133 |
|
/* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */ |
134 |
for (i = 0; i < n_pixels; ++i) |
for (i = 0; i < n_pixels; ++i) |
135 |
{ |
{ |
136 |
px = java_pixels[i]; |
java_pixels[i] = SWAPU32 ((unsigned)java_pixels[i]); |
|
|
|
|
/* move alpha around (GdkPixbufLoader results are AGBR not GBRA, in |
|
|
the lsb sense) */ |
|
|
/* px = ((px >> 24) & 0xff) | ((px << 8) & 0xffffff00); */ |
|
|
|
|
|
/* it appears to require a full byte swap, now, not just a shift to |
|
|
the A channel. why did this change? don't know. */ |
|
|
px = ((px >> 8) & 0x00ff00ff) | ((px << 8) & 0xff00ff00); |
|
|
px = ((px >> 16) & 0x0000ffff) | ((px << 16) & 0xffff0000); |
|
|
|
|
|
java_pixels[i] = px; |
|
137 |
} |
} |
138 |
|
#endif |
139 |
|
|
140 |
g_object_unref (pixbuf); |
g_object_unref (pixbuf); |
141 |
|
|