CanvasDrawPixel



Release:

4.6  •  5.0  •  5.1  •  5.2  •  5.3  •  5.4  •  6.0  •  6.1  •  6.2  •  6.3  •  6.4  •  6.5


New to Analytica 5 .1

CanvasDrawPixel( canvas, x, y, color, blend, swapXY )

Draws a single pixel on «canvas» as «x», «y» in «color». When «color» has partial transparency, the optional Boolean «blend» determines whether the transparency is mixed with the existing pixel at that location (blend:true) or whether the pixel is set directly to the partially transparent «color» directly (blend:false). «Blend» is false by default.

You can set all the pixels of an image at once (and those images might be computed) by supplying arrays to «x», «y» and «color» with common indexes.

The optional «swapXY» parameter swaps the «x» and «y» parameters.

Examples

The following expression creates a gray-scale version of an image, the result of variable Img.

Local width := ImageInfo(Img,'Width');
Local height := ImageInfo(Img,'Height');
LocalIndex x := 1..width;
LocalIndex y := 1..height;
Local grayedColor := ColorToGrayScale( ImageInfo(Img,'Color',x,y) );
 
Local c := Canvas( width, height );
CanvasDrawPixel( c, x,y, grayedColor );
CanvasImage(c) 

where ColorToGrayScale is a User-Defined Function that converts a color integer to its gray scale equivalent (not shown here).

See Also

Comments


You are not allowed to post comments.