class SG_EXPORT osg::Image

Image class for encapsulating the storage texture image data

Inheritance:


Public Methods

[more] Image()
[more] Image(const Image& image, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy
[more]virtual Object* cloneType() const
[more]virtual Object* clone(const CopyOp& copyop) const
[more]virtual bool isSameKindAs(const Object* obj) const
[more]virtual const char* libraryName() const
[more]virtual const char* className() const
[more]virtual int compare(const Image& rhs) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs
[more]void setFileName(const std::string& fileName)
[more]inline const std::string& getFileName() const
[more]void setAllocationMode(AllocationMode mode)
Set the method used for deleting data once it goes out of scope
[more]AllocationMode setAllocationMode() const
Get the method used for deleting data once it goes out of scope
[more]void allocateImage(int s, int t, int r, GLenum format, GLenum type, int packing=1)
[more]void setImage(int s, int t, int r, GLint internalTextureformat, GLenum format, GLenum type, unsigned char* data, AllocationMode mode, int packing=1)
set the image data and format.
[more]void readPixels(int x, int y, int width, int height, GLenum format, GLenum type)
readPixels from screen at specified position and size, using glReadPixels.
[more]void readImageFromCurrentTexture(unsigned int contextID=0)
read the contents of the current bound texture, handling compressed formats if present.
[more]void scaleImage(int s, int t, int r)
Scale image to specified size.
[more]void copySubImage(int s_offset, int t_offset, int r_offset, osg::Image* source)
Copy a source Image into a subpart of this Image at specified position.
[more]inline int s() const
Width of image
[more]inline int t() const
Height of image
[more]inline int r() const
Depth of image
[more]void setInternalTextureFormat(GLint internalFormat)
[more]inline GLint getInternalTextureFormat() const
[more]void setPixelFormat(GLenum format)
[more]inline GLenum getPixelFormat() const
[more]inline GLenum getDataType() const
[more]inline unsigned int getPacking() const
[more]inline unsigned int getPixelSizeInBits() const
return the numbers of bits required for each pixel
[more]inline unsigned int getRowSizeInBytes() const
return the numbers of bytes each row of pixels occupies once it has been packed
[more]inline unsigned int getImageSizeInBytes() const
return the numbers of bytes each image (_s*_t) of pixels occupies
[more]inline unsigned int getTotalSizeInBytes() const
return the numbers of bytes the whole row/image/volume of pixels occupies
[more]unsigned int getTotalSizeInBytesIncludingMipmaps() const
return the numbers of bytes the whole row/image/volume of pixels occupies, including all mip maps if included
[more]inline unsigned char* data()
raw image data
[more]inline const unsigned char* data() const
raw const image data
[more]inline unsigned char* data(int column, int row=0, int image=0) const
[more]void flipHorizontal(int image=0)
Flip the image horizontally
[more]void flipVertical(int image=0)
Flip the image vertically
[more]void ensureValidSizeForTexturing(GLint maxTextureSize)
Ensure image dimensions are a power of two.
[more]inline void dirty()
Dirty the image, which increments the modified flag, to force osg::Texture to reload the image
[more]inline void setModifiedTag(unsigned int value)
Set the modified tag value, only used by osg::Texture when using texture subloading.
[more]inline unsigned int getModifiedTag() const
Get modified tag value, only used by osg::Texture when using texture subloading.
[more]static bool isPackedType(GLenum type)
[more]static unsigned int computeNumComponents(GLenum format)
[more]static unsigned int computePixelSizeInBits(GLenum format, GLenum type)
[more]static unsigned int computeRowWidthInBytes(int width, GLenum format, GLenum type, int packing)
[more]static int computeNearestPowerOfTwo(int s, float bias=0.5f)
[more]inline bool isMipmap() const
[more]unsigned int getNumMipmapLevels() const
[more]inline void setMipmapData(const MipmapDataType& mipmapDataVector)
[more]inline unsigned char* getMipmapData(unsigned int mipmapNumber) const
[more]void computeMipMaps()
converts a single image into mip mapped version image
[more]bool isImageTranslucent() const
return true of this image is translucent - ie.

Public Members

[more]enum AllocationMode
[more]typedef std::vector< unsigned int > MipmapDataType

Protected Fields

[more]std::string _fileName
[more]int _s
[more]int _t
[more]int _r
[more]GLint _internalTextureFormat
[more]GLenum _pixelFormat
[more]GLenum _dataType
[more]unsigned int _packing
[more]AllocationMode _allocationMode
[more]unsigned char* _data
[more]unsigned int _modifiedTag
[more]MipmapDataType _mipmapData

Protected Methods

[more]virtual ~Image()
[more]Image& operator = (const Image&)
[more]void deallocateData()
[more]void setData(unsigned char* data, AllocationMode allocationMode)


Inherited from Object:

Public Methods

oinline void setDataVariance(DataVariance dv)
oinline DataVariance getDataVariance() const
oinline void setUserData(Referenced* obj)
oinline Referenced* getUserData()
oinline const Referenced* getUserData() const

Public Members

oenum DataVariance

Protected Fields

oDataVariance _dataVariance
oref_ptr<Referenced> _userData


Inherited from Referenced:

Public Methods

ostatic void setDeleteHandler(DeleteHandler* handler)
ostatic DeleteHandler* getDeleteHandler()
oinline void ref() const
oinline void unref_nodelete() const
oinline int referenceCount() const
oinline void unref() const

Protected Fields

omutable int _refCount


Documentation

Image class for encapsulating the storage texture image data
o Image()

o Image(const Image& image, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy

ovirtual Object* cloneType() const

ovirtual Object* clone(const CopyOp& copyop) const

ovirtual bool isSameKindAs(const Object* obj) const

ovirtual const char* libraryName() const

ovirtual const char* className() const

ovirtual int compare(const Image& rhs) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs

ovoid setFileName(const std::string& fileName)

oinline const std::string& getFileName() const

oenum AllocationMode

o NO_DELETE

o USE_NEW_DELETE

o USE_MALLOC_FREE

ovoid setAllocationMode(AllocationMode mode)
Set the method used for deleting data once it goes out of scope

oAllocationMode setAllocationMode() const
Get the method used for deleting data once it goes out of scope

ovoid allocateImage(int s, int t, int r, GLenum format, GLenum type, int packing=1)

ovoid setImage(int s, int t, int r, GLint internalTextureformat, GLenum format, GLenum type, unsigned char* data, AllocationMode mode, int packing=1)
set the image data and format. note, when the packing value is negative (the default is -1) this method assumes a _packing width of 1 if the width is not a multiple of 4, otherwise automatically sets to _packing to 4. If a positive value of packing is supplied than _packing is simply set to that value.

ovoid readPixels(int x, int y, int width, int height, GLenum format, GLenum type)
readPixels from screen at specified position and size, using glReadPixels. Create memory for storage if required, reuse existing pixel coords if possible.

ovoid readImageFromCurrentTexture(unsigned int contextID=0)
read the contents of the current bound texture, handling compressed formats if present. Create memory for storage if required, reuse existing pixel coords if possible.

ovoid scaleImage(int s, int t, int r)
Scale image to specified size.

ovoid copySubImage(int s_offset, int t_offset, int r_offset, osg::Image* source)
Copy a source Image into a subpart of this Image at specified position. Typically used to copy to an already allocated image, such as creating a 3D image from a stack 2D images. If the this Image is empty then image data is created to accomodate the imaging image in its offset position. If source is NULL then no operation happens, this Image is left unchanged.

oinline int s() const
Width of image

oinline int t() const
Height of image

oinline int r() const
Depth of image

ovoid setInternalTextureFormat(GLint internalFormat)

oinline GLint getInternalTextureFormat() const

ovoid setPixelFormat(GLenum format)

oinline GLenum getPixelFormat() const

oinline GLenum getDataType() const

oinline unsigned int getPacking() const

oinline unsigned int getPixelSizeInBits() const
return the numbers of bits required for each pixel

oinline unsigned int getRowSizeInBytes() const
return the numbers of bytes each row of pixels occupies once it has been packed

oinline unsigned int getImageSizeInBytes() const
return the numbers of bytes each image (_s*_t) of pixels occupies

oinline unsigned int getTotalSizeInBytes() const
return the numbers of bytes the whole row/image/volume of pixels occupies

ounsigned int getTotalSizeInBytesIncludingMipmaps() const
return the numbers of bytes the whole row/image/volume of pixels occupies, including all mip maps if included

oinline unsigned char* data()
raw image data

oinline const unsigned char* data() const
raw const image data

oinline unsigned char* data(int column, int row=0, int image=0) const

ovoid flipHorizontal(int image=0)
Flip the image horizontally

ovoid flipVertical(int image=0)
Flip the image vertically

ovoid ensureValidSizeForTexturing(GLint maxTextureSize)
Ensure image dimensions are a power of two. Mip Mapped texture require the image dimensions to be power of two and are within the maxiumum texture size for the host machine.

oinline void dirty()
Dirty the image, which increments the modified flag, to force osg::Texture to reload the image

oinline void setModifiedTag(unsigned int value)
Set the modified tag value, only used by osg::Texture when using texture subloading.

oinline unsigned int getModifiedTag() const
Get modified tag value, only used by osg::Texture when using texture subloading.

ostatic bool isPackedType(GLenum type)

ostatic unsigned int computeNumComponents(GLenum format)

ostatic unsigned int computePixelSizeInBits(GLenum format, GLenum type)

ostatic unsigned int computeRowWidthInBytes(int width, GLenum format, GLenum type, int packing)

ostatic int computeNearestPowerOfTwo(int s, float bias=0.5f)

otypedef std::vector< unsigned int > MipmapDataType

oinline bool isMipmap() const

ounsigned int getNumMipmapLevels() const

oinline void setMipmapData(const MipmapDataType& mipmapDataVector)

oinline unsigned char* getMipmapData(unsigned int mipmapNumber) const

ovoid computeMipMaps()
converts a single image into mip mapped version image

obool isImageTranslucent() const
return true of this image is translucent - ie. it has alpha values that are less 1.0 (when normalized).

ovirtual ~Image()

oImage& operator = (const Image&)

ostd::string _fileName

oint _s

oint _t

oint _r

oGLint _internalTextureFormat

oGLenum _pixelFormat

oGLenum _dataType

ounsigned int _packing

oAllocationMode _allocationMode

ounsigned char* _data

ovoid deallocateData()

ovoid setData(unsigned char* data, AllocationMode allocationMode)

ounsigned int _modifiedTag

oMipmapDataType _mipmapData


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.