First question, please be gentle ;-)
I've written an image class that makes simple things (rectangles, text) a bit easier, basically a bunch of wrapper methods for PHP's image functions.
What I'm trying to do now is to allow the user to define a selection, and have the following image operations only affect the selected area. I figured I'd do this by copying the image to imgTwo and deleting the selected area from it, do the following image operations on the original as usual, then when $img->deselect() is called, copy imgTwo back to the original, and destroy the copy.
- is this the best way? obviously it will be tricky to define deselected areas within a selected area but I can live with that for now :)
Then, the way I'm erasing the selection from the copy is by drawing a rectangle in a transparent color, which is working - but I can't figure out how to choose that color while being sure it doesn't occur in the rest of the image. The input images in this application are true color PNGs, so no palette with color indexes (I think?).
- There has to be a better way than to collect the colours of each individual pixel and then finding a color that doesn't appear in the $existing_colours array .. right?