note 58859 deleted from function.imagepolygon by cmb
| From: | cmb@php.net | Date: | Mon, 13 Jul 2015 17:22:01 +0000 |
| Subject: | note 58859 deleted from function.imagepolygon by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203099@lists.php.net to get a copy of this message | ||
Note Submitter: glowell at flash dot net
----
Something to be aware of, ImagePolygon appears to convert the array of points passed to it from
whatever format they may have been in originally into integers. This means if you pass it an array
of floats (after running a rotation routine for example) the floats will be changed to integers
INSIDE THE ORIGINAL ARRAY.
An extreme example: if for some reason you had an unit-sized polygon pt-array ( -1<x|y<1 for
easy scaling purpose for instance) and for some reason your code calls imagepolygon on it (why?
it'd only be a dot anyway) the array would be unusable after that (all either 1s, 0s or -1s).
Scaling a unit-sized array, drawing it and then scaling it again will also may have a different
result than expected.
Obviously, if the array in its original state is important to your code, it should use a copy of the
original array for this call. If your code draws the same polygon multiple times but resizes it for
different cases, you should have each size be created off an original template rather than adjusting
a single polygon array.