mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
linter changes
This commit is contained in:
parent
f7b57265ad
commit
3ba2ea71f5
|
@ -124,10 +124,8 @@ PyImagingPhotoPut(
|
||||||
if (im->mode == IMAGING_MODE_1 || im->mode == IMAGING_MODE_L) {
|
if (im->mode == IMAGING_MODE_1 || im->mode == IMAGING_MODE_L) {
|
||||||
block.pixelSize = 1;
|
block.pixelSize = 1;
|
||||||
block.offset[0] = block.offset[1] = block.offset[2] = block.offset[3] = 0;
|
block.offset[0] = block.offset[1] = block.offset[2] = block.offset[3] = 0;
|
||||||
} else if (
|
} else if (im->mode == IMAGING_MODE_RGB || im->mode == IMAGING_MODE_RGBA ||
|
||||||
im->mode == IMAGING_MODE_RGB || im->mode == IMAGING_MODE_RGBA ||
|
im->mode == IMAGING_MODE_RGBX || im->mode == IMAGING_MODE_RGBa) {
|
||||||
im->mode == IMAGING_MODE_RGBX || im->mode == IMAGING_MODE_RGBa
|
|
||||||
) {
|
|
||||||
block.pixelSize = 4;
|
block.pixelSize = 4;
|
||||||
block.offset[0] = 0;
|
block.offset[0] = 0;
|
||||||
block.offset[1] = 1;
|
block.offset[1] = 1;
|
||||||
|
|
|
@ -1720,7 +1720,9 @@ _quantize(ImagingObject *self, PyObject *args) {
|
||||||
|
|
||||||
if (!self->image->xsize || !self->image->ysize) {
|
if (!self->image->xsize || !self->image->ysize) {
|
||||||
/* no content; return an empty image */
|
/* no content; return an empty image */
|
||||||
return PyImagingNew(ImagingNew(IMAGING_MODE_P, self->image->xsize, self->image->ysize));
|
return PyImagingNew(
|
||||||
|
ImagingNew(IMAGING_MODE_P, self->image->xsize, self->image->ysize)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PyImagingNew(ImagingQuantize(self->image, colours, method, kmeans));
|
return PyImagingNew(ImagingQuantize(self->image, colours, method, kmeans));
|
||||||
|
@ -2004,7 +2006,8 @@ _reduce(ImagingObject *self, PyObject *args) {
|
||||||
|
|
||||||
static int
|
static int
|
||||||
isRGB(const ModeID mode) {
|
isRGB(const ModeID mode) {
|
||||||
return mode == IMAGING_MODE_RGB || mode == IMAGING_MODE_RGBA || mode == IMAGING_MODE_RGBX;
|
return mode == IMAGING_MODE_RGB || mode == IMAGING_MODE_RGBA ||
|
||||||
|
mode == IMAGING_MODE_RGBX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
20
src/decode.c
20
src/decode.c
|
@ -293,7 +293,9 @@ static PyTypeObject ImagingDecoderType = {
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
get_unpacker(ImagingDecoderObject *decoder, const ModeID mode, const RawModeID rawmode) {
|
get_unpacker(
|
||||||
|
ImagingDecoderObject *decoder, const ModeID mode, const RawModeID rawmode
|
||||||
|
) {
|
||||||
int bits;
|
int bits;
|
||||||
ImagingShuffler unpack;
|
ImagingShuffler unpack;
|
||||||
|
|
||||||
|
@ -324,7 +326,9 @@ PyImaging_BitDecoderNew(PyObject *self, PyObject *args) {
|
||||||
int fill = 0;
|
int fill = 0;
|
||||||
int sign = 0;
|
int sign = 0;
|
||||||
int ystep = 1;
|
int ystep = 1;
|
||||||
if (!PyArg_ParseTuple(args, "s|iiiii", &mode_name, &bits, &pad, &fill, &sign, &ystep)) {
|
if (!PyArg_ParseTuple(
|
||||||
|
args, "s|iiiii", &mode_name, &bits, &pad, &fill, &sign, &ystep
|
||||||
|
)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +439,9 @@ PyImaging_GifDecoderNew(PyObject *self, PyObject *args) {
|
||||||
int bits = 8;
|
int bits = 8;
|
||||||
int interlace = 0;
|
int interlace = 0;
|
||||||
int transparency = -1;
|
int transparency = -1;
|
||||||
if (!PyArg_ParseTuple(args, "s|iii", &mode_name, &bits, &interlace, &transparency)) {
|
if (!PyArg_ParseTuple(
|
||||||
|
args, "s|iii", &mode_name, &bits, &interlace, &transparency
|
||||||
|
)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +514,9 @@ PyImaging_LibTiffDecoderNew(PyObject *self, PyObject *args) {
|
||||||
int fp;
|
int fp;
|
||||||
uint32_t ifdoffset;
|
uint32_t ifdoffset;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "sssiI", &mode_name, &rawmode_name, &compname, &fp, &ifdoffset)) {
|
if (!PyArg_ParseTuple(
|
||||||
|
args, "sssiI", &mode_name, &rawmode_name, &compname, &fp, &ifdoffset
|
||||||
|
)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -855,7 +863,9 @@ PyImaging_JpegDecoderNew(PyObject *self, PyObject *args) {
|
||||||
int scale = 1;
|
int scale = 1;
|
||||||
int draft = 0;
|
int draft = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "ssz|ii", &mode_name, &rawmode_name, &jpegmode_name, &scale, &draft)) {
|
if (!PyArg_ParseTuple(
|
||||||
|
args, "ssz|ii", &mode_name, &rawmode_name, &jpegmode_name, &scale, &draft
|
||||||
|
)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -412,7 +412,9 @@ PyImaging_GifEncoderNew(PyObject *self, PyObject *args) {
|
||||||
char *rawmode_name;
|
char *rawmode_name;
|
||||||
Py_ssize_t bits = 8;
|
Py_ssize_t bits = 8;
|
||||||
Py_ssize_t interlace = 0;
|
Py_ssize_t interlace = 0;
|
||||||
if (!PyArg_ParseTuple(args, "ss|nn", &mode_name, &rawmode_name, &bits, &interlace)) {
|
if (!PyArg_ParseTuple(
|
||||||
|
args, "ss|nn", &mode_name, &rawmode_name, &bits, &interlace
|
||||||
|
)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1724,25 +1724,22 @@ ImagingConvertTransparent(Imaging imIn, const ModeID mode, int r, int g, int b)
|
||||||
return (Imaging)ImagingError_ModeError();
|
return (Imaging)ImagingError_ModeError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imIn->mode == IMAGING_MODE_RGB && (mode == IMAGING_MODE_RGBA || mode == IMAGING_MODE_RGBa)) {
|
if (imIn->mode == IMAGING_MODE_RGB &&
|
||||||
|
(mode == IMAGING_MODE_RGBA || mode == IMAGING_MODE_RGBa)) {
|
||||||
convert = rgb2rgba;
|
convert = rgb2rgba;
|
||||||
if (mode == IMAGING_MODE_RGBa) {
|
if (mode == IMAGING_MODE_RGBa) {
|
||||||
premultiplied = 1;
|
premultiplied = 1;
|
||||||
}
|
}
|
||||||
} else if (imIn->mode == IMAGING_MODE_RGB && (mode == IMAGING_MODE_LA || mode == IMAGING_MODE_La)) {
|
} else if (imIn->mode == IMAGING_MODE_RGB &&
|
||||||
|
(mode == IMAGING_MODE_LA || mode == IMAGING_MODE_La)) {
|
||||||
convert = rgb2la;
|
convert = rgb2la;
|
||||||
source_transparency = 1;
|
source_transparency = 1;
|
||||||
if (mode == IMAGING_MODE_La) {
|
if (mode == IMAGING_MODE_La) {
|
||||||
premultiplied = 1;
|
premultiplied = 1;
|
||||||
}
|
}
|
||||||
} else if ((imIn->mode == IMAGING_MODE_1 ||
|
} else if ((imIn->mode == IMAGING_MODE_1 || imIn->mode == IMAGING_MODE_I ||
|
||||||
imIn->mode == IMAGING_MODE_I ||
|
imIn->mode == IMAGING_MODE_I_16 || imIn->mode == IMAGING_MODE_L) &&
|
||||||
imIn->mode == IMAGING_MODE_I_16 ||
|
(mode == IMAGING_MODE_RGBA || mode == IMAGING_MODE_LA)) {
|
||||||
imIn->mode == IMAGING_MODE_L
|
|
||||||
) && (
|
|
||||||
mode == IMAGING_MODE_RGBA ||
|
|
||||||
mode == IMAGING_MODE_LA
|
|
||||||
)) {
|
|
||||||
if (imIn->mode == IMAGING_MODE_1) {
|
if (imIn->mode == IMAGING_MODE_1) {
|
||||||
convert = bit2rgb;
|
convert = bit2rgb;
|
||||||
} else if (imIn->mode == IMAGING_MODE_I) {
|
} else if (imIn->mode == IMAGING_MODE_I) {
|
||||||
|
|
|
@ -72,10 +72,8 @@ ImagingFillLinearGradient(const ModeID mode) {
|
||||||
Imaging im;
|
Imaging im;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
if (mode != IMAGING_MODE_1 && mode != IMAGING_MODE_F &&
|
if (mode != IMAGING_MODE_1 && mode != IMAGING_MODE_F && mode != IMAGING_MODE_I &&
|
||||||
mode != IMAGING_MODE_I && mode != IMAGING_MODE_L &&
|
mode != IMAGING_MODE_L && mode != IMAGING_MODE_P) {
|
||||||
mode != IMAGING_MODE_P
|
|
||||||
) {
|
|
||||||
return (Imaging)ImagingError_ModeError();
|
return (Imaging)ImagingError_ModeError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,10 +108,8 @@ ImagingFillRadialGradient(const ModeID mode) {
|
||||||
int x, y;
|
int x, y;
|
||||||
int d;
|
int d;
|
||||||
|
|
||||||
if (mode != IMAGING_MODE_1 && mode != IMAGING_MODE_F &&
|
if (mode != IMAGING_MODE_1 && mode != IMAGING_MODE_F && mode != IMAGING_MODE_I &&
|
||||||
mode != IMAGING_MODE_I && mode != IMAGING_MODE_L &&
|
mode != IMAGING_MODE_L && mode != IMAGING_MODE_P) {
|
||||||
mode != IMAGING_MODE_P
|
|
||||||
) {
|
|
||||||
return (Imaging)ImagingError_ModeError();
|
return (Imaging)ImagingError_ModeError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,11 +89,10 @@ ImagingGetBBox(Imaging im, int bbox[4], int alpha_only) {
|
||||||
INT32 mask = 0xffffffff;
|
INT32 mask = 0xffffffff;
|
||||||
if (im->bands == 3) {
|
if (im->bands == 3) {
|
||||||
((UINT8 *)&mask)[3] = 0;
|
((UINT8 *)&mask)[3] = 0;
|
||||||
} else if (alpha_only && (
|
} else if (alpha_only &&
|
||||||
im->mode == IMAGING_MODE_RGBa || im->mode == IMAGING_MODE_RGBA ||
|
(im->mode == IMAGING_MODE_RGBa || im->mode == IMAGING_MODE_RGBA ||
|
||||||
im->mode == IMAGING_MODE_La || im->mode == IMAGING_MODE_LA ||
|
im->mode == IMAGING_MODE_La || im->mode == IMAGING_MODE_LA ||
|
||||||
im->mode == IMAGING_MODE_PA
|
im->mode == IMAGING_MODE_PA)) {
|
||||||
)) {
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
mask = 0x000000ff;
|
mask = 0x000000ff;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -46,11 +46,8 @@ ImagingConvertMatrix(Imaging im, const ModeID mode, float m[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImagingSectionLeave(&cookie);
|
ImagingSectionLeave(&cookie);
|
||||||
} else if (
|
} else if (mode == IMAGING_MODE_HSV || mode == IMAGING_MODE_LAB ||
|
||||||
mode == IMAGING_MODE_HSV ||
|
mode == IMAGING_MODE_RGB) {
|
||||||
mode == IMAGING_MODE_LAB ||
|
|
||||||
mode == IMAGING_MODE_RGB
|
|
||||||
) {
|
|
||||||
imOut = ImagingNewDirty(mode, im->xsize, im->ysize);
|
imOut = ImagingNewDirty(mode, im->xsize, im->ysize);
|
||||||
if (!imOut) {
|
if (!imOut) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -9,36 +9,25 @@
|
||||||
const ModeData MODES[] = {
|
const ModeData MODES[] = {
|
||||||
[IMAGING_MODE_UNKNOWN] = {""},
|
[IMAGING_MODE_UNKNOWN] = {""},
|
||||||
|
|
||||||
[IMAGING_MODE_1] = {"1"},
|
[IMAGING_MODE_1] = {"1"}, [IMAGING_MODE_CMYK] = {"CMYK"},
|
||||||
[IMAGING_MODE_CMYK] = {"CMYK"},
|
[IMAGING_MODE_F] = {"F"}, [IMAGING_MODE_HSV] = {"HSV"},
|
||||||
[IMAGING_MODE_F] = {"F"},
|
[IMAGING_MODE_I] = {"I"}, [IMAGING_MODE_L] = {"L"},
|
||||||
[IMAGING_MODE_HSV] = {"HSV"},
|
[IMAGING_MODE_LA] = {"LA"}, [IMAGING_MODE_LAB] = {"LAB"},
|
||||||
[IMAGING_MODE_I] = {"I"},
|
[IMAGING_MODE_La] = {"La"}, [IMAGING_MODE_P] = {"P"},
|
||||||
[IMAGING_MODE_L] = {"L"},
|
[IMAGING_MODE_PA] = {"PA"}, [IMAGING_MODE_RGB] = {"RGB"},
|
||||||
[IMAGING_MODE_LA] = {"LA"},
|
[IMAGING_MODE_RGBA] = {"RGBA"}, [IMAGING_MODE_RGBX] = {"RGBX"},
|
||||||
[IMAGING_MODE_LAB] = {"LAB"},
|
[IMAGING_MODE_RGBa] = {"RGBa"}, [IMAGING_MODE_YCbCr] = {"YCbCr"},
|
||||||
[IMAGING_MODE_La] = {"La"},
|
|
||||||
[IMAGING_MODE_P] = {"P"},
|
|
||||||
[IMAGING_MODE_PA] = {"PA"},
|
|
||||||
[IMAGING_MODE_RGB] = {"RGB"},
|
|
||||||
[IMAGING_MODE_RGBA] = {"RGBA"},
|
|
||||||
[IMAGING_MODE_RGBX] = {"RGBX"},
|
|
||||||
[IMAGING_MODE_RGBa] = {"RGBa"},
|
|
||||||
[IMAGING_MODE_YCbCr] = {"YCbCr"},
|
|
||||||
|
|
||||||
[IMAGING_MODE_BGR_15] = {"BGR;15"},
|
[IMAGING_MODE_BGR_15] = {"BGR;15"}, [IMAGING_MODE_BGR_16] = {"BGR;16"},
|
||||||
[IMAGING_MODE_BGR_16] = {"BGR;16"},
|
|
||||||
[IMAGING_MODE_BGR_24] = {"BGR;24"},
|
[IMAGING_MODE_BGR_24] = {"BGR;24"},
|
||||||
|
|
||||||
[IMAGING_MODE_I_16] = {"I;16"},
|
[IMAGING_MODE_I_16] = {"I;16"}, [IMAGING_MODE_I_16L] = {"I;16L"},
|
||||||
[IMAGING_MODE_I_16L] = {"I;16L"},
|
[IMAGING_MODE_I_16B] = {"I;16B"}, [IMAGING_MODE_I_16N] = {"I;16N"},
|
||||||
[IMAGING_MODE_I_16B] = {"I;16B"},
|
[IMAGING_MODE_I_32L] = {"I;32L"}, [IMAGING_MODE_I_32B] = {"I;32B"},
|
||||||
[IMAGING_MODE_I_16N] = {"I;16N"},
|
|
||||||
[IMAGING_MODE_I_32L] = {"I;32L"},
|
|
||||||
[IMAGING_MODE_I_32B] = {"I;32B"},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ModeID findModeID(const char * const name) {
|
const ModeID
|
||||||
|
findModeID(const char *const name) {
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
return IMAGING_MODE_UNKNOWN;
|
return IMAGING_MODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -55,14 +44,14 @@ const ModeID findModeID(const char * const name) {
|
||||||
return IMAGING_MODE_UNKNOWN;
|
return IMAGING_MODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ModeData * const getModeData(const ModeID id) {
|
const ModeData *const
|
||||||
|
getModeData(const ModeID id) {
|
||||||
if (id < 0 || id > sizeof(MODES) / sizeof(*MODES)) {
|
if (id < 0 || id > sizeof(MODES) / sizeof(*MODES)) {
|
||||||
return &MODES[IMAGING_MODE_UNKNOWN];
|
return &MODES[IMAGING_MODE_UNKNOWN];
|
||||||
}
|
}
|
||||||
return &MODES[id];
|
return &MODES[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const RawModeData RAWMODES[] = {
|
const RawModeData RAWMODES[] = {
|
||||||
[IMAGING_RAWMODE_UNKNOWN] = {""},
|
[IMAGING_RAWMODE_UNKNOWN] = {""},
|
||||||
|
|
||||||
|
@ -242,7 +231,8 @@ const RawModeData RAWMODES[] = {
|
||||||
[IMAGING_RAWMODE_aRGB] = {"aRGB"},
|
[IMAGING_RAWMODE_aRGB] = {"aRGB"},
|
||||||
};
|
};
|
||||||
|
|
||||||
const RawModeID findRawModeID(const char * const name) {
|
const RawModeID
|
||||||
|
findRawModeID(const char *const name) {
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
return IMAGING_RAWMODE_UNKNOWN;
|
return IMAGING_RAWMODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -259,17 +249,16 @@ const RawModeID findRawModeID(const char * const name) {
|
||||||
return IMAGING_RAWMODE_UNKNOWN;
|
return IMAGING_RAWMODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
const RawModeData * const getRawModeData(const RawModeID id) {
|
const RawModeData *const
|
||||||
|
getRawModeData(const RawModeID id) {
|
||||||
if (id < 0 || id > sizeof(RAWMODES) / sizeof(*RAWMODES)) {
|
if (id < 0 || id > sizeof(RAWMODES) / sizeof(*RAWMODES)) {
|
||||||
return &RAWMODES[IMAGING_RAWMODE_UNKNOWN];
|
return &RAWMODES[IMAGING_RAWMODE_UNKNOWN];
|
||||||
}
|
}
|
||||||
return &RAWMODES[id];
|
return &RAWMODES[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
int isModeI16(const ModeID mode) {
|
isModeI16(const ModeID mode) {
|
||||||
return mode == IMAGING_MODE_I_16
|
return mode == IMAGING_MODE_I_16 || mode == IMAGING_MODE_I_16L ||
|
||||||
|| mode == IMAGING_MODE_I_16L
|
mode == IMAGING_MODE_I_16B || mode == IMAGING_MODE_I_16N;
|
||||||
|| mode == IMAGING_MODE_I_16B
|
|
||||||
|| mode == IMAGING_MODE_I_16N;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef __MODE_H__
|
#ifndef __MODE_H__
|
||||||
#define __MODE_H__
|
#define __MODE_H__
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
IMAGING_MODE_UNKNOWN,
|
IMAGING_MODE_UNKNOWN,
|
||||||
|
|
||||||
|
@ -38,9 +37,10 @@ typedef struct {
|
||||||
const char *const name;
|
const char *const name;
|
||||||
} ModeData;
|
} ModeData;
|
||||||
|
|
||||||
const ModeID findModeID(const char * const name);
|
const ModeID
|
||||||
const ModeData * const getModeData(const ModeID id);
|
findModeID(const char *const name);
|
||||||
|
const ModeData *const
|
||||||
|
getModeData(const ModeID id);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
IMAGING_RAWMODE_UNKNOWN,
|
IMAGING_RAWMODE_UNKNOWN,
|
||||||
|
@ -229,10 +229,12 @@ typedef struct {
|
||||||
const char *const name;
|
const char *const name;
|
||||||
} RawModeData;
|
} RawModeData;
|
||||||
|
|
||||||
const RawModeID findRawModeID(const char * const name);
|
const RawModeID
|
||||||
const RawModeData * const getRawModeData(const RawModeID id);
|
findRawModeID(const char *const name);
|
||||||
|
const RawModeData *const
|
||||||
|
getRawModeData(const RawModeID id);
|
||||||
|
|
||||||
|
int
|
||||||
int isModeI16(const ModeID mode);
|
isModeI16(const ModeID mode);
|
||||||
|
|
||||||
#endif // __MODE_H__
|
#endif // __MODE_H__
|
||||||
|
|
|
@ -653,7 +653,8 @@ static struct {
|
||||||
{IMAGING_MODE_I_16B, IMAGING_RAWMODE_I_16B, 16, copy2},
|
{IMAGING_MODE_I_16B, IMAGING_RAWMODE_I_16B, 16, copy2},
|
||||||
{IMAGING_MODE_I_16L, IMAGING_RAWMODE_I_16L, 16, copy2},
|
{IMAGING_MODE_I_16L, IMAGING_RAWMODE_I_16L, 16, copy2},
|
||||||
{IMAGING_MODE_I_16N, IMAGING_RAWMODE_I_16N, 16, copy2},
|
{IMAGING_MODE_I_16N, IMAGING_RAWMODE_I_16N, 16, copy2},
|
||||||
{IMAGING_MODE_I_16, IMAGING_RAWMODE_I_16N, 16, packI16N_I16}, // LibTiff native->image endian.
|
{IMAGING_MODE_I_16, IMAGING_RAWMODE_I_16N, 16, packI16N_I16
|
||||||
|
}, // LibTiff native->image endian.
|
||||||
{IMAGING_MODE_I_16L, IMAGING_RAWMODE_I_16N, 16, packI16N_I16},
|
{IMAGING_MODE_I_16L, IMAGING_RAWMODE_I_16N, 16, packI16N_I16},
|
||||||
{IMAGING_MODE_I_16B, IMAGING_RAWMODE_I_16N, 16, packI16N_I16B},
|
{IMAGING_MODE_I_16B, IMAGING_RAWMODE_I_16N, 16, packI16N_I16B},
|
||||||
{IMAGING_MODE_BGR_15, IMAGING_RAWMODE_BGR_15, 16, copy2},
|
{IMAGING_MODE_BGR_15, IMAGING_RAWMODE_BGR_15, 16, copy2},
|
||||||
|
|
|
@ -450,10 +450,9 @@ fill_mask_L(
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
int alpha_channel = imOut->mode == IMAGING_MODE_RGBa ||
|
int alpha_channel =
|
||||||
imOut->mode == IMAGING_MODE_RGBA ||
|
imOut->mode == IMAGING_MODE_RGBa || imOut->mode == IMAGING_MODE_RGBA ||
|
||||||
imOut->mode == IMAGING_MODE_La ||
|
imOut->mode == IMAGING_MODE_La || imOut->mode == IMAGING_MODE_LA ||
|
||||||
imOut->mode == IMAGING_MODE_LA ||
|
|
||||||
imOut->mode == IMAGING_MODE_PA;
|
imOut->mode == IMAGING_MODE_PA;
|
||||||
for (y = 0; y < ysize; y++) {
|
for (y = 0; y < ysize; y++) {
|
||||||
UINT8 *out = (UINT8 *)imOut->image[y + dy] + dx * pixelsize;
|
UINT8 *out = (UINT8 *)imOut->image[y + dy] + dx * pixelsize;
|
||||||
|
|
|
@ -209,8 +209,8 @@ ImagingPointTransform(Imaging imIn, double scale, double offset) {
|
||||||
Imaging imOut;
|
Imaging imOut;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (!imIn || (imIn->mode != IMAGING_MODE_I &&
|
if (!imIn || (imIn->mode != IMAGING_MODE_I && imIn->mode != IMAGING_MODE_I_16 &&
|
||||||
imIn->mode != IMAGING_MODE_I_16 && imIn->mode != IMAGING_MODE_F)) {
|
imIn->mode != IMAGING_MODE_F)) {
|
||||||
return (Imaging)ImagingError_ModeError();
|
return (Imaging)ImagingError_ModeError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,10 +246,26 @@ _pickUnpackers(
|
||||||
// We'll pick appropriate set of unpackers depending on planar_configuration
|
// We'll pick appropriate set of unpackers depending on planar_configuration
|
||||||
// It does not matter if data is RGB(A), CMYK or LUV really,
|
// It does not matter if data is RGB(A), CMYK or LUV really,
|
||||||
// we just copy it plane by plane
|
// we just copy it plane by plane
|
||||||
unpackers[0] = ImagingFindUnpacker(IMAGING_MODE_RGBA, bits_per_sample == 16 ? IMAGING_RAWMODE_R_16N : IMAGING_RAWMODE_R, NULL);
|
unpackers[0] = ImagingFindUnpacker(
|
||||||
unpackers[1] = ImagingFindUnpacker(IMAGING_MODE_RGBA, bits_per_sample == 16 ? IMAGING_RAWMODE_G_16N : IMAGING_RAWMODE_G, NULL);
|
IMAGING_MODE_RGBA,
|
||||||
unpackers[2] = ImagingFindUnpacker(IMAGING_MODE_RGBA, bits_per_sample == 16 ? IMAGING_RAWMODE_B_16N : IMAGING_RAWMODE_B, NULL);
|
bits_per_sample == 16 ? IMAGING_RAWMODE_R_16N : IMAGING_RAWMODE_R,
|
||||||
unpackers[3] = ImagingFindUnpacker(IMAGING_MODE_RGBA, bits_per_sample == 16 ? IMAGING_RAWMODE_A_16N : IMAGING_RAWMODE_A, NULL);
|
NULL
|
||||||
|
);
|
||||||
|
unpackers[1] = ImagingFindUnpacker(
|
||||||
|
IMAGING_MODE_RGBA,
|
||||||
|
bits_per_sample == 16 ? IMAGING_RAWMODE_G_16N : IMAGING_RAWMODE_G,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
unpackers[2] = ImagingFindUnpacker(
|
||||||
|
IMAGING_MODE_RGBA,
|
||||||
|
bits_per_sample == 16 ? IMAGING_RAWMODE_B_16N : IMAGING_RAWMODE_B,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
unpackers[3] = ImagingFindUnpacker(
|
||||||
|
IMAGING_MODE_RGBA,
|
||||||
|
bits_per_sample == 16 ? IMAGING_RAWMODE_A_16N : IMAGING_RAWMODE_A,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
return im->bands;
|
return im->bands;
|
||||||
} else {
|
} else {
|
||||||
|
@ -761,7 +777,9 @@ ImagingLibTiffDecode(
|
||||||
|
|
||||||
if (extrasamples >= 1 && (sampleinfo[0] == EXTRASAMPLE_UNSPECIFIED ||
|
if (extrasamples >= 1 && (sampleinfo[0] == EXTRASAMPLE_UNSPECIFIED ||
|
||||||
sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA)) {
|
sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA)) {
|
||||||
shuffle = ImagingFindUnpacker(IMAGING_MODE_RGBA, IMAGING_RAWMODE_RGBa, NULL);
|
shuffle = ImagingFindUnpacker(
|
||||||
|
IMAGING_MODE_RGBA, IMAGING_RAWMODE_RGBa, NULL
|
||||||
|
);
|
||||||
|
|
||||||
for (y = state->yoff; y < state->ysize; y++) {
|
for (y = state->yoff; y < state->ysize; y++) {
|
||||||
UINT8 *ptr = (UINT8 *)im->image[y + state->yoff] +
|
UINT8 *ptr = (UINT8 *)im->image[y + state->yoff] +
|
||||||
|
|
|
@ -1840,13 +1840,16 @@ static struct {
|
||||||
{IMAGING_MODE_I_16N, IMAGING_RAWMODE_I_16N, 16, copy2},
|
{IMAGING_MODE_I_16N, IMAGING_RAWMODE_I_16N, 16, copy2},
|
||||||
|
|
||||||
{IMAGING_MODE_I_16, IMAGING_RAWMODE_I_16B, 16, unpackI16B_I16},
|
{IMAGING_MODE_I_16, IMAGING_RAWMODE_I_16B, 16, unpackI16B_I16},
|
||||||
{IMAGING_MODE_I_16, IMAGING_RAWMODE_I_16N, 16, unpackI16N_I16}, // LibTiff native->image endian.
|
{IMAGING_MODE_I_16, IMAGING_RAWMODE_I_16N, 16, unpackI16N_I16
|
||||||
{IMAGING_MODE_I_16L, IMAGING_RAWMODE_I_16N, 16, unpackI16N_I16}, // LibTiff native->image endian.
|
}, // LibTiff native->image endian.
|
||||||
|
{IMAGING_MODE_I_16L, IMAGING_RAWMODE_I_16N, 16, unpackI16N_I16
|
||||||
|
}, // LibTiff native->image endian.
|
||||||
{IMAGING_MODE_I_16B, IMAGING_RAWMODE_I_16N, 16, unpackI16N_I16B},
|
{IMAGING_MODE_I_16B, IMAGING_RAWMODE_I_16N, 16, unpackI16N_I16B},
|
||||||
|
|
||||||
{IMAGING_MODE_I_16, IMAGING_RAWMODE_I_16R, 16, unpackI16R_I16},
|
{IMAGING_MODE_I_16, IMAGING_RAWMODE_I_16R, 16, unpackI16R_I16},
|
||||||
|
|
||||||
{IMAGING_MODE_I_16, IMAGING_RAWMODE_I_12, 12, unpackI12_I16} // 12 bit Tiffs stored in 16bits.
|
{IMAGING_MODE_I_16, IMAGING_RAWMODE_I_12, 12, unpackI12_I16
|
||||||
|
} // 12 bit Tiffs stored in 16bits.
|
||||||
};
|
};
|
||||||
|
|
||||||
ImagingShuffler
|
ImagingShuffler
|
||||||
|
|
Loading…
Reference in New Issue
Block a user