ColdFusion 9.0 Resources |
ImageXORDrawingModeDescriptionSets the paint mode of the image to alternate between the image’s current color and the new specified color. Parameters
UsageThis function alternates pixels between the current color and a new specified XOR (exclusive Or) color. When drawing operations are performed, pixels that are the current color are changed to the specified color, and vice versa. Pixels that are of colors other than current color or the new specified color are changed in an unpredictable but reversible manner. If the same figure is drawn twice, all pixels are restored to their original values. If the color value is a string, specify a supported named color; see the list of valid HTML named colors in cfimage. For a hexadecimal value, use the form "##xxxxxx" or "xxxxxx", where x = 0–9 or A–F; use two number signs or none. Example<!--- This example shows how to draw rectangles with alternating colors where they overlap. ---> <!--- Use the ImageNew function to create a 300x200-pixel image in RGB format. ---> <cfset myImage = ImageNew("",300,200,"rgb")> <!--- Turn on antialiasing to improve image quality. ---> <cfset ImageSetAntialiasing(myImage)> <!--- Set the drawing color to white. ---> <cfset ImageSetDrawingColor(myImage,"white")> <!--- Draw a white filled rectangle that is the size of the original image. ---> <cfset ImageDrawRect(myImage,0,0,300,200,"yes")> <!--- Set the XOR drawing mode to white. ---> <cfset ImageXORDrawingMode(myImage,"white")> <!--- Set the drawing color to red. ---> <cfset ImageSetDrawingColor(myImage,"red")> <!--- Draw a filled red rectangle. ---> <cfset ImageDrawRect(myImage,50,50,150,100,"yes")> <!--- Translate the drawing axis to (25,25). ---> <cfset ImageTranslateDrawingAxis(myImage,25,25)> <!--- Set the drawing color to blue. ---> <cfset ImageSetDrawingColor(myImage,"blue")> <!--- Draw a blue filled rectangle at the offset location. ---> <cfset ImageDrawRect(myImage,50,50,150,100,"yes")> <!--- Save the ColdFusion image as a PNG file. ---> <cfset ImageWrite(myImage,"xortest.png")> <!--- Display the PNG file.---> <img src="xortest.png"> |