Commit Graph

140 Commits

Author SHA1 Message Date
Brian Crowell
7de6ab5108 py3k: Use "y#" code in PyArg_ParseTuple where we expect byte data
This commit also renames some functions from "fromstring" and the like to
"frombytes". I'll probably need to come back later and update any
references to "string," here or in the docs.

I also noticed that encode allocates some data for certain codecs, but
never frees them. That would be a good bug to fix. I fixed the one where it
outright stole a pointer from Python.
2013-01-16 13:47:26 +08:00
Brian Crowell
a948d0a3ac py3k: Fix strict aliasing warnings under Python 3 2013-01-16 13:47:26 +08:00
Brian Crowell
39484c3632 py3k: Add module initialization and unicode/bytes int/long thunks
This commit:

* Adds Python 3 module initialization functions. I split out the main init
  of each module into a static setup_module function.
* Adds a py3.h which unifies int/long in Python 3 and unicode/bytes in
  Python 2. _imagingft.c unfortunately looks a little kludgy after this
  because it was already using PyUnicode functions, and I had to mix and
  match there manually.

With this commit, the modules all build successfully under Python 3.

What this commit does NOT do is patch all of the uses of PyArg_ParseTuple
and Py_BuildValue, which all need to be checked for proper use of bytes
and unicode codes. It also does not let selftest.py run yet, because there
are probably hundreds of issues to fix in the Python code itself.
2013-01-16 13:47:26 +08:00
Brian Crowell
30333de036 py3k: Fix strict aliasing slip-up in _imaging
Python 3 enables C's strict aliasing rules for the first time, which means
you need to be careful about the ways you reference pointers. Here, we're
using a char[4] as an INT32, so we cast between them using a union.
2013-01-16 13:47:26 +08:00
Brian Crowell
77256df067 py3k: Remove HAVE_UNICODE from _imagingft
I'm pretty sure this preserves the intent of the code. HAVE_UNICODE is now
assumed, and PyString is only used if we're not in Py3k.

Since this is the only file that uses PyUnicode, I'm going to go ahead and
#define PyUnicode and PyBytes back to PyString for 2.6, and explicitly
change out every call so I have to check them all.
2013-01-16 13:47:26 +08:00
Brian Crowell
71c817c707 py3k: Use new buffer protocol
Other ports have taken advantage of the fact that Python 3 has wrappers for
the old buffer protocol, but there's a significant disadvantage: you can't
let the buffered object know when you're done with it.

Since Python 2.6 supports the new protocol, we just go ahead and move to
it.
2013-01-16 13:47:26 +08:00
Brian Crowell
4a4d7dcf3b py3k: Modernize type declarations
This updates several Python type definitions and uses to bring us closer
to Python 3 compatibility. This includes:

* Replacing staticforward and statichere with static. These were a hack for
  old compilers and are not supported/needed anymore.
* Using Py_TYPE() instead of ob_type; ob_type is hidden in Py3.
* Replacing getattr with getters/setters. getattr is sort-of supported in
  Py3, but Py_FindMethod is not. So we just use the newer
  methods/getsetters mechanisms and start using PyType_Ready everywhere.
* Use PyVarObject_HEAD_INIT for types, since types are PyVarObject.
* Use PyMODINIT_FUNC for module initialization functions.

