Main Page | Modules | Related Pages

Palette Functions

Functions


Detailed Description

Details...

The Palette Functions module provides functions to load Palettes into Vram, save from Vram, as well as functions to manipulate Palettes. Most functions use DMA Channel 3 in 16BIT mode to transfer the data either to or from Vram.


Function Documentation

void hel_PalBgClear16 u32  PaletteBank  ) 
 

Set a background palette-bank to black.

The hel_PalBgClear16 function sets the background palette-bank specified by PaletteBank to black.

Parameters:
PaletteBank The palette-bank (0..15)
See also:
hel_PalBgClearEx, hel_PalBgClear256

void hel_PalBgClear256 void   ) 
 

Set entire background palette to black.

The hel_PalBgClear256 function sets the entire background palette to black.

See also:
hel_PalBgClearEx, hel_PalBgClear16

void hel_PalBgClearEx u32  StartIndex,
u32  EndIndex,
u32  R,
u32  G,
u32  B
 

Set entire background palette to a specific color.

This function sets all palette entries between and including StartIndex to EndIndex to the color specified in R, G and B.

Parameters:
StartIndex Index to start at (0..254)
EndIndex Index to end at (StartIndex+1..n)
R Red amount (0..255)
G Green amount (0..255)
B Blue amount (0..255)
See also:
hel_PalBgClear256, hel_PalBgClear16

void hel_PalBgInterpolate16 void *  pPaletteA,
void *  pPaletteB,
u32  PaletteBank,
u32  Step
 

Interpolate between 16 color background palettes.

The hel_PalBgInterpolate16 function interpolates between two 16 color background palettes and stores the interpolated RGB value into Vram.

Parameters:
pPaletteA Source colors
pPaletteB Target colors
PaletteBank Target palette bank of interpolated values. This can be between 0..15
Step Interpolation-Step. The Step can be between 0..31. 0 means colors are completely taken from pPaletteA, 31 means colors are completely taken from pPaletteB.
Note:
Interpolating between two palettes can be used to fake some kind of sunset for example. Use two palettes, one with colors how your level looks when it is day and one when it is night. Then simply interpolate between those palettes from level start to end. See sample project.
See also:
hel_PalBgInterpolate256

void hel_PalBgInterpolate256 void *  pPaletteA,
void *  pPaletteB,
u32  Step
 

Interpolate between 256 color background palettes.

The hel_PalBgInterpolate256 function interpolates between two 256 color background palettes and stores the interpolated RGB value into Vram.

Parameters:
pPaletteA Source colors
pPaletteB Target colors
Step Interpolation-Step. The Step can be between 0..31. 0 means colors are completely taken from pPaletteA, 31 means colors are completely taken from pPaletteB.
Note:
Interpolating between two palettes can be used to fake some kind of sunset for example. Use two palettes, one with colors how your level looks when it is day and one when it is night. Then simply interpolate between those palettes from level start to end. See sample project. This function is rather slow, it requires about 20% execution time of one frame.
See also:
hel_PalBgInterpolate16

void hel_PalBgInvert16 u32  PaletteBank  ) 
 

Invert colors of a 16 color background palette-bank.

The hel_PalBgInvert16 function inverts the colors of the background palette, specified by PaletteBank.

Parameters:
PaletteBank The palette-bank (0..15)
See also:
hel_PalBgInvertEx, hel_PalBgInvert256

void hel_PalBgInvert256 void   ) 
 

Invert colors of entire background palette.

This function inverts the entire background palette entries (colors)

See also:
hel_PalBgInvertEx, hel_PalBgInvert16

void hel_PalBgInvertEx u32  StartIndex,
u32  EndIndex
 

Invert a part of background palette.

This function inverts all background-palette colors between and including StartIndex and EndIndex.

Parameters:
StartIndex Index to start at (0..254)
EndIndex Index to end at (StartIndex+1..n)
See also:
hel_PalBgClear256, hel_PalBgClear16

void hel_PalBgLoad void *  SourceData,
u32  NumColors
 

Load a background palette.

The hel_PalBgLoad function loads a background palette.

Parameters:
SourceData Pointer to palette-data
NumColors Number of colors to load. The destination starting index is 0.

void hel_PalBgLoad16 void *  SourceData,
u32  PaletteBank
 

Load a 16 color background palette.

The hel_PalBgLoad16 function loads a 16 color background palette to the bank specified by PaletteBank

Parameters:
SourceData Pointer to palette-data
PaletteBank The palette-bank (0..15)
Note:
ham_LoadBGPal16 does not work from time to time. I didn't find out the reason for that, so I just made hel_PalBgLoad16 and use this one instead.

