Type Function Return value none Revision Release 2024.3703 Keywords MemoryBitmap, setPixel See also MemoryBitmap MemoryBitmap:getPixel() memoryBitmap.newTexture() memoryBitmap.*
Sets a bitmap pixel to a specific color.
bitmap:setPixel( x, y, r, g, b, a ) bitmap:setPixel( x, y, color )
Numbers. The x and y pixel coordinates to be changed.
Numbers. The red, green, blue and alpha components to set the bitmap pixel to. Values should be in the range of 0
to 1
. Depending on the bitmap format
, some components may be ignored — for example, a format
of "rgb"
uses only r
, g
and b
, while a format
of "mask"
ignores everything but r
.
Table. As an alternative to passing r
, g
, b
, and a
component values, you may pass color components in a Lua array as noted in the example below.
nil
instead of a component value will keep that component unchanged.texture:setPixel( 10, 10, 1, 0, 0, 1 )
texture:setPixel( 10, 10, {1,0,0,1} )