Next: , Previous: , Up: C API   [Contents][Index]


5.28 libimg

5.28.1 Overview

View lcov test coverage results on http://www.ufoot.org/liquidwar/v6/doc/coverage/src/lib/img/index.html.

5.28.2 API

Function: char * lw6img_repr (lw6sys_context_t * sys_context, const lw6img_jpeg_t * jpeg)

sys_context: global system context

jpeg: the jpeg to describe

Returns a string describing the jepg. This is a very short description, use it for logs, and to debug stuff. By no means it’s a complete exhaustive description. Still, the string returned should be unique.

Return value: a dynamically allocated string.

Function: lw6img_jpeg_t * lw6img_screenshot_new (lw6sys_context_t * sys_context, lw6ker_game_state_t * game_state, char * user_dir, int quality)

sys_context: global system context

game_state: game_state to create a screenshot from

user_dir: user directory

quality: quality, from 0 to 100

Creates a JPEG screenshot from a game state. The user_dir parameter is used to build a file name and then use it to write data on disk, it is then read and kept in memory. Globally it’s not that bad to store it for we do not generate screenshots that often, and it’s nice for debugging to have it so developping a RAM-only writer wouldn’t make it a blast anyway.

Return value: dynamically allocated object.

Function: void lw6img_screenshot_free (lw6sys_context_t * sys_context, lw6img_jpeg_t * screenshot)

sys_context: global system context

Frees a JPEG screenshot.

Return value: none.

Function: int lw6img_test_register (lw6sys_context_t * sys_context, int mode)

sys_context: global system context

mode: test mode (bitmask)

Registers all tests for the libimg module.

Return value: 1 if test is successfull, 0 on error.

Function: int lw6img_test_run (lw6sys_context_t * sys_context, int mode)

sys_context: global system context

mode: test mode (bitmask)

Runs the img module test suite, testing most (if not all...) functions.

Return value: 1 if test is successfull, 0 on error.

Struct: lw6img_jpeg_s

Contains informations about a (loaded) JPEG file.

Member of lw6img_jpeg_s: id

Type: u_int32_t

Definition: u_int32_t lw6img_jpeg_s::id

The id of the object, this is non-zero and unique within one run session, incremented at each object creation.

Member of lw6img_jpeg_s: shape

Type: lw6sys_whd_t

Definition: lw6sys_whd_t lw6img_jpeg_s::shape

JPEG file shape, only w and h are relevant.

Member of lw6img_jpeg_s: jpeg_size

Type: int

Definition: int lw6img_jpeg_s::jpeg_size

JPEG size (file size, same as data buffer size).

Member of lw6img_jpeg_s: jpeg_data

Type: void *

Definition: void* lw6img_jpeg_s::jpeg_data

JPEG raw data.


Next: , Previous: , Up: C API   [Contents][Index]