Older Newer
Wed, 01 Sep 2021 05:50:32 . . . . SyneRyder [Add simple example and link to getPixel]


Changes by last author:

Added:
= setPixel =

== Syntax ==

:void setPixel(int x, int y, int color)

== Arguments ==

:x

::X-coordinate (in pixels) of the relative position (originating top-left at 0, 0) in the control where you want to draw a pixel.

:y

::Y-coordinate (in pixels) of the relative position (originating top-left at 0, 0) in the control where you want to draw a pixel.

:color

::The RGB color value of the pixel to be drawn.

== Description ==

:Call setPixel to draw an individual pixel to an OWNERDRAW control. First call startSetPixel, then use setPixel or any of the Control drawing functions to draw to the control and finish with a call to endSetPixel. This function is not for setting pixels in the preview / final image; use pset for that instead.

== Example ==

<code>

%fml

ctl[0]: OWNERDRAW, Color=RGB(0,0,0), Size=(100,100)

OnFilterStart: {

// Get the size of the canvas

int width, height;

startSetPixel(0);

width = getSetPixelWidth();

height = getSetPixelHeight();

// Draw purple line at y = 100

for (int xp = 0; xp < width; xp++) {

setPixel(xp, 100, RGB(192,0,255));

}

// Duplicate at y = 200 line at y = 100

for (int xp = 0; xp < width; xp++) {

setPixel(xp, 200, getPixel(xp, 100));

}

endSetPixel(0);

return false;

}

</code>

== See Also ==

:startSetPixel, getPixel, endSetPixel

== Comments ==

:Everyone can add their comments about their experiences with this function here. Tips for using it are welcome, too.