Skip to content

texture

dragekk edited this page Feb 16, 2023 · 3 revisions

Texture api (very similiar to figura textures api)

saved global variables with name texture

textureApi.read(base64)

converts base64 into texture

textureApi.newTexture(width, height)

creates new texture

Texture object (this is also very similiar to figura texture object)

object that is texture

texture:getDimensions()

returns texture dimensions as vec2

texture:getPixel(x, y)

returns rgba color of pixel at x, y

texture:setPixel(x, y, color)

sets pixel at x, y to color

texture:fill(x, y, width, height, color)

sets specified region to color

texture:applyFunc(x, y, width, height, func)

applies function to specified region function gets 3 arguments: x, y, color returned color will be used as new color, if no color returned pixel will not change

texture:save()

converts texture into base64

texture:copy()

creates copy of texture