Jo Engine  2020.06.22
Jo Sega Saturn Engine
Macros | Functions
image.h File Reference

Jo Engine Image definition and tools. More...

Go to the source code of this file.

Macros

#define JO_TILE_COUNT(TILE_TABLE)
 Get tile count in table (see Tileset Demo) More...
 

Functions

void jo_replace_color (const jo_img *const img, const jo_color src_color, const jo_color dest_color)
 Add a sprite. More...
 
bool jo_bin_loader (jo_img *img, const char *const sub_dir, const char *const filename, const jo_color transparent_color)
 Load a BIN image. More...
 
int jo_sprite_add_bin_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 BIN file. More...
 
int jo_sprite_add_bin (const char *const sub_dir, const char *const filename, const jo_color transparent_color)
 Add a sprite from a BIN file. More...
 
int jo_sprite_add_image_pack (const char *const sub_dir, const char *const filename, const jo_color transparent_color)
 Add a set of image from a TEX file format. More...
 
bool jo_bin_loader_from_stream (jo_img *img, char *stream, const jo_color transparent_color)
 Load a BIN image from stream. More...
 
int jo_sprite_add_bin_from_stream (char *stream, const jo_color transparent_color)
 Add a sprite from a BIN file. More...
 
void jo_free_img (void *const img)
 Free an image loaded from CD. More...
 

Detailed Description

Jo Engine Image definition and tools.

Author
Johannes Fetz
Bug:
No known bugs.

Macro Definition Documentation

◆ JO_TILE_COUNT

#define JO_TILE_COUNT (   TILE_TABLE)

Get tile count in table (see Tileset Demo)

Parameters
TILE_TABLEjo_tile[] TABLE

Function Documentation

◆ jo_bin_loader()

bool jo_bin_loader ( jo_img img,
const char *const  sub_dir,
const char *const  filename,
const jo_color  transparent_color 
)

Load a BIN image.

Parameters
imgImage (set data to NULL for dynamic allocation)
sub_dirSub directory name (use JO_ROOT_DIR if the file is on the root directory)
filenameFilename (upper case and shorter as possible like "A.BIN")
transparent_colorTransparent color (see colors.h). Use JO_COLOR_Transparent by default
Returns
true if succeeded otherwise false

◆ jo_bin_loader_from_stream()

bool jo_bin_loader_from_stream ( jo_img img,
char *  stream,
const jo_color  transparent_color 
)

Load a BIN image from stream.

Parameters
imgImage (set data to NULL for dynamic allocation)
streamRaw bin file contents
transparent_colorTransparent color (see colors.h). Use JO_COLOR_Transparent by default
Returns
true if succeeded otherwise false

◆ jo_free_img()

void jo_free_img ( void *const  img)

Free an image loaded from CD.

Parameters
imgPointer to an image struct (jo_img, jo_img_8bits or jo_raw_img)

◆ jo_replace_color()

void jo_replace_color ( const jo_img *const  img,
const jo_color  src_color,
const jo_color  dest_color 
)

Add a sprite.

Parameters
imgPointer to an image struct
src_colorColor to replace
dest_colorNew color

◆ jo_sprite_add_bin()

int jo_sprite_add_bin ( const char *const  sub_dir,
const char *const  filename,
const jo_color  transparent_color 
)

Add a sprite from a BIN file.

Parameters
sub_dirSub directory name (use JO_ROOT_DIR if the file is on the root directory)
filenameFilename (upper case and shorter as possible like "A.BIN")
transparent_colorTransparent color (see colors.h). Use JO_COLOR_Transparent by default
Returns
Sprite Id or -1 if failed

◆ jo_sprite_add_bin_from_stream()

int jo_sprite_add_bin_from_stream ( char *  stream,
const jo_color  transparent_color 
)

Add a sprite from a BIN file.

Parameters
streamRaw bin file contents
transparent_colorTransparent color (see colors.h). Use JO_COLOR_Transparent by default
Returns
Sprite Id or -1 if failed

◆ jo_sprite_add_bin_tileset()

int jo_sprite_add_bin_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 BIN file.

Parameters
sub_dirSub directory name (use JO_ROOT_DIR if the file is on the root directory)
filenameFilename (upper case and shorter as possible like "A.BIN")
transparent_colorTransparent color (see colors.h). Use JO_COLOR_Transparent by default
tilesetTable of tiles
tile_countNumber of tile in the entire image
Returns
Sprite Id of the first image or -1 if failed

◆ jo_sprite_add_image_pack()

int jo_sprite_add_image_pack ( const char *const  sub_dir,
const char *const  filename,
const jo_color  transparent_color 
)

Add a set of image from a TEX file format.

Parameters
sub_dirSub directory name (use JO_ROOT_DIR if the file is on the root directory)
filenameFilename (upper case and shorter as possible like "A.TEX")
transparent_colorTransparent color (see colors.h). Use JO_COLOR_Transparent by default
Remarks
Sample file with 3 Textures (it's very similar to the MAP file format):
1.TGA
2.BIN
3.TGA
Returns
Sprite Id of the first image or -1 if failed