MemoryBitmap:setPixel()

Type Function
Return value none
Revision 2017.3060
Keywords MemoryBitmap, setPixel
See also MemoryBitmap
MemoryBitmap:getPixel()
memoryBitmap.newTexture()
memoryBitmap.*

Overview

Sets a bitmap pixel to a specific color.

Syntax

bitmap:setPixel( x, y, r, g, b, a )
bitmap:setPixel( x, y, color )
x, y (required)

Numbers. The x and y pixel coordinates to be changed.

r, g, b, a (required)

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.

color (required)

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.

Gotchas

Examples

Individual Components
texture:setPixel( 10, 10, 1, 0, 0, 1 )
Lua Array
texture:setPixel( 10, 10, {1,0,0,1} )