Jo Engine Truevision Targa format support.
More...
Go to the source code of this file.
|
void | jo_set_tga_palette_handling (jo_tga_palette_handling_callback callback) |
| Set the callback to handle TGA palette for 8 bits image. More...
|
|
void | jo_set_tga_default_palette (jo_palette *palette) |
| Set the palette to use for 8 bits image. More...
|
|
t_tga_error_code | jo_tga_loader_from_stream (jo_img *img, char *stream, const jo_color transparent_color) |
| Load a TGA image from stream. More...
|
|
int | jo_sprite_add_tga_from_stream (char *stream, const jo_color transparent_color) |
| Add a sprite from a TGA stream. More...
|
|
int | jo_sprite_add_tga (const char *const sub_dir, const char *const filename, const jo_color transparent_color) |
| Add a sprite from a TGA file. More...
|
|
t_tga_error_code | jo_tga_loader (jo_img *img, const char *const sub_dir, const char *const filename, const jo_color transparent_color) |
| Load a TGA image. More...
|
|
t_tga_error_code | jo_tga_8bits_loader (jo_img_8bits *img, const char *const sub_dir, const char *const filename, const int transparent_color_index_in_palette) |
| Load a 8 bits 255 colors max TGA image. More...
|
|
t_tga_error_code | jo_tga_8bits_loader_from_stream (jo_img_8bits *img, char *stream, const int transparent_color_index_in_palette) |
| Load a 8 bits 255 colors max TGA image. More...
|
|
t_tga_error_code | jo_tga_8bits_tileset_loader (const char *const sub_dir, const char *const filename, const jo_color transparent_color, const jo_tile *const tileset, const unsigned int tile_count, jo_raw_img *output_tiles) |
| Load a tileset TGA image. More...
|
|
int | jo_sprite_add_tga_tileset (const char *const sub_dir, const char *const filename, const jo_color transparent_color, const jo_tile *const tileset, const unsigned int tile_count) |
| Add tileset sprites from a TGA file. More...
|
|
Jo Engine Truevision Targa format support.
- Author
- Johannes Fetz
- Bug:
- jo_tga_tileset_loader is not tested
◆ jo_tga_palette_handling_callback
typedef jo_palette*(* jo_tga_palette_handling_callback) (void) |
Function prototype for ()
◆ t_tga_error_code
tga error code
Enumerator |
---|
JO_TGA_OK | |
JO_TGA_FILE_NOT_FOUND | |
JO_TGA_UNSUPPORTED_FORMAT | |
JO_TGA_OUT_OF_MEMORY | |
◆ jo_set_tga_default_palette()
void jo_set_tga_default_palette |
( |
jo_palette * |
palette | ) |
|
Set the palette to use for 8 bits image.
- Parameters
-
- Warning
- This function is mandatory if you use 8 bits TGA (but you can use jo_set_tga_palette_handling() instead)
-
The content of the palette will be filled when the image is loaded
◆ jo_set_tga_palette_handling()
Set the callback to handle TGA palette for 8 bits image.
- Parameters
-
- Warning
- This function is mandatory if you use 8 bits TGA (but you can use jo_set_tga_default_palette() instead)
◆ jo_sprite_add_tga()
int jo_sprite_add_tga |
( |
const char *const |
sub_dir, |
|
|
const char *const |
filename, |
|
|
const jo_color |
transparent_color |
|
) |
| |
Add a sprite from a TGA file.
- Parameters
-
sub_dir | Sub directory name (use JO_ROOT_DIR if the file is on the root directory) |
filename | Filename (upper case and shorter as possible like "A.TGA") |
transparent_color | Transparent color or palette index for 8 bits image. Use JO_COLOR_Transparent by default |
- Warning
- The first index of the palette is 1 not 0. 0 (or JO_COLOR_Transparent) means no transparency.
-
The palette of 8 bits TGA must be 255 colors max not 256
- Returns
- Sprite Id or -1 if failed
◆ jo_sprite_add_tga_from_stream()
int jo_sprite_add_tga_from_stream |
( |
char * |
stream, |
|
|
const jo_color |
transparent_color |
|
) |
| |
Add a sprite from a TGA stream.
- Parameters
-
stream | Raw TGA contents |
transparent_color | Transparent color (see colors.h). Use JO_COLOR_Transparent by default |
- Returns
- Sprite Id or -1 if failed
◆ jo_sprite_add_tga_tileset()
int jo_sprite_add_tga_tileset |
( |
const char *const |
sub_dir, |
|
|
const char *const |
filename, |
|
|
const jo_color |
transparent_color, |
|
|
const jo_tile *const |
tileset, |
|
|
const unsigned int |
tile_count |
|
) |
| |
Add tileset sprites from a TGA file.
- Parameters
-
sub_dir | Sub directory name (use JO_ROOT_DIR if the file is on the root directory) |
filename | Filename (upper case and shorter as possible like "A.TGA") |
transparent_color | Transparent color or palette index for 8 bits image. Use JO_COLOR_Transparent by default |
tileset | Tileset definition |
tile_count | Number of tile in the entire image |
- Warning
- The first index of the palette is 1 not 0. 0 (or JO_COLOR_Transparent) means no transparency.
-
The palette of 8 bits TGA must be 255 colors max not 256
- Returns
- Sprite Id of the first image or -1 if failed
◆ jo_tga_8bits_loader()
t_tga_error_code jo_tga_8bits_loader |
( |
jo_img_8bits * |
img, |
|
|
const char *const |
sub_dir, |
|
|
const char *const |
filename, |
|
|
const int |
transparent_color_index_in_palette |
|
) |
| |
Load a 8 bits 255 colors max TGA image.
- Parameters
-
img | Image (set data to NULL for dynamic allocation) |
sub_dir | Sub directory name (use JO_ROOT_DIR if the file is on the root directory) |
filename | Filename (upper case and shorter as possible like "A.TGA") |
transparent_color_index_in_palette | Transparent color in palette index. Use 0 by default |
- Warning
- The first index of the palette is 1 not 0. 0 (or JO_COLOR_Transparent) means no transparency.
-
The palette of 8 bits TGA must be 255 colors max not 256
- Returns
- t_tga_error_code
◆ jo_tga_8bits_loader_from_stream()
Load a 8 bits 255 colors max TGA image.
- Parameters
-
img | Image (set data to NULL for dynamic allocation) |
stream | Raw TGA contents |
transparent_color_index_in_palette | Transparent color in palette index. Use 0 by default |
- Warning
- The first index of the palette is 1 not 0. 0 (or JO_COLOR_Transparent) means no transparency.
-
The palette of 8 bits TGA must be 255 colors max not 256
- Returns
- t_tga_error_code
◆ jo_tga_8bits_tileset_loader()
t_tga_error_code jo_tga_8bits_tileset_loader |
( |
const char *const |
sub_dir, |
|
|
const char *const |
filename, |
|
|
const jo_color |
transparent_color, |
|
|
const jo_tile *const |
tileset, |
|
|
const unsigned int |
tile_count, |
|
|
jo_raw_img * |
output_tiles |
|
) |
| |
Load a tileset TGA image.
- Parameters
-
sub_dir | Sub directory name (use JO_ROOT_DIR if the file is on the root directory) |
filename | Filename (upper case and shorter as possible like "A.TGA") |
transparent_color | Transparent color or palette index for 8 bits image. Use JO_COLOR_Transparent by default |
tileset | Tileset definition |
tile_count | Number of tile in the entire image |
output_tiles | an array of tile_count * jo_raw_img. |
- Warning
- The first index of the palette is 1 not 0. 0 (or JO_COLOR_Transparent) means no transparency.
-
The palette of 8 bits TGA must be 255 colors max not 256
- Returns
- t_tga_error_code
◆ jo_tga_loader()
Load a TGA image.
- Parameters
-
img | Image (set data to NULL for dynamic allocation) |
sub_dir | Sub directory name (use JO_ROOT_DIR if the file is on the root directory) |
filename | Filename (upper case and shorter as possible like "A.TGA") |
transparent_color | Transparent color or palette index for 8 bits image. Use JO_COLOR_Transparent by default |
- Warning
- The first index of the palette is 1 not 0. 0 (or JO_COLOR_Transparent) means no transparency.
-
The palette of 8 bits TGA must be 255 colors max not 256
- Returns
- t_tga_error_code
◆ jo_tga_loader_from_stream()
Load a TGA image from stream.
- Parameters
-
img | Image (set data to NULL for dynamic allocation) |
stream | Raw TGA contents |
transparent_color | Transparent color or palette index for 8 bits image. Use JO_COLOR_Transparent by default |
- Warning
- The first index of the palette is 1 not 0. 0 (or JO_COLOR_Transparent) means no transparency.
-
The palette of 8 bits TGA must be 255 colors max not 256
- Returns
- t_tga_error_code