#include <unatima.hpp>
Public Member Functions | |
UNatIma (UNatDisp *, USysIma ima, USysIma imashape) | |
creates a native XWindow image. | |
UNatIma (UNatDisp *, unsigned char *glpixels, int width, int height) | |
creates a native OpenGL image (requires OpenGL to be installed). | |
bool | isRealized () const |
int | getAlpha () const |
int | getDepth () const |
int | getWidth () const |
int | getHeight () const |
USysIma | getXImage () |
USysIma | getXImageShape () |
USysPixel | getPixel (int x, int y) |
void | setPixel (USysPixel p, int x, int y) |
UNatIma * | createScaledImage (float xscale, float yscale) |
UNatIma * | createScaledImage (UNatDisp *to_nd, float xscale, float yscale) |
creates a scaled copy of this image. | |
Static Public Member Functions | |
static int | xpmFileReader (UNatDisp *, const char *fpath, UNatIma *&) |
static int | xpmDataReader (UNatDisp *, const char *xpm_data, UNatIma *&) |
static int | gifFileReader (UNatDisp *, const char *fpath, UNatIma *&) |
static int | jpegFileReader (UNatDisp *, const char *fpath, UNatIma *&, int max_w, int max_h) |
the avaibility of these readers depends on the compilation and linking options of the Ubit lib | |
static int | readImage (UNatDisp *, const char *filename, const char *filetype, UNatIma *&natima) |
static int | readImage (UNatDisp *, const char *filename, const char *filetype, UNatIma *&natima, int max_width, int max_height) |
creates a NatIma from an image file. | |
static UNatIma * | createImage (UNatDisp *, int width, int height) |
static USysIma | createEmptyXImage (UNatDisp *, int width, int height, int depth) |
creates a XImage with an empty (but allocated) data buffer. | |
static USysIma | createScaledXImage (UNatDisp *to_nd, UNatDisp *from_nd, USysIma from_ima, float xscale, float yscale) |
creates a scaled copy of an XImage. | |
static bool | blendXImages (UNatDisp *, USysIma i1, USysIma i2, float alpha) |
static bool | blendXImage (UNatDisp *, USysIma i1, USysPixel p2, float alpha) |
image blending: the resulting XImage is stored in xima1. | |
static USysPixel * | allocXColors (UNatDisp *, USysColor *colors, int col_count) |
allocates the xcolors and returns the conversion table (which must be deleted[] after use). | |
Static Public Attributes | |
static const char *const | GIF = "gif" |
static const char *const | JPG = "jpg" |
static const char *const | XPM = "xpm" |
static const char *const | XPM_DATA = "[XPM DATA]" |
native image (encapsulates the corresponding X resources). can have a "transparent background" (i.e. be shaped) (!! mais seul XPM Reader lit images transp !!) NB:
ubit::UNatIma::UNatIma | ( | UNatDisp * | , | |
USysIma | ima, | |||
USysIma | imashape | |||
) |
creates a native XWindow image.
'imashape' is a bitmap image that specifies the shape of the image (the "background is then said to be "transparent"). 'imashape' can ne null. It must have the same size as 'ima' otherwise. Notes: this function:
ubit::UNatIma::UNatIma | ( | UNatDisp * | , | |
unsigned char * | glpixels, | |||
int | width, | |||
int | height | |||
) |
creates a native OpenGL image (requires OpenGL to be installed).
The pixel array must be formatted according to GL_RGBA, with 8 bits per component. It is NOT duplicated internally and it is automatically deleted when the UNatIma is destroyed. NOTE that this constructor can't be used if OpenGL is not installed.
bool ubit::UNatIma::blendXImage | ( | UNatDisp * | , | |
USysIma | i1, | |||
USysPixel | p2, | |||
float | alpha | |||
) | [static] |
image blending: the resulting XImage is stored in xima1.
returns false if images or natdisp are not compatibles note that a trueColor Visual is requested for blending images
USysIma ubit::UNatIma::createEmptyXImage | ( | UNatDisp * | , | |
int | width, | |||
int | height, | |||
int | depth | |||
) | [static] |
creates a XImage with an empty (but allocated) data buffer.
this function allocates the XImage and its 'data' buffer
creates a scaled copy of this image.
the second variant makes it possible to create the new image on a different UNatDisp.
int ubit::UNatIma::readImage | ( | UNatDisp * | , | |
const char * | filename, | |||
const char * | filetype, | |||
UNatIma *& | natima, | |||
int | max_width, | |||
int | max_height | |||
) | [static] |
creates a NatIma from an image file.
'filetype' can be null or any of the constants: UNatIma::GIF, JPEG, XPM or XPM_DATA. If 'filetype' is null, the type is deduced from the filename suffix. This fct returns 'natima' and the UFilestat loading status.