summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2021-05-03 13:36:31 (GMT)
committerculler <culler>2021-05-03 13:36:31 (GMT)
commit079ecb61f41997583512bc9e386d5a2a25d7ca42 (patch)
treeba6c5d105dd858c89c929428220753d8de198ad4 /macosx
parent9809b3ea2b968f89c8521058921e53d57be13ec0 (diff)
downloadtk-079ecb61f41997583512bc9e386d5a2a25d7ca42.zip
tk-079ecb61f41997583512bc9e386d5a2a25d7ca42.tar.gz
tk-079ecb61f41997583512bc9e386d5a2a25d7ca42.tar.bz2
Make ImageGetPixel consistent with XGetImage.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXImage.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c
index e3beb5c..2adebe8 100644
--- a/macosx/tkMacOSXImage.c
+++ b/macosx/tkMacOSXImage.c
@@ -204,9 +204,9 @@ ImageGetPixel(
switch (image->bits_per_pixel) {
case 32: /* 8 bits per channel */
- r = (*((unsigned int*) srcPtr) >> 16) & 0xff;
+ b = (*((unsigned int*) srcPtr) >> 16) & 0xff;
g = (*((unsigned int*) srcPtr) >> 8) & 0xff;
- b = (*((unsigned int*) srcPtr) ) & 0xff;
+ r = (*((unsigned int*) srcPtr) ) & 0xff;
/*if (image->byte_order == LSBFirst) {
r = srcPtr[2]; g = srcPtr[1]; b = srcPtr[0];
} else {
@@ -646,8 +646,8 @@ CreateCGImageFromPixmap(
*----------------------------------------------------------------------
*/
struct pixel_fmt {int r; int g; int b; int a;};
-static struct pixel_fmt rgba = {0, 1, 2, 3};
-static struct pixel_fmt argb = {3, 0, 1, 2};
+static struct pixel_fmt bgra = {2, 1, 0, 3};
+static struct pixel_fmt abgr = {3, 2, 1, 0};
XImage *
XGetImage(
@@ -702,10 +702,10 @@ XGetImage(
/*
* When Apple extracts a bitmap from an NSView, it may be in either
- * RGBA or ARGB format. For an XImage we need RGBA.
+ * BGRA or ABGR format. For an XImage we need RGBA.
*/
- struct pixel_fmt pixel = bitmap_fmt == 0 ? rgba : argb;
+ struct pixel_fmt pixel = bitmap_fmt == 0 ? bgra : abgr;
for (row = 0, n = 0; row < height; row++, n += bytes_per_row) {
for (m = n; m < n + 4*width; m += 4) {