note 58859 added to function.imagepolygon
| From: | glowell at flash dot net | Date: | Thu, 17 Nov 2005 23:43:21 +0000 |
| Subject: | note 58859 added to function.imagepolygon | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-98730@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.imagepolygon.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58859
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58859&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58859&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58859&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58859&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58859&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58859&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58859&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58859&report=yes
Search -- http://master.php.net/manage/user-notes.php