28 #include <osgDB/ReadFile>
30 #include "core/common/WLogger.h"
41 m_image( new osg::Image( image, osg::CopyOp::DEEP_COPY_IMAGES ) )
46 m_image( new osg::Image( *image.m_image, osg::CopyOp::DEEP_COPY_IMAGES ) )
65 osg::ref_ptr< osg::Image > image = osgDB::readImageFile( file );
68 wlog::error(
"WGEImage" ) <<
"Failed to load image \"" << file <<
"\".";
75 wlog::error(
"WGEImage" ) <<
"Failed to load image \"" << file <<
"\".";
117 return m_image->getColor( x, y, z );
124 case osg::Image::BOTTOM_LEFT:
126 case osg::Image::TOP_LEFT:
osg::ref_ptr< osg::Image > getAsOSGImage() const
Return the underlying osg::Image.
Origin
Where is the origin?
@ BOTTOM_LEFT
bottom left origin
@ TOP_LEFT
top left origin
WColor getColor(unsigned int x, unsigned int y=0, unsigned int z=0)
Grab color at specified pixel/voxel.
unsigned char * data()
Get the raw image data.
WGEImage()
Default constructor.
osg::ref_ptr< osg::Image > m_image
The osg image we use.
int getWidth() const
Get size in X direction.
int getDepth() const
Get size in Z direction.
WGEImage & operator=(WGEImage other)
Copy assignment operator.
static WGEImage::SPtr createFromFile(boost::filesystem::path file)
Load an image from a file.
Origin getOrigin() const
Query origin.
int getHeight() const
Get size in Y direction.
virtual ~WGEImage()
Destructor.
std::shared_ptr< WGEImage > SPtr
Convenience typedef for a std::shared_ptr< WGEImage >.
WStreamedLogger error(const std::string &source)
Logging an error message.