void hel_PalBgLoad16UnComp void *  SourceData,
u32  PaletteBank,
u32  CompressionType
 

Load a 16 color compressed background palette.

The hel_PalBgLoad256UnComp function loads a compressed 16 color background palette

Parameters:
SourceData Pointer to palette-data
PaletteBank The palette-bank (0..15)
CompressionType Type of Compression. See COMPRESSION_TYPE_* predefined values.
See also:
hel_PalBgLoad256UnComp, hel_PalBgLoad16, hel_SwiUnComp

void hel_PalBgLoad256 void *  SourceData  ) 
 

Load a 256 color background palette.

The hel_PalBgLoad256 function loads a 256 color background palette

Parameters:
SourceData Pointer to palette-data

void hel_PalBgLoad256UnComp void *  SourceData,
u32  CompressionType
 

Load a 256 color compressed background palette.

The hel_PalBgLoad256UnComp function loads a compressed 256 color background palette

Parameters:
SourceData Pointer to palette-data
CompressionType Type of Compression. See COMPRESSION_TYPE_* predefined values.
See also:
hel_PalBgLoad16UnComp, hel_PalBgLoad256, hel_SwiUnComp

void hel_PalBgSave16 void *  pDest,
u32  PaletteBank
 

Save a 16 color background palette.

The hel_PalObjSave16 function copies a 16 color background palette from VRAM to the memory location specified by pDest.

Parameters:
pDest Destination address, must point to an allocated buffer of at least 16 halfwords (u16's).
PaletteBank Source palette-bank (0..15)

void hel_PalBgSave256 void *  pDest  ) 
 

Save a 256 color background palette.

The hel_PalBgSave256 function copies the 256 color background palette from VRAM to the memory location specified by pDest.

Parameters:
pDest Destination address, must point to an allocated buffer of at least 256 halfwords (u16's).

void hel_PalObjLoad void *  SourceData,
u32  NumColors
 

Load an object palette.

The hel_PalObjLoad function loads an object palette.

Parameters:
SourceData Pointer to palette-data
NumColors Number of colors to load. The destination starting index is 0.

void hel_PalObjLoad16 void *  SourceData,
u32  PaletteBank
 

Load a 16 color object palette.

The hel_PalObjLoad16 function loads a 16 color object palette to the bank specified by PaletteBank

Parameters:
SourceData Pointer to palette-data
PaletteBank The palette-bank (0..15)
Note:
ham_LoadObjPal16 does not work from time to time. I didn't find out the reason for that, so I just made hel_PalObjLoad16 and use this one instead.

void hel_PalObjLoad16UnComp void *  SourceData,
u32  PaletteBank,
u32  CompressionType
 

Load a 16 color compressed object palette.

The hel_PalObjLoad16UnComp function loads a compressed 16 color object palette

Parameters:
SourceData Pointer to palette-data
PaletteBank The palette-bank (0..15)
CompressionType Type of Compression. See COMPRESSION_TYPE_* predefined values.
See also:
hel_PalObjLoad256UnComp, hel_PalObjLoad16, hel_SwiUnComp

void hel_PalObjLoad256 void *  SourceData  ) 
 

Load a 256 color object palette.

The hel_PalObjLoad256 function loads a 256 color object palette

Parameters:
SourceData Pointer to palette-data

void hel_PalObjLoad256UnComp void *  SourceData,
u32  CompressionType
 

Load a 256 color compressed object palette.

The hel_PalObjLoad256UnComp function loads a compressed 256 color object palette

Parameters:
SourceData Pointer to palette-data
CompressionType Type of Compression. See COMPRESSION_TYPE_* predefined values.
See also:
hel_PalObjLoad16UnComp, hel_PalObjLoad256, hel_SwiUnComp

void hel_PalObjSave16 void *  pDest,
u32  PaletteBank
 

Save a 16 color object palette.

The hel_PalObjSave16 function copies a 16 color object palette from VRAM to the memory location specified by pDest.

Parameters:
pDest Destination address, must point to an allocated buffer of at least 16 halfwords (u16's).
PaletteBank Source palette-bank (0..15)

void hel_PalObjSave256 void *  pDest  ) 
 

Save a 256 color object palette.

The hel_PalObjSave256 function copies the 256 color object palette from VRAM to the memory location specified by pDest.

Parameters:
pDest Destination address, must point to an allocated buffer of at least 256 halfwords (u16's).


Generated on Mon Aug 22 20:43:41 2005 by DoxyGen 1.4.4