openvrml::img Class Reference

List of all members.

Detailed Description

Image data.


Public Member Functions

 img ()
 Construct.
 ~img ()
 Destroy.
bool set_url (const char *url, const doc2 *relative=0)
 Load an image.
bool try_urls (const std::vector< std::string > &urls, const doc2 *relative=0)
 Call img::set_url for each URI in urls until one successfully loads an image.
const char * url () const
 The URI of the currently loaded image.
size_t w () const
 Image width.
size_t h () const
 Image height.
size_t nc () const
 Number of components.
size_t nframes () const
 Number of frames.
const unsigned char * pixels () const
 Pixel data.
const unsigned char * pixels (size_t frame) const
 The pixel data for a frrame of the currently loaded image.

Private Attributes

docurl_
 Resource.
size_t w_
 Image width.
size_t h_
 Image height.
size_t nc_
 Number of components.
size_t nframes_
 Number of frames.
unsigned char * pixels_
 Pixel data.
unsigned char ** frame_
 Frame data for time-dependent images.

Constructor & Destructor Documentation

openvrml::img::img (  ) 

Construct.

openvrml::img::~img (  ) 

Destroy.


Member Function Documentation

bool openvrml::img::set_url ( const char *  url,
const doc2 relative = 0 
)

Load an image.

Parameters:
url a URI.
relative URI to which url is relative; or 0 if url is an absolute URI.
Returns:
true if the image is loaded successfully; false otherwise.

bool openvrml::img::try_urls ( const std::vector< std::string > &  urls,
const doc2 relative = 0 
)

Call img::set_url for each URI in urls until one successfully loads an image.

Parameters:
urls URIs.
relative URI to which the URIs in urls are relative; or 0 if all the URIs in urls are absolute.
Returns:
true if an image is successfully loaded from any of the URIs in urls; false otherwise.

const char * openvrml::img::url (  )  const

The URI of the currently loaded image.

Returns:
the URI of the currently loaded image; or 0 if no image is loaded.

size_t openvrml::img::w (  )  const [inline]

Image width.

Returns:
the image width.

size_t openvrml::img::h (  )  const [inline]

Image height.

Returns:
the image height.

size_t openvrml::img::nc (  )  const [inline]

Number of components.

Returns:
the number of components.

size_t openvrml::img::nframes (  )  const [inline]

Number of frames.

Returns:
the number of frames.

const unsigned char * openvrml::img::pixels (  )  const [inline]

Pixel data.

Returns:
the pixel data.

const unsigned char * openvrml::img::pixels ( size_t  frame  )  const

The pixel data for a frrame of the currently loaded image.

Parameters:
frame the frame of interest.
Returns:
the pixel data for a frame of the currently loaded image; or 0 if frame is not valid.


Member Data Documentation

doc * openvrml::img::url_ [private]

Resource.

size_t openvrml::img::w_ [private]

Image width.

size_t openvrml::img::h_ [private]

Image height.

size_t openvrml::img::nc_ [private]

Number of components.

size_t openvrml::img::nframes_ [private]

Number of frames.

unsigned char * openvrml::img::pixels_ [private]

Pixel data.

unsigned char ** openvrml::img::frame_ [private]

Frame data for time-dependent images.