Difference between revisions of "Palette Functions"

From Archaic Pixels
Jump to: navigation, search
(Created page with "** PALETTE FUNCTIONS ** ----------------------- set_color(int num, int rgb); Set the specified color (0-511) to the given rgb-value. set_color_rgb(int num, ch...")
 
Line 1: Line 1:
** PALETTE FUNCTIONS **
+
{{:HuC Function Style}}
 
+
= Palette Functions =
-----------------------
+
 
+
 
+
 
+
  set_color(int num, int rgb);
+
 
+
  
  
 +
== set_color ==
 +
{|
 +
|-
 +
! void set_color(int num, int rgb);
 +
|-
 +
|
 
       Set the specified color (0-511) to the given rgb-value.
 
       Set the specified color (0-511) to the given rgb-value.
 +
|}
  
  
 
+
== set_color_rgb ==
  set_color_rgb(int num, char r, char g, char b);
+
{|
 
+
|-
 
+
! void set_color_rgb(int num, char r, char g, char b);
 
+
|-
 +
|
 
       Set the specified color to the given rgb component
 
       Set the specified color to the given rgb component
 
 
       values. This function is easier to use than set_color(),
 
       values. This function is easier to use than set_color(),
 
 
       but it is slower.
 
       but it is slower.
 +
|}
  
  
 
+
== get_color ==
  get_color(int num);
+
{|
 
+
|-
 
+
! int get_color(int num);
 
+
|-
 +
|
 
       Retrieve the rgb-value of the specified color.
 
       Retrieve the rgb-value of the specified color.
 +
|}
  
  
 
+
== load_palette ==
  load_palette(char pal_num, int *pal, char nb_pal);
+
{|
 
+
|-
 
+
! void load_palette(char pal_num, int *pal, char nb_pal);
 
+
|-
 +
|
 
       Load one or more 16-color palette-blocks at once.
 
       Load one or more 16-color palette-blocks at once.
  
 
       'pal_num' is the index of the first block (0-31)
 
       'pal_num' is the index of the first block (0-31)
 
 
       to load, and 'nb_pal' the number of block.
 
       to load, and 'nb_pal' the number of block.
  
 
       This function can be used to load palette defined
 
       This function can be used to load palette defined
 
 
       using #defpal or included with #incpal directive.
 
       using #defpal or included with #incpal directive.
 +
|}
  
  
 
+
== set_sprpal ==
  set_sprpal(char pal_num, int *pal);
+
{|
 
+
|-
  set_sprpal(char pal_num, int *pal, int nb_pal);
+
! void set_sprpal(char pal_num, int *pal);
 
+
|-
 
+
! void set_sprpal(char pal_num, int *pal, int nb_pal);
 
+
|-
 +
|
 
       Exactly the same function has load_palette(),
 
       Exactly the same function has load_palette(),
 
 
       but this function offers direct access to sprite
 
       but this function offers direct access to sprite
 
 
       palette-blocks. Sprite palette-blocks are
 
       palette-blocks. Sprite palette-blocks are
 
 
       standard block number 16 to 31, but with this function
 
       standard block number 16 to 31, but with this function
 
 
       you can simply access them with indexes 0 to 15.
 
       you can simply access them with indexes 0 to 15.
  
 
       This function and set_bgpal() function make sprite
 
       This function and set_bgpal() function make sprite
 
 
       and character palette-blocks manipulation easier;
 
       and character palette-blocks manipulation easier;
 
 
       with them you don't have to know the real block indexes.
 
       with them you don't have to know the real block indexes.
  
 
       Without the third arguments, the function loads
 
       Without the third arguments, the function loads
 
 
       only one block.
 
       only one block.
 +
|}
  
  
 
+
== set_bgpal ==
  set_bgpal(char pal_num, int *pal);
+
{|
 
+
|-
  set_bgpal(char pal_num, int *pal, int nb_pal);
+
! void set_bgpal(char pal_num, int *pal);
 
+
|-
 
+
! void set_bgpal(char pal_num, int *pal, int nb_pal);
 
+
|-
 +
|
 
       Same function as set_sprpal() but for character
 
       Same function as set_sprpal() but for character
 
 
       palette-blocks.
 
       palette-blocks.
 +
|}

Revision as of 21:38, 12 September 2010

Palette Functions

set_color

void set_color(int num, int rgb);
     Set the specified color (0-511) to the given rgb-value.


set_color_rgb

void set_color_rgb(int num, char r, char g, char b);
     Set the specified color to the given rgb component
     values. This function is easier to use than set_color(),
     but it is slower.


get_color

int get_color(int num);
     Retrieve the rgb-value of the specified color.


load_palette

void load_palette(char pal_num, int *pal, char nb_pal);
     Load one or more 16-color palette-blocks at once.
     'pal_num' is the index of the first block (0-31)
     to load, and 'nb_pal' the number of block.
     This function can be used to load palette defined
     using #defpal or included with #incpal directive.


set_sprpal

void set_sprpal(char pal_num, int *pal);
void set_sprpal(char pal_num, int *pal, int nb_pal);
     Exactly the same function has load_palette(),
     but this function offers direct access to sprite
     palette-blocks. Sprite palette-blocks are
     standard block number 16 to 31, but with this function
     you can simply access them with indexes 0 to 15.
     This function and set_bgpal() function make sprite
     and character palette-blocks manipulation easier;
     with them you don't have to know the real block indexes.
     Without the third arguments, the function loads
     only one block.


set_bgpal

void set_bgpal(char pal_num, int *pal);
void set_bgpal(char pal_num, int *pal, int nb_pal);
     Same function as set_sprpal() but for character
     palette-blocks.