Commit Graph

131 Commits

Author SHA1 Message Date
wiredfool
1008d6a993 Windows compatibility 2014-07-05 15:06:17 -07:00
wiredfool
b7f56409eb Multiplication needs to be 64bit, to handle overflow regardless of the bittedness of the machine, fixes #771# 2014-07-05 14:30:34 -07:00
Alex Clark ☺
b2ed31e8cd Merge pull request #737 from wiredfool/terseus_imagedraw
Merged Imagedraw rewrite
2014-07-01 14:15:11 -04:00
wiredfool
98a4991762 Using local block rather than array literal 2014-07-01 10:20:15 -07:00
wiredfool
a10b91786a Fix compilation errors with C90 standard 2014-07-01 10:05:38 -07:00
cgohlke
767182a56f ENH: enable inline functions by default 2014-06-30 15:26:41 -07:00
wiredfool
3bf375c5f7 Merge branch 'master' into terseus_imagedraw 2014-06-30 14:24:59 -07:00
wiredfool
50bbb5e0c5 Removed unused function 2014-06-30 14:12:30 -07:00
David Joy
b147dea535 Add tests and fix a 16bit vs 32bit integer bug
Yay unit tests!
2014-06-25 14:06:56 -04:00
David Joy
479693417f Merge the rest of the patches
Now it actually works and passes the test suite
2014-06-25 11:42:06 -04:00
David Joy
433ec1c219 Clean commit of 16-bit monochrome JPEK2000 support 2014-06-25 11:13:33 -04:00
Hugo
9f0b688952 Merge pull request #725 from cgohlke/patch-2
Fix msvc warning: 'inline' : macro redefinition
2014-06-25 10:47:47 +03:00
cgohlke
e79f996a45 Fix test_imagedraw failures 2014-06-25 00:07:07 -07:00
cgohlke
b593ff06ad Fix msvc warning: 'inline' : macro redefinition 2014-06-24 22:23:17 -07:00
wiredfool
a990af1b97 Merge from master 2014-06-24 16:48:38 -07:00
Alex Clark ☺
a126844135 Merge pull request #681 from wiredfool/openjpeg_21
OpenJpeg 2.1
2014-06-22 15:39:32 -04:00
wiredfool
05d8cb5b8f Don't carve out exceptions for py2.4 compilers anymore 2014-06-18 16:08:50 -07:00
wiredfool
a8e02e093a We don't need unistd.h anymore on unix platforms either 2014-06-18 16:08:16 -07:00
James Anderson
5ceb3ca875 Issue #697. On MSVC 2012 builds <unistd.h> is not required. 2014-06-18 15:54:21 -07:00
Alastair Houghton
72ecb8752e Changed test for OpenJPEG 2.0 2014-05-27 12:52:50 +01:00
Alastair Houghton
1011e51083 Added support for OpenJPEG 2.1. 2014-05-27 12:43:54 +01:00
wiredfool
d7c049504d Merge pull request #643 from CounterPillow/datatype-fix
Change unsigned INT16 to UINT16
2014-05-20 16:45:06 +01:00
Nicolas F
052ea606bf Clean up defines and includes for Windows
1)  Renamed USE_INLINE to PIL_USE_INLINE to avoid conflicts with
    other headers/libraries.

2)  Replace __WIN32__ and WIN32 with _WIN32

3)  Don't define WIN32 when the compiler is MSVC but not on Windows
    Why would you even...

4)  Don't define strcasecmp if you're not even going to use it.

5)  Don't include Windows.h with undefs for compilers newer than
    1998 everywhere.

6)  Don't surpress warnings for MSVC++ 4.0. People still using
    MSVC++ 4.0 deserve it.

7)  Don't include things that are already included in Windows.h
2014-05-09 21:05:30 +02:00
Nicolas F
37bb8eec24 Don't ignore USE_INLINE on Windows 2014-05-09 20:14:46 +02:00
Nicolas F
d2fbc52d6c Change unsigned INT16 to UINT16
Addresses issue #642
2014-04-30 11:30:44 +02:00
Terseus
8eae39e98f Oops, added missing ';'
Now writing in the wall "don't push before compile" 100 times.
2014-04-04 19:20:29 +02:00
Terseus
2f6a4d5f1a Added missing free when xx fail 2014-04-04 18:57:08 +02:00
Terseus
696924f5ac Added missing xx pointer check 2014-04-04 14:02:36 +02:00
Terseus
dbe3db6fc5 Oops, fixed typo in comments 2014-04-03 11:15:21 +02:00
Terseus
be09da6507 Rewrite of the ImagingDrawWideLine function
The previous version of the function didn't generate correct wide lines
of even width.

