Click to See Complete Forum and Search --> : Transform and Image


Dafly
December 7th, 1999, 11:17 PM
I am trying to transform and image from a square into a triangle is there away to do this?

Thank you,
Jeremy H.

Weasel
February 9th, 2000, 07:26 AM
Probably no built in way, wut with some or other formula and a 3-D array (width*height*3) you should be able to do it. The 3 at the end is for Red, Green and Blue. Use the formula to copy froma rectangular image to the parts of the array yo u want to draw to. Each cell of the triangle contains the average of the color values squeezed over it. For the standard equilateral the top row would have the average of all top pixels of the source square, the and bottom row of the triangle and the bottom row of the square would be identical. Just play with it until it works. You could also try dropping pixels to make it fit instead.