29#include "streams/streams.h"
40#define IMG_FORMAT_5650 GU_PSM_5650
41#define IMG_FORMAT_5551 GU_PSM_5551
42#define IMG_FORMAT_4444 GU_PSM_4444
43#define IMG_FORMAT_8888 GU_PSM_8888
44#define IMG_FORMAT_T4 GU_PSM_T4
45#define IMG_FORMAT_T8 GU_PSM_T8
46#define IMG_FORMAT_T16 GU_PSM_T16
47#define IMG_FORMAT_T32 GU_PSM_T32
48#define IMG_FORMAT_DXT1 GU_PSM_DXT1
49#define IMG_FORMAT_DXT3 GU_PSM_DXT3
50#define IMG_FORMAT_DXT5 GU_PSM_DXT5
52#define IMG_FORMAT_5650 0
53#define IMG_FORMAT_5551 1
54#define IMG_FORMAT_4444 2
55#define IMG_FORMAT_8888 3
56#define IMG_FORMAT_T4 4
57#define IMG_FORMAT_T8 5
58#define IMG_FORMAT_T16 6
59#define IMG_FORMAT_T32 7
60#define IMG_FORMAT_DXT1 8
61#define IMG_FORMAT_DXT3 9
62#define IMG_FORMAT_DXT5 10
68#define TRI_VRAM 0x0001
69#define TRI_SWIZZLE 0x0002
71#define TRI_FRAME(x) (((x) & ~0x7FF) << 11)
72#define TRI_LEVEL(x) (((x) & 0x7) << 8)
76#define TRI_IMG_FLAGS_SWIZZLE 0x0001
77#define TRI_IMG_FLAGS_RLE 0x0002
78#define TRI_IMG_FLAGS_GZIP 0x0004
79#define TRI_IMG_FLAGS_WAVELET 0x0008
82#define PACKED __attribute__((packed))
176 triChar filename[64];
333triImage*
triImageSet( triS32 width, triS32 height, triS32 stride, triS32 bits, triS32 psm, triVoid* data );
335#ifdef TRI_SUPPORT_PNG
340triImage* triImageLoadPng( triChar* name );
406#ifdef TRI_SUPPORT_PNG
412triVoid triImageSavePng( triChar* name,
triImage *img, triS32 saveAlpha );
471#ifdef TRI_SUPPORT_PNG
481triImageAnimation* triImageAnimationFromSheetPng( triChar* name, triS32 fwidth, triS32 fheight, triS32 hframes, triS32 vframes, triU32 delay );
triVoid triImageAnimationAppend2(triImageAnimation *ani, triImage *img, triU32 delay)
Append a loaded triImage as last frame to an animation.
triVoid triImageAnimationFree(triImageAnimation *img)
Free an image animation.
triImage * triImageLoad(triChar *name, triU32 flags)
Generic file loader.
triImage * triImageGet(triS32 x, triS32 y, triS32 width, triS32 height)
Capture part of framebuffer to image.
triImage * triImageLoadTriStream(stream *s, triU32 frame)
Load TRI image from a stream.
triImageAnimation * triImageAnimationLoadTriStream(stream *s)
Load image animation from a stream.
triImage * triImageSet(triS32 width, triS32 height, triS32 stride, triS32 bits, triS32 psm, triVoid *data)
Create an image from a memory buffer.
triVoid triImageAnimationSetSpeed(triImageAnimation *ani, triFloat factor)
Set animation speed.
triVoid triImageToVRAM(triImage *img)
Upload an image to VRAM for faster drawing.
triBool triImageAnimationIsDone(triImageAnimation *ani)
Return if animation is finished.
triVoid triImageToRAM(triImage *img)
Download an image to RAM.
triImage * triImageLoadRaw(triChar *name)
Load image from a .raw file.
triImage * triImageLoadTga(triChar *name)
Load image from a .tga file.
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 * 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.
triImage * triImageAnimationGetFrame(triImageAnimation *ani, triS32 nFrame)
Return one frame from animation.
triImage * triImageLoadTgaStream(stream *s)
Load TGA image from a stream.
triVoid triImageAnimationStart(triImageAnimation *ani)
Start animation.
void triImageAnimationSaveTri(triChar *name, triImageAnimation *ani, triS32 flags)
Save image animation to a .tri file.
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.
triVoid triImageUnswizzle(triImage *img)
Unswizzle an image.
triVoid triImageAnimationPause(triImageAnimation *ani)
Pause animation.
triS32 triImageAnimationUpdate(triImageAnimation *ani)
Update animation.
triImageAnimation * triImageAnimationCreate()
Create a new blank triImageAnimation structure.
triImage * triImageLoadTri(triChar *name, triU32 frame)
Load image from a .tri file.
triVoid triImageFree(triImage *img)
Free an image.
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 * triImageAnimationLoadTri(triChar *name)
Load image animation from a .tri file.
triImage * triImageLoadRawStream(stream *s)
Load RAW image from a stream.
triVoid triImageAnimationAppend3(triImageAnimation *ani, triImage *img, triS32 xOffs, triS32 yOffs, triU32 delay)
Append a loaded triImage as last frame to an animation.
triVoid triImageSaveTri(triChar *name, triImage *img, triU32 flags)
Save image to a .tri file.
triVoid triImageSwizzleToVRAM(triImage *img)
Swizzle and upload an image to VRAM for faster drawing.
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 triImageSaveTga(triChar *name, triImage *img, triS32 saveAlpha, triS32 rle)
Save image to a .tga file.
triVoid triImageSwizzle(triImage *img)
Swizzle an image for faster drawing.
triVoid triImagePaletteGet(triImage *img, triU32 col, triU32 *r, triU32 *g, triU32 *b, triU32 *a)
Get a palette entry from image.
triVoid triImageAnimationReset(triImageAnimation *ani)
Reset animation (Stop+Rewind).
triImage * triImageLoadStream(stream *s, triU32 flags)
Generic stream file loader.
triVoid triImagePaletteSet(triImage *img, triU32 col, triU32 r, triU32 g, triU32 b, triU32 a)
Set a palette entry in image.
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.
Definition: streams.h:200
ImageAnimation struct.
Definition: triImage.h:234
triU16 width
Maximum width of all frames.
Definition: triImage.h:243
triS16 timeBase
Time base of delays in µs (default 1000 = 1ms).
Definition: triImage.h:254
triS16 loops
Number of loops.
Definition: triImage.h:252
triU16 height
Maximum height of all frames.
Definition: triImage.h:244
triImageList * frames
List of animation frames.
Definition: triImage.h:238
u64 lastUpdate
Time of last update.
Definition: triImage.h:255
triImageList * curFrame
Current animation frame.
Definition: triImage.h:239
triVoid * palette
Global palette for all animation frames.
Definition: triImage.h:247
triU8 globalPalette
Animation frames use a global palette.
Definition: triImage.h:248
triU8 palformat
Global palette format - one of IMG_FORMAT_5650, IMG_FORMAT_5551, IMG_FORMAT_4444, IMG_FORMAT_8888.
Definition: triImage.h:249
triS16 loopsDone
Number of finished loops.
Definition: triImage.h:253
triImage * image
Pointer to current frame image for easy access.
Definition: triImage.h:235
triU32 numFrames
Number of frames.
Definition: triImage.h:240
triBool playing
Is animation playing?
Definition: triImage.h:256
Definition: triImage.h:109
triU32 height
Image height.
Definition: triImage.h:111
triU32 width
Image width.
Definition: triImage.h:110
triU32 size
Size of data in bytes.
Definition: triImage.h:113
triU32 stride
Image allocated width (power of two).
Definition: triImage.h:112
Large Image struct.
Definition: triImage.h:195
triU16 hslices
Number of horizontal slices.
Definition: triImage.h:201
triVoid * palette
Image palette.
Definition: triImage.h:196
triU8 bits
Image bits per pixel.
Definition: triImage.h:206
triImageSlice * data
Image slices.
Definition: triImage.h:199
triU16 height
Image height.
Definition: triImage.h:203
triU16 width
Image width.
Definition: triImage.h:202
triU16 vslices
Number of vertical slices.
Definition: triImage.h:200
triU16 format
Image format - one of IMG_FORMAT_*.
Definition: triImage.h:205
triU32 palformat
Palette format - one of IMG_FORMAT_5650, IMG_FORMAT_5551, IMG_FORMAT_4444, IMG_FORMAT_8888.
Definition: triImage.h:197
triBool swizzled
Is image swizzled.
Definition: triImage.h:208
Definition: triImage.h:215
Image slice struct.
Definition: triImage.h:183
triU16 height
Image height.
Definition: triImage.h:187
triU32 size
Size of data in bytes.
Definition: triImage.h:185
triU16 width
Image width.
Definition: triImage.h:186
triVoid * data
Image data.
Definition: triImage.h:184
triU16 pitch
Image allocated width (power of two).
Definition: triImage.h:188
Image struct.
Definition: triImage.h:158
triVoid * data
Image data.
Definition: triImage.h:162
triU16 stride
Image allocated width (power of two).
Definition: triImage.h:166
triU16 height
Image height.
Definition: triImage.h:165
triU8 levels
Number of mipmap levels in image.
Definition: triImage.h:171
triVoid * palette
Image palette.
Definition: triImage.h:159
triU16 width
Image width.
Definition: triImage.h:164
triU32 palformat
Palette format - one of IMG_FORMAT_5650, IMG_FORMAT_5551, IMG_FORMAT_4444, IMG_FORMAT_8888.
Definition: triImage.h:160
triU16 tex_height
Image texture height (power of two).
Definition: triImage.h:167
triU16 format
Image format - one of IMG_FORMAT_*.
Definition: triImage.h:168
triBool swizzled
Is image swizzled.
Definition: triImage.h:174
triMipLevel * level
Linked list of mipmap levels.
Definition: triImage.h:172
triU8 bits
Image bits per pixel.
Definition: triImage.h:169
triU32 size
Size of data in bytes.
Definition: triImage.h:163
Definition: triImage.h:143