Commit Graph

1659 Commits

Author SHA1 Message Date
Terseus
4b7236f460 Added tests of hor/ver lines 101px wide
These tests should guarantee that the proportion of the width is
maintained with a margin of error < 1%.
2014-04-09 19:34:50 +02:00
Terseus
8228caf14d Added some oblique 45º lines tests
Only the oblique 3 pixels wide lines are defined:
* The oblique 2 pixels wide lines are somewhat hard to define.
* To define the oblique lines wider than 3 pixels we neet to define
  first how the oblique lines should expand their width (realistic or
  exact).
2014-04-09 19:33:46 +02:00
Terseus
92dd58c014 Added descriptive errors to imagedraw tests 2014-04-06 14:03:03 +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
1c02d467ef Added test for vertical lines.
The behavior is consistent with horizontal lines, see previous commit
for details.
2014-04-04 12:45:47 +02:00
Terseus
fee2faa8dc Added test for horizontal lines
Notice that the expansion of the line width depends on the order of the
points:
  * If the bigger axis value is provided as the *second* point the line
    expand first to the *positive* side of the axis.
  * If the bigger axis value is provided as the *first* point the line
    expand first to the *negative* side of the axis.
  * If the line's width is odd this doesn't matter, as the line will
    expand the same amount to both sides.

This behavior should be consistent in both horizontal and vertical lines.
2014-04-04 12:35:26 +02:00
Terseus
e2cb2195eb Added test for a simple right triangle
The diagonals of the right angled edges must be perfect and the bottom
vertice should be drawn.
2014-04-04 11:46:58 +02:00
Terseus
ec74779b19 Added test for a simple square 2014-04-04 11:28:41 +02:00
Terseus
7de14a51dd Added base method and constants to test_imagedraw
The method `create_base_image_draw` will be used in all the new draw
tests.
2014-04-04 10:47:22 +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
6e2075e25d Merge pull request #574 from wiredfool/convert_trns
Indexed Transparency handled for conversions between L, RGB, and P modes
2014-03-31 21:40:22 -07:00
Alex Clark ☺
dc1664500b Merge pull request #590 from wiredfool/ppc-setup
Rearrange lib directory detection, fixes #587
2014-03-31 16:10:07 -04:00
Eric Soroos
cde7e3e279 Rearrange lib directory detection, fixes #587 2014-03-31 18:59:29 +00:00
wiredfool
182e7782fa Trapping warnings 2014-03-30 09:26:03 -07:00
wiredfool
4877d52cf4 warn category defaults to UserWarning 2014-03-30 09:25:52 -07:00
wiredfool
0d7115a5a4 Merge from master 2014-03-30 09:14:04 -07:00
Alex Clark
cc8677e0df Add history 2014-03-30 07:30:53 -04:00
Alex Clark ☺
6e6bc21ba1 Merge pull request #565 from al45tair/icns-support
Improved icns support
2014-03-30 07:30:14 -04:00
Alex Clark
6efe503123 Add history 2014-03-29 18:26:33 -04:00
Alex Clark ☺
0baa82ac69 Merge pull request #580 from wiredfool/libtiff-fd-leak
Fixes libtiff leaking open files
2014-03-29 18:25:57 -04:00
wiredfool
d09637bc55 Merge pull request #583 from cgohlke/patch-1
Link openjpeg2 statically on Windows
2014-03-29 08:55:47 -07:00
cgohlke
e7e103b1a5 Link openjpeg2 statically on Windows 2014-03-28 20:29:58 -07:00
wiredfool
65c17d4176 Removed warning import, stray im=None, and moved os import to top 2014-03-28 08:35:18 -07:00
Alastair Houghton
172e46def8 Fixed a silly mistake. 2014-03-28 09:30:16 +00:00
Alastair Houghton
5dd67abd71 Merge branch 'master' into icns-support 2014-03-28 09:15:20 +00:00
Alastair Houghton
c2ddcbfde9 Merge JPEG 2000 icon support. 2014-03-28 09:11:45 +00:00
Alastair Houghton
5aac5b7eff Made JPEG2K support for files conditional on its inclusion in pillow build. Added a JPEG2K icon test. 2014-03-28 09:09:55 +00:00
wiredfool
937ae7790f Renamed variables from reused single letter confusing names to something halfway descriptive 2014-03-27 22:19:39 -07:00
wiredfool
9552d9bc66 close the fd, if possible. Fixes #526 2014-03-27 22:18:40 -07:00
wiredfool
b73b4a7b63 Tests for #526 2014-03-27 22:17:27 -07:00
wiredfool
af4424ebf1 Update CHANGES.rst 2014-03-27 20:54:35 -07:00
wiredfool
3e24bc684d Merge pull request #578 from wiredfool/xrange
Python3 issues in JpegImagePlugin
2014-03-27 20:52:07 -07:00
wiredfool
47d1f0db2e Merge pull request #579 from wiredfool/jpeg2k
Jpeg2000 support
2014-03-27 20:50:58 -07:00
wiredfool
7a8025b947 Merge of travis-tweaks into jpeg2k 2014-03-27 20:36:15 -07:00
wiredfool
a2800ba9a1 Additional commits from pr 2014-03-27 20:00:10 -07:00
wiredfool
5a4808d2d2 test cleanup: don't mask file builtin, data is unused 2014-03-27 16:44:58 -07:00
wiredfool
e07b0d8ac9 don't use xrange, has_key, fixes #577 2014-03-27 16:40:44 -07:00
wiredfool
c7af2bf5b0 Test for #577 2014-03-27 16:39:58 -07:00
Alastair Houghton
0eccdf534d Merge branch 'master' into icns+jp2k 2014-03-27 08:38:02 +00:00
Alastair Houghton
946753a3b5 Ignore spurious messages from OpenJPEG. 2014-03-27 08:36:15 +00: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
wiredfool
33dda2ef61 Removing python-tk install [skip ci] 2014-03-26 14:37:38 -07:00
wiredfool
8ffcf97070 Correct resolution of typo 2014-03-26 14:11:41 -07:00