mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-03 19:45:56 +03:00
Merge branch 'master' into fli
This commit is contained in:
commit
680a7ac43b
|
@ -59,7 +59,7 @@ class FliImageFile(ImageFile.ImageFile):
|
||||||
# animation speed
|
# animation speed
|
||||||
duration = i32(s[16:20])
|
duration = i32(s[16:20])
|
||||||
if magic == 0xAF11:
|
if magic == 0xAF11:
|
||||||
duration = (duration * 1000) / 70
|
duration = (duration * 1000) // 70
|
||||||
self.info["duration"] = duration
|
self.info["duration"] = duration
|
||||||
|
|
||||||
# look for palette
|
# look for palette
|
||||||
|
@ -156,6 +156,7 @@ class FliImageFile(ImageFile.ImageFile):
|
||||||
def tell(self):
|
def tell(self):
|
||||||
return self.__frame
|
return self.__frame
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# registry
|
# registry
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,9 @@ try:
|
||||||
from . import _imaging as core
|
from . import _imaging as core
|
||||||
if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
|
if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
|
||||||
raise ImportError("The _imaging extension was built for another "
|
raise ImportError("The _imaging extension was built for another "
|
||||||
"version of Pillow or PIL: Core Version: %s"
|
"version of Pillow or PIL:\n"
|
||||||
"Pillow Version: %s" %
|
"Core version: %s\n"
|
||||||
|
"Pillow version: %s" %
|
||||||
(getattr(core, 'PILLOW_VERSION', None),
|
(getattr(core, 'PILLOW_VERSION', None),
|
||||||
PILLOW_VERSION))
|
PILLOW_VERSION))
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ class _imagingft_not_installed(object):
|
||||||
def __getattr__(self, id):
|
def __getattr__(self, id):
|
||||||
raise ImportError("The _imagingft C module is not installed")
|
raise ImportError("The _imagingft C module is not installed")
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from . import _imagingft as core
|
from . import _imagingft as core
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -113,7 +114,6 @@ class ImageFont(object):
|
||||||
return self.font.getmask(text, mode)
|
return self.font.getmask(text, mode)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Wrapper for FreeType fonts. Application code should use the
|
# Wrapper for FreeType fonts. Application code should use the
|
||||||
# <b>truetype</b> factory function to create font objects.
|
# <b>truetype</b> factory function to create font objects.
|
||||||
|
@ -162,7 +162,7 @@ class FreeTypeFont(object):
|
||||||
def getmask(self, text, mode="", direction=None, features=None):
|
def getmask(self, text, mode="", direction=None, features=None):
|
||||||
return self.getmask2(text, mode, direction=direction, features=features)[0]
|
return self.getmask2(text, mode, direction=direction, features=features)[0]
|
||||||
|
|
||||||
def getmask2(self, text, mode="", fill=Image.core.fill, direction=None, features=None):
|
def getmask2(self, text, mode="", fill=Image.core.fill, direction=None, features=None, *args, **kwargs):
|
||||||
size, offset = self.font.getsize(text, direction, features)
|
size, offset = self.font.getsize(text, direction, features)
|
||||||
im = fill("L", size, 0)
|
im = fill("L", size, 0)
|
||||||
self.font.render(text, im.id, mode == "1", direction, features)
|
self.font.render(text, im.id, mode == "1", direction, features)
|
||||||
|
@ -250,7 +250,7 @@ def truetype(font=None, size=10, index=0, encoding="",
|
||||||
and "armn" (Apple Roman). See the FreeType documentation
|
and "armn" (Apple Roman). See the FreeType documentation
|
||||||
for more information.
|
for more information.
|
||||||
:param layout_engine: Which layout engine to use, if available:
|
:param layout_engine: Which layout engine to use, if available:
|
||||||
`ImageFont.LAYOUT_BASIC` or `ImageFont.LAYOUT_RAQM`.
|
`ImageFont.LAYOUT_BASIC` or `ImageFont.LAYOUT_RAQM`.
|
||||||
:return: A font object.
|
:return: A font object.
|
||||||
:exception IOError: If the file could not be read.
|
:exception IOError: If the file could not be read.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -104,6 +104,11 @@ def _save(im, fp, filename):
|
||||||
z = len(im.mode)
|
z = len(im.mode)
|
||||||
if dim == 1 or dim == 2:
|
if dim == 1 or dim == 2:
|
||||||
z = 1
|
z = 1
|
||||||
|
# assert we've got the right number of bands.
|
||||||
|
if len(im.getbands()) != z:
|
||||||
|
raise ValueError("incorrect number of bands in SGI write: %s vs %s" %
|
||||||
|
(z, len(im.getbands())))
|
||||||
|
|
||||||
# Minimum Byte value
|
# Minimum Byte value
|
||||||
pinmin = 0
|
pinmin = 0
|
||||||
# Maximum Byte value (255 = 8bits per pixel)
|
# Maximum Byte value (255 = 8bits per pixel)
|
||||||
|
@ -131,11 +136,6 @@ def _save(im, fp, filename):
|
||||||
|
|
||||||
fp.write(struct.pack('404s', b'')) # dummy
|
fp.write(struct.pack('404s', b'')) # dummy
|
||||||
|
|
||||||
# assert we've got the right number of bands.
|
|
||||||
if len(im.getbands()) != z:
|
|
||||||
raise ValueError("incorrect number of bands in SGI write: %s vs %s" %
|
|
||||||
(z, len(im.getbands())))
|
|
||||||
|
|
||||||
for channel in im.split():
|
for channel in im.split():
|
||||||
fp.write(channel.tobytes())
|
fp.write(channel.tobytes())
|
||||||
|
|
||||||
|
|
BIN
Tests/images/a.fli
Normal file
BIN
Tests/images/a.fli
Normal file
Binary file not shown.
BIN
Tests/images/hopper_emboss.bmp
Normal file
BIN
Tests/images/hopper_emboss.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
Tests/images/hopper_emboss_more.bmp
Normal file
BIN
Tests/images/hopper_emboss_more.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
|
@ -4,17 +4,28 @@ from PIL import Image, FliImagePlugin
|
||||||
|
|
||||||
# created as an export of a palette image from Gimp2.6
|
# created as an export of a palette image from Gimp2.6
|
||||||
# save as...-> hopper.fli, default options.
|
# save as...-> hopper.fli, default options.
|
||||||
test_file = "Tests/images/hopper.fli"
|
static_test_file = "Tests/images/hopper.fli"
|
||||||
|
|
||||||
|
# From https://samples.libav.org/fli-flc/
|
||||||
|
animated_test_file = "Tests/images/a.fli"
|
||||||
|
|
||||||
|
|
||||||
class TestFileFli(PillowTestCase):
|
class TestFileFli(PillowTestCase):
|
||||||
|
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
im = Image.open(test_file)
|
im = Image.open(static_test_file)
|
||||||
im.load()
|
im.load()
|
||||||
self.assertEqual(im.mode, "P")
|
self.assertEqual(im.mode, "P")
|
||||||
self.assertEqual(im.size, (128, 128))
|
self.assertEqual(im.size, (128, 128))
|
||||||
self.assertEqual(im.format, "FLI")
|
self.assertEqual(im.format, "FLI")
|
||||||
|
self.assertFalse(im.is_animated)
|
||||||
|
|
||||||
|
im = Image.open(animated_test_file)
|
||||||
|
self.assertEqual(im.mode, "P")
|
||||||
|
self.assertEqual(im.size, (320, 200))
|
||||||
|
self.assertEqual(im.format, "FLI")
|
||||||
|
self.assertEqual(im.info["duration"], 71)
|
||||||
|
self.assertTrue(im.is_animated)
|
||||||
|
|
||||||
def test_tell(self):
|
def test_tell(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
@ -33,12 +44,16 @@ class TestFileFli(PillowTestCase):
|
||||||
lambda: FliImagePlugin.FliImageFile(invalid_file))
|
lambda: FliImagePlugin.FliImageFile(invalid_file))
|
||||||
|
|
||||||
def test_n_frames(self):
|
def test_n_frames(self):
|
||||||
im = Image.open(test_file)
|
im = Image.open(static_test_file)
|
||||||
self.assertEqual(im.n_frames, 1)
|
self.assertEqual(im.n_frames, 1)
|
||||||
self.assertFalse(im.is_animated)
|
self.assertFalse(im.is_animated)
|
||||||
|
|
||||||
|
im = Image.open(animated_test_file)
|
||||||
|
self.assertEqual(im.n_frames, 385)
|
||||||
|
self.assertTrue(im.is_animated)
|
||||||
|
|
||||||
def test_eoferror(self):
|
def test_eoferror(self):
|
||||||
im = Image.open(test_file)
|
im = Image.open(animated_test_file)
|
||||||
|
|
||||||
n_frames = im.n_frames
|
n_frames = im.n_frames
|
||||||
while True:
|
while True:
|
||||||
|
@ -58,6 +73,24 @@ class TestFileFli(PillowTestCase):
|
||||||
# Test seek past end of file
|
# Test seek past end of file
|
||||||
self.assertRaises(EOFError, lambda: im.seek(2))
|
self.assertRaises(EOFError, lambda: im.seek(2))
|
||||||
|
|
||||||
|
def test_seek_tell(self):
|
||||||
|
im = Image.open(animated_test_file)
|
||||||
|
|
||||||
|
layer_number = im.tell()
|
||||||
|
self.assertEqual(layer_number, 0)
|
||||||
|
|
||||||
|
im.seek(0)
|
||||||
|
layer_number = im.tell()
|
||||||
|
self.assertEqual(layer_number, 0)
|
||||||
|
|
||||||
|
im.seek(1)
|
||||||
|
layer_number = im.tell()
|
||||||
|
self.assertEqual(layer_number, 1)
|
||||||
|
|
||||||
|
im.seek(2)
|
||||||
|
layer_number = im.tell()
|
||||||
|
self.assertEqual(layer_number, 2)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -94,6 +94,28 @@ class TestImageFilter(PillowTestCase):
|
||||||
self.assertEqual(rankfilter.size, 1)
|
self.assertEqual(rankfilter.size, 1)
|
||||||
self.assertEqual(rankfilter.rank, 2)
|
self.assertEqual(rankfilter.rank, 2)
|
||||||
|
|
||||||
|
def test_consistency_3x3(self):
|
||||||
|
im = Image.open("Tests/images/hopper.bmp")
|
||||||
|
emboss = im.filter(ImageFilter.Kernel((3, 3),
|
||||||
|
(-1, -1, 0,
|
||||||
|
-1, 0, 1,
|
||||||
|
0, 1, 1), .3))
|
||||||
|
|
||||||
|
self.assert_image_equal(
|
||||||
|
emboss, Image.open("Tests/images/hopper_emboss.bmp"))
|
||||||
|
|
||||||
|
def test_consistency_5x5(self):
|
||||||
|
im = Image.open("Tests/images/hopper.bmp")
|
||||||
|
emboss = im.filter(ImageFilter.Kernel((5, 5),
|
||||||
|
(-1, -1, -1, -1, 0,
|
||||||
|
-1, -1, -1, 0, 1,
|
||||||
|
-1, -1, 0, 1, 1,
|
||||||
|
-1, 0, 1, 1, 1,
|
||||||
|
0, 1, 1, 1, 1), 0.3))
|
||||||
|
|
||||||
|
self.assert_image_equal(
|
||||||
|
emboss, Image.open("Tests/images/hopper_emboss_more.bmp"))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -40,13 +40,15 @@ class SimplePatcher(object):
|
||||||
else:
|
else:
|
||||||
delattr(self._parent_obj, self._attr_name)
|
delattr(self._parent_obj, self._attr_name)
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(HAS_FREETYPE, "ImageFont not Available")
|
@unittest.skipUnless(HAS_FREETYPE, "ImageFont not Available")
|
||||||
class TestImageFont(PillowTestCase):
|
class TestImageFont(PillowTestCase):
|
||||||
LAYOUT_ENGINE = ImageFont.LAYOUT_BASIC
|
LAYOUT_ENGINE = ImageFont.LAYOUT_BASIC
|
||||||
|
|
||||||
# Freetype has different metrics depending on the version.
|
# Freetype has different metrics depending on the version.
|
||||||
# (and, other things, but first things first)
|
# (and, other things, but first things first)
|
||||||
METRICS = { ('2', '3'): {'multiline': 30,
|
METRICS = {
|
||||||
|
('2', '3'): {'multiline': 30,
|
||||||
'textsize': 12,
|
'textsize': 12,
|
||||||
'getters': (13, 16)},
|
'getters': (13, 16)},
|
||||||
('2', '7'): {'multiline': 6.2,
|
('2', '7'): {'multiline': 6.2,
|
||||||
|
@ -213,6 +215,14 @@ class TestImageFont(PillowTestCase):
|
||||||
font=ttf,
|
font=ttf,
|
||||||
align="unknown"))
|
align="unknown"))
|
||||||
|
|
||||||
|
def test_draw_align(self):
|
||||||
|
im = Image.new('RGB', (300, 100), 'white')
|
||||||
|
draw = ImageDraw.Draw(im)
|
||||||
|
ttf = self.get_font()
|
||||||
|
line = "some text"
|
||||||
|
draw.text((100, 40), line, (0, 0, 0), font=ttf, align='left')
|
||||||
|
del draw
|
||||||
|
|
||||||
def test_multiline_size(self):
|
def test_multiline_size(self):
|
||||||
ttf = self.get_font()
|
ttf = self.get_font()
|
||||||
im = Image.new(mode='RGB', size=(300, 100))
|
im = Image.new(mode='RGB', size=(300, 100))
|
||||||
|
@ -395,7 +405,7 @@ class TestImageFont(PillowTestCase):
|
||||||
|
|
||||||
def test_getsize_empty(self):
|
def test_getsize_empty(self):
|
||||||
font = self.get_font()
|
font = self.get_font()
|
||||||
# should not crash.
|
# should not crash.
|
||||||
self.assertEqual((0, 0), font.getsize(''))
|
self.assertEqual((0, 0), font.getsize(''))
|
||||||
|
|
||||||
def _test_fake_loading_font(self, path_to_fake, fontname):
|
def _test_fake_loading_font(self, path_to_fake, fontname):
|
||||||
|
@ -494,5 +504,6 @@ class TestImageFont(PillowTestCase):
|
||||||
class TestImageFont_RaqmLayout(TestImageFont):
|
class TestImageFont_RaqmLayout(TestImageFont):
|
||||||
LAYOUT_ENGINE = ImageFont.LAYOUT_RAQM
|
LAYOUT_ENGINE = ImageFont.LAYOUT_RAQM
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
2
docs/_templates/sidebarhelp.html
vendored
2
docs/_templates/sidebarhelp.html
vendored
|
@ -1,4 +1,4 @@
|
||||||
<h3>Need help?</h3>
|
<h3>Need help?</h3>
|
||||||
<p>
|
<p>
|
||||||
You can get help via IRC at <a href="irc://irc.freenode.net#pil">irc://irc.freenode.net#pil</a> or Stack Overflow <a href="https://stackoverflow.com/questions/tagged/pillow">here</a> and <a href="https://stackoverflow.com/questions/tagged/pil">here</a>. Please <a href="https://github.com/python-pillow/Pillow/issues/new">report issues on GitHub</a>.
|
You can get help via IRC at <a href="irc://irc.freenode.net#pil">irc://irc.freenode.net#pil</a> or Stack Overflow <a href="https://stackoverflow.com/questions/tagged/pillow">here</a> and <a href="https://stackoverflow.com/questions/tagged/python-imaging-library">here</a>. Please <a href="https://github.com/python-pillow/Pillow/issues/new">report issues on GitHub</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -815,6 +815,7 @@ static int decode_bcn(Imaging im, ImagingCodecState state, const UINT8* src, int
|
||||||
case NN: \
|
case NN: \
|
||||||
while (bytes >= SZ) { \
|
while (bytes >= SZ) { \
|
||||||
TY col[16]; \
|
TY col[16]; \
|
||||||
|
memset(col, 0, 16 * sizeof(col[0])); \
|
||||||
decode_bc##NN##_block(col, ptr); \
|
decode_bc##NN##_block(col, ptr); \
|
||||||
put_block(im, state, (const char *)col, sizeof(col[0]), C); \
|
put_block(im, state, (const char *)col, sizeof(col[0]), C); \
|
||||||
ptr += SZ; \
|
ptr += SZ; \
|
||||||
|
|
|
@ -31,6 +31,7 @@ ImagingExpand(Imaging imIn, int xmargin, int ymargin, int mode)
|
||||||
{
|
{
|
||||||
Imaging imOut;
|
Imaging imOut;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
ImagingSectionCookie cookie;
|
||||||
|
|
||||||
if (xmargin < 0 && ymargin < 0)
|
if (xmargin < 0 && ymargin < 0)
|
||||||
return (Imaging) ImagingError_ValueError("bad kernel size");
|
return (Imaging) ImagingError_ValueError("bad kernel size");
|
||||||
|
@ -60,11 +61,13 @@ ImagingExpand(Imaging imIn, int xmargin, int ymargin, int mode)
|
||||||
EXPAND_LINE(type, image, imIn->ysize-1, ymargin+imIn->ysize+y);\
|
EXPAND_LINE(type, image, imIn->ysize-1, ymargin+imIn->ysize+y);\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImagingSectionEnter(&cookie);
|
||||||
if (imIn->image8) {
|
if (imIn->image8) {
|
||||||
EXPAND(UINT8, image8);
|
EXPAND(UINT8, image8);
|
||||||
} else {
|
} else {
|
||||||
EXPAND(INT32, image32);
|
EXPAND(INT32, image32);
|
||||||
}
|
}
|
||||||
|
ImagingSectionLeave(&cookie);
|
||||||
|
|
||||||
ImagingCopyInfo(imOut, imIn);
|
ImagingCopyInfo(imOut, imIn);
|
||||||
|
|
||||||
|
@ -78,6 +81,7 @@ ImagingFilter(Imaging im, int xsize, int ysize, const FLOAT32* kernel,
|
||||||
Imaging imOut;
|
Imaging imOut;
|
||||||
int x, y;
|
int x, y;
|
||||||
FLOAT32 sum;
|
FLOAT32 sum;
|
||||||
|
ImagingSectionCookie cookie;
|
||||||
|
|
||||||
if (!im || strcmp(im->mode, "L") != 0)
|
if (!im || strcmp(im->mode, "L") != 0)
|
||||||
return (Imaging) ImagingError_ModeError();
|
return (Imaging) ImagingError_ModeError();
|
||||||
|
@ -92,6 +96,9 @@ ImagingFilter(Imaging im, int xsize, int ysize, const FLOAT32* kernel,
|
||||||
if (!imOut)
|
if (!imOut)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
// Add one time for rounding
|
||||||
|
offset += 0.5;
|
||||||
|
|
||||||
/* brute force kernel implementations */
|
/* brute force kernel implementations */
|
||||||
#define KERNEL3x3(image, kernel, d) ( \
|
#define KERNEL3x3(image, kernel, d) ( \
|
||||||
(int) image[y+1][x-d] * kernel[0] + \
|
(int) image[y+1][x-d] * kernel[0] + \
|
||||||
|
@ -131,6 +138,7 @@ ImagingFilter(Imaging im, int xsize, int ysize, const FLOAT32* kernel,
|
||||||
(int) image[y-2][x+d] * kernel[23] + \
|
(int) image[y-2][x+d] * kernel[23] + \
|
||||||
(int) image[y-2][x+d+d] * kernel[24])
|
(int) image[y-2][x+d+d] * kernel[24])
|
||||||
|
|
||||||
|
ImagingSectionEnter(&cookie);
|
||||||
if (xsize == 3) {
|
if (xsize == 3) {
|
||||||
/* 3x3 kernel. */
|
/* 3x3 kernel. */
|
||||||
for (x = 0; x < im->xsize; x++)
|
for (x = 0; x < im->xsize; x++)
|
||||||
|
@ -174,6 +182,7 @@ ImagingFilter(Imaging im, int xsize, int ysize, const FLOAT32* kernel,
|
||||||
for (x = 0; x < im->xsize; x++)
|
for (x = 0; x < im->xsize; x++)
|
||||||
imOut->image8[y][x] = im->image8[y][x];
|
imOut->image8[y][x] = im->image8[y][x];
|
||||||
}
|
}
|
||||||
|
ImagingSectionLeave(&cookie);
|
||||||
return imOut;
|
return imOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,13 @@
|
||||||
|
|
||||||
#define ROUND_UP(f) ((int) ((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F))
|
#define ROUND_UP(f) ((int) ((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F))
|
||||||
|
|
||||||
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
#define MAKE_UINT32(u0, u1, u2, u3) (u3 | (u2<<8) | (u1<<16) | (u0<<24))
|
||||||
|
#else
|
||||||
|
#define MAKE_UINT32(u0, u1, u2, u3) (u0 | (u1<<8) | (u2<<16) | (u3<<24))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct filter {
|
struct filter {
|
||||||
double (*filter)(double x);
|
double (*filter)(double x);
|
||||||
double support;
|
double support;
|
||||||
|
@ -281,8 +288,8 @@ ImagingResampleHorizontal_8bpc(Imaging imIn, int xsize, struct filter *filterp)
|
||||||
ss0 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 0]) * k[x];
|
ss0 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 0]) * k[x];
|
||||||
ss3 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 3]) * k[x];
|
ss3 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 3]) * k[x];
|
||||||
}
|
}
|
||||||
imOut->image[yy][xx*4 + 0] = clip8(ss0);
|
((UINT32 *) imOut->image[yy])[xx] = MAKE_UINT32(
|
||||||
imOut->image[yy][xx*4 + 3] = clip8(ss3);
|
clip8(ss0), 0, 0, clip8(ss3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (imIn->bands == 3) {
|
} else if (imIn->bands == 3) {
|
||||||
|
@ -297,9 +304,8 @@ ImagingResampleHorizontal_8bpc(Imaging imIn, int xsize, struct filter *filterp)
|
||||||
ss1 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 1]) * k[x];
|
ss1 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 1]) * k[x];
|
||||||
ss2 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 2]) * k[x];
|
ss2 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 2]) * k[x];
|
||||||
}
|
}
|
||||||
imOut->image[yy][xx*4 + 0] = clip8(ss0);
|
((UINT32 *) imOut->image[yy])[xx] = MAKE_UINT32(
|
||||||
imOut->image[yy][xx*4 + 1] = clip8(ss1);
|
clip8(ss0), clip8(ss1), clip8(ss2), 0);
|
||||||
imOut->image[yy][xx*4 + 2] = clip8(ss2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -315,10 +321,8 @@ ImagingResampleHorizontal_8bpc(Imaging imIn, int xsize, struct filter *filterp)
|
||||||
ss2 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 2]) * k[x];
|
ss2 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 2]) * k[x];
|
||||||
ss3 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 3]) * k[x];
|
ss3 += ((UINT8) imIn->image[yy][(x + xmin)*4 + 3]) * k[x];
|
||||||
}
|
}
|
||||||
imOut->image[yy][xx*4 + 0] = clip8(ss0);
|
((UINT32 *) imOut->image[yy])[xx] = MAKE_UINT32(
|
||||||
imOut->image[yy][xx*4 + 1] = clip8(ss1);
|
clip8(ss0), clip8(ss1), clip8(ss2), clip8(ss3));
|
||||||
imOut->image[yy][xx*4 + 2] = clip8(ss2);
|
|
||||||
imOut->image[yy][xx*4 + 3] = clip8(ss3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,8 +390,8 @@ ImagingResampleVertical_8bpc(Imaging imIn, int ysize, struct filter *filterp)
|
||||||
ss0 += ((UINT8) imIn->image[y + ymin][xx*4 + 0]) * k[y];
|
ss0 += ((UINT8) imIn->image[y + ymin][xx*4 + 0]) * k[y];
|
||||||
ss3 += ((UINT8) imIn->image[y + ymin][xx*4 + 3]) * k[y];
|
ss3 += ((UINT8) imIn->image[y + ymin][xx*4 + 3]) * k[y];
|
||||||
}
|
}
|
||||||
imOut->image[yy][xx*4 + 0] = clip8(ss0);
|
((UINT32 *) imOut->image[yy])[xx] = MAKE_UINT32(
|
||||||
imOut->image[yy][xx*4 + 3] = clip8(ss3);
|
clip8(ss0), 0, 0, clip8(ss3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (imIn->bands == 3) {
|
} else if (imIn->bands == 3) {
|
||||||
|
@ -402,9 +406,8 @@ ImagingResampleVertical_8bpc(Imaging imIn, int ysize, struct filter *filterp)
|
||||||
ss1 += ((UINT8) imIn->image[y + ymin][xx*4 + 1]) * k[y];
|
ss1 += ((UINT8) imIn->image[y + ymin][xx*4 + 1]) * k[y];
|
||||||
ss2 += ((UINT8) imIn->image[y + ymin][xx*4 + 2]) * k[y];
|
ss2 += ((UINT8) imIn->image[y + ymin][xx*4 + 2]) * k[y];
|
||||||
}
|
}
|
||||||
imOut->image[yy][xx*4 + 0] = clip8(ss0);
|
((UINT32 *) imOut->image[yy])[xx] = MAKE_UINT32(
|
||||||
imOut->image[yy][xx*4 + 1] = clip8(ss1);
|
clip8(ss0), clip8(ss1), clip8(ss2), 0);
|
||||||
imOut->image[yy][xx*4 + 2] = clip8(ss2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -420,10 +423,8 @@ ImagingResampleVertical_8bpc(Imaging imIn, int ysize, struct filter *filterp)
|
||||||
ss2 += ((UINT8) imIn->image[y + ymin][xx*4 + 2]) * k[y];
|
ss2 += ((UINT8) imIn->image[y + ymin][xx*4 + 2]) * k[y];
|
||||||
ss3 += ((UINT8) imIn->image[y + ymin][xx*4 + 3]) * k[y];
|
ss3 += ((UINT8) imIn->image[y + ymin][xx*4 + 3]) * k[y];
|
||||||
}
|
}
|
||||||
imOut->image[yy][xx*4 + 0] = clip8(ss0);
|
((UINT32 *) imOut->image[yy])[xx] = MAKE_UINT32(
|
||||||
imOut->image[yy][xx*4 + 1] = clip8(ss1);
|
clip8(ss0), clip8(ss1), clip8(ss2), clip8(ss3));
|
||||||
imOut->image[yy][xx*4 + 2] = clip8(ss2);
|
|
||||||
imOut->image[yy][xx*4 + 3] = clip8(ss3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user