Skip to content

niPixelData⚓︎

Represents 2D arrays of pixel values, as well as pyramids of multiple mipmap levels, each of 2D arrays of pixel values. Also contains information representing the format of the pixels and dimensions of the arrays.

This type inherits the following: niObject

Properties⚓︎

bytesPerPixel⚓︎

Read-only. The number of bytes per pixel.

Returns:

  • result (number)

mipMapLevels⚓︎

Read-only. The number of MipMap levels.

Returns:

  • result (number)

refCount⚓︎

Read-only. The number of references that exist for this object. When this value reaches zero, the object will be deleted.

Returns:

  • result (number)

RTTI⚓︎

Read-only. The runtime type information for this object. This is an alias for the .runTimeTypeInformation property.

Returns:


runTimeTypeInformation⚓︎

Read-only. The runtime type information for this object.

Returns:


Methods⚓︎

clone⚓︎

Creates a copy of this object.

local result = myObject:clone()

Returns:


createSourceTexture⚓︎

Creates a source texture from the current NiPixelData object.

local result = myObject:createSourceTexture()

Returns:


fill⚓︎

Fills this pixel data with the provided color.

myObject:fill(data, mipMapLevel)

Parameters:

  • data (number[]): The color data to be set (1-indexed). The values should be in range [0.0, 1.0]. The first three values are RGB color channels, while the last one is alpha channel. The array length must be equal to the bytesPerPixel property of this niPixelData object, because alpha can be assigned only to the niPixelData object that has an alpha channel.
  • mipMapLevel (number): Default: 0. The mipmap level to fill with the provided color. The finest (largest) mipmap level is level 0.

getHeight⚓︎

Returns the height of the mipmap level at the given index, where level 1 is the finest (largest) mipmap level, and level mipMapLevels is the coarsest (smallest) mipmap level.

local result = myObject:getHeight(mipMapLevel)

Parameters:

  • mipMapLevel (number): Default: 1.

Returns:

  • result (number)

getWidth⚓︎

Returns the width of the mipmap level at the given index, where level 1 is the finest (largest) mipmap level, and level mipMapLevels is the coarsest (smallest) mipmap level.

local result = myObject:getWidth(mipMapLevel)

Parameters:

  • mipMapLevel (number): Default: 1.

Returns:

  • result (number)

isInstanceOfType⚓︎

Determines if the object is of a given type, or of a type derived from the given type.

local result = myObject:isInstanceOfType(type)

Parameters:

Returns:

  • result (boolean)

isOfType⚓︎

Determines if the object is of a given type.

local result = myObject:isOfType(type)

Parameters:

Returns:

  • result (boolean)

saveBinary⚓︎

Serializes the object, and writes it to the given file.

local success = myObject:saveBinary(path)

Parameters:

  • path (string): The path to write the file at, relative to the Morrowind installation folder.

Returns:

  • success (boolean): If true the object was successfully serialized.

setPixelsByte⚓︎

Sets the pixel data from byte data.

myObject:setPixelsByte(data, mipMapLevel)

Parameters:

  • data (number[]): The byte data to be set to (1-indexed).
  • mipMapLevel (number): Default: 0. The mipmap level whose data to modify. The finest (largest) mipmap level is level 0.

setPixelsFloat⚓︎

Sets the pixel data from float data.

myObject:setPixelsFloat(data, mipMapLevel)

Parameters:

  • data (number[]): The float data to be set to (1-indexed). The values should be in range [0.0, 1.0].
  • mipMapLevel (number): Default: 0. The mipmap level whose data to modify. The finest (largest) mipmap level is level 0.

Functions⚓︎

new⚓︎

Creates a new NiPixelData object.

local pixelData = niPixelData.new(width, height, mipMapLevels)

Parameters:

  • width (number)
  • height (number)
  • mipMapLevels (number): Default: 1.

Returns: