Hatch Game Engine Documentation v1.4.0
The documentation for the Hatch Game Engine
Loading...
Searching...
No Matches
Palette Class Reference

Palette manipulation. More...

Public Member Functions

void EnablePaletteUsage (boolean usePalettes)
 Enables or disables palette usage for the application.
void LoadFromResource (integer paletteIndex, string filename, bitfield activeRows)
 Loads palette from an .act, .col, .gif, .png, or .hpal resource.
void LoadFromImage (integer paletteIndex, integer image)
 Loads palette from an image resource.
integer GetColor (integer paletteIndex, integer colorIndex)
 Gets a color from the specified palette.
void SetColor (integer paletteIndex, integer colorIndex, integer hex)
 Sets a color on the specified palette, format 0xRRGGBB.
boolean GetColorTransparent (integer paletteIndex, integer colorIndex)
 Gets if the color on the specified palette is transparent.
void SetColorTransparent (integer paletteIndex, integer colorIndex, boolean isTransparent)
 Sets a color on the specified palette transparent.
void MixPalettes (integer destinationPaletteIndex, integer paletteIndexA, integer paletteIndexB, number mixRatio, integer colorIndexStart, integer colorCount)
 Mixes colors between two palettes and outputs to another palette.
void RotateColorsLeft (integer paletteIndex, integer colorIndexStart, integer colorCount)
 Shifts the colors on the palette to the left.
void RotateColorsRight (integer paletteIndex, integer colorIndexStart, integer colorCount)
 Shifts the colors on the palette to the right.
void CopyColors (integer paletteIndexA, integer colorIndexStartA, integer paletteIndexB, integer colorIndexStartB, integer colorCount)
 Copies colors from Palette A to Palette B.
void UsePaletteIndexLines (boolean usePaletteIndexLines)
 Enables or disables the global palette index table.
void SetPaletteIndexLines (integer paletteIndex, number lineStart, number lineEnd)
 Sets the palette to be used for drawing on certain Y-positions on the screen (between the start and end lines).

Detailed Description

Palette manipulation.

Use Palette.EnablePaletteUsage to enable palettes.

Member Function Documentation

◆ CopyColors()

void Palette.CopyColors ( integer paletteIndexA,
integer colorIndexStartA,
integer paletteIndexB,
integer colorIndexStartB,
integer colorCount )

Copies colors from Palette A to Palette B.

Parameters
paletteIndexAIndex of palette to get colors from.
colorIndexStartAFirst index of colors to copy.
paletteIndexBIndex of palette to put colors to.
colorIndexStartBFirst index of colors to be placed.
colorCountAmount of colors to be copied.

◆ EnablePaletteUsage()

void Palette.EnablePaletteUsage ( boolean usePalettes)

Enables or disables palette usage for the application.

Parameters
usePalettesWhether to use palettes.

◆ GetColor()

integer Palette.GetColor ( integer paletteIndex,
integer colorIndex )

Gets a color from the specified palette.

Parameters
paletteIndexIndex of palette.
colorIndexIndex of color.
Returns
Returns an integer value.

◆ GetColorTransparent()

boolean Palette.GetColorTransparent ( integer paletteIndex,
integer colorIndex )

Gets if the color on the specified palette is transparent.

Parameters
paletteIndexIndex of palette.
colorIndexIndex of color.
Returns
Returns a boolean value.

◆ LoadFromImage()

void Palette.LoadFromImage ( integer paletteIndex,
integer image )

Loads palette from an image resource.

Parameters
paletteIndexIndex of palette to load to.
imageIndex of the loaded image.

◆ LoadFromResource()

void Palette.LoadFromResource ( integer paletteIndex,
string filename,
bitfield activeRows )

Loads palette from an .act, .col, .gif, .png, or .hpal resource.

Parameters
paletteIndexIndex of palette to load to.
filenameFilepath of resource.
activeRowsWhich rows of 16 colors will not be loaded for .act, .col, and .gif files, from bottom to top.

◆ MixPalettes()

void Palette.MixPalettes ( integer destinationPaletteIndex,
integer paletteIndexA,
integer paletteIndexB,
number mixRatio,
integer colorIndexStart,
integer colorCount )

Mixes colors between two palettes and outputs to another palette.

Parameters
destinationPaletteIndexIndex of palette to put colors to.
paletteIndexAFirst index of palette.
paletteIndexBSecond index of palette.
mixRatioPercentage to mix the colors between 0.0 - 1.0.
colorIndexStartFirst index of colors to mix.
colorCountAmount of colors to mix.

◆ RotateColorsLeft()

void Palette.RotateColorsLeft ( integer paletteIndex,
integer colorIndexStart,
integer colorCount )

Shifts the colors on the palette to the left.

Parameters
paletteIndexIndex of palette.
colorIndexStartFirst index of colors to shift.
colorCountAmount of colors to shift.

◆ RotateColorsRight()

void Palette.RotateColorsRight ( integer paletteIndex,
integer colorIndexStart,
integer colorCount )

Shifts the colors on the palette to the right.

Parameters
paletteIndexIndex of palette.
colorIndexStartFirst index of colors to shift.
colorCountAmount of colors to shift.

◆ SetColor()

void Palette.SetColor ( integer paletteIndex,
integer colorIndex,
integer hex )

Sets a color on the specified palette, format 0xRRGGBB.

Parameters
paletteIndexIndex of palette.
colorIndexIndex of color.
hexHexadecimal color value to set the color to. (format: 0xRRGGBB)

◆ SetColorTransparent()

void Palette.SetColorTransparent ( integer paletteIndex,
integer colorIndex,
boolean isTransparent )

Sets a color on the specified palette transparent.

Parameters
paletteIndexIndex of palette.
colorIndexIndex of color.
isTransparentWhether to make the color transparent.

◆ SetPaletteIndexLines()

void Palette.SetPaletteIndexLines ( integer paletteIndex,
number lineStart,
number lineEnd )

Sets the palette to be used for drawing on certain Y-positions on the screen (between the start and end lines).

Parameters
paletteIndexIndex of palette.
lineStartStart line to set to the palette.
lineEndLine where to stop setting the palette.

◆ UsePaletteIndexLines()

void Palette.UsePaletteIndexLines ( boolean usePaletteIndexLines)

Enables or disables the global palette index table.

Parameters
usePaletteIndexLinesWhether to use the global palette index table.