The most notable changes are:
  * Make variable names far more descriptive about the process.
  * Corrected the width calculation; we should deduct one pixel from the
    width because the pixels at the center of the line doesn't count for
    the triangles.
  * Now we calculate *two* ratios, one for left/top displacement (dxmin)
    and one for right/bottom (dxmax), this fix the behavior with lines
    of even width.

It can probably be optimized.
2014-04-02 21:30:42 +02:00
Terseus
cd332fc38a Rewrite of the polygon_generic function
The (previously refactored) polygon_generic function didn't draw
consistent polygons (equilateral polygons were not equilateral nor
symmetrical).

The most notable changes are:
  * The horizontal edges are searched for when finding the polygon
    boundaries, drawn and discarded from the edge list used to detect
    intersections.
  * The intersections are now checked and calculated from the current value
    of the scan line (ymin) instead of in the middle (ymin + 0.5).
  * Because the change in the scan line behavior, we should duplicate
    the intersections in the maximum Y value of an edge or there will be
    draw errors with concave and complex polygons.
  * The rounds of the X coordinates in the hline function calls are
    switched to draw the inner pixels.
  * Removed the ugly micro-optimization of qsort at the end.

This implementation of the scan line algorithm may not be technically
correct, it's not optimized and it have problems with some edge cases,
like a wide line from (x0, y) to (x1, y + 1), therefore it should be
reviewed in the future.
2014-04-02 21:05:13 +02:00
Terseus
8739613cfb Implementation of rounds around zero
The rounds used in the library are towards positive/negative infinity.
Since we're in a cartesian plane, rounds around zero are much more
convenient, so we can use positive and negative values with consistent
results.
2014-04-01 13:08:15 +02:00
Terseus
deecd8a137 Refactored polygon functions to unify logic
The functions `polygon8`, `polygon32` and `polygon32rgba` all have exactly
the same logic in code, only changes the hline function called inside.

Now all the logic is contained in `polygon_generic` which gets a
function pointer to the hline handler, so there is no duplicated code
anymore.
2014-04-01 13:01:03 +02:00
wiredfool
a2800ba9a1 Additional commits from pr 2014-03-27 20:00:10 -07:00
Alastair Houghton
18d6432036 Fixed some problems with the reduce option, as well as a number of warnings from GCC. 2014-03-27 08:35:38 +00:00
wiredfool
2b81156619 merge to master 2014-03-26 18:46:35 -07:00
Alastair Houghton
831216f609 Fixed a Python 3 specific crash. 2014-03-25 16:58:44 +00:00
Alastair Houghton
fea6811af0 Merged wiredfool's changes. 2014-03-19 14:58:47 +00:00
Alastair Houghton
ac8ebccfa6 Added tests and fixed a few bugs that the tests threw up. 2014-03-19 12:16:14 +00:00
wiredfool
dfe6fff10f Eliminating warning for possibly uninitialized variable use 2014-03-14 14:23:44 -07:00
wiredfool
ac52886da1 Fixed compilation errors on linux, ref #547 2014-03-14 11:35:23 -07:00
Alastair Houghton
5853d2aed0 Add a couple of unpackers. 2014-03-14 16:38:30 +00:00
Alastair Houghton
168acabcb0 Fixed some warnings. 2014-03-14 16:38:07 +00:00
Alastair Houghton
9a1b6966b5 Added precinct size option. Also added the jp2klib_version symbol on the _imaging module. 2014-03-14 15:40:30 +00:00
Alastair Houghton
5cb73c94e9 Fixed some Windows issues. 2014-03-14 14:35:09 +00:00
Alastair Houghton
cb1f990a92 Added seek support to make writing jp2 files work. Also added support for directly using an fd rather than relying on the Python loop, if we have a real fd. 2014-03-14 11:21:08 +00:00
Alastair Houghton
61fb89ec54 Added a JPEG 2000 encoder. 2014-03-13 18:27:16 +00:00
Alastair Houghton
aea0ec56b2 Fixed a small bug. 2014-03-13 13:48:15 +00:00
Alastair Houghton
9a4bff722f Decode tile-by-tile; saves memory and means we don't need to buffer the entire image in the OpenJPEG opj_image. 2014-03-13 13:44:26 +00:00
Alastair Houghton
5b22b715ce Fixed some bugs. 2014-03-13 12:29:03 +00:00