libtcod
Loading...
Searching...
No Matches
image.h File Reference

Image handling module. More...

#include "color.h"
#include "console_types.h"
#include "error.h"
#include "portability.h"

Go to the source code of this file.

Classes

struct  TCOD_Image

Namespaces

namespace  tcod
 The libtcod namespace.

Typedefs

typedef struct TCOD_Image TCOD_Image
typedef TCOD_ImageTCOD_image_t

Functions

TCOD_ImageTCOD_image_new (int width, int height)
TCOD_ImageTCOD_image_from_console (const TCOD_Console *console)
 Return a new image rendered from a console.
void TCOD_image_refresh_console (TCOD_Image *image, const TCOD_Console *console)
 Same as TCOD_image_from_console, but with an existing image.
void TCOD_image_clear (TCOD_Image *image, TCOD_color_t color)
void TCOD_image_invert (TCOD_Image *image)
void TCOD_image_hflip (TCOD_Image *image)
void TCOD_image_rotate90 (TCOD_Image *image, int numRotations)
void TCOD_image_vflip (TCOD_Image *image)
void TCOD_image_scale (TCOD_Image *image, int new_w, int new_h)
TCOD_ImageTCOD_image_load (const char *filename)
TCOD_Error TCOD_image_save (const TCOD_Image *image, const char *filename)
 Save an image to a PNG or BMP file.
void TCOD_image_get_size (const TCOD_Image *image, int *w, int *h)
TCOD_color_t TCOD_image_get_pixel (const TCOD_Image *image, int x, int y)
int TCOD_image_get_alpha (const TCOD_Image *image, int x, int y)
TCOD_color_t TCOD_image_get_mipmap_pixel (TCOD_Image *image, float x0, float y0, float x1, float y1)
 Return a mipmapped pixel of image.
void TCOD_image_put_pixel (TCOD_Image *image, int x, int y, TCOD_color_t col)
void TCOD_image_blit (TCOD_Image *image, TCOD_console_t console, float x, float y, TCOD_bkgnd_flag_t bkgnd_flag, float scale_x, float scale_y, float angle)
void TCOD_image_blit_rect (TCOD_Image *image, TCOD_console_t console, int x, int y, int w, int h, TCOD_bkgnd_flag_t bkgnd_flag)
void TCOD_image_blit_2x (const TCOD_Image *image, TCOD_Console *dest, int dx, int dy, int sx, int sy, int w, int h)
void TCOD_image_delete (TCOD_Image *image)
void TCOD_image_set_key_color (TCOD_Image *image, TCOD_color_t key_color)
bool TCOD_image_is_pixel_transparent (const TCOD_Image *image, int x, int y)

Detailed Description

Image handling module.

Function Documentation

◆ TCOD_image_from_console()

TCOD_Image * TCOD_image_from_console ( const TCOD_Console * console)

Return a new image rendered from a console.

This effectively returns a screenshot of the console.

◆ TCOD_image_get_mipmap_pixel()

TCOD_color_t TCOD_image_get_mipmap_pixel ( TCOD_Image * image,
float x0,
float y0,
float x1,
float y1 )

Return a mipmapped pixel of image.

Mipmaps are updated when you call this, so it can't be called from multiple threads.

◆ TCOD_image_save()

TCOD_Error TCOD_image_save ( const TCOD_Image * image,
const char * filename )

Save an image to a PNG or BMP file.

Returns a negative error code on failure. Check TCOD_get_error for details.

embed:rst:leading-asterisk 
.. versionchanged:: 1.16
    Now returns TCOD_Error.