libnds
Data Structures | Typedefs | Functions | Variables

image.h File Reference

An image abstraction for working with image data. More...

#include <nds/arm9/video.h>
#include <nds/arm9/pcx.h>

Data Structures

struct  RGB_24
 holds a red green blue triplet More...
struct  sImage
 A generic image structure. More...

Typedefs

typedef struct sImage sImage
 A generic image structure.

Functions

struct RGB_24 __attribute__ ((packed)) RGB_24
 holds a red green blue triplet
void image24to16 (sImage *img)
 Converts a 24 bit image to 16 bit.
void image8to16 (sImage *img)
 Converts an 8 bit image to 16 bit setting the alpha bit.
void image8to16trans (sImage *img, u8 transparentColor)
 Converts an 8 bit image to 16 bit with alpha bit cleared for the supplied palette index.
void imageDestroy (sImage *img)
 frees the image data. Only call if the image data was returned from an image loader
void imageTileData (sImage *img)
 Tiles 8 bit image data into a sequence of 8x8 tiles.

Variables

unsigned char b
 8 bits for the blue value.
unsigned char g
 8 bits for the green value.
unsigned char r
 8 bits for the red value.

Detailed Description

An image abstraction for working with image data.

Image data pointers must be allocated using malloc as the conversion rutiens will free the pointers and allocate new data. As such any loader implemented utilizing this structure must use malloc() to allocate the image pointer data.

Function Documentation

struct RGB_24 __attribute__ ( (packed)  )

holds a red green blue triplet

holds a red green blue triplet

Theme/Color values:

  • 0 = Gray
  • 1 = Brown
  • 2 = Red
  • 3 = Pink
  • 4 = Orange
  • 5 = Yellow
  • 6 = Yellow/Green-ish
  • 7 = Green
  • 8 = Dark Green
  • 9 = Green/Blue-ish
  • 10 = Light Blue
  • 11 = Blue
  • 12 = Dark Blue
  • 13 = Dark Purple
  • 14 = Purple
  • 15 = Purple/Red-ish

Language values:

  • 0 = Japanese
  • 1 = English
  • 2 = French
  • 3 = German
  • 4 = Italian
  • 5 = Spanish
  • 6 = Chinese(?)
  • 7 = Unknown/Reserved

< User's language.

< GBA screen selection (lower screen if set, otherwise upper screen).

< Brightness level at power on, dslite.

< The DS should boot from the DS cart or GBA cart automatically if one is inserted.

< User Settings Lost (0=Normal, 1=Prompt/Settings Lost)

void image24to16 ( sImage img)

Converts a 24 bit image to 16 bit.

Parameters:
imga pointer to image to manipulate
void image8to16 ( sImage img)
void image8to16trans ( sImage img,
u8  transparentColor 
)

Converts an 8 bit image to 16 bit with alpha bit cleared for the supplied palette index.

Parameters:
imga pointer to image to manipulate
transparentColorColor indexes equal to this value will have the alpha bit clear
Examples:
Graphics/3D/nehe/lesson09/source/nehe9.cpp.
void imageDestroy ( sImage img)

frees the image data. Only call if the image data was returned from an image loader

Parameters:
imga pointer to image to manipulate (the image data will be free() )
Examples:
Graphics/3D/nehe/lesson06/source/nehe6.cpp, Graphics/3D/nehe/lesson07/source/nehe7.cpp, Graphics/3D/nehe/lesson08/source/nehe8.cpp, Graphics/3D/nehe/lesson09/source/nehe9.cpp, Graphics/3D/nehe/lesson10/source/nehe10.cpp, Graphics/3D/Ortho/source/main.cpp, and input/Touch_Pad/touch_look/source/main.cpp.
void imageTileData ( sImage img)

Tiles 8 bit image data into a sequence of 8x8 tiles.

Parameters:
imga pointer to image to manipulate
Examples:
Graphics/Sprites/fire_and_sprites/source/main.cpp.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines