Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

UNatIma Class Reference

native image (encapsulates the corresponding X resources). More...

#include <unatima.hpp>

List of all members.

Public Types

typedef int(* Reader )(class UNatDisp *, const char *fpath, UNatIma *&natima)
 type of File or Data Reader functions; returns UFilestat and natima (which can be null).
typedef int(* Writer )(class UNatDisp *, const char *fpath, const UNatIma *natima)
 type of File or Data Writer functions; returns UFilestat.

Public Member Functions

 UNatIma (UNatDisp *, UX_Image xima, UX_Image ximashape)
 constructor
u_dim getWidth () const
u_dim getHeight () const
const UX_Image getXImage () const
const UX_Image getXImageShape () const
bool isRealized () const
bool isShaped () const
UNatImacreateScaledImage (float xscale, float yscale)
UNatImacreateScaledImage (UNatDisp *to_nd, float xscale, float yscale)
 creates a scaled copy of this image

Static Public Member Functions

static int readImage (UNatDisp *, const char *filename, const char *filetype, UNatIma *&natima)
 creates a NatIma from an image file
static UX_Image createEmptyImage (UNatDisp *, u_dim width, u_dim height, u_dim depth)
 creates an empty XImage
static UX_Image createScaledImage (UNatDisp *to_nd, UNatDisp *from_nd, UX_Image from_ima, float xscale, float yscale)
 creates a scaled copy of an XImage
static bool blendImages (UNatDisp *, UX_Image xima1, UX_Image xima2, float alpha)
static bool blendImage (UNatDisp *, UX_Image xima1, UX_Color pixel2, float alpha)
 image blending: the resulting XImage is stored in xima1
static unsigned long * allocXColors (UNatDisp *nd, const XColor *colors, int colorCount)
 allocates the xcolors and returns the conversion table (which must be deleted[] after use).
static int xpmFileReader (UNatDisp *, const char *fpath, UNatIma *&natima)
static int xpmDataReader (UNatDisp *, const char *xpm_data, UNatIma *&natima)
static int gifFileReader (UNatDisp *, const char *fpath, UNatIma *&natima)
static int jpegFileReader (UNatDisp *, const char *fpath, UNatIma *&natima)
 the avaibility of these readers depends on the compilation and linking options of the Ubit lib

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]"


Detailed Description

native image (encapsulates the corresponding X resources).

can have a "transparent background" (i.e. be shaped) (!! mais seul XPM Reader lit images transp !!) NB:


Constructor & Destructor Documentation

UNatIma::UNatIma UNatDisp *  ,
UX_Image  xima,
UX_Image  ximashape
 

constructor

Note:

  • ximashape == null => opaque image
  • ximashape != null => shaped image (so called "transparent" background)


Member Function Documentation

bool UNatIma::blendImage UNatDisp *  ,
UX_Image  xima1,
UX_Color  pixel2,
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

UX_Image UNatIma::createEmptyImage UNatDisp *  ,
u_dim  width,
u_dim  height,
u_dim  depth
[static]
 

creates an empty XImage

Notes:

  • this function also allocates the XImage data field.
  • size and depth must be > 0
  • depth must be <= to the NatDisp depth
  • returns null if the image could not be created

UX_Image UNatIma::createScaledImage UNatDisp *  to_nd,
UNatDisp *  from_nd,
UX_Image  from_ima,
float  xscale,
float  yscale
[static]
 

creates a scaled copy of an XImage

args:

  • to_nd : the UNatDisp of the XImage to be created
  • from_nd : the UNatDisp of from_ima
  • this functions converts image pixels according to both NatDisps
  • returns null if the image could not be created

UNatIma * UNatIma::createScaledImage UNatDisp *  to_nd,
float  xscale,
float  yscale
 

creates a scaled copy of this image

the second variant makes it possible to create the new image on a different UNatDisp.

int UNatIma::readImage UNatDisp *  ,
const char *  filename,
const char *  filetype,
UNatIma *&  natima
[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.


The documentation for this class was generated from the following files:
Generated on Thu Mar 3 09:58:46 2005 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.4.1