Phoenard
Public Member Functions | List of all members
PHN_Image Class Reference

Stores the information needed to draw an image to screen. More...

#include <PHNImage.h>

Public Member Functions

 PHN_Image ()
 Null constructor used for copying one image to another.
 
 PHN_Image (void(*drawFunc)(int, int, int, int, PHN_Image &), uint32_t data)
 Constructs a new image with the draw function and uint32 data.
 
 PHN_Image (void(*drawFunc)(int, int, int, int, PHN_Image &), const char *text)
 Constructs a new image with the draw function and text NULL-terminated data.
 
 PHN_Image (void(*drawFunc)(int, int, int, int, PHN_Image &), const void *data, int dataSize)
 Constructs a new image with the draw function and data set.
 
 PHN_Image (const PHN_Image &value)
 Constructs a new image, using the data of the image specified.
 
const PHN_Palettepalette ()
 Gets the palette of colors set for the image.
 
const color_t color (uint8_t index)
 Gets a color in the palette of colors set for the image.
 
const void setPalette (const PHN_Palette &palette)
 Sets a new palette of colors set for the image.
 
const void * data () const
 Gets the data associated with the image.
 
const char * text () const
 Gets the data associated with the image as text.
 
const uint32_t data_int () const
 Gets the data associated with the image as an integer.
 
const void * data_ptr () const
 Gets the data associated with the image as a memory pointer.
 
const int dataSize ()
 Gets the byte size of the data associated with the image.
 
void setData (const void *data, int dataSize)
 Sets new data associated with the image.
 
void setData (const char *text)
 Sets new data associated with the image using a null-terminated String.
 
void draw (int x, int y, int width, int height)
 Calls the draw function to draw in the rectangle specified.
 

Detailed Description

Stores the information needed to draw an image to screen.

It stores a palette of colors to use when drawing, a function to call to draw the function and user-defined data to pass along, such as a path or pointer to the data being drawn.

It is strongly discouraged to pass the actual data being drawn with it, as a copy of the data is stored on the heap, which may get copied over onto new instances frequently. Keeping the data size minimal is recommended.


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