openTRI 0.1
|
Data Structures | |
struct | triImageFileHeader |
Image File Header. More... | |
struct | triImageChunkHeader |
struct | triImageChunk |
struct | triMipLevel |
struct | triImage |
Image struct. More... | |
struct | triImageSlice |
Image slice struct. More... | |
struct | triImageLarge |
Large Image struct. More... | |
struct | triImageAnimation |
ImageAnimation struct. More... |
Macros | |
#define | IMG_FORMAT_5650 GU_PSM_5650 |
Pixelformat R5:G6:B5:A0. | |
#define | IMG_FORMAT_5551 GU_PSM_5551 |
Pixelformat R5:G5:B5:A1. | |
#define | IMG_FORMAT_4444 GU_PSM_4444 |
Pixelformat R4:G4:B4:A4. | |
#define | IMG_FORMAT_8888 GU_PSM_8888 |
Pixelformat R8:G8:B8:A8. | |
#define | IMG_FORMAT_T4 GU_PSM_T4 |
Pixelformat 4bit indexed. | |
#define | IMG_FORMAT_T8 GU_PSM_T8 |
Pixelformat 8bit indexed. | |
#define | IMG_FORMAT_T16 GU_PSM_T16 |
Pixelformat 16bit indexed. | |
#define | IMG_FORMAT_T32 GU_PSM_T32 |
Pixelformat 32bit indexed. | |
#define | IMG_FORMAT_DXT1 GU_PSM_DXT1 |
Pixelformat DXT1 compressed. | |
#define | IMG_FORMAT_DXT3 GU_PSM_DXT3 |
Pixelformat DXT3 compressed. | |
#define | IMG_FORMAT_DXT5 GU_PSM_DXT5 |
Pixelformat DXT5 compressed. | |
#define | TRI_RAM 0x0000 |
Load image in system ram. | |
#define | TRI_VRAM 0x0001 |
Load image in VRAM. | |
#define | TRI_SWIZZLE 0x0002 |
Swizzle image. | |
#define | TRI_FRAME(x) |
Load frame number x [0-2097151] from file (only for .tri) | |
#define | TRI_LEVEL(x) |
Load level number x [0-7] from file (only for .tri) | |
#define | TRI_IMG_FLAGS_SWIZZLE 0x0001 |
Swizzled image data. | |
#define | TRI_IMG_FLAGS_RLE 0x0002 |
RLE compressed image data. | |
#define | TRI_IMG_FLAGS_GZIP 0x0004 |
GZIP compressed image data. | |
#define | TRI_IMG_FLAGS_WAVELET 0x0008 |
Wavelet compressed image data (stores mipmaps as integral part of the actual image) | |
#define | PACKED __attribute__((packed)) |
Functions | |
struct triImageFileHeader | __attribute__ ((packed)) triImageFileHeader |
Image File Header. | |
triVoid | triImagePaletteGet (triImage *img, triU32 col, triU32 *r, triU32 *g, triU32 *b, triU32 *a) |
Get a palette entry from image. | |
triVoid | triImagePaletteSet (triImage *img, triU32 col, triU32 r, triU32 g, triU32 b, triU32 a) |
Set a palette entry in image. | |
triVoid | triImageSwizzleToVRAM (triImage *img) |
Swizzle and upload an image to VRAM for faster drawing. | |
triVoid | triImageSwizzle (triImage *img) |
Swizzle an image for faster drawing. | |
triVoid | triImageUnswizzle (triImage *img) |
Unswizzle an image. | |
triVoid | triImageToVRAM (triImage *img) |
Upload an image to VRAM for faster drawing. | |
triVoid | triImageToRAM (triImage *img) |
Download an image to RAM. | |
triVoid | triImageFree (triImage *img) |
Free an image. | |
triVoid | triImageAnimationFree (triImageAnimation *img) |
Free an image animation. | |
triImage * | triImageGet (triS32 x, triS32 y, triS32 width, triS32 height) |
Capture part of framebuffer to image. | |
triImage * | triImageSet (triS32 width, triS32 height, triS32 stride, triS32 bits, triS32 psm, triVoid *data) |
Create an image from a memory buffer. | |
triImage * | triImageLoadRaw (triChar *name) |
Load image from a .raw file. | |
triImage * | triImageLoadRawStream (stream *s) |
Load RAW image from a stream. | |
triImage * | triImageLoadTga (triChar *name) |
Load image from a .tga file. | |
triImage * | triImageLoadTgaStream (stream *s) |
Load TGA image from a stream. | |
triImage * | triImageLoadTri (triChar *name, triU32 frame) |
Load image from a .tri file. | |
triImage * | triImageLoadTriStream (stream *s, triU32 frame) |
Load TRI image from a stream. | |
triImage * | triImageLoad (triChar *name, triU32 flags) |
Generic file loader. | |
triImage * | triImageLoadStream (stream *s, triU32 flags) |
Generic stream file loader. | |
triVoid | triImageSaveTga (triChar *name, triImage *img, triS32 saveAlpha, triS32 rle) |
Save image to a .tga file. | |
triVoid | triImageSaveTri (triChar *name, triImage *img, triU32 flags) |
Save image to a .tri file. | |
triImageAnimation * | triImageAnimationCreate () |
Create a new blank triImageAnimation structure. | |
triImageAnimation * | triImageAnimationFromSheet (triImage *img, triS32 fwidth, triS32 fheight, triS32 hframes, triS32 vframes, triU32 delay) |
Create an animation from an imagesheet in order left-right, top-down. | |
triImageAnimation * | triImageAnimationFromSheet2 (triImage *img, triS32 xoffs, triS32 yoffs, triS32 fwidth, triS32 fheight, triS32 hframes, triS32 vframes, triU32 delay) |
Create an animation from an imagesheet in order left-right, top-down. | |
triImageAnimation * | triImageAnimationFromSheetTga (triChar *name, triS32 fwidth, triS32 fheight, triS32 hframes, triS32 vframes, triU32 delay) |
Create an animation from an imagesheet in a Tga file, in order left-right, top-down. | |
triImageAnimation * | triImageAnimationFromSheetFile (triChar *name, triS32 fwidth, triS32 fheight, triS32 hframes, triS32 vframes, triU32 delay) |
Create an animation from an imagesheet in a file, in order left-right, top-down. | |
triImageAnimation * | triImageAnimationFromSheetFile2 (triChar *name, triS32 xoffs, triS32 yoffs, triS32 fwidth, triS32 fheight, triS32 hframes, triS32 vframes, triU32 delay) |
Create an animation from an imagesheet in a file, in order left-right, top-down. | |
triVoid | triImageAnimationAppend (triImageAnimation *ani, triImage *img, triS32 sx, triS32 sy, triS32 sw, triS32 sh, triS32 x_offs, triS32 y_offs, triU32 delay) |
Append a loaded triImage as last frame to an animation. | |
triVoid | triImageAnimationAppend2 (triImageAnimation *ani, triImage *img, triU32 delay) |
Append a loaded triImage as last frame to an animation. | |
triVoid | triImageAnimationAppend3 (triImageAnimation *ani, triImage *img, triS32 xOffs, triS32 yOffs, triU32 delay) |
Append a loaded triImage as last frame to an animation. | |
triImageAnimation * | triImageAnimationLoadGif (triChar *name) |
triImageAnimation * | triImageAnimationLoadGifStream (stream *s) |
triImageAnimation * | triImageAnimationLoadTri (triChar *name) |
Load image animation from a .tri file. | |
triImageAnimation * | triImageAnimationLoadTriStream (stream *s) |
Load image animation from a stream. | |
void | triImageAnimationSaveTri (triChar *name, triImageAnimation *ani, triS32 flags) |
Save image animation to a .tri file. | |
triVoid | triImageAnimationStart (triImageAnimation *ani) |
Start animation. | |
triVoid | triImageAnimationPause (triImageAnimation *ani) |
Pause animation. | |
triVoid | triImageAnimationReset (triImageAnimation *ani) |
Reset animation (Stop+Rewind). | |
triS32 | triImageAnimationUpdate (triImageAnimation *ani) |
Update animation. | |
triVoid | triImageAnimationSetSpeed (triImageAnimation *ani, triFloat factor) |
Set animation speed. | |
triBool | triImageAnimationIsDone (triImageAnimation *ani) |
Return if animation is finished. | |
triImage * | triImageAnimationGetFrame (triImageAnimation *ani, triS32 nFrame) |
Return one frame from animation. |
#define TRI_FRAME | ( | x | ) |
Load frame number x [0-2097151] from file (only for .tri)
#define TRI_LEVEL | ( | x | ) |
Load level number x [0-7] from file (only for .tri)
struct triImageFileHeader __attribute__ | ( | (packed) | ) |
Image File Header.
ImageAnimation struct.
Large Image struct.
Image slice struct.
Image struct.
Max 1024xN.
Contains an image region of max 512x512 pixels.
Used to load and draw large images.
triVoid triImagePaletteGet | ( | triImage * | img, |
triU32 | col, | ||
triU32 * | r, | ||
triU32 * | g, | ||
triU32 * | b, | ||
triU32 * | a ) |
Get a palette entry from image.
*img | - Pointer to image containing the palette |
col | - Palette entry index |
*r | - Pointer to U32 to contain the red component (0-255) |
*g | - Pointer to U32 to contain the green component (0-255) |
*b | - Pointer to U32 to contain the blue component (0-255) |
triVoid triImagePaletteSet | ( | triImage * | img, |
triU32 | col, | ||
triU32 | r, | ||
triU32 | g, | ||
triU32 | b, | ||
triU32 | a ) |
Set a palette entry in image.
*img | - Pointer to image containing the palette |
col | - Palette entry index |
r | - Red component (0-255) |
g | - Green component (0-255) |
b | - Blue component (0-255) |
triVoid triImageSwizzleToVRAM | ( | triImage * | img | ) |
Swizzle and upload an image to VRAM for faster drawing.
*img | - Pointer to image |
triVoid triImageSwizzle | ( | triImage * | img | ) |
Swizzle an image for faster drawing.
*img | - Pointer to image |
triVoid triImageUnswizzle | ( | triImage * | img | ) |
Unswizzle an image.
*img | - Pointer to image |
triVoid triImageToVRAM | ( | triImage * | img | ) |
Upload an image to VRAM for faster drawing.
*img | - Pointer to image |
triVoid triImageToRAM | ( | triImage * | img | ) |
Download an image to RAM.
*img | - Pointer to image |
triVoid triImageFree | ( | triImage * | img | ) |
Free an image.
*img | - Pointer to image |
triVoid triImageAnimationFree | ( | triImageAnimation * | img | ) |
Free an image animation.
*img | - Pointer to image animation |
triImage * triImageGet | ( | triS32 | x, |
triS32 | y, | ||
triS32 | width, | ||
triS32 | height ) |
Capture part of framebuffer to image.
x | - X-coordinate of rect to capture |
y | - Y-coordinate of rect to capture |
width | - Width of rect to capture |
height | - Height of rect to capture |
triImage * triImageSet | ( | triS32 | width, |
triS32 | height, | ||
triS32 | stride, | ||
triS32 | bits, | ||
triS32 | psm, | ||
triVoid * | data ) |
Create an image from a memory buffer.
width | - Width of image |
height | - Height of image |
stride | - Allocated width of image (buffer width) |
bits | - Bits of image |
psm | - Format of image - one of IMG_FORMAT_* |
data | - Pointer to memory containing the image data |
triImage * triImageLoadRaw | ( | triChar * | name | ) |
Load image from a .raw file.
name | - Filename of file to load |
Load RAW image from a stream.
s | - Opened stream to read from |
triImage * triImageLoadTga | ( | triChar * | name | ) |
Load image from a .tga file.
name | - Filename of file to load |
Load TGA image from a stream.
s | - Opened stream to read from |
triImage * triImageLoadTri | ( | triChar * | name, |
triU32 | frame ) |
Load image from a .tri file.
name | - Filename of file to load |
frame | - Frame number of file to load |
level | - Sublevel to load (0-7) |
Load TRI image from a stream.
s | - Opened stream to read from |
frame | - Frame number of file to load |
level | - Sublevel to load (0-7) |
triImage * triImageLoad | ( | triChar * | name, |
triU32 | flags ) |
Generic file loader.
Loads .tga, .tri and .png.
name | - Filename of file to load |
flags | - flags to apply to the image (one of TRI_RAM/TRI_VRAM/TRI_SWIZZLE) |
Generic stream file loader.
Loads .tga, .tri and .png.
s | - Stream to load from |
flags | - flags to apply to the image (one of TRI_RAM/TRI_VRAM/TRI_SWIZZLE) |
triVoid triImageSaveTga | ( | triChar * | name, |
triImage * | img, | ||
triS32 | saveAlpha, | ||
triS32 | rle ) |
Save image to a .tga file.
name | - Filename of file to save |
img | - Pointer to image to save |
saveAlpha | - Whether to save the alpha channel with the image |
rle | - Whether to RLE compress image |
triVoid triImageSaveTri | ( | triChar * | name, |
triImage * | img, | ||
triU32 | flags ) |
Save image to a .tri file.
name | - Filename of file to save |
img | - Pointer to image to save |
flags | - any combination of TRI_IMG_FLAGS_* |
triImageAnimation * triImageAnimationCreate | ( | ) |
Create a new blank triImageAnimation structure.
triImageAnimation * triImageAnimationFromSheet | ( | triImage * | img, |
triS32 | fwidth, | ||
triS32 | fheight, | ||
triS32 | hframes, | ||
triS32 | vframes, | ||
triU32 | delay ) |
Create an animation from an imagesheet in order left-right, top-down.
img | - Pointer to triImage containing spritesheet |
fwidth | - Width of one frame in sheet |
fheight | - Height of one frame in sheet |
hframes | - Number of horizontal frames |
vframes | - Number of vertical frames |
delay | - Delay to apply per frame, given in ms |
triImageAnimation * triImageAnimationFromSheet2 | ( | triImage * | img, |
triS32 | xoffs, | ||
triS32 | yoffs, | ||
triS32 | fwidth, | ||
triS32 | fheight, | ||
triS32 | hframes, | ||
triS32 | vframes, | ||
triU32 | delay ) |
Create an animation from an imagesheet in order left-right, top-down.
img | - Pointer to triImage containing spritesheet |
xoffs | - X offset where the frames should start |
yoffs | - Y offset where the frames should start |
fwidth | - Width of one frame in sheet |
fheight | - Height of one frame in sheet |
hframes | - Number of horizontal frames |
vframes | - Number of vertical frames |
delay | - Delay to apply per frame, given in ms |
triImageAnimation * triImageAnimationFromSheetTga | ( | triChar * | name, |
triS32 | fwidth, | ||
triS32 | fheight, | ||
triS32 | hframes, | ||
triS32 | vframes, | ||
triU32 | delay ) |
Create an animation from an imagesheet in a Tga file, in order left-right, top-down.
name | - Filename of Tga image to load from. |
fwidth | - Width of one frame in sheet |
fheight | - Height of one frame in sheet |
hframes | - Number of horizontal frames |
vframes | - Number of vertical frames |
delay | - Delay to apply per frame, given in ms |
triImageAnimation * triImageAnimationFromSheetFile | ( | triChar * | name, |
triS32 | fwidth, | ||
triS32 | fheight, | ||
triS32 | hframes, | ||
triS32 | vframes, | ||
triU32 | delay ) |
Create an animation from an imagesheet in a file, in order left-right, top-down.
name | - Filename of image to load from. |
fwidth | - Width of one frame in sheet |
fheight | - Height of one frame in sheet |
hframes | - Number of horizontal frames |
vframes | - Number of vertical frames |
delay | - Delay to apply per frame, given in ms |
triImageAnimation * triImageAnimationFromSheetFile2 | ( | triChar * | name, |
triS32 | xoffs, | ||
triS32 | yoffs, | ||
triS32 | fwidth, | ||
triS32 | fheight, | ||
triS32 | hframes, | ||
triS32 | vframes, | ||
triU32 | delay ) |
Create an animation from an imagesheet in a file, in order left-right, top-down.
name | - Filename of image to load from. |
xoffs | - X offset where the frames should start |
yoffs | - Y offset where the frames should start |
fwidth | - Width of one frame in sheet |
fheight | - Height of one frame in sheet |
hframes | - Number of horizontal frames |
vframes | - Number of vertical frames |
delay | - Delay to apply per frame, given in ms |
triVoid triImageAnimationAppend | ( | triImageAnimation * | ani, |
triImage * | img, | ||
triS32 | sx, | ||
triS32 | sy, | ||
triS32 | sw, | ||
triS32 | sh, | ||
triS32 | x_offs, | ||
triS32 | y_offs, | ||
triU32 | delay ) |
Append a loaded triImage as last frame to an animation.
ani | - Pointer to triAnimationImage to append the image to |
img | - Pointer to triImage to append |
sx | - X-coordinate of source image rect |
sy | - Y-coordinate of source image rect |
sw | - Width of source image rect |
sh | - Height of source image rect |
x_offs | - Offset in X-coordinate to draw the image |
y_offs | - Offset in Y-coordinate to draw the image |
delay | - Delay to apply per frame, given in ms |
triVoid triImageAnimationAppend2 | ( | triImageAnimation * | ani, |
triImage * | img, | ||
triU32 | delay ) |
triVoid triImageAnimationAppend3 | ( | triImageAnimation * | ani, |
triImage * | img, | ||
triS32 | xOffs, | ||
triS32 | yOffs, | ||
triU32 | delay ) |
Append a loaded triImage as last frame to an animation.
ani | - Pointer to triAnimationImage to append the image to |
img | - Pointer to triImage to append |
x_offs | - Offset in X-coordinate to draw the image |
y_offs | - Offset in Y-coordinate to draw the image |
delay | - Delay to apply per frame, given in ms |
triImageAnimation * triImageAnimationLoadTri | ( | triChar * | name | ) |
Load image animation from a .tri file.
name | - Filename of file to load |
triImageAnimation * triImageAnimationLoadTriStream | ( | stream * | s | ) |
Load image animation from a stream.
s | - Opened stream to read from |
void triImageAnimationSaveTri | ( | triChar * | name, |
triImageAnimation * | ani, | ||
triS32 | flags ) |
Save image animation to a .tri file.
name | - Filename of file to save |
ani | - Pointer to triImageAnimation structure to save |
flags | - any combination of TRI_IMG_FLAGS_* |
triVoid triImageAnimationStart | ( | triImageAnimation * | ani | ) |
Start animation.
ani | - Pointer to triAnimationImage |
triVoid triImageAnimationPause | ( | triImageAnimation * | ani | ) |
Pause animation.
ani | - Pointer to triAnimationImage |
triVoid triImageAnimationReset | ( | triImageAnimation * | ani | ) |
Reset animation (Stop+Rewind).
ani | - Pointer to triAnimationImage |
triS32 triImageAnimationUpdate | ( | triImageAnimation * | ani | ) |
Update animation.
ani | - Pointer to triAnimationImage |
triVoid triImageAnimationSetSpeed | ( | triImageAnimation * | ani, |
triFloat | factor ) |
Set animation speed.
ani | - Pointer to triAnimationImage |
factor | - Float specifying the speed - 1.0 = normal speed, 2.0 = double speed |
triBool triImageAnimationIsDone | ( | triImageAnimation * | ani | ) |
Return if animation is finished.
ani | - Pointer to triAnimationImage |
triImage * triImageAnimationGetFrame | ( | triImageAnimation * | ani, |
triS32 | nFrame ) |
Return one frame from animation.
ani | - Pointer to triAnimationImage |
nFrame | - Number of Frame to return (starting at 0) |