You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changes the color of any pixel or writes an image directly into the display window.<br />
<br />
The <b>x</b> and <b>y</b> parameters specify the pixel to change and the <b>color</b> parameter specifies the color value. The color parameter is affected by the current color mode (the default is RGB values from 0 to 255). When setting an image, the <b>x</b> and <b>y</b> parameters define the coordinates for the upper-left corner of the image, regardless of the current <b>imageMode()</b>.
<br /><br />
Setting the color of a single pixel with <b>set(x, y)</b> is easy, but not as fast as putting the data directly into <b>pixels</b>. The equivalent statement to <b>set(x, y, #000000)</b> using <b>pixels</b> is <b>pixels[y*width+x] = #000000</b>. See the reference for <b>pixels</b> for more information.
]]></description>
<syntax>
<c>pimg</c>.set(<c>x</c>, <c>y</c>, <c>c</c>)
<c>pimg</c>.set(<c>x</c>, <c>y</c>, <c>img</c>)
</syntax>
<parameter>
<label>pimg</label>
<description><![CDATA[PImage: any object of type PImage]]></description>
</parameter>
<parameter>
<label>x</label>
<description><![CDATA[int: x-coordinate of the pixel]]></description>
</parameter>
<parameter>
<label>y</label>
<description><![CDATA[int: y-coordinate of the pixel]]></description>
</parameter>
<parameter>
<label>c</label>
<description><![CDATA[int: any value of the color datatype]]></description>
</parameter>
<parameter>
<label>img</label>
<description><![CDATA[PImage: image to copy into the original image]]></description>