mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-23 19:44:13 +03:00
Trim trailing whitespace src dir
This commit is contained in:
parent
c255948860
commit
22a59ac839
|
@ -42,7 +42,7 @@ class DcxImageFile(PcxImageFile):
|
||||||
format = "DCX"
|
format = "DCX"
|
||||||
format_description = "Intel DCX"
|
format_description = "Intel DCX"
|
||||||
_close_exclusive_fp_after_loading = False
|
_close_exclusive_fp_after_loading = False
|
||||||
|
|
||||||
def _open(self):
|
def _open(self):
|
||||||
|
|
||||||
# Header
|
# Header
|
||||||
|
|
|
@ -2102,7 +2102,7 @@ class Image(object):
|
||||||
in the output image.
|
in the output image.
|
||||||
:returns: An :py:class:`~PIL.Image.Image` object.
|
:returns: An :py:class:`~PIL.Image.Image` object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.mode == 'LA':
|
if self.mode == 'LA':
|
||||||
return self.convert('La').transform(
|
return self.convert('La').transform(
|
||||||
size, method, data, resample, fill).convert('LA')
|
size, method, data, resample, fill).convert('LA')
|
||||||
|
|
|
@ -278,7 +278,7 @@ class BitmapImage(object):
|
||||||
|
|
||||||
def getimage(photo):
|
def getimage(photo):
|
||||||
""" This function is unimplemented """
|
""" This function is unimplemented """
|
||||||
|
|
||||||
"""Copies the contents of a PhotoImage to a PIL image memory."""
|
"""Copies the contents of a PhotoImage to a PIL image memory."""
|
||||||
photo.tk.call("PyImagingPhotoGet", photo)
|
photo.tk.call("PyImagingPhotoGet", photo)
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class MpoImageFile(JpegImagePlugin.JpegImageFile):
|
||||||
format = "MPO"
|
format = "MPO"
|
||||||
format_description = "MPO (CIPA DC-007)"
|
format_description = "MPO (CIPA DC-007)"
|
||||||
_close_exclusive_fp_after_loading = False
|
_close_exclusive_fp_after_loading = False
|
||||||
|
|
||||||
def _open(self):
|
def _open(self):
|
||||||
self.fp.seek(0) # prep the fp in order to pass the JPEG test
|
self.fp.seek(0) # prep the fp in order to pass the JPEG test
|
||||||
JpegImagePlugin.JpegImageFile._open(self)
|
JpegImagePlugin.JpegImageFile._open(self)
|
||||||
|
|
|
@ -750,7 +750,7 @@ def _save(im, fp, filename, chunk=putchunk):
|
||||||
name = b"ICC Profile"
|
name = b"ICC Profile"
|
||||||
data = name + b"\0\0" + zlib.compress(icc)
|
data = name + b"\0\0" + zlib.compress(icc)
|
||||||
chunk(fp, b"iCCP", data)
|
chunk(fp, b"iCCP", data)
|
||||||
|
|
||||||
# You must either have sRGB or iCCP.
|
# You must either have sRGB or iCCP.
|
||||||
# Disallow sRGB chunks when an iCCP-chunk has been emitted.
|
# Disallow sRGB chunks when an iCCP-chunk has been emitted.
|
||||||
chunks.remove(b"sRGB")
|
chunks.remove(b"sRGB")
|
||||||
|
|
|
@ -143,7 +143,7 @@ TAGS_V2 = {
|
||||||
342: ("TransferRange", SHORT, 6),
|
342: ("TransferRange", SHORT, 6),
|
||||||
|
|
||||||
347: ("JPEGTables", UNDEFINED, 1),
|
347: ("JPEGTables", UNDEFINED, 1),
|
||||||
|
|
||||||
# obsolete JPEG tags
|
# obsolete JPEG tags
|
||||||
512: ("JPEGProc", SHORT, 1),
|
512: ("JPEGProc", SHORT, 1),
|
||||||
513: ("JPEGInterchangeFormat", LONG, 1),
|
513: ("JPEGInterchangeFormat", LONG, 1),
|
||||||
|
@ -161,7 +161,7 @@ TAGS_V2 = {
|
||||||
532: ("ReferenceBlackWhite", LONG, 0),
|
532: ("ReferenceBlackWhite", LONG, 0),
|
||||||
|
|
||||||
700: ('XMP', BYTE, 1),
|
700: ('XMP', BYTE, 1),
|
||||||
|
|
||||||
33432: ("Copyright", ASCII, 1),
|
33432: ("Copyright", ASCII, 1),
|
||||||
34377: ('PhotoshopInfo', BYTE, 1),
|
34377: ('PhotoshopInfo', BYTE, 1),
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ TAGS_V2 = {
|
||||||
|
|
||||||
50741: ("MakerNoteSafety", SHORT, 1, {"Unsafe": 0, "Safe": 1}),
|
50741: ("MakerNoteSafety", SHORT, 1, {"Unsafe": 0, "Safe": 1}),
|
||||||
50780: ("BestQualityScale", RATIONAL, 1),
|
50780: ("BestQualityScale", RATIONAL, 1),
|
||||||
50838: ("ImageJMetaDataByteCounts", LONG, 0), # Can be more than one
|
50838: ("ImageJMetaDataByteCounts", LONG, 0), # Can be more than one
|
||||||
50839: ("ImageJMetaData", UNDEFINED, 1) # see Issue #2006
|
50839: ("ImageJMetaData", UNDEFINED, 1) # see Issue #2006
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1499,11 +1499,11 @@ _resize(ImagingObject* self, PyObject* args)
|
||||||
int xsize, ysize;
|
int xsize, ysize;
|
||||||
int filter = IMAGING_TRANSFORM_NEAREST;
|
int filter = IMAGING_TRANSFORM_NEAREST;
|
||||||
float box[4] = {0, 0, 0, 0};
|
float box[4] = {0, 0, 0, 0};
|
||||||
|
|
||||||
imIn = self->image;
|
imIn = self->image;
|
||||||
box[2] = imIn->xsize;
|
box[2] = imIn->xsize;
|
||||||
box[3] = imIn->ysize;
|
box[3] = imIn->ysize;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "(ii)|i(ffff)", &xsize, &ysize, &filter,
|
if (!PyArg_ParseTuple(args, "(ii)|i(ffff)", &xsize, &ysize, &filter,
|
||||||
&box[0], &box[1], &box[2], &box[3]))
|
&box[0], &box[1], &box[2], &box[3]))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -3325,7 +3325,7 @@ _reset_stats(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, ":reset_stats"))
|
if (!PyArg_ParseTuple(args, ":reset_stats"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
arena->stats_new_count = 0;
|
arena->stats_new_count = 0;
|
||||||
arena->stats_allocated_blocks = 0;
|
arena->stats_allocated_blocks = 0;
|
||||||
arena->stats_reused_blocks = 0;
|
arena->stats_reused_blocks = 0;
|
||||||
|
@ -3341,7 +3341,7 @@ _get_alignment(PyObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
if (!PyArg_ParseTuple(args, ":get_alignment"))
|
if (!PyArg_ParseTuple(args, ":get_alignment"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return PyInt_FromLong(ImagingDefaultArena.alignment);
|
return PyInt_FromLong(ImagingDefaultArena.alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3350,7 +3350,7 @@ _get_block_size(PyObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
if (!PyArg_ParseTuple(args, ":get_block_size"))
|
if (!PyArg_ParseTuple(args, ":get_block_size"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return PyInt_FromLong(ImagingDefaultArena.block_size);
|
return PyInt_FromLong(ImagingDefaultArena.block_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3359,7 +3359,7 @@ _get_blocks_max(PyObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
if (!PyArg_ParseTuple(args, ":get_blocks_max"))
|
if (!PyArg_ParseTuple(args, ":get_blocks_max"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return PyInt_FromLong(ImagingDefaultArena.blocks_max);
|
return PyInt_FromLong(ImagingDefaultArena.blocks_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3369,7 +3369,7 @@ _set_alignment(PyObject* self, PyObject* args)
|
||||||
int alignment;
|
int alignment;
|
||||||
if (!PyArg_ParseTuple(args, "i:set_alignment", &alignment))
|
if (!PyArg_ParseTuple(args, "i:set_alignment", &alignment))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (alignment < 1 || alignment > 128) {
|
if (alignment < 1 || alignment > 128) {
|
||||||
PyErr_SetString(PyExc_ValueError, "alignment should be from 1 to 128");
|
PyErr_SetString(PyExc_ValueError, "alignment should be from 1 to 128");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -3392,7 +3392,7 @@ _set_block_size(PyObject* self, PyObject* args)
|
||||||
int block_size;
|
int block_size;
|
||||||
if (!PyArg_ParseTuple(args, "i:set_block_size", &block_size))
|
if (!PyArg_ParseTuple(args, "i:set_block_size", &block_size))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (block_size <= 0) {
|
if (block_size <= 0) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"block_size should be greater than 0");
|
"block_size should be greater than 0");
|
||||||
|
@ -3417,7 +3417,7 @@ _set_blocks_max(PyObject* self, PyObject* args)
|
||||||
int blocks_max;
|
int blocks_max;
|
||||||
if (!PyArg_ParseTuple(args, "i:set_blocks_max", &blocks_max))
|
if (!PyArg_ParseTuple(args, "i:set_blocks_max", &blocks_max))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (blocks_max < 0) {
|
if (blocks_max < 0) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"blocks_max should be greater than 0");
|
"blocks_max should be greater than 0");
|
||||||
|
@ -3440,7 +3440,7 @@ _clear_cache(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|i:clear_cache", &i))
|
if (!PyArg_ParseTuple(args, "|i:clear_cache", &i))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ImagingMemoryClearCache(&ImagingDefaultArena, i);
|
ImagingMemoryClearCache(&ImagingDefaultArena, i);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
|
|
@ -108,7 +108,7 @@ typedef struct {
|
||||||
t_raqm_set_par_direction set_par_direction;
|
t_raqm_set_par_direction set_par_direction;
|
||||||
t_raqm_add_font_feature add_font_feature;
|
t_raqm_add_font_feature add_font_feature;
|
||||||
t_raqm_set_freetype_face set_freetype_face;
|
t_raqm_set_freetype_face set_freetype_face;
|
||||||
t_raqm_layout layout;
|
t_raqm_layout layout;
|
||||||
t_raqm_get_glyphs get_glyphs;
|
t_raqm_get_glyphs get_glyphs;
|
||||||
t_raqm_get_glyphs_01 get_glyphs_01;
|
t_raqm_get_glyphs_01 get_glyphs_01;
|
||||||
t_raqm_destroy destroy;
|
t_raqm_destroy destroy;
|
||||||
|
@ -247,7 +247,7 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "eti|is"PY_ARG_BYTES_LENGTH"i",
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "eti|is"PY_ARG_BYTES_LENGTH"i",
|
||||||
kwlist,
|
kwlist,
|
||||||
Py_FileSystemDefaultEncoding, &filename,
|
Py_FileSystemDefaultEncoding, &filename,
|
||||||
&size, &index, &encoding, &font_bytes,
|
&size, &index, &encoding, &font_bytes,
|
||||||
|
@ -458,7 +458,7 @@ text_layout_raqm(PyObject* string, FontObject* self, const char* dir,
|
||||||
count = 0;
|
count = 0;
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
} else { /* version == 2 */
|
} else { /* version == 2 */
|
||||||
glyphs = (*p_raqm.get_glyphs)(rq, &count);
|
glyphs = (*p_raqm.get_glyphs)(rq, &count);
|
||||||
if (glyphs == NULL) {
|
if (glyphs == NULL) {
|
||||||
PyErr_SetString(PyExc_ValueError, "raqm_get_glyphs() failed.");
|
PyErr_SetString(PyExc_ValueError, "raqm_get_glyphs() failed.");
|
||||||
|
@ -654,7 +654,7 @@ font_getsize(FontObject* self, PyObject* args)
|
||||||
PyMem_Free(glyph_info);
|
PyMem_Free(glyph_info);
|
||||||
glyph_info = NULL;
|
glyph_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (face) {
|
if (face) {
|
||||||
|
|
||||||
/* left bearing */
|
/* left bearing */
|
||||||
|
|
|
@ -226,7 +226,7 @@ normalize_coeffs_8bpc(int outSize, int ksize, double *prekk)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ImagingResampleHorizontal_8bpc(Imaging imOut, Imaging imIn, int offset,
|
ImagingResampleHorizontal_8bpc(Imaging imOut, Imaging imIn, int offset,
|
||||||
int ksize, int *bounds, double *prekk)
|
int ksize, int *bounds, double *prekk)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@ static void read4B(UINT32* dest, UINT8* buf)
|
||||||
static int expandrow(UINT8* dest, UINT8* src, int n, int z)
|
static int expandrow(UINT8* dest, UINT8* src, int n, int z)
|
||||||
{
|
{
|
||||||
UINT8 pixel, count;
|
UINT8 pixel, count;
|
||||||
|
|
||||||
for (;n > 0; n--)
|
for (;n > 0; n--)
|
||||||
{
|
{
|
||||||
pixel = *src++;
|
pixel = *src++;
|
||||||
|
@ -42,7 +42,7 @@ static int expandrow(UINT8* dest, UINT8* src, int n, int z)
|
||||||
*dest = *src++;
|
*dest = *src++;
|
||||||
dest += z;
|
dest += z;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pixel = *src++;
|
pixel = *src++;
|
||||||
|
@ -51,7 +51,7 @@ static int expandrow(UINT8* dest, UINT8* src, int n, int z)
|
||||||
dest += z;
|
dest += z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ static int expandrow2(UINT16* dest, UINT16* src, int n, int z)
|
||||||
{
|
{
|
||||||
UINT8 pixel, count;
|
UINT8 pixel, count;
|
||||||
|
|
||||||
|
|
||||||
for (;n > 0; n--)
|
for (;n > 0; n--)
|
||||||
{
|
{
|
||||||
pixel = ((UINT8*)src)[1];
|
pixel = ((UINT8*)src)[1];
|
||||||
|
@ -96,7 +96,7 @@ ImagingSgiRleDecode(Imaging im, ImagingCodecState state,
|
||||||
SGISTATE *c;
|
SGISTATE *c;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
/* Get all data from File descriptor */
|
/* Get all data from File descriptor */
|
||||||
c = (SGISTATE*)state->context;
|
c = (SGISTATE*)state->context;
|
||||||
_imaging_seek_pyFd(state->fd, 0L, SEEK_END);
|
_imaging_seek_pyFd(state->fd, 0L, SEEK_END);
|
||||||
c->bufsize = _imaging_tell_pyFd(state->fd);
|
c->bufsize = _imaging_tell_pyFd(state->fd);
|
||||||
|
@ -155,7 +155,7 @@ ImagingSgiRleDecode(Imaging im, ImagingCodecState state,
|
||||||
c->rleoffset = c->starttab[c->rowno + c->channo * im->ysize];
|
c->rleoffset = c->starttab[c->rowno + c->channo * im->ysize];
|
||||||
c->rlelength = c->lengthtab[c->rowno + c->channo * im->ysize];
|
c->rlelength = c->lengthtab[c->rowno + c->channo * im->ysize];
|
||||||
c->rleoffset -= SGI_HEADER_SIZE;
|
c->rleoffset -= SGI_HEADER_SIZE;
|
||||||
|
|
||||||
/* row decompression */
|
/* row decompression */
|
||||||
if (c->bpc ==1) {
|
if (c->bpc ==1) {
|
||||||
if(expandrow(&state->buffer[c->channo], &ptr[c->rleoffset], c->rlelength, im->bands))
|
if(expandrow(&state->buffer[c->channo], &ptr[c->rleoffset], c->rlelength, im->bands))
|
||||||
|
@ -165,19 +165,19 @@ ImagingSgiRleDecode(Imaging im, ImagingCodecState state,
|
||||||
if(expandrow2((UINT16*)&state->buffer[c->channo * 2], (UINT16*)&ptr[c->rleoffset], c->rlelength, im->bands))
|
if(expandrow2((UINT16*)&state->buffer[c->channo * 2], (UINT16*)&ptr[c->rleoffset], c->rlelength, im->bands))
|
||||||
goto sgi_finish_decode;
|
goto sgi_finish_decode;
|
||||||
}
|
}
|
||||||
|
|
||||||
state->count += c->rlelength;
|
state->count += c->rlelength;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* store decompressed data in image */
|
/* store decompressed data in image */
|
||||||
state->shuffle((UINT8*)im->image[state->y], state->buffer, im->xsize);
|
state->shuffle((UINT8*)im->image[state->y], state->buffer, im->xsize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c->bufsize++;
|
c->bufsize++;
|
||||||
|
|
||||||
sgi_finish_decode: ;
|
sgi_finish_decode: ;
|
||||||
|
|
||||||
free(c->starttab);
|
free(c->starttab);
|
||||||
free(c->lengthtab);
|
free(c->lengthtab);
|
||||||
free(ptr);
|
free(ptr);
|
||||||
|
|
|
@ -188,7 +188,7 @@ unpack1IR(UINT8* out, const UINT8* in, int pixels)
|
||||||
static void
|
static void
|
||||||
unpack18(UINT8* out, const UINT8* in, int pixels)
|
unpack18(UINT8* out, const UINT8* in, int pixels)
|
||||||
{
|
{
|
||||||
/* Unpack a '|b1' image, which is a numpy boolean.
|
/* Unpack a '|b1' image, which is a numpy boolean.
|
||||||
1 == true, 0==false, in bytes */
|
1 == true, 0==false, in bytes */
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@ -1334,7 +1334,7 @@ static struct {
|
||||||
{"RGBA", "RGBA;16N", 64, unpackRGBA16L},
|
{"RGBA", "RGBA;16N", 64, unpackRGBA16L},
|
||||||
{"RGBX", "RGBX;16N", 64, unpackRGBA16B},
|
{"RGBX", "RGBX;16N", 64, unpackRGBA16B},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* true colour w. alpha premultiplied */
|
/* true colour w. alpha premultiplied */
|
||||||
{"RGBa", "RGBa", 32, copy4},
|
{"RGBa", "RGBa", 32, copy4},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user