OpenWalnut
1.5.0dev
|
Image data object. More...
#include <WGEImage.h>
Public Types | |
enum | Origin { BOTTOM_LEFT = 0 , TOP_LEFT } |
Where is the origin? More... | |
typedef std::shared_ptr< WGEImage > | SPtr |
Convenience typedef for a std::shared_ptr< WGEImage >. More... | |
typedef std::shared_ptr< const WGEImage > | ConstSPtr |
Convenience typedef for a std::shared_ptr< const WGEImage >. More... | |
Public Member Functions | |
WGEImage () | |
Default constructor. More... | |
WGEImage (const osg::Image &image) | |
Construct from a given osg::Image. More... | |
WGEImage (const WGEImage &image) | |
Copy construct from given image. More... | |
virtual | ~WGEImage () |
Destructor. More... | |
WGEImage & | operator= (WGEImage other) |
Copy assignment operator. More... | |
int | getWidth () const |
Get size in X direction. More... | |
int | getHeight () const |
Get size in Y direction. More... | |
int | getDepth () const |
Get size in Z direction. More... | |
osg::ref_ptr< osg::Image > | getAsOSGImage () const |
Return the underlying osg::Image. More... | |
unsigned char * | data () |
Get the raw image data. More... | |
const unsigned char * | data () const |
Get the raw image data. More... | |
WColor | getColor (unsigned int x, unsigned int y=0, unsigned int z=0) |
Grab color at specified pixel/voxel. More... | |
Origin | getOrigin () const |
Query origin. More... | |
Static Public Member Functions | |
static WGEImage::SPtr | createFromFile (boost::filesystem::path file) |
Load an image from a file. More... | |
static WGEImage::SPtr | createFromFile (std::string file) |
Load an image from a file. More... | |
Private Attributes | |
osg::ref_ptr< osg::Image > | m_image |
The osg image we use. More... | |
Image data object.
Encapsulate 1D, 2D, and 3D images. Also provides static load function. This basically encapsulates an osg::Image. The osg::Image can contain a huge variety of image data of different data types, formats, and so on.
Definition at line 42 of file WGEImage.h.
typedef std::shared_ptr< const WGEImage > WGEImage::ConstSPtr |
Convenience typedef for a std::shared_ptr< const WGEImage >.
Definition at line 53 of file WGEImage.h.
typedef std::shared_ptr< WGEImage > WGEImage::SPtr |
Convenience typedef for a std::shared_ptr< WGEImage >.
Definition at line 48 of file WGEImage.h.
enum WGEImage::Origin |
Where is the origin?
Enumerator | |
---|---|
BOTTOM_LEFT | bottom left origin |
TOP_LEFT | top left origin |
Definition at line 162 of file WGEImage.h.
WGEImage::WGEImage | ( | ) |
Default constructor.
Definition at line 34 of file WGEImage.cpp.
Referenced by createFromFile().
|
explicit |
Construct from a given osg::Image.
image | the image |
Definition at line 40 of file WGEImage.cpp.
|
explicit |
Copy construct from given image.
image | the image |
Definition at line 45 of file WGEImage.cpp.
|
virtual |
Destructor.
Definition at line 56 of file WGEImage.cpp.
|
static |
Load an image from a file.
This is very fault tolerant. Just returns NULL on error.
file | the file to load |
Definition at line 80 of file WGEImage.cpp.
Referenced by WMTemplateShaders::moduleMain(), and WMTemplateUI::moduleMain().
|
static |
Load an image from a file.
This is very fault tolerant. Just returns NULL on error.
file | the file to load |
Definition at line 61 of file WGEImage.cpp.
References wlog::error(), and WGEImage().
unsigned char * WGEImage::data | ( | ) |
Get the raw image data.
Definition at line 105 of file WGEImage.cpp.
References m_image.
const unsigned char * WGEImage::data | ( | ) | const |
Get the raw image data.
Definition at line 110 of file WGEImage.cpp.
References m_image.
osg::ref_ptr< osg::Image > WGEImage::getAsOSGImage | ( | ) | const |
Return the underlying osg::Image.
Should rarely be used and is mostly useful when working directly with OSG.
Definition at line 85 of file WGEImage.cpp.
References m_image.
WColor WGEImage::getColor | ( | unsigned int | x, |
unsigned int | y = 0 , |
||
unsigned int | z = 0 |
||
) |
Grab color at specified pixel/voxel.
Please note that you should consider the image's origin. Query with getOrigin().
x | X coord |
y | Y coord, optional in 1D images |
z | Z coord, optional in 1D,2D images. |
Definition at line 115 of file WGEImage.cpp.
References m_image.
int WGEImage::getDepth | ( | ) | const |
Get size in Z direction.
This is 1 for 2D & 1D images.
Definition at line 100 of file WGEImage.cpp.
References m_image.
int WGEImage::getHeight | ( | ) | const |
Get size in Y direction.
This is 1 for 1D images.
Definition at line 95 of file WGEImage.cpp.
References m_image.
WGEImage::Origin WGEImage::getOrigin | ( | ) | const |
Query origin.
Definition at line 120 of file WGEImage.cpp.
References BOTTOM_LEFT, m_image, and TOP_LEFT.
int WGEImage::getWidth | ( | ) | const |
Get size in X direction.
Definition at line 90 of file WGEImage.cpp.
References m_image.
Copy assignment operator.
other | the other instance |
Definition at line 50 of file WGEImage.cpp.
References m_image.
|
private |
The osg image we use.
Definition at line 179 of file WGEImage.h.
Referenced by data(), getAsOSGImage(), getColor(), getDepth(), getHeight(), getOrigin(), getWidth(), and operator=().