Skip to content

FxPixel โ€‹

This module contains functions for making and editing FoxelPixel values.

Load โ€‹

lua
FxPixel = require "FxPixel";

Functions โ€‹

FunctionDescription
Create (Color, Material)Creates a pixel.
GetHeight (Pixel)Returns the height of a pixel.
GetColor (Pixel)Returns the color of a pixel.
GetMaterial (Pixel)Returns the material of a pixel.
SetHeight (Pixel, Value)Sets the height of a pixel.
SetColor (Pixel, Value)Sets the color of a pixel.
SetMaterial (Pixel, Value)Sets the material of a pixel.

Create (Color, Material) โ€‹

This function creates a pixel from the given color and material ItemIndex.

Parameters โ€‹

Returns โ€‹

The created FoxelPixel

Errors โ€‹

Possible errors include FX_ITEM_INDEX_INVALID

Since โ€‹

Version 1.0

Example โ€‹

lua
pixel = FxPixel.Create(10, 0);

GetHeight (Pixel) โ€‹

This function returns the height of the given pixel.

Parameters โ€‹

Returns โ€‹

The height

Errors โ€‹

Possible errors include FX_VALUE_INVALID

Since โ€‹

Version 1.0

Example โ€‹

lua
height = FxPixel.GetHeight(pixel);

GetColor (Pixel) โ€‹

This function returns the color ItemIndex of the given pixel. This index can be used for example with FxColorPalette to get the color properties.

Parameters โ€‹

Returns โ€‹

The color ItemIndex

Errors โ€‹

Possible errors include FX_VALUE_INVALID

Since โ€‹

Version 1.0

Example โ€‹

lua
colorid = FxPixel.GetColor(pixel); 
color = FxColorPalette.GetItemColor(colorid);

GetMaterial (Pixel) โ€‹

This function returns the material ItemIndex of the given pixel. This index can be used for example with FxMaterialSet to get the material properties.

Parameters โ€‹

Returns โ€‹

The material ItemIndex

Errors โ€‹

Possible errors include FX_VALUE_INVALID

Since โ€‹

Version 1.0

Example โ€‹

lua
material = FxPixel.GetMaterial(pixel); 
metallic = FxMaterialMap.GetItemMetallic(material);

SetHeight (Pixel, Value) โ€‹

This function changes the height of the given pixel and returns the updated pixel.

Parameters โ€‹

Returns โ€‹

The updated FoxelPixel

Errors โ€‹

Possible errors include FX_VALUE_INVALID

Since โ€‹

Version 1.0

Example โ€‹

lua
pixel = FxPixel.SetHeight(pixel, 100);

SetColor (Pixel, Value) โ€‹

This function changes the color of the given pixel and returns the updated pixel.

Parameters โ€‹

Returns โ€‹

The updated FoxelPixel

Errors โ€‹

Possible errors include FX_VALUE_INVALID, FX_ITEM_INDEX_INVALID

Since โ€‹

Version 1.0

Example โ€‹

lua
pixel = FxPixel.SetColor(pixel, 100);

SetMaterial (Pixel, Value) โ€‹

This function changes the material of the given pixel and returns the updated pixel.

Parameters โ€‹

Returns โ€‹

The updated FoxelPixel

Errors โ€‹

Possible errors include FX_VALUE_INVALID, FX_ITEM_INDEX_INVALID

Since โ€‹

Version 1.0

Example โ€‹

lua
pixel = FxPixel.SetMaterial(pixel, 2);