ubit::UIma Class Reference

Image Brick. More...

#include <uima.hpp>

Inheritance diagram for ubit::UIma:

ubit::UData ubit::UBrick ubit::UObject ubit::UPix List of all members.

Public Member Functions

 UIma (const UStr &filename, bool load_now=false)
 UIma (const char *filename=null, bool load_now=false)
 creates a new image from an image file.
 UIma (const char **xpm_data, bool load_now=false)
 creates a new image from XPM data.
 UIma (int width, int height)
 creates an empty image.
UImaoperator= (const UIma &ima2)
bool copy (const UIma &ima2)
 copies the content of ima2 to this image.
bool setSize (int width, int height)
bool setSize (int width, int height, bool preserve_ratio, bool preserve_smaller)
 rescales this image.
bool rescale (float xyscale)
bool rescale (float xscale, float yscale)
 rescales this image.
virtual void set (const UStr &filename)
virtual void set (const char *filename)
virtual void set (const char **xpm_data)
 specifies the file name.
virtual int read (const UStr &filename, int max_w=0, int max_h=0)
virtual int read (const char *filename, int max_w=0, int max_h=0)
 loads an image file.
virtual int load ()
 loads the image file that was specified by set() or by the constructor.
virtual int load (const char **xpm_data)
 loads XPM data.
bool isLoaded () const
 returns true if the image has been loaded.
bool isRealized () const
 returns true if the image has been sucesfully loaded and initialized.
int getAlpha () const
 return the number of bits of the alpha channel (0 if the image is not loaded).
int getBpp () const
 returns the number of bits per pixel (0 if the image is not loaded).
int getDepth () const
 returns the depth of the image (0 if the image is not loaded).
int getHeight () const
int getWidth () const
 returns the image size (0 if the image is not loaded).
int getStatus () const
 returns the loading status of this image (see UFilestat)
unsigned long getPixel (int x, int y)
 gets a pixel in the image.
void setPixel (unsigned long, int x, int y)
 sets a pixel in the image.
virtual void update ()
 update parents' views.
int realize (int max_w=0, int max_h=0, UDisp *disp=null, bool force_reload=true) const
 [impl] allocates physical resources and loads the image in memory.
std::list< UNatIma * > & getNatImas () const
 [impl] returns internal implementation.

Static Public Member Functions

static void getFullPath (UStr &fullpath, const char *filename)
 gets the full image pathname.

Friends

UImauima (const UStr &filename)
UImauima (const char *filename)
UImauima (const char **xpm_data)
 creator shortcuts (see UIma::UIma() constructors for details)

Detailed Description

Image Brick.

Notes on alpha channel and "background transparency".

See also: the UPix subclass.


Constructor & Destructor Documentation

ubit::UIma::UIma ( const char *  filename = null,
bool  load_now = false 
)

creates a new image from an image file.

If 'load_now' is false (the default), the file is loaded when the image appears for the first time (it is loaded immediately otherwise). The load() and read() functions can also be used to (re)load a file.

Filename and formats:

ubit::UIma::UIma ( const char **  xpm_data,
bool  load_now = false 
)

creates a new image from XPM data.

the XPM data is not duplicated and should not be destroyed. If 'load_now' is false (the default), the data is loaded when the image appears for the first time (it is loaded immediately otherwise). The load() functions can also be used to (re)load a file.


Member Function Documentation

bool ubit::UIma::copy ( const UIma ima2  ) 

copies the content of ima2 to this image.

does nothing and returns false if ima2 is not loaded (see isLoaded()).

void ubit::UIma::getFullPath ( UStr fullpath,
const char *  filename 
) [static]

gets the full image pathname.

UAppli::getImaPath() (the default image pathname) is prefixed to image filenames that don't start with / or .

bool ubit::UIma::isLoaded (  )  const

returns true if the image has been loaded.

Note that images that have not been displayed on the screen are not loaded except if stated explicitely (see the UIma::Uima, load(), read())

int ubit::UIma::load ( const char **  xpm_data  )  [virtual]

loads XPM data.

the XPM data is not duplicated and should not be destroyed. Use UIma::set() instead of read() if you want to postone the loading.

int ubit::UIma::load (  )  [virtual]

loads the image file that was specified by set() or by the constructor.

returns the reading status (see UFilestat).

int ubit::UIma::read ( const char *  filename,
int  max_w = 0,
int  max_h = 0 
) [virtual]

loads an image file.

returns the reading status (see UFilestat). Use UIma::set() instead of read() if you want to postone the loading.

int ubit::UIma::realize ( int  max_w = 0,
int  max_h = 0,
UDisp disp = null,
bool  force_reload = true 
) const

[impl] allocates physical resources and loads the image in memory.

this function is automatically called when this image is displayed for the first time: there no need to call it in client code. details:

bool ubit::UIma::rescale ( float  xscale,
float  yscale 
)

rescales this image.

does nothing and returns false if this image is not loaded (see isLoaded()).

void ubit::UIma::set ( const char **  xpm_data  )  [virtual]

specifies the file name.

the file is not loaded immediately but when the image appears for the first time. Call load() to load the file immediately.

bool ubit::UIma::setSize ( int  width,
int  height,
bool  preserve_ratio,
bool  preserve_smaller 
)

rescales this image.

does nothing and returns false if this image is not loaded (see isLoaded()).


The documentation for this class was generated from the following files:
Generated on Mon Jan 29 00:20:51 2007 for Ubit by  doxygen 1.4.7