mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Merge branch 'master' of https://github.com/python-imaging/Pillow
This commit is contained in:
commit
e969b5ae14
16
README.rst
16
README.rst
|
@ -80,6 +80,21 @@ Current platform support for Pillow. Binary distributions are contributed for ea
|
||||||
.. [1] x86 only
|
.. [1] x86 only
|
||||||
.. [2] In some cases, x86 support may indicate 32-bit compilation on 64-bit architecture (vs. compilation on 32-bit hardware).
|
.. [2] In some cases, x86 support may indicate 32-bit compilation on 64-bit architecture (vs. compilation on 32-bit hardware).
|
||||||
|
|
||||||
|
Donations
|
||||||
|
---------
|
||||||
|
|
||||||
|
You can help fund Pillow development!
|
||||||
|
|
||||||
|
.. Note:: New contributors: please add your name (and donation preference) here and send a pull request.
|
||||||
|
|
||||||
|
Pillow is a volunteer effort led by Alex Clark. Any contributor interested in receiving donations may add their name (and donation preference) here.
|
||||||
|
|
||||||
|
+--------------------------------------+---------------------------------------+
|
||||||
|
| **Developer** | **Preference** |
|
||||||
|
+--------------------------------------+---------------------------------------+
|
||||||
|
| Alex Clark (fork author) | http://gittip.com/aclark4life |
|
||||||
|
+--------------------------------------+---------------------------------------+
|
||||||
|
|
||||||
Python Imaging Library
|
Python Imaging Library
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
@ -386,4 +401,3 @@ Python Imaging Library
|
||||||
http://mingw.org (compiler)
|
http://mingw.org (compiler)
|
||||||
http://sebsauvage.net/python/mingw.html (build instructions)
|
http://sebsauvage.net/python/mingw.html (build instructions)
|
||||||
http://sourceforge.net/projects/gnuwin32 (prebuilt libraries)
|
http://sourceforge.net/projects/gnuwin32 (prebuilt libraries)
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ from tester import *
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
codecs = dir(Image.core)
|
try:
|
||||||
|
import _webp
|
||||||
if "webp_encoder" not in codecs or "webp_decoder" not in codecs:
|
except:
|
||||||
skip("webp support not available")
|
skip('webp support not installed')
|
||||||
|
|
||||||
def test_read():
|
def test_read():
|
||||||
""" Can we write a webp without error. Does it have the bits we expect?"""
|
""" Can we write a webp without error. Does it have the bits we expect?"""
|
||||||
|
|
|
@ -69,21 +69,22 @@ ImagingAlphaComposite(Imaging imDst, Imaging imSrc)
|
||||||
// almost equivalent to:
|
// almost equivalent to:
|
||||||
// tmp = a + (2 << (n-1)), ((tmp >> n) + tmp) >> n
|
// tmp = a + (2 << (n-1)), ((tmp >> n) + tmp) >> n
|
||||||
|
|
||||||
|
UINT32 tmpr, tmpg, tmpb;
|
||||||
UINT16 blend = dst->a * (255 - src->a);
|
UINT16 blend = dst->a * (255 - src->a);
|
||||||
UINT16 outa255 = src->a * 255 + blend;
|
UINT16 outa255 = src->a * 255 + blend;
|
||||||
// There we use 7 bits for precision.
|
// There we use 7 bits for precision.
|
||||||
// We could use more, but we go beyond 32 bits.
|
// We could use more, but we go beyond 32 bits.
|
||||||
UINT16 coef1 = src->a * 255 * 255 * 128 / outa255;
|
UINT16 coef1 = src->a * 255 * 255 * 128 / outa255;
|
||||||
UINT16 coef2 = blend * 255 * 128 / outa255;
|
UINT16 coef2 = 255 * 128 - coef1;
|
||||||
|
|
||||||
#define SHIFTFORDIV255(a)\
|
#define SHIFTFORDIV255(a)\
|
||||||
((a >> 8) + a >> 8)
|
((((a) >> 8) + a) >> 8)
|
||||||
|
|
||||||
UINT32 tmpr = src->r * coef1 + dst->r * coef2 + (0x80 << 7);
|
tmpr = src->r * coef1 + dst->r * coef2 + (0x80 << 7);
|
||||||
out->r = SHIFTFORDIV255(tmpr) >> 7;
|
out->r = SHIFTFORDIV255(tmpr) >> 7;
|
||||||
UINT32 tmpg = src->g * coef1 + dst->g * coef2 + (0x80 << 7);
|
tmpg = src->g * coef1 + dst->g * coef2 + (0x80 << 7);
|
||||||
out->g = SHIFTFORDIV255(tmpg) >> 7;
|
out->g = SHIFTFORDIV255(tmpg) >> 7;
|
||||||
UINT32 tmpb = src->b * coef1 + dst->b * coef2 + (0x80 << 7);
|
tmpb = src->b * coef1 + dst->b * coef2 + (0x80 << 7);
|
||||||
out->b = SHIFTFORDIV255(tmpb) >> 7;
|
out->b = SHIFTFORDIV255(tmpb) >> 7;
|
||||||
out->a = SHIFTFORDIV255(outa255 + 0x80);
|
out->a = SHIFTFORDIV255(outa255 + 0x80);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user