Hey all,
Basically the problem I have the moment is I'm working on a scrip someone sent me which generates a cube using poly imageFilledPolygon and imagePolygon for the edges. Now the thing is they want shading done on the different sides of the cube, but they're only passing in an individual colour pointer and I'm not sure how I can use this to convert it to a new colour which is darker. Is there a way to return the RGB or hex value off a colour thats been already allocated?
Image Colour
Moderator: General Moderators
- andyhoneycutt
- Forum Contributor
- Posts: 468
- Joined: Wed Aug 27, 2008 10:02 am
- Location: Idaho Falls
Re: Image Colour
After a bit of searching, I think I found what it is you're looking for, check out the imagecolorsforindex function. It returns the 0-255 value as well as the alpha for the color in an associative array.
-Andy
-Andy
Re: Image Colour
Hi, thanks heaps for the reply, it's exactly what I was looking for. In the process of looking things up I realised I could also do this:-
imageFilledPolygon($image,$vertices,count($poly),$fill + 0xF0F0F0);
This darkens the colour without having to convert it back to RGB like the function above does.
imageFilledPolygon($image,$vertices,count($poly),$fill + 0xF0F0F0);
This darkens the colour without having to convert it back to RGB like the function above does.