PNTK
Public Member Functions | Static Public Member Functions | List of all members
pntk::gui_image Class Reference

#include <gui_image.h>

Public Member Functions

 gui_image ()
 
 gui_image (int width, int height, gui_image_format format, bool initialize_native=0)
 
 gui_image (gui_stream *stream, bool initialize_native=0)
 
gui_size get_size ()
 
int get_bit_depth ()
 
bool has_alpha ()
 
bool has_native_image ()
 
bool has_native_surface ()
 
void clear ()
 
gui_image_format get_format ()
 
unsigned char * get_bits ()
 
void * get_native_image ()
 
void * get_native_surface ()
 
void create_native_image ()
 
void create_native_surface ()
 
void release_native_image ()
 
void release_native_surface ()
 
void load_bmp (gui_stream *stream)
 
void save_bmp (gui_stream *stream)
 
void load_xpm (gui_stream *stream)
 
void save_xpm (gui_stream *stream)
 
void convert (gui_image_format format)
 

Static Public Member Functions

static void get_channel_info (gui_image_format format, int &bit_depth, int &channel_a, int &channel_r, int &channel_g, int &channel_b)
 

Detailed Description

An abstract image class that loads/saves image files and can convert them to a format usable by the native toolkit implementations.

Constructor & Destructor Documentation

◆ gui_image() [1/3]

pntk::gui_image::gui_image ( )

Creates an empty image object

◆ gui_image() [2/3]

pntk::gui_image::gui_image ( int  width,
int  height,
gui_image_format  format,
bool  initialize_native = 0 
)

Creates an image object with a the given width and height. This constructor will optionally initialize the underlaying platform image resource.

◆ gui_image() [3/3]

pntk::gui_image::gui_image ( gui_stream stream,
bool  initialize_native = 0 
)

Creates an image object from the filed stored in stream. This constructor will optionally initialize the underlaying platform image resource.

Member Function Documentation

◆ clear()

void pntk::gui_image::clear ( )

Clears the entire image, filling it with White (0xFFFFFFFF).

◆ convert()

void pntk::gui_image::convert ( gui_image_format  format)

Converts the current image into another format.

◆ create_native_image()

void pntk::gui_image::create_native_image ( )

Creates the native underlaying image resource from the loaded data..

◆ create_native_surface()

void pntk::gui_image::create_native_surface ( )

Creates the native underlaying image surface (for drawing to a canvas) from the loaded data.

◆ get_bit_depth()

int pntk::gui_image::get_bit_depth ( )

Returns the bit depth of the image

◆ get_bits()

unsigned char* pntk::gui_image::get_bits ( )

Returns a pointer to the raw bits of the image once loaded.

◆ get_channel_info()

static void pntk::gui_image::get_channel_info ( gui_image_format  format,
int &  bit_depth,
int &  channel_a,
int &  channel_r,
int &  channel_g,
int &  channel_b 
)
static

Returns channel information about an image format.

◆ get_format()

gui_image_format pntk::gui_image::get_format ( )

Returns internal format.

◆ get_native_image()

void* pntk::gui_image::get_native_image ( )

Returns a pointer to the underlaying platform image resource. Calls create_native_image if the resource has not been created yet.

◆ get_native_surface()

void* pntk::gui_image::get_native_surface ( )

Returns a pointer to the underlaying platform off screen surface. Calls create_native_surface if the surface has not been created yet.

◆ get_size()

gui_size pntk::gui_image::get_size ( )

Returns the size of the image.

◆ has_alpha()

bool pntk::gui_image::has_alpha ( )

Returns a boolean that indicates whether or not the image contains an alpha channel

◆ has_native_image()

bool pntk::gui_image::has_native_image ( )

Returns a boolean that indicates whether or not the underlaying platform resource has been created.

◆ has_native_surface()

bool pntk::gui_image::has_native_surface ( )

Returns a boolean that indicates whether or not the underlaying platform surface has been created.

◆ load_bmp()

void pntk::gui_image::load_bmp ( gui_stream stream)

Loads a bmp image from the given filename.

◆ load_xpm()

void pntk::gui_image::load_xpm ( gui_stream stream)

Loads an xpm image from the given filename.

◆ release_native_image()

void pntk::gui_image::release_native_image ( )

Destroys the native image resource associated with the data, if it was created previously.

◆ release_native_surface()

void pntk::gui_image::release_native_surface ( )

Destroys the native image surface associated with the data, if it was created previously.

◆ save_bmp()

void pntk::gui_image::save_bmp ( gui_stream stream)

Saves the current image as a bmp to the given filename.

◆ save_xpm()

void pntk::gui_image::save_xpm ( gui_stream stream)

Saves the current image as an xpm to the given filename.


The documentation for this class was generated from the following file: