mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
tabs->spaces
This commit is contained in:
parent
15347b6703
commit
b3f8b5fa7d
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* The Python Imaging Library.
|
* The Python Imaging Library.
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
|
@ -28,16 +28,16 @@
|
||||||
|
|
||||||
#include "Imaging.h"
|
#include "Imaging.h"
|
||||||
|
|
||||||
#define R 0
|
#define R 0
|
||||||
#define G 1
|
#define G 1
|
||||||
#define B 2
|
#define B 2
|
||||||
#define X 3
|
#define X 3
|
||||||
#define A 3
|
#define A 3
|
||||||
|
|
||||||
#define C 0
|
#define C 0
|
||||||
#define M 1
|
#define M 1
|
||||||
#define Y 2
|
#define Y 2
|
||||||
#define K 3
|
#define K 3
|
||||||
|
|
||||||
/* byte swapping macros */
|
/* byte swapping macros */
|
||||||
|
|
||||||
|
@ -83,16 +83,16 @@ pack1(UINT8* out, const UINT8* in, int pixels)
|
||||||
/* bilevel (black is 0) */
|
/* bilevel (black is 0) */
|
||||||
b = 0; m = 128;
|
b = 0; m = 128;
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
if (in[i] != 0)
|
if (in[i] != 0)
|
||||||
b |= m;
|
b |= m;
|
||||||
m >>= 1;
|
m >>= 1;
|
||||||
if (m == 0) {
|
if (m == 0) {
|
||||||
*out++ = b;
|
*out++ = b;
|
||||||
b = 0; m = 128;
|
b = 0; m = 128;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m != 128)
|
if (m != 128)
|
||||||
*out++ = b;
|
*out++ = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -102,16 +102,16 @@ pack1I(UINT8* out, const UINT8* in, int pixels)
|
||||||
/* bilevel (black is 1) */
|
/* bilevel (black is 1) */
|
||||||
b = 0; m = 128;
|
b = 0; m = 128;
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
if (in[i] == 0)
|
if (in[i] == 0)
|
||||||
b |= m;
|
b |= m;
|
||||||
m >>= 1;
|
m >>= 1;
|
||||||
if (m == 0) {
|
if (m == 0) {
|
||||||
*out++ = b;
|
*out++ = b;
|
||||||
b = 0; m = 128;
|
b = 0; m = 128;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m != 128)
|
if (m != 128)
|
||||||
*out++ = b;
|
*out++ = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -121,16 +121,16 @@ pack1R(UINT8* out, const UINT8* in, int pixels)
|
||||||
/* bilevel, lsb first (black is 0) */
|
/* bilevel, lsb first (black is 0) */
|
||||||
b = 0; m = 1;
|
b = 0; m = 1;
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
if (in[i] != 0)
|
if (in[i] != 0)
|
||||||
b |= m;
|
b |= m;
|
||||||
m <<= 1;
|
m <<= 1;
|
||||||
if (m == 256){
|
if (m == 256){
|
||||||
*out++ = b;
|
*out++ = b;
|
||||||
b = 0; m = 1;
|
b = 0; m = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m != 1)
|
if (m != 1)
|
||||||
*out++ = b;
|
*out++ = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -140,16 +140,16 @@ pack1IR(UINT8* out, const UINT8* in, int pixels)
|
||||||
/* bilevel, lsb first (black is 1) */
|
/* bilevel, lsb first (black is 1) */
|
||||||
b = 0; m = 1;
|
b = 0; m = 1;
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
if (in[i] == 0)
|
if (in[i] == 0)
|
||||||
b |= m;
|
b |= m;
|
||||||
m <<= 1;
|
m <<= 1;
|
||||||
if (m == 256){
|
if (m == 256){
|
||||||
*out++ = b;
|
*out++ = b;
|
||||||
b = 0; m = 1;
|
b = 0; m = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m != 1)
|
if (m != 1)
|
||||||
*out++ = b;
|
*out++ = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -158,44 +158,44 @@ pack1L(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* bilevel, stored as bytes */
|
/* bilevel, stored as bytes */
|
||||||
for (i = 0; i < pixels; i++)
|
for (i = 0; i < pixels; i++)
|
||||||
out[i] = (in[i] != 0) ? 255 : 0;
|
out[i] = (in[i] != 0) ? 255 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
packP4(UINT8* out, const UINT8* in, int pixels)
|
packP4(UINT8* out, const UINT8* in, int pixels)
|
||||||
{
|
{
|
||||||
while (pixels >= 2) {
|
while (pixels >= 2) {
|
||||||
*out++ = (in[0] << 4) |
|
*out++ = (in[0] << 4) |
|
||||||
(in[1] & 15);
|
(in[1] & 15);
|
||||||
in += 2; pixels -= 2;
|
in += 2; pixels -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pixels)
|
if (pixels)
|
||||||
out[0] = (in[0] << 4);
|
out[0] = (in[0] << 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
packP2(UINT8* out, const UINT8* in, int pixels)
|
packP2(UINT8* out, const UINT8* in, int pixels)
|
||||||
{
|
{
|
||||||
while (pixels >= 4) {
|
while (pixels >= 4) {
|
||||||
*out++ = (in[0] << 6) |
|
*out++ = (in[0] << 6) |
|
||||||
((in[1] & 3) << 4) |
|
((in[1] & 3) << 4) |
|
||||||
((in[2] & 3) << 2) |
|
((in[2] & 3) << 2) |
|
||||||
(in[3] & 3);
|
(in[3] & 3);
|
||||||
in += 4; pixels -= 4;
|
in += 4; pixels -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (pixels) {
|
switch (pixels) {
|
||||||
case 3:
|
case 3:
|
||||||
out[0] = (in[0] << 6) |
|
out[0] = (in[0] << 6) |
|
||||||
((in[1] & 3) << 4) |
|
((in[1] & 3) << 4) |
|
||||||
((in[2] & 3) << 2);
|
((in[2] & 3) << 2);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
out[0] = (in[0] << 6) |
|
out[0] = (in[0] << 6) |
|
||||||
((in[1] & 3) << 4);
|
((in[1] & 3) << 4);
|
||||||
case 1:
|
case 1:
|
||||||
out[0] = (in[0] << 6);
|
out[0] = (in[0] << 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,9 +205,9 @@ packLA(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* LA, pixel interleaved */
|
/* LA, pixel interleaved */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[0] = in[R];
|
out[0] = in[R];
|
||||||
out[1] = in[A];
|
out[1] = in[A];
|
||||||
out += 2; in += 4;
|
out += 2; in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,9 +217,9 @@ packLAL(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* LA, line interleaved */
|
/* LA, line interleaved */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[i] = in[R];
|
out[i] = in[R];
|
||||||
out[i+pixels] = in[A];
|
out[i+pixels] = in[A];
|
||||||
in += 4;
|
in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,10 +229,10 @@ ImagingPackRGB(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* RGB triplets */
|
/* RGB triplets */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[0] = in[R];
|
out[0] = in[R];
|
||||||
out[1] = in[G];
|
out[1] = in[G];
|
||||||
out[2] = in[B];
|
out[2] = in[B];
|
||||||
out += 3; in += 4;
|
out += 3; in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,11 +242,11 @@ ImagingPackXRGB(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* XRGB, triplets with left padding */
|
/* XRGB, triplets with left padding */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[0] = 0;
|
out[0] = 0;
|
||||||
out[1] = in[R];
|
out[1] = in[R];
|
||||||
out[2] = in[G];
|
out[2] = in[G];
|
||||||
out[3] = in[B];
|
out[3] = in[B];
|
||||||
out += 4; in += 4;
|
out += 4; in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,10 +256,10 @@ ImagingPackBGR(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* RGB, reversed bytes */
|
/* RGB, reversed bytes */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[0] = in[B];
|
out[0] = in[B];
|
||||||
out[1] = in[G];
|
out[1] = in[G];
|
||||||
out[2] = in[R];
|
out[2] = in[R];
|
||||||
out += 3; in += 4;
|
out += 3; in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,11 +269,11 @@ ImagingPackBGRX(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* BGRX, reversed bytes with right padding */
|
/* BGRX, reversed bytes with right padding */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[0] = in[B];
|
out[0] = in[B];
|
||||||
out[1] = in[G];
|
out[1] = in[G];
|
||||||
out[2] = in[R];
|
out[2] = in[R];
|
||||||
out[3] = 0;
|
out[3] = 0;
|
||||||
out += 4; in += 4;
|
out += 4; in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,11 +283,11 @@ ImagingPackXBGR(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* XBGR, reversed bytes with left padding */
|
/* XBGR, reversed bytes with left padding */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[0] = 0;
|
out[0] = 0;
|
||||||
out[1] = in[B];
|
out[1] = in[B];
|
||||||
out[2] = in[G];
|
out[2] = in[G];
|
||||||
out[3] = in[R];
|
out[3] = in[R];
|
||||||
out += 4; in += 4;
|
out += 4; in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,11 +297,11 @@ ImagingPackBGRA(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* BGRX, reversed bytes with right padding */
|
/* BGRX, reversed bytes with right padding */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[0] = in[B];
|
out[0] = in[B];
|
||||||
out[1] = in[G];
|
out[1] = in[G];
|
||||||
out[2] = in[R];
|
out[2] = in[R];
|
||||||
out[3] = in[A];
|
out[3] = in[A];
|
||||||
out += 4; in += 4;
|
out += 4; in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,11 +311,11 @@ ImagingPackABGR(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* XBGR, reversed bytes with left padding */
|
/* XBGR, reversed bytes with left padding */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[0] = in[A];
|
out[0] = in[A];
|
||||||
out[1] = in[B];
|
out[1] = in[B];
|
||||||
out[2] = in[G];
|
out[2] = in[G];
|
||||||
out[3] = in[R];
|
out[3] = in[R];
|
||||||
out += 4; in += 4;
|
out += 4; in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,10 +340,10 @@ packRGBL(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* RGB, line interleaved */
|
/* RGB, line interleaved */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[i] = in[R];
|
out[i] = in[R];
|
||||||
out[i+pixels] = in[G];
|
out[i+pixels] = in[G];
|
||||||
out[i+pixels+pixels] = in[B];
|
out[i+pixels+pixels] = in[B];
|
||||||
in += 4;
|
in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,11 +353,11 @@ packRGBXL(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* RGBX, line interleaved */
|
/* RGBX, line interleaved */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[i] = in[R];
|
out[i] = in[R];
|
||||||
out[i+pixels] = in[G];
|
out[i+pixels] = in[G];
|
||||||
out[i+pixels+pixels] = in[B];
|
out[i+pixels+pixels] = in[B];
|
||||||
out[i+pixels+pixels+pixels] = in[X];
|
out[i+pixels+pixels+pixels] = in[X];
|
||||||
in += 4;
|
in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ packI16B(UINT8* out, const UINT8* in_, int pixels)
|
||||||
else
|
else
|
||||||
tmp_ = in[0];
|
tmp_ = in[0];
|
||||||
C16B;
|
C16B;
|
||||||
out += 2; in++;
|
out += 2; in++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ packI16N_I16B(UINT8* out, const UINT8* in, int pixels){
|
||||||
UINT8* tmp = (UINT8*) in;
|
UINT8* tmp = (UINT8*) in;
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
C16B;
|
C16B;
|
||||||
out += 2; tmp += 2;
|
out += 2; tmp += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ packI16N_I16(UINT8* out, const UINT8* in, int pixels){
|
||||||
UINT8* tmp = (UINT8*) in;
|
UINT8* tmp = (UINT8*) in;
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
C16L;
|
C16L;
|
||||||
out += 2; tmp += 2;
|
out += 2; tmp += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ packI32S(UINT8* out, const UINT8* in, int pixels)
|
||||||
UINT8* tmp = (UINT8*) in;
|
UINT8* tmp = (UINT8*) in;
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
C32L;
|
C32L;
|
||||||
out += 4; tmp += 4;
|
out += 4; tmp += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,10 +418,10 @@ ImagingPackLAB(UINT8* out, const UINT8* in, int pixels)
|
||||||
int i;
|
int i;
|
||||||
/* LAB triplets */
|
/* LAB triplets */
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
out[0] = in[0];
|
out[0] = in[0];
|
||||||
out[1] = in[1] ^ 128; /* signed in outside world */
|
out[1] = in[1] ^ 128; /* signed in outside world */
|
||||||
out[2] = in[2] ^ 128;
|
out[2] = in[2] ^ 128;
|
||||||
out += 3; in += 4;
|
out += 3; in += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ copy4I(UINT8* out, const UINT8* in, int pixels)
|
||||||
/* RGBA, CMYK quadruples, inverted */
|
/* RGBA, CMYK quadruples, inverted */
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < pixels*4; i++)
|
for (i = 0; i < pixels*4; i++)
|
||||||
out[i] = ~in[i];
|
out[i] = ~in[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -467,7 +467,7 @@ band0(UINT8* out, const UINT8* in, int pixels)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < pixels; i++, in += 4)
|
for (i = 0; i < pixels; i++, in += 4)
|
||||||
out[i] = in[0];
|
out[i] = in[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -475,7 +475,7 @@ band1(UINT8* out, const UINT8* in, int pixels)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < pixels; i++, in += 4)
|
for (i = 0; i < pixels; i++, in += 4)
|
||||||
out[i] = in[1];
|
out[i] = in[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -483,7 +483,7 @@ band2(UINT8* out, const UINT8* in, int pixels)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < pixels; i++, in += 4)
|
for (i = 0; i < pixels; i++, in += 4)
|
||||||
out[i] = in[2];
|
out[i] = in[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -491,7 +491,7 @@ band3(UINT8* out, const UINT8* in, int pixels)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < pixels; i++, in += 4)
|
for (i = 0; i < pixels; i++, in += 4)
|
||||||
out[i] = in[3];
|
out[i] = in[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
@ -502,122 +502,122 @@ static struct {
|
||||||
} packers[] = {
|
} packers[] = {
|
||||||
|
|
||||||
/* bilevel */
|
/* bilevel */
|
||||||
{"1", "1", 1, pack1},
|
{"1", "1", 1, pack1},
|
||||||
{"1", "1;I", 1, pack1I},
|
{"1", "1;I", 1, pack1I},
|
||||||
{"1", "1;R", 1, pack1R},
|
{"1", "1;R", 1, pack1R},
|
||||||
{"1", "1;IR", 1, pack1IR},
|
{"1", "1;IR", 1, pack1IR},
|
||||||
{"1", "L", 8, pack1L},
|
{"1", "L", 8, pack1L},
|
||||||
|
|
||||||
/* greyscale */
|
/* greyscale */
|
||||||
{"L", "L", 8, copy1},
|
{"L", "L", 8, copy1},
|
||||||
|
|
||||||
/* greyscale w. alpha */
|
/* greyscale w. alpha */
|
||||||
{"LA", "LA", 16, packLA},
|
{"LA", "LA", 16, packLA},
|
||||||
{"LA", "LA;L", 16, packLAL},
|
{"LA", "LA;L", 16, packLAL},
|
||||||
|
|
||||||
/* palette */
|
/* palette */
|
||||||
{"P", "P;1", 1, pack1},
|
{"P", "P;1", 1, pack1},
|
||||||
{"P", "P;2", 2, packP2},
|
{"P", "P;2", 2, packP2},
|
||||||
{"P", "P;4", 4, packP4},
|
{"P", "P;4", 4, packP4},
|
||||||
{"P", "P", 8, copy1},
|
{"P", "P", 8, copy1},
|
||||||
|
|
||||||
/* palette w. alpha */
|
/* palette w. alpha */
|
||||||
{"PA", "PA", 16, packLA},
|
{"PA", "PA", 16, packLA},
|
||||||
{"PA", "PA;L", 16, packLAL},
|
{"PA", "PA;L", 16, packLAL},
|
||||||
|
|
||||||
/* true colour */
|
/* true colour */
|
||||||
{"RGB", "RGB", 24, ImagingPackRGB},
|
{"RGB", "RGB", 24, ImagingPackRGB},
|
||||||
{"RGB", "RGBX", 32, copy4},
|
{"RGB", "RGBX", 32, copy4},
|
||||||
{"RGB", "XRGB", 32, ImagingPackXRGB},
|
{"RGB", "XRGB", 32, ImagingPackXRGB},
|
||||||
{"RGB", "BGR", 24, ImagingPackBGR},
|
{"RGB", "BGR", 24, ImagingPackBGR},
|
||||||
{"RGB", "BGRX", 32, ImagingPackBGRX},
|
{"RGB", "BGRX", 32, ImagingPackBGRX},
|
||||||
{"RGB", "XBGR", 32, ImagingPackXBGR},
|
{"RGB", "XBGR", 32, ImagingPackXBGR},
|
||||||
{"RGB", "RGB;L", 24, packRGBL},
|
{"RGB", "RGB;L", 24, packRGBL},
|
||||||
{"RGB", "R", 8, band0},
|
{"RGB", "R", 8, band0},
|
||||||
{"RGB", "G", 8, band1},
|
{"RGB", "G", 8, band1},
|
||||||
{"RGB", "B", 8, band2},
|
{"RGB", "B", 8, band2},
|
||||||
|
|
||||||
/* true colour w. alpha */
|
/* true colour w. alpha */
|
||||||
{"RGBA", "RGBA", 32, copy4},
|
{"RGBA", "RGBA", 32, copy4},
|
||||||
{"RGBA", "RGBA;L", 32, packRGBXL},
|
{"RGBA", "RGBA;L", 32, packRGBXL},
|
||||||
{"RGBA", "RGB", 24, ImagingPackRGB},
|
{"RGBA", "RGB", 24, ImagingPackRGB},
|
||||||
{"RGBA", "BGR", 24, ImagingPackBGR},
|
{"RGBA", "BGR", 24, ImagingPackBGR},
|
||||||
{"RGBA", "BGRA", 32, ImagingPackBGRA},
|
{"RGBA", "BGRA", 32, ImagingPackBGRA},
|
||||||
{"RGBA", "ABGR", 32, ImagingPackABGR},
|
{"RGBA", "ABGR", 32, ImagingPackABGR},
|
||||||
{"RGBA", "BGRa", 32, ImagingPackBGRa},
|
{"RGBA", "BGRa", 32, ImagingPackBGRa},
|
||||||
{"RGBA", "R", 8, band0},
|
{"RGBA", "R", 8, band0},
|
||||||
{"RGBA", "G", 8, band1},
|
{"RGBA", "G", 8, band1},
|
||||||
{"RGBA", "B", 8, band2},
|
{"RGBA", "B", 8, band2},
|
||||||
{"RGBA", "A", 8, band3},
|
{"RGBA", "A", 8, band3},
|
||||||
|
|
||||||
/* true colour w. alpha premultiplied */
|
/* true colour w. alpha premultiplied */
|
||||||
{"RGBa", "RGBa", 32, copy4},
|
{"RGBa", "RGBa", 32, copy4},
|
||||||
{"RGBa", "BGRa", 32, ImagingPackBGRA},
|
{"RGBa", "BGRa", 32, ImagingPackBGRA},
|
||||||
{"RGBa", "aBGR", 32, ImagingPackABGR},
|
{"RGBa", "aBGR", 32, ImagingPackABGR},
|
||||||
|
|
||||||
/* true colour w. padding */
|
/* true colour w. padding */
|
||||||
{"RGBX", "RGBX", 32, copy4},
|
{"RGBX", "RGBX", 32, copy4},
|
||||||
{"RGBX", "RGBX;L", 32, packRGBXL},
|
{"RGBX", "RGBX;L", 32, packRGBXL},
|
||||||
{"RGBX", "RGB", 32, ImagingPackRGB},
|
{"RGBX", "RGB", 32, ImagingPackRGB},
|
||||||
{"RGBX", "BGR", 32, ImagingPackBGR},
|
{"RGBX", "BGR", 32, ImagingPackBGR},
|
||||||
{"RGBX", "BGRX", 32, ImagingPackBGRX},
|
{"RGBX", "BGRX", 32, ImagingPackBGRX},
|
||||||
{"RGBX", "XBGR", 32, ImagingPackXBGR},
|
{"RGBX", "XBGR", 32, ImagingPackXBGR},
|
||||||
{"RGBX", "R", 8, band0},
|
{"RGBX", "R", 8, band0},
|
||||||
{"RGBX", "G", 8, band1},
|
{"RGBX", "G", 8, band1},
|
||||||
{"RGBX", "B", 8, band2},
|
{"RGBX", "B", 8, band2},
|
||||||
{"RGBX", "X", 8, band3},
|
{"RGBX", "X", 8, band3},
|
||||||
|
|
||||||
/* colour separation */
|
/* colour separation */
|
||||||
{"CMYK", "CMYK", 32, copy4},
|
{"CMYK", "CMYK", 32, copy4},
|
||||||
{"CMYK", "CMYK;I", 32, copy4I},
|
{"CMYK", "CMYK;I", 32, copy4I},
|
||||||
{"CMYK", "CMYK;L", 32, packRGBXL},
|
{"CMYK", "CMYK;L", 32, packRGBXL},
|
||||||
{"CMYK", "C", 8, band0},
|
{"CMYK", "C", 8, band0},
|
||||||
{"CMYK", "M", 8, band1},
|
{"CMYK", "M", 8, band1},
|
||||||
{"CMYK", "Y", 8, band2},
|
{"CMYK", "Y", 8, band2},
|
||||||
{"CMYK", "K", 8, band3},
|
{"CMYK", "K", 8, band3},
|
||||||
|
|
||||||
/* video (YCbCr) */
|
/* video (YCbCr) */
|
||||||
{"YCbCr", "YCbCr", 24, ImagingPackRGB},
|
{"YCbCr", "YCbCr", 24, ImagingPackRGB},
|
||||||
{"YCbCr", "YCbCr;L", 24, packRGBL},
|
{"YCbCr", "YCbCr;L", 24, packRGBL},
|
||||||
{"YCbCr", "YCbCrX", 32, copy4},
|
{"YCbCr", "YCbCrX", 32, copy4},
|
||||||
{"YCbCr", "YCbCrK", 32, copy4},
|
{"YCbCr", "YCbCrK", 32, copy4},
|
||||||
{"YCbCr", "Y", 8, band0},
|
{"YCbCr", "Y", 8, band0},
|
||||||
{"YCbCr", "Cb", 8, band1},
|
{"YCbCr", "Cb", 8, band1},
|
||||||
{"YCbCr", "Cr", 8, band2},
|
{"YCbCr", "Cr", 8, band2},
|
||||||
|
|
||||||
/* LAB Color */
|
/* LAB Color */
|
||||||
{"LAB", "LAB", 24, ImagingPackLAB},
|
{"LAB", "LAB", 24, ImagingPackLAB},
|
||||||
{"LAB", "L", 8, band0},
|
{"LAB", "L", 8, band0},
|
||||||
{"LAB", "A", 8, band1},
|
{"LAB", "A", 8, band1},
|
||||||
{"LAB", "B", 8, band2},
|
{"LAB", "B", 8, band2},
|
||||||
|
|
||||||
/* HSV */
|
/* HSV */
|
||||||
{"HSV", "HSV", 24, ImagingPackRGB},
|
{"HSV", "HSV", 24, ImagingPackRGB},
|
||||||
{"HSV", "H", 8, band0},
|
{"HSV", "H", 8, band0},
|
||||||
{"HSV", "S", 8, band1},
|
{"HSV", "S", 8, band1},
|
||||||
{"HSV", "V", 8, band2},
|
{"HSV", "V", 8, band2},
|
||||||
|
|
||||||
/* integer */
|
/* integer */
|
||||||
{"I", "I", 32, copy4},
|
{"I", "I", 32, copy4},
|
||||||
{"I", "I;16B", 16, packI16B},
|
{"I", "I;16B", 16, packI16B},
|
||||||
{"I", "I;32S", 32, packI32S},
|
{"I", "I;32S", 32, packI32S},
|
||||||
{"I", "I;32NS", 32, copy4},
|
{"I", "I;32NS", 32, copy4},
|
||||||
|
|
||||||
/* floating point */
|
/* floating point */
|
||||||
{"F", "F", 32, copy4},
|
{"F", "F", 32, copy4},
|
||||||
{"F", "F;32F", 32, packI32S},
|
{"F", "F;32F", 32, packI32S},
|
||||||
{"F", "F;32NF", 32, copy4},
|
{"F", "F;32NF", 32, copy4},
|
||||||
|
|
||||||
/* storage modes */
|
/* storage modes */
|
||||||
{"I;16", "I;16", 16, copy2},
|
{"I;16", "I;16", 16, copy2},
|
||||||
{"I;16B", "I;16B", 16, copy2},
|
{"I;16B", "I;16B", 16, copy2},
|
||||||
{"I;16L", "I;16L", 16, copy2},
|
{"I;16L", "I;16L", 16, copy2},
|
||||||
{"I;16", "I;16N", 16, packI16N_I16}, // LibTiff native->image endian.
|
{"I;16", "I;16N", 16, packI16N_I16}, // LibTiff native->image endian.
|
||||||
{"I;16L", "I;16N", 16, packI16N_I16},
|
{"I;16L", "I;16N", 16, packI16N_I16},
|
||||||
{"I;16B", "I;16N", 16, packI16N_I16B},
|
{"I;16B", "I;16N", 16, packI16N_I16B},
|
||||||
{"BGR;15", "BGR;15", 16, copy2},
|
{"BGR;15", "BGR;15", 16, copy2},
|
||||||
{"BGR;16", "BGR;16", 16, copy2},
|
{"BGR;16", "BGR;16", 16, copy2},
|
||||||
{"BGR;24", "BGR;24", 24, copy3},
|
{"BGR;24", "BGR;24", 24, copy3},
|
||||||
|
|
||||||
{NULL} /* sentinel */
|
{NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
@ -630,11 +630,11 @@ ImagingFindPacker(const char* mode, const char* rawmode, int* bits_out)
|
||||||
|
|
||||||
/* find a suitable pixel packer */
|
/* find a suitable pixel packer */
|
||||||
for (i = 0; packers[i].rawmode; i++)
|
for (i = 0; packers[i].rawmode; i++)
|
||||||
if (strcmp(packers[i].mode, mode) == 0 &&
|
if (strcmp(packers[i].mode, mode) == 0 &&
|
||||||
strcmp(packers[i].rawmode, rawmode) == 0) {
|
strcmp(packers[i].rawmode, rawmode) == 0) {
|
||||||
if (bits_out)
|
if (bits_out)
|
||||||
*bits_out = packers[i].bits;
|
*bits_out = packers[i].bits;
|
||||||
return packers[i].pack;
|
return packers[i].pack;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user