mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Added BGXR and BGAR unpackers
This commit is contained in:
parent
9e5b9fb18f
commit
98ae91a65d
|
@ -184,9 +184,11 @@ class BmpImageFile(ImageFile.ImageFile):
|
|||
32: [
|
||||
(0xFF0000, 0xFF00, 0xFF, 0x0),
|
||||
(0xFF000000, 0xFF0000, 0xFF00, 0x0),
|
||||
(0xFF000000, 0xFF00, 0xFF, 0x0),
|
||||
(0xFF000000, 0xFF0000, 0xFF00, 0xFF),
|
||||
(0xFF, 0xFF00, 0xFF0000, 0xFF000000),
|
||||
(0xFF0000, 0xFF00, 0xFF, 0xFF000000),
|
||||
(0xFF000000, 0xFF00, 0xFF, 0xFF0000),
|
||||
(0x0, 0x0, 0x0, 0x0),
|
||||
],
|
||||
24: [(0xFF0000, 0xFF00, 0xFF)],
|
||||
|
@ -195,9 +197,11 @@ class BmpImageFile(ImageFile.ImageFile):
|
|||
MASK_MODES = {
|
||||
(32, (0xFF0000, 0xFF00, 0xFF, 0x0)): "BGRX",
|
||||
(32, (0xFF000000, 0xFF0000, 0xFF00, 0x0)): "XBGR",
|
||||
(32, (0xFF000000, 0xFF00, 0xFF, 0x0)): "BGXR",
|
||||
(32, (0xFF000000, 0xFF0000, 0xFF00, 0xFF)): "ABGR",
|
||||
(32, (0xFF, 0xFF00, 0xFF0000, 0xFF000000)): "RGBA",
|
||||
(32, (0xFF0000, 0xFF00, 0xFF, 0xFF000000)): "BGRA",
|
||||
(32, (0xFF000000, 0xFF00, 0xFF, 0xFF0000)): "BGAR",
|
||||
(32, (0x0, 0x0, 0x0, 0x0)): "BGRA",
|
||||
(24, (0xFF0000, 0xFF00, 0xFF)): "BGR",
|
||||
(16, (0xF800, 0x7E0, 0x1F)): "BGR;16",
|
||||
|
|
|
@ -790,6 +790,17 @@ ImagingUnpackBGRX(UINT8 *_out, const UINT8 *in, int pixels) {
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ImagingUnpackBGXR(UINT8 *_out, const UINT8 *in, int pixels) {
|
||||
int i;
|
||||
for (i = 0; i < pixels; i++) {
|
||||
UINT32 iv = MAKE_UINT32(in[3], in[1], in[0], 255);
|
||||
memcpy(_out, &iv, sizeof(iv));
|
||||
in += 4;
|
||||
_out += 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ImagingUnpackXRGB(UINT8 *_out, const UINT8 *in, int pixels) {
|
||||
int i;
|
||||
|
@ -1090,6 +1101,17 @@ unpackBGRA16B(UINT8 *_out, const UINT8 *in, int pixels) {
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpackBGAR(UINT8 *_out, const UINT8 *in, int pixels) {
|
||||
int i;
|
||||
for (i = 0; i < pixels; i++) {
|
||||
UINT32 iv = MAKE_UINT32(in[3], in[1], in[0], in[2]);
|
||||
memcpy(_out, &iv, sizeof(iv));
|
||||
in += 4;
|
||||
_out += 4;
|
||||
}
|
||||
}
|
||||
|
||||
/* Unpack to "CMYK" image */
|
||||
|
||||
static void
|
||||
|
@ -1584,6 +1606,7 @@ static struct {
|
|||
{"RGB", "RGBA;L", 32, unpackRGBAL},
|
||||
{"RGB", "RGBA;15", 16, ImagingUnpackRGBA15},
|
||||
{"RGB", "BGRX", 32, ImagingUnpackBGRX},
|
||||
{"RGB", "BGXR", 32, ImagingUnpackBGXR},
|
||||
{"RGB", "XRGB", 32, ImagingUnpackXRGB},
|
||||
{"RGB", "XBGR", 32, ImagingUnpackXBGR},
|
||||
{"RGB", "YCC;P", 24, ImagingUnpackYCC},
|
||||
|
@ -1624,6 +1647,7 @@ static struct {
|
|||
{"RGBA", "BGRA", 32, unpackBGRA},
|
||||
{"RGBA", "BGRA;16L", 64, unpackBGRA16L},
|
||||
{"RGBA", "BGRA;16B", 64, unpackBGRA16B},
|
||||
{"RGBA", "BGAR", 32, unpackBGAR},
|
||||
{"RGBA", "ARGB", 32, unpackARGB},
|
||||
{"RGBA", "ABGR", 32, unpackABGR},
|
||||
{"RGBA", "YCCA;P", 32, ImagingUnpackYCCA},
|
||||
|
|
Loading…
Reference in New Issue
Block a user