There are some tab/space issues in this commit. I'm set for spaces; the
source is a little schizo.
2013-01-16 13:47:26 +08:00
Brian Crowell
edfe1062ef py3k: Get setup.py to run under python3
First real fix: open the temp file in text mode.
2013-01-16 13:47:26 +08:00
Brian Crowell
ab29a5a223 py3k: Update exception usage to modern syntax 2013-01-16 13:47:26 +08:00
Brian Crowell
3ab0a29887 py3k: Use string methods instead of string module
First, we go for the obvious stuff. The string module methods are gone in
3.0, so we translate them to the appropriate methods on the string class.
2013-01-16 13:47:26 +08:00
d-schmidt
a9d42aebc7 fixed crash loading broken color profile from file-like object 2013-01-16 13:47:26 +08:00
Alex Po
5e7920d0f6 Move custom path of JPEG_ROOT, TIFF_ROOT, etc. before system. 2013-01-16 13:47:26 +08:00
Tom Payne
23ebec0080 Avoid rounding error in Image.alpha_composite 2013-01-16 13:47:26 +08:00
cgohlke
4204c24df6 Make FLI image detection more stringent 2013-01-16 13:47:26 +08:00
Manuel Ebert
ab94dde3da Radius was hardcoded to 2.
This will probably, some time in the future get fixed upstream in PIL. Maybe.
2013-01-16 13:47:26 +08:00
Brian J. Crowell
d03b1fbb24 Add files to the MANIFEST which were missing from the source distribution 2013-01-16 13:47:26 +08:00
Tom Payne
3a21c8893a Add Image.alpha_composite 2013-01-16 13:47:26 +08:00
Alex Clark
833b2b5f63 Release 1.7.8 2013-01-16 13:47:26 +08:00
Alex Clark
8e0c27437e Fix formatting of installation summary 2013-01-16 13:47:26 +08:00
tdesvenain
4d4e2de42b Removed doctests.py that made tests of other packages fail. 2013-01-16 13:47:26 +08:00
tdesvenain
f4d9eaca53 revert last commit, images rendered didn't match very well 2013-01-16 13:47:26 +08:00
tdesvenain
f242f72736 Added a psd mode (mode 4, 16 bits). 2013-01-16 13:47:26 +08:00
tdesvenain
1a8f45bc50 Fix opening psd files with RGBA layers when A mode is not of type 65535
but 3.
Fixes issue https://github.com/python-imaging/Pillow/issues/3
2013-01-16 13:47:26 +08:00
Lars Yencken
997de5608a Fix a bug in quantize() causing PIL crashes.
From German Bravo's Image-SIG post:
http://mail.python.org/pipermail/image-sig/2012-June/007047.html
2013-01-16 13:47:26 +08:00
Alex Clark
323824f8b2 Fix URL 2013-01-16 13:47:26 +08:00
Alex Clark
61e266aa2f Save issues and comments 2013-01-16 13:47:25 +08:00
Alex Clark
cac1398a51 Save watchers 2013-01-16 13:47:25 +08:00
Alex Clark
63a4cb7957 Change URL 2013-01-16 13:47:25 +08:00
Alex Clark
8182f046d5 Test travis 2013-01-16 13:47:25 +08:00
Alex Clark
b8cabe1a3b Test travis 2013-01-16 13:47:25 +08:00
Corey Richardson
3bd4f26f24 Better import of _imaging 2013-01-16 13:47:25 +08:00
Marc Abramowitz
b07b19c00b Make things more Python 3 friendly. Python 3 still doesn't work because
of C code that doesn't compile with Python 3.
2013-01-16 13:47:25 +08:00
Marc Abramowitz
dae289d0d1 Add .travis.yml for Travis CI (http://travis-ci.org/) 2013-01-16 13:47:25 +08:00
Marc Abramowitz
353543d3a5 Add support for tox (http://tox.testrun.org/) 2013-01-16 13:47:25 +08:00
Shuge Lee
3e709faeb2 Add .gitignore
Conflicts:

	.gitignore
2013-01-16 13:46:33 +08:00
Tom Gross
1e120cb951 fixed reading of EPS pictures
found in: http://www.mail-archive.com/image-sig@python.org/msg03054.html
2013-01-16 12:56:12 +08:00
Shuge Lee
2b54c9959e Use "from PIL import Imagexx" instead of "import Imagexx" 2013-01-16 11:53:53 +08:00
Shuge Lee
065f59f04d Fixed draw_text/draw_text.py on Ubuntu 2013-01-16 11:52:55 +08:00
Shuge Lee
acdda34589 Small changed, using range() instead of deprecated xrange() 2013-01-16 11:05:50 +08:00
Shuge Lee
03c5242269 Small changed, fixed spell pixsel -> pixel 2013-01-16 10:59:22 +08:00
Shuge Lee
d22ae7a3ad Using relation path in demo; using captcha image instead of lena 2013-01-16 10:49:20 +08:00
Shuge Lee
cb743697fc Small chagned, clean up code 2013-01-15 11:03:52 +08:00
Shuge Lee
108228d84b fixed fg_color/bg_color in hex 2012-06-23 12:55:56 +08:00
Shuge Lee
0ee26c7437 added drawing polygon example 2012-06-23 12:48:13 +08:00
Shuge Lee
e6838b60ab rm lena images 2012-06-18 12:01:52 +08:00
Shuge Lee
6ac2be47f1 fixed drawing demos 2012-05-22 17:30:57 +08:00
Shuge Lee
8b76c692e4 small changed, updated file readme 2012-05-12 16:43:05 +08:00
Shuge Lee
43b9e48f58 Added pythonic demos 2012-05-12 16:34:53 +08:00
Alex Clark
4aaf00458c Merge pull request #22 from saltycrane/master
For Issue #21, "Pillow cuts off top of text but PIL does not"
2012-05-03 16:06:58 -07:00
Eliot
558254f028 Revert "Fix descender parameter was ignored on rendering truetype fonts"
This reverts commit 501c5c47b6.
2012-05-03 15:55:51 -07:00