osg::Image Class Reference

Image class. See Image for a description. More...

#include <OSGImage.h>

Inheritance diagram for osg::Image:

osg::ImageBase osg::AttachmentContainer osg::FieldContainer

List of all members.

Public Types

enum  PixelFormat {
  OSG_INVALID_PF = 0, OSG_A_PF = GL_ALPHA, OSG_I_PF = GL_INTENSITY, OSG_L_PF = GL_LUMINANCE,
  OSG_LA_PF = GL_LUMINANCE_ALPHA, OSG_BGR_PF = GL_BGR, OSG_BGRA_PF = GL_BGRA, OSG_RGB_DXT1 = GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
  OSG_RGBA_DXT1 = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, OSG_RGBA_DXT3 = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, OSG_RGBA_DXT5 = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, OSG_RGB_PF = GL_RGB,
  OSG_RGBA_PF = GL_RGBA, OSG_ALPHA_INTEGER_PF = GL_ALPHA_INTEGER_EXT, OSG_RGB_INTEGER_PF = GL_RGB_INTEGER_EXT, OSG_RGBA_INTEGER_PF = GL_RGBA_INTEGER_EXT,
  OSG_BGR_INTEGER_PF = GL_BGR_INTEGER_EXT, OSG_BGRA_INTEGER_PF = GL_BGRA_INTEGER_EXT, OSG_LUMINANCE_INTEGER_PF = GL_LUMINANCE_INTEGER_EXT, OSG_LUMINANCE_ALPHA_INTEGER_PF = GL_LUMINANCE_ALPHA_INTEGER_EXT
}
enum  Type {
  OSG_INVALID_IMAGEDATATYPE = GL_NONE, OSG_UINT8_IMAGEDATA = GL_UNSIGNED_BYTE, OSG_UINT16_IMAGEDATA = GL_UNSIGNED_SHORT, OSG_UINT32_IMAGEDATA = GL_UNSIGNED_INT,
  OSG_FLOAT16_IMAGEDATA = GL_HALF_FLOAT_NV, OSG_FLOAT32_IMAGEDATA = GL_FLOAT, OSG_INT16_IMAGEDATA = GL_SHORT, OSG_INT32_IMAGEDATA = GL_INT
}
enum  ResUnit { OSG_RESUNIT_INVALID = 0, OSG_RESUNIT_NONE = 1, OSG_RESUNIT_INCH = 2 }
enum  {
  ParentsFieldId = Inherited::NextFieldId, DimensionFieldId = ParentsFieldId + 1, WidthFieldId = DimensionFieldId + 1, HeightFieldId = WidthFieldId + 1,
  DepthFieldId = HeightFieldId + 1, BppFieldId = DepthFieldId + 1, MipMapCountFieldId = BppFieldId + 1, FrameCountFieldId = MipMapCountFieldId + 1,
  FrameDelayFieldId = FrameCountFieldId + 1, PixelFormatFieldId = FrameDelayFieldId + 1, PixelFieldId = PixelFormatFieldId + 1, FrameSizeFieldId = PixelFieldId + 1,
  NameFieldId = FrameSizeFieldId + 1, DataTypeFieldId = NameFieldId + 1, ComponentSizeFieldId = DataTypeFieldId + 1, SideCountFieldId = ComponentSizeFieldId + 1,
  SideSizeFieldId = SideCountFieldId + 1, ForceCompressedDataFieldId = SideSizeFieldId + 1, ForceAlphaChannelFieldId = ForceCompressedDataFieldId + 1, ForceColorChannelFieldId = ForceAlphaChannelFieldId + 1,
  ForceAlphaBinaryFieldId = ForceColorChannelFieldId + 1, ResXFieldId = ForceAlphaBinaryFieldId + 1, ResYFieldId = ResXFieldId + 1, ResUnitFieldId = ResYFieldId + 1,
  NextFieldId = ResUnitFieldId + 1
}
typedef ImagePtr Ptr
enum  { AttachmentsFieldId = Inherited::NextFieldId, NextFieldId = AttachmentsFieldId + 1 }
enum  { NextFieldId = 1 }

Public Member Functions

Sync


virtual void changed (BitVector whichField, UInt32 origin)
Output


virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
Set Object Data


bool set (UInt32 pixelFormat, Int32 width, Int32 height=1, Int32 depth=1, Int32 mipmapCount=1, Int32 frameCount=1, Time frameDelay=0.0, const UInt8 *data=0, Int32 type=OSG_UINT8_IMAGEDATA, bool allocMem=true, Int32 sideCount=1)
bool set (ImagePtr image)
bool setData (const UInt8 *data=0)
void clearData (void)
bool setSubData (Int32 offX, Int32 offY, Int32 offZ, Int32 srcW, Int32 srcH, Int32 srcD, const UInt8 *data)
bool flipDepthFrameData (void)
Add Value


bool addValue (const char *value)
Reformate


bool reformat (const PixelFormat pixelFormat, ImagePtr destination=NullFC)
Convert dataType


void swapDataEndian (void)
bool convertDataTypeTo (Int32 destDataType=OSG_UINT8_IMAGEDATA)
Scale


bool scale (Int32 width, Int32 height=1, Int32 depth=1, ImagePtr destination=NullFC)
bool scaleNextPower2 (ImagePtr destination=NullFC)
SubImage


bool subImage (Int32 offX, Int32 offY, Int32 offZ, Int32 destW, Int32 destH, Int32 destD, ImagePtr destination=NullFC)
Slice


bool slice (Int32 offX=-1, Int32 offY=-1, Int32 offZ=-1, ImagePtr destination=NullFC)
Mipmap


bool createMipmap (Int32 level=-1, ImagePtr destination=NullFC)
Read/Write


bool write (const Char8 *fileName)
bool read (const Char8 *fileName)
Storage/Restore


UInt64 store (const Char8 *mimeType, UInt8 *mem, Int32 memSize=-1)
UInt64 restore (const UInt8 *mem, Int32 memSize=-1)
Comparison/Assign


Imageoperator= (const Image &image)
bool operator< (const Image &image)
bool operator== (const Image &image)
bool operator!= (const Image &image)
Get Methods


bool isValid (void) const
bool hasAlphaChannel (void)
bool isAlphaBinary (void)
bool hasColorChannel (void)
bool hasCompressedData (void)
UInt8 getComponents (void) const
bool calcIsAlphaBinary (void)
Size


unsigned long getSize (bool withMipmap=true, bool withFrames=true, bool withSides=true) const
Get Methods


const UInt8getData (UInt32 mipmapNum=0, UInt32 frameNum=0, UInt32 sideNum=0) const
UInt8getData (UInt32 mipmapNum=0, UInt32 frameNum=0, UInt32 sideNum=0)
UInt8getDataByTime (Time time, UInt32 mipmapNum=1)
Calculate


void calcMipmapGeometry (UInt32 mipmapNum, UInt32 &width, UInt32 &height, UInt32 &depth) const
UInt32 calcMipmapLevelCount (void) const
UInt32 calcFrameNum (Time time, bool loop=true) const
Clear Image


virtual void clear (UChar8 pixelValue=0)
virtual void clearFloat (Real32 pixelValue=0.0)
virtual void clearHalf (Real16 pixelValue=Real16(0.0))
attachment handling


bool hasAttachment (void) const
UInt32 attachmentCount (void) const
void setAttachmentField (const std::string &key, const std::string &data)
const std::string * findAttachmentField (const std::string &key) const
Calculate Mipmap Size


UInt32 calcMipmapLevelSize (UInt32 mipmapNum, UInt32 w, UInt32 h, UInt32 d) const
UInt32 calcMipmapLevelSize (UInt32 mipmapNum) const
UInt32 calcMipmapSumSize (UInt32 mipmapNum, UInt32 w, UInt32 h, UInt32 d) const
UInt32 calcMipmapSumSize (UInt32 mipmapNum) const
FieldContainer Get


virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get


MFFieldContainerPtrgetMFParents (void)
 Get the Image::_mfParents field.
SFInt32getSFDimension (void)
 Get the Image::_sfDimension field.
SFInt32getSFWidth (void)
 Get the Image::_sfWidth field.
SFInt32getSFHeight (void)
 Get the Image::_sfHeight field.
SFInt32getSFDepth (void)
 Get the Image::_sfDepth field.
SFInt32getSFBpp (void)
 Get the Image::_sfBpp field.
SFInt32getSFMipMapCount (void)
 Get the Image::_sfMipMapCount field.
SFInt32getSFFrameCount (void)
 Get the Image::_sfFrameCount field.
SFTimegetSFFrameDelay (void)
 Get the Image::_sfFrameDelay field.
SFUInt32getSFPixelFormat (void)
 Get the Image::_sfPixelFormat field.
MFUInt8getMFPixel (void)
 Get the Image::_mfPixel field.
SFInt32getSFFrameSize (void)
 Get the Image::_sfFrameSize field.
SFStringgetSFName (void)
 Get the Image::_sfName field.
SFInt32getSFDataType (void)
 Get the Image::_sfDataType field.
SFInt32getSFSideCount (void)
 Get the Image::_sfSideCount field.
SFInt32getSFSideSize (void)
 Get the Image::_sfSideSize field.
SFBoolgetSFForceCompressedData (void)
 Get the Image::_sfForceCompressedData field.
SFBoolgetSFForceAlphaChannel (void)
 Get the Image::_sfForceAlphaChannel field.
SFBoolgetSFForceColorChannel (void)
 Get the Image::_sfForceColorChannel field.
SFBoolgetSFForceAlphaBinary (void)
 Get the Image::_sfForceAlphaBinary field.
SFReal32getSFResX (void)
 Get the Image::_sfResX field.
SFReal32getSFResY (void)
 Get the Image::_sfResY field.
SFUInt16getSFResUnit (void)
 Get the Image::_sfResUnit field.
Int32getDimension (void)
 Get the value of the Image::_sfDimension field.
const Int32getDimension (void) const
 Get the value of the Image::_sfDimension field.
Int32getWidth (void)
 Get the value of the Image::_sfWidth field.
const Int32getWidth (void) const
 Get the value of the Image::_sfWidth field.
Int32getHeight (void)
 Get the value of the Image::_sfHeight field.
const Int32getHeight (void) const
 Get the value of the Image::_sfHeight field.
Int32getDepth (void)
 Get the value of the Image::_sfDepth field.
const Int32getDepth (void) const
 Get the value of the Image::_sfDepth field.
Int32getBpp (void)
 Get the value of the Image::_sfBpp field.
const Int32getBpp (void) const
 Get the value of the Image::_sfBpp field.
Int32getMipMapCount (void)
 Get the value of the Image::_sfMipMapCount field.
const Int32getMipMapCount (void) const
 Get the value of the Image::_sfMipMapCount field.
Int32getFrameCount (void)
 Get the value of the Image::_sfFrameCount field.
const Int32getFrameCount (void) const
 Get the value of the Image::_sfFrameCount field.
TimegetFrameDelay (void)
 Get the value of the Image::_sfFrameDelay field.
const TimegetFrameDelay (void) const
 Get the value of the Image::_sfFrameDelay field.
UInt32getPixelFormat (void)
 Get the value of the Image::_sfPixelFormat field.
const UInt32getPixelFormat (void) const
 Get the value of the Image::_sfPixelFormat field.
Int32getFrameSize (void)
 Get the value of the Image::_sfFrameSize field.
const Int32getFrameSize (void) const
 Get the value of the Image::_sfFrameSize field.
std::string & getName (void)
 Get the value of the Image::_sfName field.
const std::string & getName (void) const
 Get the value of the Image::_sfName field.
Int32getDataType (void)
 Get the value of the Image::_sfDataType field.
const Int32getDataType (void) const
 Get the value of the Image::_sfDataType field.
Int32getSideCount (void)
 Get the value of the Image::_sfSideCount field.
const Int32getSideCount (void) const
 Get the value of the Image::_sfSideCount field.
Int32getSideSize (void)
 Get the value of the Image::_sfSideSize field.
const Int32getSideSize (void) const
 Get the value of the Image::_sfSideSize field.
bool & getForceCompressedData (void)
 Get the value of the Image::_sfForceCompressedData field.
const bool & getForceCompressedData (void) const
 Get the value of the Image::_sfForceCompressedData field.
bool & getForceAlphaChannel (void)
 Get the value of the Image::_sfForceAlphaChannel field.
const bool & getForceAlphaChannel (void) const
 Get the value of the Image::_sfForceAlphaChannel field.
bool & getForceColorChannel (void)
 Get the value of the Image::_sfForceColorChannel field.
const bool & getForceColorChannel (void) const
 Get the value of the Image::_sfForceColorChannel field.
bool & getForceAlphaBinary (void)
 Get the value of the Image::_sfForceAlphaBinary field.
const bool & getForceAlphaBinary (void) const
 Get the value of the Image::_sfForceAlphaBinary field.
Real32getResX (void)
 Get the value of the Image::_sfResX field.
const Real32getResX (void) const
 Get the value of the Image::_sfResX field.
Real32getResY (void)
 Get the value of the Image::_sfResY field.
const Real32getResY (void) const
 Get the value of the Image::_sfResY field.
UInt16getResUnit (void)
 Get the value of the Image::_sfResUnit field.
const UInt16getResUnit (void) const
 Get the value of the Image::_sfResUnit field.
FieldContainerPtrgetParents (const UInt32 index)
 Get the value of the index element the Image::_mfParents field.
MFFieldContainerPtrgetParents (void)
 Get the Image::_mfParents field.
const MFFieldContainerPtrgetParents (void) const
 Get the Image::_mfParents field.
UInt8getPixel (const UInt32 index)
 Get the value of the index element the Image::_mfPixel field.
MFUInt8getPixel (void)
 Get the Image::_mfPixel field.
const MFUInt8getPixel (void) const
 Get the Image::_mfPixel field.
Field Set


void setDimension (const Int32 &value)
 Set the value of the Image::_sfDimension field.
void setWidth (const Int32 &value)
 Set the value of the Image::_sfWidth field.
void setHeight (const Int32 &value)
 Set the value of the Image::_sfHeight field.
void setDepth (const Int32 &value)
 Set the value of the Image::_sfDepth field.
void setBpp (const Int32 &value)
 Set the value of the Image::_sfBpp field.
void setMipMapCount (const Int32 &value)
 Set the value of the Image::_sfMipMapCount field.
void setFrameCount (const Int32 &value)
 Set the value of the Image::_sfFrameCount field.
void setFrameDelay (const Time &value)
 Set the value of the Image::_sfFrameDelay field.
void setPixelFormat (const UInt32 &value)
 Set the value of the Image::_sfPixelFormat field.
void setFrameSize (const Int32 &value)
 Set the value of the Image::_sfFrameSize field.
void setName (const std::string &value)
 Set the value of the Image::_sfName field.
void setDataType (const Int32 &value)
 Set the value of the Image::_sfDataType field.
void setSideCount (const Int32 &value)
 Set the value of the Image::_sfSideCount field.
void setSideSize (const Int32 &value)
 Set the value of the Image::_sfSideSize field.
void setForceCompressedData (const bool &value)
 Set the value of the Image::_sfForceCompressedData field.
void setForceAlphaChannel (const bool &value)
 Set the value of the Image::_sfForceAlphaChannel field.
void setForceColorChannel (const bool &value)
 Set the value of the Image::_sfForceColorChannel field.
void setForceAlphaBinary (const bool &value)
 Set the value of the Image::_sfForceAlphaBinary field.
void setResX (const Real32 &value)
 Set the value of the Image::_sfResX field.
void setResY (const Real32 &value)
 Set the value of the Image::_sfResY field.
void setResUnit (const UInt16 &value)
 Set the value of the Image::_sfResUnit field.
Binary Access
virtual UInt32 getBinSize (const BitVector &whichField)
virtual void copyToBin (BinaryDataHandler &pMem, const BitVector &whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField)
Copy


virtual FieldContainerPtr shallowCopy (void) const
Handle Attachments


void addAttachment (const AttachmentPtr &fieldContainerP, UInt16 binding=0)
void subAttachment (const AttachmentPtr &fieldContainerP, UInt16 binding=0)
AttachmentPtr findAttachment (UInt32 groupId, UInt16 binding=0)
AttachmentPtr findAttachment (const FieldContainerType &type, UInt16 binding=0)


SFAttachmentMapgetSFAttachments (void)
Get Instance Type Information


UInt32 getTypeId (void) const
UInt16 getGroupId (void) const
const Char8getTypeName (void) const


FieldgetField (UInt32 fieldId)
FieldgetField (const Char8 *fieldName)

Static Public Member Functions

Class Get


static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction


static ImagePtr create (void)
 create a new instance of the class
static ImagePtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype
Get Class Type Information


static UInt16 getClassGroupId (void)

Static Public Attributes

static const osg::BitVector ParentsFieldMask
static const osg::BitVector DimensionFieldMask
static const osg::BitVector WidthFieldMask
static const osg::BitVector HeightFieldMask
static const osg::BitVector DepthFieldMask
static const osg::BitVector BppFieldMask
static const osg::BitVector MipMapCountFieldMask
static const osg::BitVector FrameCountFieldMask
static const osg::BitVector FrameDelayFieldMask
static const osg::BitVector PixelFormatFieldMask
static const osg::BitVector PixelFieldMask
static const osg::BitVector FrameSizeFieldMask
static const osg::BitVector NameFieldMask
static const osg::BitVector DataTypeFieldMask
static const osg::BitVector ComponentSizeFieldMask
static const osg::BitVector SideCountFieldMask
static const osg::BitVector SideSizeFieldMask
static const osg::BitVector ForceCompressedDataFieldMask
static const osg::BitVector ForceAlphaChannelFieldMask
static const osg::BitVector ForceColorChannelFieldMask
static const osg::BitVector ForceAlphaBinaryFieldMask
static const osg::BitVector ResXFieldMask
static const osg::BitVector ResYFieldMask
static const osg::BitVector ResUnitFieldMask
static const osg::BitVector MTInfluenceMask
static const BitVector AttachmentsFieldMask
static const BitVector NextFieldMask
CoredNodePtr helper


static const bool isNodeCore = false

Protected Member Functions

Constructors


 Image (void)
 Image (const Image &source)
Destructors


virtual ~Image (void)
Field Get


SFInt32getSFComponentSize (void)
 Get the Image::_sfComponentSize field.
Int32getComponentSize (void)
 Get the value of the Image::_sfComponentSize field.
const Int32getComponentSize (void) const
 Get the value of the Image::_sfComponentSize field.
Field Set


void setComponentSize (const Int32 &value)
 Set the value of the Image::_sfComponentSize field.
Sync


void executeSyncImpl (ImageBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)
Sync


void executeSyncImpl (AttachmentContainer *pOther, const BitVector &whichField)
Sync


void executeSyncImpl (FieldContainer *pOther, const BitVector &whichField)
Pointer


AttachmentContainerPtr getPtr (void)
MT Edit


template<class FieldTypeT>
void beginEditX (const BitVector &whichField, FieldTypeT &field)
template<class FieldTypeT>
void endEditX (const BitVector &whichField, FieldTypeT &field)
MT Construction


void onCreate (const FieldContainer *source=NULL)
void onCreateAspect (const FieldContainer *aspect0, const FieldContainer *source=NULL)
MT Destruction


virtual void onDestroy (void)

Static Protected Member Functions

Create Fieldcontainer


template<class ObjectPtrT>
static void newPtr (ObjectPtrT &result, const typename ObjectPtrT::StoredObjectType *prototypeP)
template<class ObjectPtrT>
static void newPtr (ObjectPtrT &result)

Protected Attributes

Fields


MFFieldContainerPtr _mfParents
SFInt32 _sfDimension
SFInt32 _sfWidth
SFInt32 _sfHeight
SFInt32 _sfDepth
SFInt32 _sfBpp
SFInt32 _sfMipMapCount
SFInt32 _sfFrameCount
SFTime _sfFrameDelay
SFUInt32 _sfPixelFormat
MFUInt8 _mfPixel
SFInt32 _sfFrameSize
SFString _sfName
SFInt32 _sfDataType
SFInt32 _sfComponentSize
SFInt32 _sfSideCount
SFInt32 _sfSideSize
SFBool _sfForceCompressedData
SFBool _sfForceAlphaChannel
SFBool _sfForceColorChannel
SFBool _sfForceAlphaBinary
SFReal32 _sfResX
SFReal32 _sfResY
SFUInt16 _sfResUnit
Fields


SFAttachmentMap _attachmentMap
Member


UInt32 _shares

Static Protected Attributes

static element


static Int32 _formatDic [][2]
static Int32 _typeDic [][2]

Private Types

typedef ImageBase Inherited

Private Member Functions

Image Data


bool createData (const UInt8 *data, bool allocMem=true)
bool scaleData (UInt8 *srcData, Int32 srcW, Int32 srcH, Int32 srcD, UInt8 *destData, Int32 destW, Int32 destH, Int32 destD)

Static Private Member Functions

static void initMethod (void)

Friends

class FieldContainer
class ImageBase


Detailed Description

1D/2D/3D Image with various pixel types data, can also optional hold mipMap and simple multi-frame data.

Definition at line 56 of file OSGImage.h.


Member Typedef Documentation

typedef ImageBase osg::Image::Inherited [private]

Reimplemented from osg::ImageBase.

Definition at line 60 of file OSGImage.h.

typedef ImagePtr osg::ImageBase::Ptr [inherited]

Definition at line 113 of file OSGImageBase.h.


Member Enumeration Documentation

Enumerator:
OSG_INVALID_PF 
OSG_A_PF 
OSG_I_PF 
OSG_L_PF 
OSG_LA_PF 
OSG_BGR_PF 
OSG_BGRA_PF 
OSG_RGB_DXT1 
OSG_RGBA_DXT1 
OSG_RGBA_DXT3 
OSG_RGBA_DXT5 
OSG_RGB_PF 
OSG_RGBA_PF 
OSG_ALPHA_INTEGER_PF 
OSG_RGB_INTEGER_PF 
OSG_RGBA_INTEGER_PF 
OSG_BGR_INTEGER_PF 
OSG_BGRA_INTEGER_PF 
OSG_LUMINANCE_INTEGER_PF 
OSG_LUMINANCE_ALPHA_INTEGER_PF 

Definition at line 65 of file OSGImage.h.

00065                      {   OSG_INVALID_PF = 0,
00066 
00067                          OSG_A_PF       = GL_ALPHA,
00068                          OSG_I_PF       = GL_INTENSITY,
00069 
00070                          OSG_L_PF       = GL_LUMINANCE,
00071                          OSG_LA_PF      = GL_LUMINANCE_ALPHA,
00072 
00073 /*** BGR ***/
00074 #if defined(GL_BGR)
00075                          OSG_BGR_PF     = GL_BGR,
00076 #elif defined(GL_BGR_EXT)
00077                          OSG_BGR_PF     = GL_BGR_EXT,
00078 #else
00079                          OSG_BGR_PF     = 0,
00080 #endif
00081 
00082 /*** BGRA ***/
00083 #if defined(GL_BGRA)
00084                          OSG_BGRA_PF    = GL_BGRA,
00085 #elif defined(GL_BGRA_EXT)
00086                          OSG_BGRA_PF    = GL_BGRA_EXT,
00087 #else
00088                          OSG_BGRA_PF    = 0,
00089 #endif
00090 
00091 /*** RGB_DXT1 ***/
00092 #if defined(GL_COMPRESSED_RGB_S3TC_DXT1_EXT)
00093                          OSG_RGB_DXT1   = GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
00094 #else
00095                          OSG_RGB_DXT1   = 0,
00096 #endif
00097 
00098 /*** RGBA_DXT1 ***/
00099 #if defined(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
00100                          OSG_RGBA_DXT1  = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
00101 #else
00102                          OSG_RGBA_DXT1   = 0,
00103 #endif
00104 
00105 /*** RGBA_DXT3 ***/
00106 #if defined(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT)
00107                          OSG_RGBA_DXT3  = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
00108 #else
00109                          OSG_RGBA_DXT3   = 0,
00110 #endif
00111 
00112 /*** RGBA_DXT5 ***/
00113 #if defined(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)
00114                          OSG_RGBA_DXT5  = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
00115 #else
00116                          OSG_RGBA_DXT5   = 0,
00117 #endif
00118 
00119                          OSG_RGB_PF     = GL_RGB,
00120                          OSG_RGBA_PF    = GL_RGBA,
00121                          
00122                          OSG_ALPHA_INTEGER_PF = GL_ALPHA_INTEGER_EXT,
00123                          OSG_RGB_INTEGER_PF = GL_RGB_INTEGER_EXT,
00124                          OSG_RGBA_INTEGER_PF = GL_RGBA_INTEGER_EXT,
00125                          OSG_BGR_INTEGER_PF = GL_BGR_INTEGER_EXT,
00126                          OSG_BGRA_INTEGER_PF = GL_BGRA_INTEGER_EXT,
00127                          OSG_LUMINANCE_INTEGER_PF = GL_LUMINANCE_INTEGER_EXT,
00128                          OSG_LUMINANCE_ALPHA_INTEGER_PF = GL_LUMINANCE_ALPHA_INTEGER_EXT
00129     };

Enumerator:
OSG_INVALID_IMAGEDATATYPE 
OSG_UINT8_IMAGEDATA 
OSG_UINT16_IMAGEDATA 
OSG_UINT32_IMAGEDATA 
OSG_FLOAT16_IMAGEDATA 
OSG_FLOAT32_IMAGEDATA 
OSG_INT16_IMAGEDATA 
OSG_INT32_IMAGEDATA 

Definition at line 131 of file OSGImage.h.

00131               {
00132                          OSG_INVALID_IMAGEDATATYPE  = GL_NONE,
00133                          OSG_UINT8_IMAGEDATA        = GL_UNSIGNED_BYTE,
00134                          OSG_UINT16_IMAGEDATA       = GL_UNSIGNED_SHORT,
00135                          OSG_UINT32_IMAGEDATA       = GL_UNSIGNED_INT,
00136                          OSG_FLOAT16_IMAGEDATA      = GL_HALF_FLOAT_NV,
00137                          OSG_FLOAT32_IMAGEDATA      = GL_FLOAT,
00138                          OSG_INT16_IMAGEDATA         = GL_SHORT,
00139                          OSG_INT32_IMAGEDATA         = GL_INT
00140     };

Enumerator:
OSG_RESUNIT_INVALID 
OSG_RESUNIT_NONE 
OSG_RESUNIT_INCH 

Definition at line 142 of file OSGImage.h.

00142                  {
00143                          OSG_RESUNIT_INVALID       = 0,
00144                          OSG_RESUNIT_NONE          = 1,
00145                          OSG_RESUNIT_INCH          = 2
00146     };

anonymous enum [inherited]

Enumerator:
ParentsFieldId 
DimensionFieldId 
WidthFieldId 
HeightFieldId 
DepthFieldId 
BppFieldId 
MipMapCountFieldId 
FrameCountFieldId 
FrameDelayFieldId 
PixelFormatFieldId 
PixelFieldId 
FrameSizeFieldId 
NameFieldId 
DataTypeFieldId 
ComponentSizeFieldId 
SideCountFieldId 
SideSizeFieldId 
ForceCompressedDataFieldId 
ForceAlphaChannelFieldId 
ForceColorChannelFieldId 
ForceAlphaBinaryFieldId 
ResXFieldId 
ResYFieldId 
ResUnitFieldId 
NextFieldId 

Definition at line 115 of file OSGImageBase.h.

00116     {
00117         ParentsFieldId             = Inherited::NextFieldId,
00118         DimensionFieldId           = ParentsFieldId             + 1,
00119         WidthFieldId               = DimensionFieldId           + 1,
00120         HeightFieldId              = WidthFieldId               + 1,
00121         DepthFieldId               = HeightFieldId              + 1,
00122         BppFieldId                 = DepthFieldId               + 1,
00123         MipMapCountFieldId         = BppFieldId                 + 1,
00124         FrameCountFieldId          = MipMapCountFieldId         + 1,
00125         FrameDelayFieldId          = FrameCountFieldId          + 1,
00126         PixelFormatFieldId         = FrameDelayFieldId          + 1,
00127         PixelFieldId               = PixelFormatFieldId         + 1,
00128         FrameSizeFieldId           = PixelFieldId               + 1,
00129         NameFieldId                = FrameSizeFieldId           + 1,
00130         DataTypeFieldId            = NameFieldId                + 1,
00131         ComponentSizeFieldId       = DataTypeFieldId            + 1,
00132         SideCountFieldId           = ComponentSizeFieldId       + 1,
00133         SideSizeFieldId            = SideCountFieldId           + 1,
00134         ForceCompressedDataFieldId = SideSizeFieldId            + 1,
00135         ForceAlphaChannelFieldId   = ForceCompressedDataFieldId + 1,
00136         ForceColorChannelFieldId   = ForceAlphaChannelFieldId   + 1,
00137         ForceAlphaBinaryFieldId    = ForceColorChannelFieldId   + 1,
00138         ResXFieldId                = ForceAlphaBinaryFieldId    + 1,
00139         ResYFieldId                = ResXFieldId                + 1,
00140         ResUnitFieldId             = ResYFieldId                + 1,
00141         NextFieldId                = ResUnitFieldId             + 1
00142     };

anonymous enum [inherited]

Enumerator:
AttachmentsFieldId 
NextFieldId 

Definition at line 78 of file OSGAttachmentContainerImpl.h.

anonymous enum [inherited]

Enumerator:
NextFieldId 

Definition at line 73 of file OSGFieldContainerImpl.h.

00073 { NextFieldId = 1 };


Constructor & Destructor Documentation

Image::Image ( void   )  [protected]

Default Constructor. Creates a invalid Image of the size 0x0x0

Definition at line 3165 of file OSGImage.cpp.

References OSG_INVALID_PF, and osg::ImageBase::setPixelFormat().

03165                  :
03166     Inherited()
03167 {
03168     setPixelFormat(OSG_INVALID_PF);
03169     return;
03170 }

Image::Image ( const Image obj  )  [protected]

Copy Constructor. Creates a copy of the given image

Definition at line 3174 of file OSGImage.cpp.

03174                              :
03175     Inherited(obj)
03176 {
03177 }

Image::~Image ( void   )  [protected, virtual]

Destructor.

Definition at line 3181 of file OSGImage.cpp.

03182 {
03183 }


Member Function Documentation

void Image::changed ( BitVector  whichField,
UInt32  origin 
) [virtual]

Inform parents, when image was changed

Reimplemented from osg::AttachmentContainer.

Definition at line 117 of file OSGImage.cpp.

References osg::ImageBase::_mfParents, _typeDic, osg::MField< FieldTypeT, fieldNameSpace >::begin(), calcMipmapSumSize(), osg::AttachmentContainer::changed(), osg::ChangedOrigin::Child, osg::MField< FieldTypeT, fieldNameSpace >::end(), osg::ImageBase::getDataType(), osg::ImageBase::getMipMapCount(), osg::ImageBase::getSideCount(), osg::ImageBase::getSideSize(), osg::ImageBase::setComponentSize(), osg::ImageBase::setFrameSize(), and osg::ImageBase::setSideSize().

00118 {
00119     MFFieldContainerPtr::iterator parentsIt  = _mfParents.begin();
00120     MFFieldContainerPtr::iterator parentsEnd = _mfParents.end();
00121 
00122     while(parentsIt != parentsEnd)
00123     {
00124         (*parentsIt)->changed(  TypeTraits<BitVector>::One <<
00125                                     parentsIt->getParentFieldPos(),
00126                                 ChangedOrigin::Child);
00127         ++parentsIt;
00128     }
00129     
00130     // Update internals
00131     Int32 mapSizeType = sizeof(_typeDic) / sizeof(UInt32[2]);
00132     UInt32 typeFormat  = 0;
00133     Int32 i;
00134     for(i = 0; i < mapSizeType; i++)
00135     {
00136         if(_typeDic[i][0] == getDataType())
00137             typeFormat = _typeDic[i][1];
00138     }
00139 
00140     setComponentSize( typeFormat );
00141     setSideSize ( calcMipmapSumSize(getMipMapCount()) );
00142     setFrameSize( getSideSize() * getSideCount() );
00143    
00144     Inherited::changed(whichField, origin);
00145 }

void Image::dump ( UInt32  uiIndent = 0,
const BitVector  bvFlags = 0 
) const [virtual]

Reimplemented from osg::AttachmentContainer.

Definition at line 149 of file OSGImage.cpp.

References FLOG, osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getFrameCount(), osg::ImageBase::getFrameDelay(), osg::ImageBase::getHeight(), osg::ImageBase::getMipMapCount(), osg::ImageBase::getPixelFormat(), osg::ImageBase::getSideCount(), getSize(), osg::ImageBase::getWidth(), OSG_A_PF, OSG_ALPHA_INTEGER_PF, OSG_BGR_INTEGER_PF, OSG_BGR_PF, OSG_BGRA_INTEGER_PF, OSG_BGRA_PF, OSG_FLOAT16_IMAGEDATA, OSG_FLOAT32_IMAGEDATA, OSG_I_PF, OSG_INT16_IMAGEDATA, OSG_INT32_IMAGEDATA, OSG_L_PF, OSG_LA_PF, OSG_LUMINANCE_ALPHA_INTEGER_PF, OSG_LUMINANCE_INTEGER_PF, OSG_RGB_DXT1, OSG_RGB_INTEGER_PF, OSG_RGB_PF, OSG_RGBA_DXT1, OSG_RGBA_DXT3, OSG_RGBA_DXT5, OSG_RGBA_INTEGER_PF, OSG_RGBA_PF, OSG_UINT16_IMAGEDATA, OSG_UINT32_IMAGEDATA, and OSG_UINT8_IMAGEDATA.

00151 {
00152     const char  *pfStr = "UNDEF_PIXEL_FORMAT";
00153     const char  *typeStr = "INVALID_IMAGEDATA_TYPE";
00154 
00155     switch(getPixelFormat())
00156     {
00157     case OSG_A_PF:
00158         pfStr = "ALPHA";
00159         break;
00160     case OSG_I_PF:
00161         pfStr = "INTENSITY";
00162         break;
00163     case OSG_L_PF:
00164         pfStr = "LUMINANCE";
00165         break;
00166     case OSG_LA_PF:
00167         pfStr = "LUMINANCE_ALPHA";
00168         break;
00169     case OSG_BGR_PF:
00170         pfStr = "BGR";
00171         break;
00172     case OSG_BGRA_PF:
00173         pfStr = "BGRA";
00174         break;
00175     case OSG_RGB_PF:
00176         pfStr = "RGB";
00177         break;
00178     case OSG_RGBA_PF:
00179         pfStr = "RGBA";
00180         break;
00181     case OSG_RGB_DXT1:
00182         pfStr = "RGB_DXT1";
00183         break;
00184     case OSG_RGBA_DXT1:
00185         pfStr = "RGBA_DXT1";
00186         break;
00187     case OSG_RGBA_DXT3:
00188         pfStr = "RGBA_DXT3";
00189         break;
00190     case OSG_RGBA_DXT5:
00191         pfStr = "RGBA_DXT5";
00192         break;
00193     case OSG_ALPHA_INTEGER_PF:
00194         pfStr = "ALPHA_INTEGER";
00195         break;
00196     case OSG_RGB_INTEGER_PF:
00197         pfStr = "RGB_INTEGER";
00198         break;
00199     case OSG_RGBA_INTEGER_PF:
00200         pfStr = "RGBA_INTEGER";
00201         break;
00202     case OSG_BGR_INTEGER_PF:
00203         pfStr = "BGR_INTEGER";
00204         break;
00205     case OSG_BGRA_INTEGER_PF:
00206         pfStr = "BGRA_INTEGER";
00207         break;
00208     case OSG_LUMINANCE_INTEGER_PF:
00209         pfStr = "LUMINANCE_INTEGER";
00210         break;
00211     case OSG_LUMINANCE_ALPHA_INTEGER_PF:
00212         pfStr = "LUMINANCE_ALPHA_INTEGER";
00213         break;
00214     default:
00215         pfStr = "UNKNOWN_PIXEL_FORMAT";
00216         break;
00217     };
00218 
00219     switch (getDataType())
00220     {
00221     case OSG_UINT8_IMAGEDATA:
00222         typeStr = "IMAGEDATA_TYPE UCHAR8";
00223         break;
00224     case OSG_UINT16_IMAGEDATA:
00225         typeStr = "IMAGEDATA_TYPE UCHAR16";
00226         break;
00227     case OSG_UINT32_IMAGEDATA:
00228         typeStr = "IMAGEDATA_TYPE UCHAR32";
00229         break;
00230     case OSG_FLOAT16_IMAGEDATA:
00231         typeStr = "IMAGEDATA_TYPE FLOAT16";
00232         break;
00233     case OSG_FLOAT32_IMAGEDATA:
00234         typeStr = "IMAGEDATA_TYPE FLOAT32";
00235         break;
00236     case OSG_INT16_IMAGEDATA:
00237         typeStr = "IMAGEDATA_TYPE INT16";
00238         break;
00239     case OSG_INT32_IMAGEDATA:
00240         typeStr = "IMAGEDATA_TYPE INT32";
00241         break;
00242 
00243     default:
00244         typeStr = "UNKNOWN_IMAGEDATA_TYPE";
00245         break;
00246     };
00247 
00248     FLOG (("ImageDump: %s; %d/%d/%d; #mm: %d, #side: %d, #frame: %d, frameDelay %g, dataType %s, size: %d\n",
00249            pfStr, getWidth(),
00250            getHeight(), getDepth(),
00251            getMipMapCount(), 
00252            getSideCount(),
00253            getFrameCount(), getFrameDelay(), 
00254            typeStr,
00255            getSize()
00256            ));
00257 }

bool osg::Image::set ( UInt32  pixelFormat,
Int32  width,
Int32  height = 1,
Int32  depth = 1,
Int32  mipmapCount = 1,
Int32  frameCount = 1,
Time  frameDelay = 0.0,
const UInt8 data = 0,
Int32  type = OSG_UINT8_IMAGEDATA,
bool  allocMem = true,
Int32  sideCount = 1 
)

bool Image::set ( ImagePtr  image  ) 

method to set the image from another image object. Use the doCopy parameter to specify, whether the method should copy or link the pixel data.

Definition at line 331 of file OSGImage.cpp.

00332 {
00333     this->set(image->getPixelFormat(),
00334               image->getWidth(),
00335               image->getHeight(),
00336               image->getDepth(),
00337               image->getMipMapCount(),
00338               image->getFrameCount(),
00339               image->getFrameDelay(),
00340               image->getData(),
00341               image->getDataType(),
00342               true,
00343               image->getSideCount());
00344 
00345     return true;
00346 }

bool osg::Image::setData ( const UInt8 data = 0  ) 

void Image::clearData ( void   ) 

Definition at line 365 of file OSGImage.cpp.

References osg::MField< FieldTypeT, fieldNameSpace >::clear(), and osg::ImageBase::getPixel().

00366 {
00367     getPixel().clear();
00368 }

bool Image::setSubData ( Int32  offX,
Int32  offY,
Int32  offZ,
Int32  srcW,
Int32  srcH,
Int32  srcD,
const UInt8 src 
)

method to update just a subregion of the image data all paramter (e. pixelFormat,width,height,depth) stay the same

Definition at line 373 of file OSGImage.cpp.

References FDEBUG, FFATAL, osg::ImageBase::getBpp(), getData(), osg::ImageBase::getDepth(), osg::ImageBase::getHeight(), osg::ImageBase::getWidth(), hasCompressedData(), osg::osgMax(), and osg::osgMin().

00376 {
00377     UChar8 *dest = getData();
00378     UInt64 lineSize;
00379 
00380     FDEBUG(( "Image::setSubData (%d %d %d) - (%d %d %d) - src %p\n",
00381              offX, offY, offZ, srcW, srcH, srcD, src ));
00382 
00383     if (hasCompressedData()) 
00384     {
00385         FFATAL (("Invalid Image::setSubData for compressed image\n"));
00386         return false;
00387     }
00388 
00389     if(!src || !dest)
00390     {
00391         FFATAL(("Invalid data pointer in Image::setSubData\n"));
00392         return false;
00393     }
00394 
00395     // determine the area to actually copy
00396     UInt32 xMin = osgMax(0,offX);
00397     UInt32 yMin = osgMax(0,offY);
00398     UInt32 zMin = osgMax(0,offZ);
00399 
00400     UInt32 xMax = osgMin(getWidth(),  offX + srcW);
00401     UInt32 yMax = osgMin(getHeight(), offY + srcH);
00402     UInt32 zMax = osgMin(getDepth(),  offZ + srcD);
00403 
00404     // fill the destination buffer with the subdata
00405     UInt32 destIdx, srcIdx = 0;
00406 
00407     for(UInt32 z = zMin; z < zMax; z++)
00408     {
00409         for(UInt32 y = yMin; y < yMax; y++)
00410         {
00411             lineSize = (xMax - xMin) * getBpp();
00412             destIdx = ( (z * getHeight() + y) * getWidth() + xMin) * getBpp();
00413             memcpy (&dest[destIdx], &src[srcIdx], size_t(lineSize));
00414             srcIdx += Int32((srcW - (xMax - xMin)) * getBpp() + lineSize);
00415         }
00416         srcIdx += (srcH - (yMax - yMin)) * srcW * getBpp();
00417     }
00418 
00419     return true;
00420 }

bool Image::flipDepthFrameData ( void   ) 

The Image is not just a 2D container. The class can hold 3D (volume) and movie data. If we have 3D/singleFrame or 2D/multiFrame data without mipmaps we can flip between this two formats by just swapping the getFrameCount() and getDepth() values.

Definition at line 427 of file OSGImage.cpp.

References FWARNING, osg::ImageBase::getDepth(), osg::ImageBase::getFrameCount(), osg::ImageBase::getMipMapCount(), osg::ImageBase::setDepth(), and osg::ImageBase::setFrameCount().

00428 {
00429   bool retCode = false;
00430   Int32 value;
00431 
00432   if((getMipMapCount() == 1)&&((getFrameCount() == 1)||(getDepth() == 1)))
00433   {
00434       value = getFrameCount();
00435       setFrameCount(getDepth());
00436       setDepth(value);
00437       retCode = true;
00438   }
00439   else
00440   {
00441       FWARNING (("Cant flipDepthFrameData(); invalid data layout\n"));
00442   }
00443 
00444   return retCode;
00445 }

bool Image::addValue ( const char *  value  ) 

This method is used by the parser to fill the image with string pixel data. It expects the data in VRML PixelTexture Format.

Definition at line 450 of file OSGImage.cpp.

References FDEBUG, FFATAL, osg::ImageBase::getBpp(), getData(), osg::ImageBase::getDataType(), hasCompressedData(), OSG_FLOAT16_IMAGEDATA, OSG_FLOAT32_IMAGEDATA, OSG_INT16_IMAGEDATA, OSG_INT32_IMAGEDATA, OSG_INVALID_IMAGEDATATYPE, OSG_INVALID_PF, OSG_L_PF, OSG_LA_PF, OSG_RGB_PF, OSG_RGBA_PF, OSG_UINT16_IMAGEDATA, OSG_UINT32_IMAGEDATA, OSG_UINT8_IMAGEDATA, and osg::ImageBase::setDataType().

00451 {
00452     static Image       *currentImage = 0;
00453     static UChar8      *currentData  = 0;
00454 
00455            Int64        j;
00456            Int64        v;
00457 
00458            bool         isHead = strchr(value, ' ') ? true : false;
00459 
00460     if (hasCompressedData()) 
00461     {
00462         FFATAL (("Invalid Image::addValue for compressed image\n"));
00463         return false;
00464     }
00465 
00466     // make sure we only read one image at a time
00467     if(currentImage == this)
00468     {
00469         if(isHead)
00470         {
00471             FDEBUG(("Start new read cycle in image::addValue()\n"));
00472         }
00473     }
00474     else
00475     {
00476         if(!isHead)
00477         {
00478             FFATAL(("Additional image date for different image\n"));
00479         }
00480     }
00481 
00482     currentImage = this;
00483 
00484     if(isHead == true)
00485     {
00486         Int32        width;
00487         Int32        height;
00488         Int32        pixelDepth;
00489         PixelFormat  pf = osg::Image::OSG_INVALID_PF;
00490 
00491         // read the head
00492         sscanf(value, "%d %d %d", &width, &height, &pixelDepth);
00493 
00494         FDEBUG(("Image::addValue() set: w/h/bpp: %d/%d/%d\n",
00495                 width, height, pixelDepth));
00496 
00497         switch(getDataType())
00498         {
00499             case OSG_UINT8_IMAGEDATA:
00500                 switch(pixelDepth)
00501                 {
00502                     case 1:
00503                         pf = osg::Image::OSG_L_PF;
00504                         break;
00505                     case 2:
00506                         pf = osg::Image::OSG_LA_PF;
00507                         break;
00508                     case 3:
00509                         pf = osg::Image::OSG_RGB_PF;
00510                         break;
00511                     case 4:
00512                         pf = osg::Image::OSG_RGBA_PF;
00513                         break;
00514                     default:
00515                         pf = osg::Image::OSG_INVALID_PF;
00516                         FFATAL(("Invalid pixel depth: %d\n", pixelDepth));
00517                         break;
00518                 }
00519                 break;
00520             case OSG_UINT16_IMAGEDATA:
00521                 switch(pixelDepth)
00522                 {
00523                     case 2:
00524                         pf = osg::Image::OSG_L_PF;
00525                         break;
00526                     case 4:
00527                         pf = osg::Image::OSG_LA_PF;
00528                         break;
00529                     case 6:
00530                         pf = osg::Image::OSG_RGB_PF;
00531                         break;
00532                     case 8:
00533                         pf = osg::Image::OSG_RGBA_PF;
00534                         break;
00535                     default:
00536                         pf = osg::Image::OSG_INVALID_PF;
00537                         FFATAL(("Invalid pixel depth: %d\n", pixelDepth));
00538                         break;
00539                 }
00540                 break;
00541             case OSG_UINT32_IMAGEDATA:
00542                 switch(pixelDepth)
00543                 {
00544                     case 4:
00545                         pf = osg::Image::OSG_L_PF;
00546                         break;
00547                     case 8:
00548                         pf = osg::Image::OSG_LA_PF;
00549                         break;
00550                     case 12:
00551                         pf = osg::Image::OSG_RGB_PF;
00552                         break;
00553                     case 16:
00554                         pf = osg::Image::OSG_RGBA_PF;
00555                         break;
00556                     default:
00557                         pf = osg::Image::OSG_INVALID_PF;
00558                         FFATAL(("Invalid pixel depth: %d\n", pixelDepth));
00559                         break;
00560                 }
00561                 break;
00562             case OSG_FLOAT32_IMAGEDATA:
00563                 switch(pixelDepth)
00564                 {
00565                     case 4:
00566                         pf = osg::Image::OSG_L_PF;
00567                         break;
00568                     case 8:
00569                         pf = osg::Image::OSG_LA_PF;
00570                         break;
00571                     case 12:
00572                         pf = osg::Image::OSG_RGB_PF;
00573                         break;
00574                     case 16:
00575                         pf = osg::Image::OSG_RGBA_PF;
00576                         break;
00577                     default:
00578                         pf = osg::Image::OSG_INVALID_PF;
00579                         FFATAL(("Invalid pixel depth: %d\n", pixelDepth));
00580                         break;
00581                 }
00582                 break;
00583             case OSG_FLOAT16_IMAGEDATA:
00584                 switch(pixelDepth)
00585                 {
00586                     case 2:
00587                         pf = osg::Image::OSG_L_PF;
00588                         break;
00589                     case 4:
00590                         pf = osg::Image::OSG_LA_PF;
00591                         break;
00592                     case 6:
00593                         pf = osg::Image::OSG_RGB_PF;
00594                         break;
00595                     case 8:
00596                         pf = osg::Image::OSG_RGBA_PF;
00597                         break;
00598                     default:
00599                         pf = osg::Image::OSG_INVALID_PF;
00600                         FFATAL(("Invalid pixel depth: %d\n", pixelDepth));
00601                         break;
00602                 }
00603                 break;
00604             case OSG_INT16_IMAGEDATA:
00605             case OSG_INT32_IMAGEDATA:
00606                 {
00607                     FFATAL((" 'addValue' NYI\n "));
00608                 }
00609                 break;
00610             default:
00611                 setDataType(OSG_INVALID_IMAGEDATATYPE);
00612                 FFATAL(("Invalid type of image data: %d\n", getDataType()));
00613         }
00614 
00615         if(pf != 0 && (width > 0) && (height > 0))
00616         {
00617             set(pf, width, height);
00618 
00619             currentData = getData();
00620         }
00621         else
00622         {
00623             currentData = NULL;
00624         }
00625     }
00626     else
00627     {
00628         if(currentData != NULL)
00629         {
00630             // add data
00631             // TODO; should we check the bounds, should be done by the parser
00632 
00633             v = strtoul(value, 0, strchr(value, 'x') ? 16 : 10);
00634 
00635             for(j = getBpp(); j--;)
00636             {
00637                 *currentData++ = UChar8( (v >> (8 * j)) & 255 );
00638             }
00639 
00640         }
00641     }
00642 
00643     return currentData ? true : false;
00644 }

bool Image::reformat ( const PixelFormat  pixelFormat,
ImagePtr  destination = NullFC 
)

It is a simple method to reformat the image pixelFormat (not the size). So you can for example convert a RGBA to RGB or RGB to Grey image.

Definition at line 649 of file OSGImage.cpp.

References osg::addRefCP(), osg::ImageBase::create(), FFATAL, FINFO, FWARNING, osg::ImageBase::getComponentSize(), getData(), osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getHeight(), osg::ImageBase::getPixelFormat(), getSize(), osg::ImageBase::getWidth(), hasCompressedData(), osg::NullFC, OSG_A_PF, OSG_ALPHA_INTEGER_PF, OSG_BGR_INTEGER_PF, OSG_BGRA_INTEGER_PF, OSG_FLOAT16_IMAGEDATA, OSG_FLOAT32_IMAGEDATA, OSG_I_PF, OSG_L_PF, OSG_LA_PF, OSG_LUMINANCE_ALPHA_INTEGER_PF, OSG_LUMINANCE_INTEGER_PF, OSG_RGB_INTEGER_PF, OSG_RGB_PF, OSG_RGBA_INTEGER_PF, OSG_RGBA_PF, OSG_UINT16_IMAGEDATA, OSG_UINT32_IMAGEDATA, OSG_UINT8_IMAGEDATA, and osg::subRefCP().

00651 {
00652     UChar8 *data = 0,*sourceData = 0;
00653     UInt32 srcI, destI, destSize = 0;
00654     UInt32 sum;
00655     Real64 sumReal;
00656     ImagePtr dest = destination;
00657 
00658     if (hasCompressedData()) 
00659     {
00660         FFATAL (("Invalid Image::reformat for compressed image\n"));
00661         return false;
00662     }
00663 
00664     if(destination == NullFC)
00665     {
00666         dest = Image::create();
00667         addRefCP(dest);
00668     }
00669 
00670     FINFO (( "Try to reformat image from pixelDepth %d to %d\n",
00671              getPixelFormat(), pixelFormat ));
00672 
00673     // TODO !!! code all the cases !!!
00674 
00675     if ( getSize() && pixelFormat &&
00676          (destination != NullFC || (pixelFormat != getPixelFormat()) ) )
00677     {
00678 
00679         dest->set(pixelFormat, getWidth(), getHeight(), getDepth() );
00680         sourceData = getData();
00681         data = dest->getData();
00682         destSize = dest->getSize();
00683 
00684         UInt16 *sourceDataUC16 = (UInt16*) sourceData;
00685         UInt16 *destDataUC16 = (UInt16*) data;
00686         UInt32 *sourceDataUC32 = (UInt32*) sourceData;
00687         UInt32 *destDataUC32 = (UInt32*) data;
00688         Real32 *sourceDataF32 = (Real32*) sourceData;
00689         Real32 *destDataF32 = (Real32*) data;
00690         Real16 *sourceDataH16 = (Real16*) sourceData;
00691         Real16 *destDataH16 = (Real16* ) data;
00692 
00693         if (data)
00694         {
00695             switch (getPixelFormat())
00696             {
00697                 //-----------------------------------------------------
00698                 case OSG_A_PF:
00699                     switch (pixelFormat) {
00700                         case OSG_A_PF:
00701                         case OSG_I_PF:
00702                             switch (getDataType())
00703                             {
00704                             case OSG_UINT8_IMAGEDATA:
00705                                 memcpy (data, getData(), destSize);
00706                                 break;
00707                             case OSG_UINT16_IMAGEDATA:
00708                                 memcpy (data, getData(), destSize);
00709                                 break;
00710                             case OSG_UINT32_IMAGEDATA:
00711                                 memcpy (data, getData(), destSize);
00712                                 break;
00713                             case OSG_FLOAT32_IMAGEDATA:
00714                                 memcpy (data, getData(), destSize);
00715                                 break;
00716                             case OSG_FLOAT16_IMAGEDATA:
00717                                 memcpy (data, getData(), destSize);
00718                                 break;
00719 
00720                             default:
00721                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
00722                                 break;
00723                             }
00724                             break;
00725 
00726                         case OSG_L_PF:
00727                             switch (getDataType())
00728                             {
00729                             case OSG_UINT8_IMAGEDATA:
00730                                 memcpy (data, getData(), destSize);
00731                                 break;
00732                             case OSG_UINT16_IMAGEDATA:
00733                                 memcpy (data, getData(), destSize);
00734                                 break;
00735                             case OSG_UINT32_IMAGEDATA:
00736                                 memcpy (data, getData(), destSize);
00737                                 break;
00738                             case OSG_FLOAT32_IMAGEDATA:
00739                                 memcpy (data, getData(), destSize);
00740                                 break;
00741                             case OSG_FLOAT16_IMAGEDATA:
00742                                 memcpy (data, getData(), destSize);
00743                                 break;
00744 
00745                             default:
00746                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
00747                                 break;
00748                             }
00749                             break;
00750 
00751                         case OSG_LA_PF:
00752                             switch (getDataType())
00753                             {
00754                             case OSG_UINT8_IMAGEDATA:
00755                                 for (srcI = destI = 0; destI < destSize;)
00756                                 {
00757                                     data[destI++] = sourceData[srcI];
00758                                     data[destI++] = sourceData[srcI++];
00759                                 }
00760                                 break;
00761                             case OSG_UINT16_IMAGEDATA:
00762                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00763                                 {
00764                                     destDataUC16[destI++] = sourceDataUC16[srcI];
00765                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
00766                                 }
00767                                 break;
00768                             case OSG_UINT32_IMAGEDATA:
00769                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00770                                 {
00771                                     destDataUC32[destI++] = sourceDataUC32[srcI];
00772                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
00773                                 }
00774                                 break;
00775                             case OSG_FLOAT32_IMAGEDATA:
00776                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00777                                 {
00778                                     destDataF32[destI++] = sourceDataF32[srcI];
00779                                     destDataF32[destI++] = sourceDataF32[srcI++];
00780                                 }
00781                                 break;
00782 
00783                             case OSG_FLOAT16_IMAGEDATA:
00784                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00785                                 {
00786                                     destDataH16[destI++] = sourceDataH16[srcI];
00787                                     destDataH16[destI++] = sourceDataH16[srcI++];
00788                                 }
00789                                 break;
00790                             default:
00791                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
00792                                 break;
00793                             }
00794                             break;
00795 
00796                         case OSG_RGB_PF:
00797                             switch (getDataType())
00798                             {
00799                             case OSG_UINT8_IMAGEDATA:
00800                                 for (srcI = destI = 0; destI < destSize;)
00801                                 {
00802                                     data[destI++] = sourceData[srcI];
00803                                     data[destI++] = sourceData[srcI];
00804                                     data[destI++] = sourceData[srcI++];
00805                                 }
00806                                 break;
00807                             case OSG_UINT16_IMAGEDATA:
00808                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00809                                 {
00810                                     destDataUC16[destI++] = sourceDataUC16[srcI];
00811                                     destDataUC16[destI++] = sourceDataUC16[srcI];
00812                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
00813                                 }
00814                                 break;
00815                             case OSG_UINT32_IMAGEDATA:
00816                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00817                                 {
00818                                     destDataUC32[destI++] = sourceDataUC32[srcI];
00819                                     destDataUC32[destI++] = sourceDataUC32[srcI];
00820                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
00821                                 }
00822                                 break;
00823                             case OSG_FLOAT32_IMAGEDATA:
00824                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00825                                 {
00826                                     destDataF32[destI++] = sourceDataF32[srcI];
00827                                     destDataF32[destI++] = sourceDataF32[srcI];
00828                                     destDataF32[destI++] = sourceDataF32[srcI++];
00829                                 }
00830                                 break;
00831                             case OSG_FLOAT16_IMAGEDATA:
00832                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00833                                 {
00834                                     destDataH16[destI++] = sourceDataH16[srcI];
00835                                     destDataH16[destI++] = sourceDataH16[srcI];
00836                                     destDataH16[destI++] = sourceDataH16[srcI++];
00837                                 }
00838                                 break;
00839                             default:
00840                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
00841                                 break;
00842                             }
00843                             break;
00844 
00845                         case OSG_RGBA_PF:
00846                             switch (getDataType())
00847                             {
00848                             case OSG_UINT8_IMAGEDATA:
00849                                 for (srcI = destI = 0; destI < destSize;)
00850                                 {
00851                                     data[destI++] = sourceData[srcI];
00852                                     data[destI++] = sourceData[srcI];
00853                                     data[destI++] = sourceData[srcI];
00854                                     data[destI++] = sourceData[srcI++];
00855                                 }
00856                                 break;
00857                             case OSG_UINT16_IMAGEDATA:
00858                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00859                                 {
00860                                     destDataUC16[destI++] = sourceDataUC16[srcI];
00861                                     destDataUC16[destI++] = sourceDataUC16[srcI];
00862                                     destDataUC16[destI++] = sourceDataUC16[srcI];
00863                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
00864                                 }
00865                                 break;
00866                             case OSG_UINT32_IMAGEDATA:
00867                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00868                                 {
00869                                     destDataUC32[destI++] = sourceDataUC32[srcI];
00870                                     destDataUC32[destI++] = sourceDataUC32[srcI];
00871                                     destDataUC32[destI++] = sourceDataUC32[srcI];
00872                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
00873                                 }
00874                                 break;
00875                             case OSG_FLOAT32_IMAGEDATA:
00876                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00877                                 {
00878                                     destDataF32[destI++] = sourceDataF32[srcI];
00879                                     destDataF32[destI++] = sourceDataF32[srcI];
00880                                     destDataF32[destI++] = sourceDataF32[srcI];
00881                                     destDataF32[destI++] = sourceDataF32[srcI++];
00882                                 }
00883                                 break;
00884                             case OSG_FLOAT16_IMAGEDATA:
00885                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00886                                 {
00887                                     destDataH16[destI++] = sourceDataH16[srcI];
00888                                     destDataH16[destI++] = sourceDataH16[srcI];
00889                                     destDataH16[destI++] = sourceDataH16[srcI];
00890                                     destDataH16[destI++] = sourceDataH16[srcI++];
00891                                 }
00892                                 break;
00893                             default:
00894                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
00895                                 break;
00896                             }
00897                             break;
00898                     default:
00899                         FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
00900                         break;
00901                     }
00902                     break;
00903 
00904                 //-----------------------------------------------------
00905                 case OSG_I_PF:
00906                     switch (pixelFormat) {
00907                         case OSG_A_PF:
00908                         case OSG_I_PF:
00909                         case OSG_L_PF:
00910                             switch (getDataType())
00911                             {
00912                             case OSG_UINT8_IMAGEDATA:
00913                                 memcpy (data, getData(), destSize);
00914                                 break;
00915                             case OSG_UINT16_IMAGEDATA:
00916                                 memcpy (data, getData(), destSize);
00917                                 break;
00918                             case OSG_UINT32_IMAGEDATA:
00919                                 memcpy (data, getData(), destSize);
00920                                 break;
00921                             case OSG_FLOAT32_IMAGEDATA:
00922                                 memcpy (data, getData(), destSize);
00923                                 break;
00924                             case OSG_FLOAT16_IMAGEDATA:
00925                                 memcpy (data, getData(), destSize);
00926                                 break;
00927 
00928                             default:
00929                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
00930                                 break;
00931                             }
00932                             break;
00933 
00934                         case OSG_LA_PF:
00935                             switch (getDataType())
00936                             {
00937                             case OSG_UINT8_IMAGEDATA:
00938                                 for (srcI = destI = 0; destI < destSize;)
00939                                 {
00940                                     data[destI++] = sourceData[srcI];
00941                                     data[destI++] = sourceData[srcI++];
00942                                 }
00943                                 break;
00944                             case OSG_UINT16_IMAGEDATA:
00945                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00946                                 {
00947                                     destDataUC16[destI++] = sourceDataUC16[srcI];
00948                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
00949                                 }
00950                                 break;
00951                             case OSG_UINT32_IMAGEDATA:
00952                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00953                                 {
00954                                     destDataUC32[destI++] = sourceDataUC32[srcI];
00955                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
00956                                 }
00957                                 break;
00958                             case OSG_FLOAT32_IMAGEDATA:
00959                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00960                                 {
00961                                     destDataF32[destI++] = sourceDataF32[srcI];
00962                                     destDataF32[destI++] = sourceDataF32[srcI++];
00963                                 }
00964                                 break;
00965 
00966                             case OSG_FLOAT16_IMAGEDATA:
00967                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00968                                 {
00969                                     destDataH16[destI++] = sourceDataH16[srcI];
00970                                     destDataH16[destI++] = sourceDataH16[srcI++];
00971                                 }
00972                                 break;
00973                             default:
00974                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
00975                                 break;
00976                             }
00977                             break;
00978 
00979                         case OSG_RGB_PF:
00980                             switch (getDataType())
00981                             {
00982                             case OSG_UINT8_IMAGEDATA:
00983                                 for (srcI = destI = 0; destI < destSize;)
00984                                 {
00985                                     data[destI++] = sourceData[srcI];
00986                                     data[destI++] = sourceData[srcI];
00987                                     data[destI++] = sourceData[srcI++];
00988                                 }
00989                                 break;
00990                             case OSG_UINT16_IMAGEDATA:
00991                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
00992                                 {
00993                                     destDataUC16[destI++] = sourceDataUC16[srcI];
00994                                     destDataUC16[destI++] = sourceDataUC16[srcI];
00995                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
00996                                 }
00997                                 break;
00998                             case OSG_UINT32_IMAGEDATA:
00999                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01000                                 {
01001                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01002                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01003                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01004                                 }
01005                                 break;
01006                             case OSG_FLOAT32_IMAGEDATA:
01007                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01008                                 {
01009                                     destDataF32[destI++] = sourceDataF32[srcI];
01010                                     destDataF32[destI++] = sourceDataF32[srcI];
01011                                     destDataF32[destI++] = sourceDataF32[srcI++];
01012                                 }
01013                                 break;
01014                             case OSG_FLOAT16_IMAGEDATA:
01015                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01016                                 {
01017                                     destDataH16[destI++] = sourceDataH16[srcI];
01018                                     destDataH16[destI++] = sourceDataH16[srcI];
01019                                     destDataH16[destI++] = sourceDataH16[srcI++];
01020                                 }
01021                                 break;
01022                             default:
01023                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01024                                 break;
01025                             }
01026                             break;
01027 
01028                         case OSG_RGBA_PF:
01029                             switch (getDataType())
01030                             {
01031                             case OSG_UINT8_IMAGEDATA:
01032                                 for (srcI = destI = 0; destI < destSize;)
01033                                 {
01034                                     data[destI++] = sourceData[srcI];
01035                                     data[destI++] = sourceData[srcI];
01036                                     data[destI++] = sourceData[srcI];
01037                                     data[destI++] = sourceData[srcI++];
01038                                 }
01039                                 break;
01040                             case OSG_UINT16_IMAGEDATA:
01041                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01042                                 {
01043                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01044                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01045                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01046                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01047                                 }
01048                                 break;
01049                             case OSG_UINT32_IMAGEDATA:
01050                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01051                                 {
01052                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01053                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01054                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01055                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01056                                 }
01057                                 break;
01058                             case OSG_FLOAT32_IMAGEDATA:
01059                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01060                                 {
01061                                     destDataF32[destI++] = sourceDataF32[srcI];
01062                                     destDataF32[destI++] = sourceDataF32[srcI];
01063                                     destDataF32[destI++] = sourceDataF32[srcI];
01064                                     destDataF32[destI++] = sourceDataF32[srcI++];
01065                                 }
01066                                 break;
01067                             case OSG_FLOAT16_IMAGEDATA:
01068                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01069                                 {
01070                                     destDataH16[destI++] = sourceDataH16[srcI];
01071                                     destDataH16[destI++] = sourceDataH16[srcI];
01072                                     destDataH16[destI++] = sourceDataH16[srcI];
01073                                     destDataH16[destI++] = sourceDataH16[srcI++];
01074                                 }
01075                                 break;
01076                             default:
01077                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01078                                 break;
01079                             }
01080                             break;
01081                     default:
01082                         FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01083                         break;
01084                     }
01085                     break;
01086 
01087 
01088                 //-----------------------------------------------------
01089                 case OSG_L_PF:
01090                     switch (pixelFormat) {
01091                         case OSG_A_PF:
01092                         case OSG_I_PF:
01093                         case OSG_L_PF:
01094                             switch (getDataType())
01095                             {
01096                             case OSG_UINT8_IMAGEDATA:
01097                                 memcpy (data, getData(), destSize);
01098                                 break;
01099                             case OSG_UINT16_IMAGEDATA:
01100                                 memcpy (data, getData(), destSize);
01101                                 break;
01102                             case OSG_UINT32_IMAGEDATA:
01103                                 memcpy (data, getData(), destSize);
01104                                 break;
01105                             case OSG_FLOAT32_IMAGEDATA:
01106                                 memcpy (data, getData(), destSize);
01107                                 break;
01108                             case OSG_FLOAT16_IMAGEDATA:
01109                                 memcpy (data, getData(), destSize);
01110                                 break;
01111 
01112                             default:
01113                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01114                                 break;
01115                             }
01116                             break;
01117 
01118                         case OSG_LA_PF:
01119                             switch (getDataType())
01120                             {
01121                             case OSG_UINT8_IMAGEDATA:
01122                                 for (srcI = destI = 0; destI < destSize;)
01123                                 {
01124                                     data[destI++] = sourceData[srcI];
01125                                     data[destI++] = sourceData[srcI++];
01126                                 }
01127                                 break;
01128                             case OSG_UINT16_IMAGEDATA:
01129                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01130                                 {
01131                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01132                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01133                                 }
01134                                 break;
01135                             case OSG_UINT32_IMAGEDATA:
01136                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01137                                 {
01138                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01139                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01140                                 }
01141                                 break;
01142                             case OSG_FLOAT32_IMAGEDATA:
01143                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01144                                 {
01145                                     destDataF32[destI++] = sourceDataF32[srcI];
01146                                     destDataF32[destI++] = sourceDataF32[srcI++];
01147                                 }
01148                                 break;
01149 
01150                             case OSG_FLOAT16_IMAGEDATA:
01151                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01152                                 {
01153                                     destDataH16[destI++] = sourceDataH16[srcI];
01154                                     destDataH16[destI++] = sourceDataH16[srcI++];
01155                                 }
01156                                 break;
01157                             default:
01158                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01159                                 break;
01160                             }
01161                             break;
01162 
01163                         case OSG_RGB_PF:
01164                             switch (getDataType())
01165                             {
01166                             case OSG_UINT8_IMAGEDATA:
01167                                 for (srcI = destI = 0; destI < destSize;)
01168                                 {
01169                                     data[destI++] = sourceData[srcI];
01170                                     data[destI++] = sourceData[srcI];
01171                                     data[destI++] = sourceData[srcI++];
01172                                 }
01173                                 break;
01174                             case OSG_UINT16_IMAGEDATA:
01175                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01176                                 {
01177                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01178                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01179                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01180                                 }
01181                                 break;
01182                             case OSG_UINT32_IMAGEDATA:
01183                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01184                                 {
01185                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01186                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01187                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01188                                 }
01189                                 break;
01190                             case OSG_FLOAT32_IMAGEDATA:
01191                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01192                                 {
01193                                     destDataF32[destI++] = sourceDataF32[srcI];
01194                                     destDataF32[destI++] = sourceDataF32[srcI];
01195                                     destDataF32[destI++] = sourceDataF32[srcI++];
01196                                 }
01197                                 break;
01198                             case OSG_FLOAT16_IMAGEDATA:
01199                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01200                                 {
01201                                     destDataH16[destI++] = sourceDataH16[srcI];
01202                                     destDataH16[destI++] = sourceDataH16[srcI];
01203                                     destDataH16[destI++] = sourceDataH16[srcI++];
01204                                 }
01205                                 break;
01206                             default:
01207                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01208                                 break;
01209                             }
01210                             break;
01211 
01212                         case OSG_RGBA_PF:
01213                             switch (getDataType())
01214                             {
01215                             case OSG_UINT8_IMAGEDATA:
01216                                 for (srcI = destI = 0; destI < destSize;)
01217                                 {
01218                                     data[destI++] = sourceData[srcI];
01219                                     data[destI++] = sourceData[srcI];
01220                                     data[destI++] = sourceData[srcI];
01221                                     data[destI++] = sourceData[srcI++];
01222                                 }
01223                                 break;
01224                             case OSG_UINT16_IMAGEDATA:
01225                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01226                                 {
01227                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01228                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01229                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01230                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01231                                 }
01232                                 break;
01233                             case OSG_UINT32_IMAGEDATA:
01234                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01235                                 {
01236                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01237                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01238                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01239                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01240                                 }
01241                                 break;
01242                             case OSG_FLOAT32_IMAGEDATA:
01243                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01244                                 {
01245                                     destDataF32[destI++] = sourceDataF32[srcI];
01246                                     destDataF32[destI++] = sourceDataF32[srcI];
01247                                     destDataF32[destI++] = sourceDataF32[srcI];
01248                                     destDataF32[destI++] = sourceDataF32[srcI++];
01249                                 }
01250                                 break;
01251                             case OSG_FLOAT16_IMAGEDATA:
01252                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01253                                 {
01254                                     destDataH16[destI++] = sourceDataH16[srcI];
01255                                     destDataH16[destI++] = sourceDataH16[srcI];
01256                                     destDataH16[destI++] = sourceDataH16[srcI];
01257                                     destDataH16[destI++] = sourceDataH16[srcI++];
01258                                 }
01259                                 break;
01260                             default:
01261                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01262                                 break;
01263                             }
01264                             break;
01265                     default:
01266                         FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01267                         break;
01268                     }
01269                     break;
01270 
01271                 //-----------------------------------------------------
01272                 case OSG_LA_PF:
01273                     switch (pixelFormat) {
01274                         case OSG_A_PF:
01275                             switch (getDataType())
01276                             {
01277                             case OSG_UINT8_IMAGEDATA:
01278                                 for (srcI = destI = 0; destI < destSize;)
01279                                 {
01280                                     srcI++;
01281                                     data[destI++] = sourceData[srcI++];
01282                                 }
01283                                 break;
01284                             case OSG_UINT16_IMAGEDATA:
01285                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01286                                 {
01287                                     srcI++;
01288                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01289                                 }
01290                                 break;
01291                             case OSG_UINT32_IMAGEDATA:
01292                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01293                                 {
01294                                     srcI++;
01295                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01296                                 }
01297                                 break;
01298                             case OSG_FLOAT32_IMAGEDATA:
01299                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01300                                 {
01301                                     srcI++;
01302                                     destDataF32[destI++] = sourceDataF32[srcI++];
01303                                 }
01304                                 break;
01305                             case OSG_FLOAT16_IMAGEDATA:
01306                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01307                                 {
01308                                     srcI++;
01309                                     destDataH16[destI++] = sourceDataH16[srcI++];
01310                                 }
01311                                 break;
01312                             default:
01313                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01314                                 break;
01315                             }
01316                             break;
01317                         case OSG_I_PF:
01318                         case OSG_L_PF:
01319                             switch (getDataType())
01320                             {
01321                             case OSG_UINT8_IMAGEDATA:
01322                                 for (srcI = destI = 0; destI < destSize;)
01323                                 {
01324                                     data[destI++] = sourceData[srcI++];
01325                                     srcI++;
01326                                 }
01327                                 break;
01328                             case OSG_UINT16_IMAGEDATA:
01329                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01330                                 {
01331                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01332                                     srcI++;
01333                                 }
01334                                 break;
01335                             case OSG_UINT32_IMAGEDATA:
01336                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01337                                 {
01338                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01339                                     srcI++;
01340                                 }
01341                                 break;
01342                             case OSG_FLOAT32_IMAGEDATA:
01343                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01344                                 {
01345                                     destDataF32[destI++] = sourceDataF32[srcI++];
01346                                     srcI++;
01347                                 }
01348                                 break;
01349                             case OSG_FLOAT16_IMAGEDATA:
01350                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01351                                 {
01352                                     destDataH16[destI++] = sourceDataH16[srcI++];
01353                                     srcI++;
01354                                 }
01355                                 break;
01356                             default:
01357                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01358                                 break;
01359                             }
01360                             break;
01361                         case OSG_LA_PF:
01362                             switch (getDataType())
01363                             {
01364                             case OSG_UINT8_IMAGEDATA:
01365                                 memcpy (data, getData(), destSize);
01366                                 break;
01367                             case OSG_UINT16_IMAGEDATA:
01368                                 memcpy (data, getData(), destSize);
01369                                 break;
01370                             case OSG_UINT32_IMAGEDATA:
01371                                 memcpy (data, getData(), destSize);
01372                                 break;
01373                             case OSG_FLOAT32_IMAGEDATA:
01374                                 memcpy (data, getData(), destSize);
01375                                 break;
01376                             case OSG_FLOAT16_IMAGEDATA:
01377                                 memcpy (data, getData(), destSize);
01378                                 break;
01379                             default:
01380                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01381                                 break;
01382                             }
01383                             break;
01384 
01385                         case OSG_RGB_PF:
01386                             switch (getDataType())
01387                             {
01388                             case OSG_UINT8_IMAGEDATA:
01389                                 for (srcI = destI = 0; destI < destSize;)
01390                                 {
01391                                     data[destI++] = sourceData[srcI];
01392                                     data[destI++] = sourceData[srcI];
01393                                     data[destI++] = sourceData[srcI++];
01394                                     srcI++;
01395                                 }
01396                                 break;
01397                             case OSG_UINT16_IMAGEDATA:
01398                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01399                                 {
01400                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01401                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01402                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01403                                     srcI++;
01404                                 }
01405                                 break;
01406                             case OSG_UINT32_IMAGEDATA:
01407                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01408                                 {
01409                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01410                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01411                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01412                                     srcI++;
01413                                 }
01414                                 break;
01415                             case OSG_FLOAT32_IMAGEDATA:
01416                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01417                                 {
01418                                     destDataF32[destI++] = sourceDataF32[srcI];
01419                                     destDataF32[destI++] = sourceDataF32[srcI];
01420                                     destDataF32[destI++] = sourceDataF32[srcI++];
01421                                     srcI++;
01422                                 }
01423                                 break;
01424                             case OSG_FLOAT16_IMAGEDATA:
01425                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01426                                 {
01427                                     destDataH16[destI++] = sourceDataH16[srcI];
01428                                     destDataH16[destI++] = sourceDataH16[srcI];
01429                                     destDataH16[destI++] = sourceDataH16[srcI++];
01430                                     srcI++;
01431                                 }
01432                                 break;
01433                             default:
01434                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01435                                 break;
01436                             }
01437                             break;
01438 
01439                         case OSG_RGBA_PF:
01440                             switch (getDataType())
01441                             {
01442                             case OSG_UINT8_IMAGEDATA:
01443                                 for (srcI = destI = 0; destI < destSize;)
01444                                 {
01445                                     data[destI++] = sourceData[srcI];
01446                                     data[destI++] = sourceData[srcI];
01447                                     data[destI++] = sourceData[srcI++];
01448                                     data[destI++] = sourceData[srcI++];
01449                                 }
01450                                 break;
01451                             case OSG_UINT16_IMAGEDATA:
01452                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01453                                 {
01454                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01455                                     destDataUC16[destI++] = sourceDataUC16[srcI];
01456                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01457                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01458                                 }
01459                                 break;
01460                             case OSG_UINT32_IMAGEDATA:
01461                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01462                                 {
01463                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01464                                     destDataUC32[destI++] = sourceDataUC32[srcI];
01465                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01466                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01467                                 }
01468                                 break;
01469                             case OSG_FLOAT32_IMAGEDATA:
01470                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01471                                 {
01472                                     destDataF32[destI++] = sourceDataF32[srcI];
01473                                     destDataF32[destI++] = sourceDataF32[srcI];
01474                                     destDataF32[destI++] = sourceDataF32[srcI++];
01475                                     destDataF32[destI++] = sourceDataF32[srcI++];
01476                                 }
01477                                 break;
01478                             case OSG_FLOAT16_IMAGEDATA:
01479                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01480                                 {
01481                                     destDataH16[destI++] = sourceDataH16[srcI];
01482                                     destDataH16[destI++] = sourceDataH16[srcI];
01483                                     destDataH16[destI++] = sourceDataH16[srcI++];
01484                                     destDataH16[destI++] = sourceDataH16[srcI++];
01485                                 }
01486                                 break;
01487                             default:
01488                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01489                                 break;
01490                             }
01491                             break;
01492                     default:
01493                         FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01494                         break;
01495                     }
01496                     break;
01497 
01498                 //-----------------------------------------------------
01499                 case OSG_RGB_PF:
01500                     switch (pixelFormat) {
01501                         case OSG_A_PF:
01502                         case OSG_I_PF:
01503                         case OSG_L_PF:
01504                             switch (getDataType())
01505                             {
01506                             case OSG_UINT8_IMAGEDATA:
01507                                 for (srcI = destI = 0; destI < destSize;)
01508                                 {
01509                                     sum = 0;
01510                                     sum += sourceData[srcI++];
01511                                     sum += sourceData[srcI++];
01512                                     sum += sourceData[srcI++];
01513                                     data[destI++] = sum / 3;
01514                                 }
01515                                 break;
01516                             case OSG_UINT16_IMAGEDATA:
01517                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01518                                 {
01519                                     sum = 0;
01520                                     sum += sourceDataUC16[srcI++];
01521                                     sum += sourceDataUC16[srcI++];
01522                                     sum += sourceDataUC16[srcI++];
01523                                     destDataUC16[destI++] = sum / 3;
01524                                 }
01525                                 break;
01526                             case OSG_UINT32_IMAGEDATA:
01527                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01528                                 {
01529                                     sum = 0;
01530                                     sum += sourceDataUC32[srcI++];
01531                                     sum += sourceDataUC32[srcI++];
01532                                     sum += sourceDataUC32[srcI++];
01533                                     destDataUC32[destI++] = sum / 3;
01534                                 }
01535                                 break;
01536                             case OSG_FLOAT32_IMAGEDATA:
01537                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01538                                 {
01539                                     sumReal = 0;
01540                                     sumReal += sourceDataF32[srcI++];
01541                                     sumReal += sourceDataF32[srcI++];
01542                                     sumReal += sourceDataF32[srcI++];
01543                                     destDataF32[destI++] = sumReal / 3.0;
01544                                 }
01545                                 break;
01546                             case OSG_FLOAT16_IMAGEDATA:
01547                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01548                                 {
01549                                     sumReal = 0;
01550                                     sumReal += sourceDataH16[srcI++];
01551                                     sumReal += sourceDataH16[srcI++];
01552                                     sumReal += sourceDataH16[srcI++];
01553                                     destDataH16[destI++] = sumReal / 3.0;
01554                                 }
01555                                 break;
01556                             default:
01557                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01558                                 break;
01559                             }
01560                             break;
01561                         case OSG_LA_PF:
01562                             switch (getDataType())
01563                             {
01564                             case OSG_UINT8_IMAGEDATA:
01565                                 for (srcI = destI = 0; destI < destSize;)
01566                                 {
01567                                     sum = 0;
01568                                     sum += sourceData[srcI++];
01569                                     sum += sourceData[srcI++];
01570                                     sum += sourceData[srcI++];
01571                                     data[destI++] = sum / 3;
01572                                     data[destI++] = sum / 3;
01573                                 }
01574                                 break;
01575                             case OSG_UINT16_IMAGEDATA:
01576                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01577                                 {
01578                                     sum = 0;
01579                                     sum += sourceDataUC16[srcI++];
01580                                     sum += sourceDataUC16[srcI++];
01581                                     sum += sourceDataUC16[srcI++];
01582                                     destDataUC16[destI++] = sum / 3;
01583                                     destDataUC16[destI++] = sum / 3;
01584                                 }
01585                                 break;
01586                             case OSG_UINT32_IMAGEDATA:
01587                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01588                                 {
01589                                     sum = 0;
01590                                     sum += sourceDataUC32[srcI++];
01591                                     sum += sourceDataUC32[srcI++];
01592                                     sum += sourceDataUC32[srcI++];
01593                                     destDataUC32[destI++] = sum / 3;
01594                                     destDataUC32[destI++] = sum / 3;
01595                                 }
01596                                 break;
01597                             case OSG_FLOAT32_IMAGEDATA:
01598                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01599                                 {
01600                                     sumReal = 0;
01601                                     sumReal += sourceDataF32[srcI++];
01602                                     sumReal += sourceDataF32[srcI++];
01603                                     sumReal += sourceDataF32[srcI++];
01604                                     destDataF32[destI++] = sumReal / 3.0;
01605                                     destDataF32[destI++] = sumReal / 3.0;
01606                                 }
01607                                 break;
01608                             case OSG_FLOAT16_IMAGEDATA:
01609                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01610                                 {
01611                                     sumReal = 0;
01612                                     sumReal += sourceDataH16[srcI++];
01613                                     sumReal += sourceDataH16[srcI++];
01614                                     sumReal += sourceDataH16[srcI++];
01615                                     destDataH16[destI++] = sumReal / 3.0;
01616                                     destDataH16[destI++] = sumReal / 3.0;
01617                                 }
01618                                 break;
01619                             default:
01620                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01621                                 break;
01622                             }
01623                             break;
01624                         case OSG_RGB_PF:
01625                            switch (getDataType())
01626                             {
01627                             case OSG_UINT8_IMAGEDATA:
01628                                 memcpy (data, getData(), destSize);
01629                                 break;
01630                             case OSG_UINT16_IMAGEDATA:
01631                                 memcpy (data, getData(), destSize);
01632                                 break;
01633                             case OSG_UINT32_IMAGEDATA:
01634                                 memcpy (data, getData(), destSize);
01635                                 break;
01636                             case OSG_FLOAT32_IMAGEDATA:
01637                                 memcpy (data, getData(), destSize);
01638                                 break;
01639                             case OSG_FLOAT16_IMAGEDATA:
01640                                 memcpy (data, getData(), destSize);
01641                                 break;
01642                             default:
01643                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01644                                 break;
01645                             }
01646                             break;
01647 
01648                         case OSG_RGBA_PF:
01649                             switch (getDataType())
01650                             {
01651                             case OSG_UINT8_IMAGEDATA:
01652                                 for (srcI = destI = 0; destI < destSize;)
01653                                 {
01654                                     sum = 0;
01655                                     sum += data[destI++] = sourceData[srcI++];
01656                                     sum += data[destI++] = sourceData[srcI++];
01657                                     sum += data[destI++] = sourceData[srcI++];
01658                                     data[destI++] = sum / 3;
01659                                 }
01660                                 break;
01661                             case OSG_UINT16_IMAGEDATA:
01662                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01663                                 {
01664                                     sum = 0;
01665                                     sum += destDataUC16[destI++] = sourceDataUC16[srcI++];
01666                                     sum += destDataUC16[destI++] = sourceDataUC16[srcI++];
01667                                     sum += destDataUC16[destI++] = sourceDataUC16[srcI++];
01668                                     destDataUC16[destI++] = sum / 3;
01669                                 }
01670                                 break;
01671                             case OSG_UINT32_IMAGEDATA:
01672                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01673                                 {
01674                                     sum = 0;
01675                                     sum += destDataUC32[destI++] = sourceDataUC32[srcI++];
01676                                     sum += destDataUC32[destI++] = sourceDataUC32[srcI++];
01677                                     sum += destDataUC32[destI++] = sourceDataUC32[srcI++];
01678                                     destDataUC32[destI++] = sum / 3;
01679                                 }
01680                                 break;
01681                             case OSG_FLOAT32_IMAGEDATA:
01682                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01683                                 {
01684                                     sumReal = 0;
01685                                     sumReal += destDataF32[destI++] = sourceDataF32[srcI++];
01686                                     sumReal += destDataF32[destI++] = sourceDataF32[srcI++];
01687                                     sumReal += destDataF32[destI++] = sourceDataF32[srcI++];
01688                                     destDataF32[destI++] = sumReal / 3.0;
01689                                 }
01690                                 break;
01691                             case OSG_FLOAT16_IMAGEDATA:
01692                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01693                                 {
01694                                     sumReal = 0;
01695                                     sumReal += destDataH16[destI++] = sourceDataH16[srcI++];
01696                                     sumReal += destDataH16[destI++] = sourceDataH16[srcI++];
01697                                     sumReal += destDataH16[destI++] = sourceDataH16[srcI++];
01698                                     destDataH16[destI++] = sumReal / 3.0;
01699                                 }
01700                                 break;
01701                             default:
01702                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01703                                 break;
01704                             }
01705                             break;
01706                     default:
01707                         FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01708                         break;
01709                     }
01710                     break;
01711                     //-----------------------------------------------------
01712                 case OSG_RGBA_PF:
01713                     switch (pixelFormat) {
01714                         case OSG_A_PF:
01715                             switch (getDataType())
01716                             {
01717                             case OSG_UINT8_IMAGEDATA:
01718                                 for (srcI = destI = 0; destI < destSize;)
01719                                 {
01720                                     srcI += 3;
01721                                     data[destI++] = sourceData[srcI++];;
01722                                 }
01723                                 break;
01724                             case OSG_UINT16_IMAGEDATA:
01725                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01726                                 {
01727                                     srcI += 3;
01728                                     destDataUC16[destI++] = sourceDataUC16[srcI++];;
01729                                 }
01730                                 break;
01731                             case OSG_UINT32_IMAGEDATA:
01732                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01733                                 {
01734                                     srcI += 3;
01735                                     destDataUC32[destI++] = sourceDataUC32[srcI++];;
01736                                 }
01737                                 break;
01738                             case OSG_FLOAT32_IMAGEDATA:
01739                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01740                                 {
01741                                     srcI += 3;
01742                                     destDataF32[destI++] = sourceDataF32[srcI++];
01743                                 }
01744                                 break;
01745                             case OSG_FLOAT16_IMAGEDATA:
01746                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01747                                 {
01748                                     srcI += 3;
01749                                     destDataH16[destI++] = sourceDataH16[srcI++];
01750                                 }
01751                                 break;
01752                             default:
01753                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01754                                 break;
01755                             }
01756                             break;
01757                         case OSG_I_PF:
01758                         case OSG_L_PF:
01759                             switch (getDataType())
01760                             {
01761                             case OSG_UINT8_IMAGEDATA:
01762                                 for (srcI = destI = 0; destI < destSize;)
01763                                 {
01764                                     sum = 0;
01765                                     sum += sourceData[srcI++];
01766                                     sum += sourceData[srcI++];
01767                                     sum += sourceData[srcI++];
01768                                     data[destI++] = sum / 3;
01769                                     srcI++;
01770                                 }
01771                                 break;
01772                             case OSG_UINT16_IMAGEDATA:
01773                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01774                                 {
01775                                     sum = 0;
01776                                     sum += sourceDataUC16[srcI++];
01777                                     sum += sourceDataUC16[srcI++];
01778                                     sum += sourceDataUC16[srcI++];
01779                                     destDataUC16[destI++] = sum / 3;
01780                                     srcI++;
01781                                 }
01782                                 break;
01783                             case OSG_UINT32_IMAGEDATA:
01784                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01785                                 {
01786                                     sum = 0;
01787                                     sum += sourceDataUC32[srcI++];
01788                                     sum += sourceDataUC32[srcI++];
01789                                     sum += sourceDataUC32[srcI++];
01790                                     destDataUC32[destI++] = sum / 3;
01791                                     srcI++;
01792                                 }
01793                                 break;
01794                             case OSG_FLOAT32_IMAGEDATA:
01795                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01796                                 {
01797                                     sumReal = 0;
01798                                     sumReal += sourceDataF32[srcI++];
01799                                     sumReal += sourceDataF32[srcI++];
01800                                     sumReal += sourceDataF32[srcI++];
01801                                     destDataF32[destI++] = sumReal / 3.0;
01802                                     srcI++;
01803                                 }
01804                                 break;
01805                             case OSG_FLOAT16_IMAGEDATA:
01806                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01807                                 {
01808                                     sumReal = 0;
01809                                     sumReal += sourceDataH16[srcI++];
01810                                     sumReal += sourceDataH16[srcI++];
01811                                     sumReal += sourceDataH16[srcI++];
01812                                     destDataH16[destI++] = sumReal / 3.0;
01813                                     srcI++;
01814                                 }
01815                                 break;
01816                             default:
01817                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01818                                 break;
01819                             }
01820                             break;
01821                         case OSG_LA_PF:
01822                             switch (getDataType())
01823                             {
01824                             case OSG_UINT8_IMAGEDATA:
01825                                 for (srcI = destI = 0; destI < destSize;)
01826                                 {
01827                                     sum = 0;
01828                                     sum += sourceData[srcI++];
01829                                     sum += sourceData[srcI++];
01830                                     sum += sourceData[srcI++];
01831                                     data[destI++] = sum / 3;
01832                                     data[destI++] = sourceData[srcI++];;
01833                                 }
01834                                 break;
01835                             case OSG_UINT16_IMAGEDATA:
01836                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01837                                 {
01838                                     sum = 0;
01839                                     sum += sourceDataUC16[srcI++];
01840                                     sum += sourceDataUC16[srcI++];
01841                                     sum += sourceDataUC16[srcI++];
01842                                     destDataUC16[destI++] = sum / 3;
01843                                     destDataUC16[destI++] = sourceDataUC16[srcI++];;
01844                                 }
01845                                 break;
01846                             case OSG_UINT32_IMAGEDATA:
01847                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01848                                 {
01849                                     sum = 0;
01850                                     sum += sourceDataUC32[srcI++];
01851                                     sum += sourceDataUC32[srcI++];
01852                                     sum += sourceDataUC32[srcI++];
01853                                     destDataUC32[destI++] = sum / 3;
01854                                     destDataUC32[destI++] = sourceDataUC32[srcI++];;
01855                                 }
01856                                 break;
01857                             case OSG_FLOAT32_IMAGEDATA:
01858                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01859                                 {
01860                                     sumReal = 0;
01861                                     sumReal += sourceDataF32[srcI++];
01862                                     sumReal += sourceDataF32[srcI++];
01863                                     sumReal += sourceDataF32[srcI++];
01864                                     destDataF32[destI++] = sumReal / 3.0;
01865                                     destDataF32[destI++] = sourceDataF32[srcI++];
01866                                 }
01867                                 break;
01868                             case OSG_FLOAT16_IMAGEDATA:
01869                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01870                                 {
01871                                     sumReal = 0;
01872                                     sumReal += sourceDataH16[srcI++];
01873                                     sumReal += sourceDataH16[srcI++];
01874                                     sumReal += sourceDataH16[srcI++];
01875                                     destDataH16[destI++] = sumReal / 3.0;
01876                                     destDataH16[destI++] = sourceDataH16[srcI++];
01877                                 }
01878                                 break;
01879                             default:
01880                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01881                                 break;
01882                             }
01883                             break;
01884                         case OSG_RGB_PF:
01885                            switch (getDataType())
01886                             {
01887                             case OSG_UINT8_IMAGEDATA:
01888                                 for (srcI = destI = 0; destI < destSize;)
01889                                 {
01890                                     data[destI++] = sourceData[srcI++];
01891                                     data[destI++] = sourceData[srcI++];
01892                                     data[destI++] = sourceData[srcI++];
01893                                     srcI++;
01894                                 }
01895                                 break;
01896                             case OSG_UINT16_IMAGEDATA:
01897                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01898                                 {
01899                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01900                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01901                                     destDataUC16[destI++] = sourceDataUC16[srcI++];
01902                                     srcI++;
01903                                 }
01904                                 break;
01905                             case OSG_UINT32_IMAGEDATA:
01906                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01907                                 {
01908                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01909                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01910                                     destDataUC32[destI++] = sourceDataUC32[srcI++];
01911                                     srcI++;
01912                                 }
01913                                 break;
01914                             case OSG_FLOAT32_IMAGEDATA:
01915                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01916                                 {
01917                                     destDataF32[destI++] = sourceDataF32[srcI++];
01918                                     destDataF32[destI++] = sourceDataF32[srcI++];
01919                                     destDataF32[destI++] = sourceDataF32[srcI++];
01920                                     srcI++;
01921                                 }
01922                                 break;
01923                             case OSG_FLOAT16_IMAGEDATA:
01924                                 for (srcI = destI = 0; destI < destSize/getComponentSize();)
01925                                 {
01926                                     destDataH16[destI++] = sourceDataH16[srcI++];
01927                                     destDataH16[destI++] = sourceDataH16[srcI++];
01928                                     destDataH16[destI++] = sourceDataH16[srcI++];
01929                                     srcI++;
01930                                 }
01931                                 break;
01932                             default:
01933                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01934                                 break;
01935                             }
01936                             break;
01937                         case OSG_RGBA_PF:
01938                             switch (getDataType())
01939                             {
01940                             case OSG_UINT8_IMAGEDATA:
01941                                 memcpy (data, getData(), destSize);
01942                                 break;
01943                             case OSG_UINT16_IMAGEDATA:
01944                                 memcpy (data, getData(), destSize);
01945                                 break;
01946                             case OSG_UINT32_IMAGEDATA:
01947                                 memcpy (data, getData(), destSize);
01948                                 break;
01949                             case OSG_FLOAT32_IMAGEDATA:
01950                                 memcpy (data, getData(), destSize);
01951                                 break;
01952                             case OSG_FLOAT16_IMAGEDATA:
01953                                 memcpy (data, getData(), destSize);
01954                                 break;
01955                             default:
01956                                 FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
01957                                 break;
01958                             }
01959                             break;
01960 
01961                         default:
01962                             break;
01963                     }
01964                     break;
01965                 case OSG_ALPHA_INTEGER_PF:
01966                 case OSG_RGB_INTEGER_PF:
01967                 case OSG_RGBA_INTEGER_PF:
01968                 case OSG_BGR_INTEGER_PF:
01969                 case OSG_BGRA_INTEGER_PF:
01970                 case OSG_LUMINANCE_INTEGER_PF:
01971                 case OSG_LUMINANCE_ALPHA_INTEGER_PF:
01972                     {
01973                         FFATAL((" 'reformat' NYI\n "));
01974                     }
01975                     break;
01976                 default:
01977                     FWARNING (( "Unvalid pixeldepth (%d) in reformat() !\n",
01978                                 pixelFormat ));
01979             }
01980         }
01981         if (data)
01982         {
01983             // rip the data from the local destImage if necessary
01984             if(destination == NullFC)
01985             {
01986                 this->set(dest);
01987                 subRefCP(dest);
01988             }
01989         }
01990     }
01991 
01992     return (data ? true : false);
01993 }

void Image::swapDataEndian ( void   ) 

Definition at line 1995 of file OSGImage.cpp.

References osg::beginEditCP(), osg::endEditCP(), FFATAL, FWARNING, osg::ImageBase::getComponentSize(), getData(), osg::ImageBase::getDataType(), getSize(), OSG_FLOAT32_IMAGEDATA, OSG_INT16_IMAGEDATA, OSG_INT32_IMAGEDATA, OSG_UINT16_IMAGEDATA, OSG_UINT32_IMAGEDATA, OSG_UINT8_IMAGEDATA, p, and osg::ImageBase::PixelFieldMask.

01996 {
01997     UChar8 *data = getData();
01998 
01999     Int32 size = getSize() / getComponentSize();
02000     UInt16 *dataUC16 = (UInt16*) data;
02001     UInt32 *dataUC32 = (UInt32*) data;
02002     Real32 *dataF32 = (Real32*) data;
02003     
02004 
02005     ImagePtr iPtr(this);
02006     beginEditCP(iPtr, PixelFieldMask);
02007     
02008     switch (getDataType())
02009     {
02010         case OSG_UINT8_IMAGEDATA:
02011             // do nothing
02012         break;
02013 
02014         case OSG_UINT16_IMAGEDATA:
02015             for(UInt32 i=0;i<size;++i)
02016             {
02017                 UInt16 p = dataUC16[i];
02018                 dataUC16[i] = (((p >> 8)) | (p << 8));
02019             }
02020         break;
02021 
02022         case OSG_UINT32_IMAGEDATA:
02023            for(UInt32 i=0;i<size;++i)
02024             {
02025                 UInt32 p = dataUC32[i];
02026                 dataUC32[i] = (((p&0x000000FF)<<24) | ((p&0x0000FF00)<<8) |
02027                                ((p&0x00FF0000)>>8)  | ((p&0xFF000000)>>24));
02028             }
02029         break;
02030 
02031         case OSG_FLOAT32_IMAGEDATA:
02032             for(UInt32 i=0;i<size;++i)
02033             {
02034                 Real32 p = dataF32[i];
02035                 UInt8 *b = (UInt8 *) &p;
02036                 std::swap(b[0], b[3]);
02037                 std::swap(b[1], b[2]);
02038                 dataF32[i] = p;
02039             }
02040         break;
02041             
02042         case OSG_INT16_IMAGEDATA:
02043         case OSG_INT32_IMAGEDATA:
02044             {
02045                 FFATAL((" 'swapDataEndian' NYI\n "));
02046             }
02047         break;
02048 
02049         default:
02050             FWARNING (( "invalid source data type \n"));
02051         break;
02052     }
02053     
02054     endEditCP(iPtr, PixelFieldMask);
02055 }

bool Image::convertDataTypeTo ( Int32  destDataType = OSG_UINT8_IMAGEDATA  ) 

It is a simple method to convert the image dataType. Does not change the pixelFormat. So you can for example convert a image consisting of UChar8 data to Float data.

Definition at line 2060 of file OSGImage.cpp.

References osg::addRefCP(), osg::ImageBase::create(), FFATAL, FINFO, FWARNING, osg::ImageBase::getComponentSize(), getData(), osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getFrameCount(), osg::ImageBase::getHeight(), osg::ImageBase::getMipMapCount(), osg::ImageBase::getPixelFormat(), osg::ImageBase::getSideCount(), getSize(), osg::ImageBase::getWidth(), hasCompressedData(), OSG_FLOAT16_IMAGEDATA, OSG_FLOAT32_IMAGEDATA, OSG_INT16_IMAGEDATA, OSG_INT32_IMAGEDATA, OSG_UINT16_IMAGEDATA, OSG_UINT32_IMAGEDATA, OSG_UINT8_IMAGEDATA, REAL16_MAX, and osg::subRefCP().

02061 {
02062     if (hasCompressedData()) 
02063     {
02064         FFATAL (("Invalid Image::convertDataTypeTo for compressed image\n"));
02065         return false;
02066     }
02067 
02068     if (destDataType == getDataType())
02069     {
02070         FWARNING (( "source image and destination image have same data types: no conversion possible"));
02071         return true;
02072     }
02073 
02074     FINFO (( "Try to convert image from dataType %d to %d\n",
02075              getDataType(), destDataType ));
02076 
02077     ImagePtr dest;
02078     dest = Image::create();
02079     addRefCP(dest);
02080 
02081     dest->set ( getPixelFormat(), 
02082                 getWidth(), getHeight(), getDepth(), 
02083                 getMipMapCount(), 
02084                 getFrameCount(), 0.0, 
02085                 0, destDataType,
02086                 true,
02087                 getSideCount());
02088 
02089     UChar8 *sourceData = getData();
02090     UChar8 *destData = dest->getData();
02091 
02092     Int32 sourceSize = getSize()/getComponentSize();
02093     Int32 destSize = dest->getSize()/dest->getComponentSize();
02094 
02095     UInt16 *sourceDataUC16 = (UInt16*) sourceData;
02096     UInt16 *destDataUC16 = (UInt16*) destData;
02097     UInt32 *sourceDataUC32 = (UInt32*) sourceData;
02098     UInt32 *destDataUC32 = (UInt32*) destData;
02099     Real32 *sourceDataF32 = (Real32*) sourceData;
02100     Real32 *destDataF32 = (Real32*) destData;
02101     Real16 *sourceDataH16 = (Real16*) sourceData;
02102     Real16 *destDataH16 = (Real16*) destData;
02103 
02104     switch (getDataType())
02105     {
02106         case OSG_UINT8_IMAGEDATA:
02107             switch (destDataType)
02108             {
02109                 case OSG_UINT16_IMAGEDATA:
02110                     for (int i = 0; i < sourceSize; i++)
02111                     {
02112                         destDataUC16[i] = (UInt16) (sourceData[i]<<8);
02113                     }
02114                     break;
02115                 case OSG_UINT32_IMAGEDATA:
02116                     for (int i = 0; i < sourceSize; i++)
02117                     {
02118                         destDataUC32[i] = (UInt32) (sourceData[i]<<24);
02119                     }
02120                     break;
02121                 case OSG_FLOAT32_IMAGEDATA:
02122                     for (int i = 0; i < sourceSize; i++)
02123                     {
02124                         destDataF32[i] = (Real32) (sourceData[i]/255.0);
02125                     }
02126                     break;
02127                 case OSG_FLOAT16_IMAGEDATA:
02128                     for (int i = 0; i < sourceSize; i++)
02129                     {
02130                         destDataH16[i] = (Real16) (sourceData[i]/255.0);
02131                     }
02132                     break;
02133                 default:
02134                     FWARNING (( "invalid destination data type \n" ));
02135                     break;
02136             }
02137 
02138             break;
02139 
02140         case OSG_UINT16_IMAGEDATA:
02141             switch (destDataType)
02142             {
02143                 case OSG_UINT8_IMAGEDATA:
02144                     {
02145                         UInt16 nMin = (UInt16) 65535;
02146                         UInt16 nMax = (UInt16) 0;
02147                         for (UInt32 i = 0; i < sourceSize; ++i)
02148                         {
02149                             if (sourceDataUC16[i] > nMax)
02150                                 nMax = sourceDataUC16[i];
02151                             if (sourceDataUC16[i] < nMin)
02152                                 nMin = sourceDataUC16[i];
02153                         }
02154                     
02155                         Real32 fRange = (Real32) nMax - nMin;
02156                         if (fRange <= 0.0)
02157                         {
02158                             for (UInt32 i = 0; i < sourceSize; ++i)
02159                                 destData[i] = 0;
02160                         }
02161                         else
02162                         {
02163                             for (UInt32 i = 0; i < sourceSize; ++i)
02164                                 destData[i] = (UInt8) (255.0 * ((Real32) (sourceDataUC16[i] - nMin)) / fRange);
02165                         }
02166                     }
02167                     break;
02168                 case OSG_UINT32_IMAGEDATA:
02169                     for (int i = 0; i < sourceSize; i++)
02170                     {
02171                         destDataUC32[i] = (UInt32) (sourceDataUC16[i]<<16);
02172                     }
02173                     break;
02174                 case OSG_FLOAT32_IMAGEDATA:
02175                     for (int i = 0; i < sourceSize; i++)
02176                     {
02177                         destDataF32[i] = (Real32) (sourceDataUC16[i]/65535.0);
02178                     }
02179                     break;
02180                 case OSG_FLOAT16_IMAGEDATA:
02181                     for (int i = 0; i < sourceSize; i++)
02182                     {
02183                         destDataH16[i] = (Real16) (sourceDataUC16[i]/255.0);
02184                     }
02185                     break;
02186                 default:
02187                     FWARNING (( "invalid destination data type \n" ));
02188                     break;
02189             }
02190             break;
02191 
02192         case OSG_UINT32_IMAGEDATA:
02193             switch (destDataType)
02194             {
02195                 case OSG_UINT8_IMAGEDATA:
02196                     {
02197                         UInt32 nMin = (UInt32) 4294967295ul;
02198                         UInt32 nMax = (UInt32) 0;
02199                         for (UInt32 i = 0; i < sourceSize; ++i)
02200                         {
02201                             if (sourceDataUC32[i] > nMax)
02202                                 nMax = sourceDataUC32[i];
02203                             if (sourceDataUC32[i] < nMin)
02204                                 nMin = sourceDataUC32[i];
02205                         }
02206                     
02207                         Real32 fRange = (Real32) nMax - nMin;
02208                         if (fRange <= 0.0)
02209                         {
02210                             for (UInt32 i = 0; i < sourceSize; ++i)
02211                                 destData[i] = 0;
02212                         }
02213                         else
02214                         {
02215                             for (UInt32 i = 0; i < sourceSize; ++i)
02216                                 destData[i] = (UInt8) (255.0 * ((Real32) (sourceDataUC32[i] - nMin)) / fRange);
02217                         }
02218                     }
02219                     break;
02220                 case OSG_UINT16_IMAGEDATA:
02221                     {
02222                         UInt32 nMin = (UInt32) 4294967295ul;
02223                         UInt32 nMax = (UInt32) 0;
02224                         for (UInt32 i = 0; i < sourceSize; ++i)
02225                         {
02226                             if (sourceDataUC32[i] > nMax)
02227                                 nMax = sourceDataUC32[i];
02228                             if (sourceDataUC32[i] < nMin)
02229                                 nMin = sourceDataUC32[i];
02230                         }
02231                     
02232                         Real32 fRange = (Real32) nMax - nMin;
02233                         if (fRange <= 0.0)
02234                         {
02235                             for (UInt32 i = 0; i < sourceSize; ++i)
02236                                 destDataUC16[i] = 0;
02237                         }
02238                         else
02239                         {
02240                             for (UInt32 i = 0; i < sourceSize; ++i)
02241                                 destDataUC16[i] = (UInt16) (65535.0 * ((Real32) (sourceDataUC32[i] - nMin)) / fRange);
02242                         }
02243                     }
02244                     break;
02245                 case OSG_FLOAT32_IMAGEDATA:
02246                     for (int i = 0; i < sourceSize; i++)
02247                     {
02248                         destDataF32[i] = ((Real32) sourceDataUC32[i]) / 4294967295.0;
02249                     }
02250                     break;
02251                 case OSG_FLOAT16_IMAGEDATA:
02252                     for (int i = 0; i < sourceSize; i++)
02253                     {
02254                         destDataH16[i] = ((Real16) sourceDataUC32[i]) / REAL16_MAX;
02255                     }
02256                     break;
02257                 default:
02258                     FWARNING (( "invalid destination data type \n" ));
02259                     break;
02260             }
02261             break;
02262 
02263         case OSG_FLOAT32_IMAGEDATA:
02264             switch (destDataType)
02265             {
02266                 case OSG_UINT8_IMAGEDATA:
02267                     for (int i = 0; i < sourceSize; i++)
02268                     {
02269                         destData[i] = (UInt8) (sourceDataF32[i]*255.0);
02270                     }
02271                     break;
02272                 case OSG_UINT16_IMAGEDATA:
02273                     for (int i = 0; i < sourceSize; i++)
02274                     {
02275                         destDataUC16[i] = (UInt16) (sourceDataF32[i]*65535.0);
02276                     }
02277                     break;
02278                 case OSG_UINT32_IMAGEDATA:
02279                     for (int i = 0; i < sourceSize; i++)
02280                     {
02281                         destDataUC32[i] = (UInt32) (sourceDataF32[i]*4294967295.0);
02282                     }
02283                     break;
02284                 case OSG_FLOAT16_IMAGEDATA:
02285                     for (int i = 0; i < sourceSize; i++)
02286                     {
02287                         destDataH16[i] = Real16 (sourceDataF32[i]); // half-constructor
02288                     }
02289                     break;
02290                 default:
02291                     FWARNING (( "invalid destination data type \n" ));
02292                     break;
02293             }
02294             break;
02295             
02296         case OSG_INT16_IMAGEDATA:
02297         case OSG_INT32_IMAGEDATA:
02298             {
02299                 FFATAL((" 'convertDataTypeTo' NYI\n "));
02300             }
02301             break;
02302             
02303         default:
02304             FWARNING (( "invalid source data type \n"));
02305             break;
02306     }
02307 
02308     if (dest->getData()!= NULL)
02309     {
02310         this->set(dest);
02311         subRefCP(dest);
02312     }
02313 
02314     return (getData() ? true : false);
02315 }

bool Image::scale ( Int32  width,
Int32  height = 1,
Int32  depth = 1,
ImagePtr  destination = NullFC 
)

Method to scale the image. It just does a very simple but fast 'nearest' scale. Should handle mipmap and frame data correct. The method can operate on the object or stores the result in the optional destination Image.

Definition at line 2433 of file OSGImage.cpp.

References osg::beginEditCP(), calcMipmapSumSize(), osg::endEditCP(), FFATAL, osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getFrameCount(), osg::ImageBase::getFrameDelay(), osg::ImageBase::getFrameSize(), osg::ImageBase::getHeight(), osg::ImageBase::getMipMapCount(), osg::ImageBase::getPixel(), osg::ImageBase::getPixelFormat(), osg::ImageBase::getSideCount(), osg::ImageBase::getSideSize(), osg::ImageBase::getWidth(), hasCompressedData(), osg::NullFC, osg::ImageBase::PixelFieldMask, and scaleData().

Referenced by scaleNextPower2().

02435 {
02436     ImagePtr destImage;
02437     UInt32  sw, sh, sd, dw, dh, dd;
02438     Int32   frame, side, mipmap;
02439     UChar8  *src, *dest;
02440     Int32   oldWidth =getWidth();
02441     Int32   oldHeight=getHeight();
02442     Int32   oldDepth =getDepth();
02443     MFUInt8 srcPixel;
02444 
02445     if ( (oldWidth == width) &&
02446          (oldHeight == height) &&
02447          (oldDepth == depth) ) 
02448     {
02449       if (destination != osg::NullFC)
02450         *destination = *this;
02451 
02452       return true;
02453     }
02454      
02455     if (hasCompressedData()) 
02456     {
02457         FFATAL (("Invalid Image::scale for compressed image\n"));
02458         return false;
02459     }
02460 
02461     if(destination != NullFC)
02462         destImage=destination;
02463     else
02464         destImage=ImagePtr(this);
02465 
02466     // get pixel
02467     srcPixel=getPixel();
02468     // set image data
02469     destImage->set((PixelFormat)getPixelFormat(),
02470                    width, height, depth, getMipMapCount(),
02471                    getFrameCount(), getFrameDelay(), 0, getDataType(),
02472                    true,
02473                    getSideCount());
02474 
02475     beginEditCP(destImage,PixelFieldMask);
02476 
02477     // copy every mipmap in every side in every frame
02478     for(frame = 0; frame < getFrameCount(); frame++)
02479     {
02480       for (side = 0; side < getSideCount(); side++) 
02481       {
02482         for(mipmap = 0; mipmap < getMipMapCount(); mipmap++)
02483         {
02484           // get the memory pointer
02485           src = (&srcPixel[0]) +
02486             (side  * getSideSize()) +
02487             (frame * getFrameSize()) ;
02488           if(mipmap)
02489             src+=calcMipmapSumSize ( mipmap,
02490                                      oldWidth, oldHeight, oldDepth);
02491           dest=destImage->getData(mipmap,frame,side);
02492           
02493           // calc the mipmap size
02494           sw = oldWidth  >> mipmap;
02495           sh = oldHeight >> mipmap;
02496           sd = oldDepth  >> mipmap;
02497           destImage->calcMipmapGeometry(mipmap, dw, dh, dd);
02498           
02499           // copy and scale the data
02500           scaleData(src, sw, sh, sd, dest, dw, dh, dd);
02501         }
02502       }
02503     }
02504 
02505     endEditCP(destImage,PixelFieldMask);
02506 
02507     return true;
02508 }

bool Image::scaleNextPower2 ( ImagePtr  destination = NullFC  ) 

Scale the image to the next power of 2 dimensions The method can operate on the object or stores the result in the optional destination Image.

Definition at line 2514 of file OSGImage.cpp.

References osg::ImageBase::getDepth(), osg::ImageBase::getHeight(), osg::ImageBase::getWidth(), osg::osgnextpower2(), and scale().

02515 {
02516   return scale ( osgnextpower2(getWidth()),
02517                  osgnextpower2(getHeight()),
02518                  osgnextpower2(getDepth()),
02519                  destination );
02520 }

bool Image::subImage ( Int32  offX,
Int32  offY,
Int32  offZ,
Int32  destW,
Int32  destH,
Int32  destD,
ImagePtr  destination = NullFC 
)

Crop the image to the given bounding box. The method can operate on the object or stores the result in the optional destination Image.

Definition at line 2526 of file OSGImage.cpp.

References osg::addRefCP(), osg::ImageBase::create(), FDEBUG, FFATAL, osg::ImageBase::getBpp(), getData(), osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getHeight(), osg::ImageBase::getPixelFormat(), osg::ImageBase::getWidth(), hasCompressedData(), osg::NullFC, osg::osgMin(), and osg::subRefCP().

Referenced by slice().

02529 {
02530     ImagePtr destImage = destination;
02531     bool     retCode   = true;
02532 
02533     if (hasCompressedData()) 
02534     {
02535         FFATAL (("Invalid Image::subImage for compressed image\n"));
02536         return false;
02537     }
02538 
02539     if(destination == NullFC)
02540     {
02541         destImage = Image::create();
02542         addRefCP(destImage);
02543     }
02544 
02545     destImage->set((PixelFormat)getPixelFormat(),
02546                    destW, destH, destD,1,1,0.0,0,getDataType());
02547 
02548     UChar8  *src = getData();
02549     UChar8 *dest = destImage->getData();
02550 
02551     FDEBUG(("Image::subImage (%d %d %d) - (%d %d %d) - destPtr %p\n",
02552             offX, offY, offZ, destW, destH, destD, dest));
02553 
02554     // ensure destination data is zero
02555     memset(dest, 0, destImage->getSize());
02556 
02557     // determine the area to actually copy
02558     UInt32 xMin = offX;
02559     UInt32 yMin = offY;
02560     UInt32 zMin = offZ;
02561 
02562     UInt32 xMax = osgMin(getWidth(),  offX + destW);
02563     UInt32 yMax = osgMin(getHeight(), offY + destH);
02564     UInt32 zMax = osgMin(getDepth(),  offZ + destD);
02565 
02566     // fill the destination buffer with the subdata
02567     UInt32 destIdx = 0;
02568 
02569     for(UInt32 z = zMin; z < zMax; z++)
02570     {
02571         for(UInt32 y = yMin; y < yMax; y++)
02572         {
02573             for(UInt32 x = xMin; x < xMax; x++)
02574             {
02575                 for(UInt32 i = 0; i < getBpp(); i++)
02576                 {
02577                     dest[destIdx] = src[((z * getHeight() + y) *
02578                                             getWidth() + x) * getBpp() + i];
02579                     destIdx++;
02580                 }
02581             }
02582             destIdx += (destW - (xMax - xMin)) * getBpp();
02583         }
02584         destIdx += (destH - (yMax - yMin)) * destW * getBpp();
02585     }
02586 
02587     // rip the data from the local destImage if necessary
02588     if(destination == NullFC)
02589     {
02590         this->set(destImage);
02591         subRefCP(destImage);
02592     }
02593 
02594     return retCode;
02595 }

bool Image::slice ( Int32  offX = -1,
Int32  offY = -1,
Int32  offZ = -1,
ImagePtr  destination = NullFC 
)

Crop a slice. The method can operate on the object or stores the result in the optional destination Image.

Definition at line 2601 of file OSGImage.cpp.

References osg::addRefCP(), osg::ImageBase::create(), FDEBUG, FFATAL, FWARNING, osg::ImageBase::getBpp(), getData(), osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getHeight(), osg::ImageBase::getPixelFormat(), osg::ImageBase::getWidth(), hasCompressedData(), osg::NullFC, subImage(), and osg::subRefCP().

Referenced by scaleData().

02603 {
02604     ImagePtr destImage = destination;
02605     bool     retCode   = true;
02606     UInt32   counter   = 0;
02607 
02608     if (hasCompressedData()) 
02609     {
02610         FFATAL (("Invalid Image::slice for compressed image\n"));
02611         return false;
02612     }
02613 
02614     if(destination == NullFC)
02615     {
02616         destImage = Image::create();
02617         addRefCP(destImage);
02618     }
02619 
02620     FDEBUG(("Image::slice (%d %d %d)\n",
02621         offX, offY, offZ));
02622 
02623     if (offX >= 0) counter++;
02624     if (offY >= 0) counter++;
02625     if (offZ >= 0) counter++;
02626 
02627     if (counter != 1) {
02628         FWARNING(("Image::slice - more/less than one non negative value\n"));
02629         return false;
02630     }
02631 
02632     if (offZ >= 0) {
02633         // XY slice
02634         retCode = subImage( 0, 0, offZ, getWidth(), getHeight(), 1,
02635                             destImage );
02636     }
02637 
02638     if (offY >= 0) {
02639         // XZ slice
02640         destImage->set((PixelFormat)getPixelFormat(),
02641                        getWidth(), getDepth(), 1,1,1,0.0,0,getDataType());
02642 
02643         UChar8  *src  = getData();
02644         UChar8  *dest = destImage->getData();
02645 
02646         // ensure destination data is zero
02647         memset(dest, 0, destImage->getSize());
02648 
02649         for(UInt32 z = 0; z < getDepth(); z++)
02650         {
02651           for(UInt32 x = 0; x < getWidth(); x++)
02652           {
02653             for(UInt32 i = 0; i < getBpp(); i++)
02654             {
02655               dest[(z * getWidth() + x) * getBpp() + i] = src[((z * getHeight() + offY) *
02656                                                        getWidth() + x) *
02657                                                      getBpp() + i];
02658             }
02659           }
02660         }
02661     }
02662 
02663     if (offX >= 0) {
02664         // YZ slice
02665         destImage->set((PixelFormat)getPixelFormat(),
02666                        getWidth(), getDepth(), 1,1,1,0.0,0,getDataType());
02667 
02668         UChar8  *src  = getData();
02669         UChar8  *dest = destImage->getData();
02670 
02671         // ensure destination data is zero
02672         memset(dest, 0, destImage->getSize());
02673 
02674         for(UInt32 z = 0; z < getDepth(); z++)
02675         {
02676           for(UInt32 y = 0; y < getHeight(); y++)
02677           {
02678             for(UInt32 i = 0; i < getBpp(); i++)
02679             {
02680               dest[(z * getHeight() + y) * getBpp() + i] = src[((z * getHeight() + y) *
02681                                                         getWidth() + offX) *
02682                                                       getBpp() + i];
02683             }
02684           }
02685         }
02686     }
02687 
02688     // rip the data from the local destImage if necessary
02689     if(destination == NullFC)
02690     {
02691         this->set(destImage);
02692         subRefCP(destImage);
02693     }
02694 
02695     return retCode;
02696 }

bool Image::createMipmap ( Int32  level = -1,
ImagePtr  destination = NullFC 
)

Create mipmaps data, level defines the number of level The method can operate on the object or stores the result in the optional destination Image.

Definition at line 2702 of file OSGImage.cpp.

References osg::addRefCP(), calcMipmapLevelCount(), osg::ImageBase::create(), FFATAL, FWARNING, osg::ImageBase::getBpp(), osg::ImageBase::getComponentSize(), getData(), osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getFrameCount(), osg::ImageBase::getFrameDelay(), osg::ImageBase::getHeight(), osg::ImageBase::getPixelFormat(), osg::ImageBase::getSideCount(), osg::ImageBase::getWidth(), hasCompressedData(), osg::NullFC, OSG_FLOAT16_IMAGEDATA, OSG_FLOAT32_IMAGEDATA, OSG_INT16_IMAGEDATA, OSG_INT32_IMAGEDATA, OSG_UINT16_IMAGEDATA, OSG_UINT32_IMAGEDATA, OSG_UINT8_IMAGEDATA, and osg::subRefCP().

02703 {
02704     struct Offset
02705     {
02706       Int32   d;
02707       Int32   h;
02708       Int32   w;
02709     };
02710 
02711     Offset  offset[][8] =
02712     {
02713         {   // 000
02714             { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
02715             { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } },
02716         {   // 100
02717             { 0, 0, 0 }, { 1, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
02718             { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } },
02719         {   // 010
02720             { 0, 0, 0 }, { 0, 1, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
02721             { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } },
02722         {   // 110
02723             { 0, 0, 0 }, { 0, 1, 0 }, { 1, 0, 0 }, { 1, 1, 0 },
02724             { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } },
02725         {   // 001
02726             { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 },
02727             { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } },
02728         {   // 101
02729             { 0, 0, 0 }, { 1, 0, 0 }, { 0, 0, 1 }, { 1, 0, 1 },
02730             { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } },
02731         {   // 011
02732             { 0, 0, 0 }, { 0, 0, 1 }, { 0, 1, 0 }, { 0, 1, 1 },
02733             { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } },
02734         {   // 111
02735             { 0, 0, 0 }, { 1, 0, 0 }, { 0, 1, 0 }, { 1, 1, 0 },
02736             { 0, 0, 1 }, { 1, 0, 1 }, { 0, 1, 1 }, { 1, 1, 1 } }
02737     };
02738     Int32   offsetSize[] = { 0, 2, 2, 4, 2, 4, 4, 8 };
02739     ImagePtr destImage = destination;
02740     Int32   w = getWidth(), h = getHeight(), d = getDepth();
02741     Int32   wm, hm, dm, wi, hi, di;
02742     UChar8  *src, *dest;
02743     UInt16 *sourceDataUC16, *destDataUC16;
02744     UInt32 *sourceDataUC32, *destDataUC32;
02745     Real32 *sourceDataF32, *destDataF32;
02746     Real16 *sourceDataH16, *destDataH16;
02747 
02748     if (hasCompressedData()) 
02749     {
02750         FFATAL (("Invalid Image::createMipmap for compressed image\n"));
02751         return false;
02752     }
02753 
02754     if(destImage == NullFC)
02755     {
02756         destImage = Image::create();
02757         addRefCP(destImage);
02758     }
02759 
02760     Real32 valueFloat;
02761     Int32   value, i, elem, dim, side, frame, size, mipmap;
02762     Int32   channel, lineSize, sliceSize;
02763 
02764     // calc the level count
02765     if(level < 0)
02766     {
02767         level = calcMipmapLevelCount() - 1;
02768     }
02769 
02770     // create destination image
02771     destImage->set(getPixelFormat(),
02772                    getWidth(), getHeight(), getDepth(),
02773                    level, getFrameCount(),
02774                    getFrameDelay(), 0, getDataType(),
02775                    true,
02776                    getSideCount() );
02777 
02778     // copy the data;
02779     switch (getDataType())
02780     {
02781         case OSG_UINT8_IMAGEDATA:
02782             for(frame = 0; frame < getFrameCount(); frame++)
02783             {
02784               for(side = 0; side < getSideCount(); side++) 
02785               {
02786                 src = this->getData(0, frame, side);
02787                 dest = destImage->getData(0, frame, side);
02788                 size = getWidth() * getHeight() * getDepth() * getBpp();
02789                 memcpy(dest,src, size);
02790                 src = dest;
02791                 dest = src + size;
02792                 w = getWidth();
02793                 h = getHeight();
02794                 d = getDepth();
02795 
02796                 for(mipmap = 1; mipmap < level; mipmap++)
02797                 {
02798                     lineSize = w * getBpp();
02799                     sliceSize = w * h * getBpp();
02800                     wm = (w == 1) ? w : (w >> 1);
02801                     hm = (h == 1) ? h : (h >> 1);
02802                     dm = (d == 1) ? d : (d >> 1);
02803 
02804                     dim = (d > dm) * 1 + (h > hm) * 2 + (w > wm) * 4;
02805                     elem = offsetSize[dim];
02806 
02807                     for(di = 0; di < dm; di++)
02808                     {
02809                         for(hi = 0; hi < hm; hi++)
02810                         {
02811                             for(wi = 0; wi < wm; wi++)
02812                             {
02813                                 for(channel = 0; channel < getBpp(); channel++)
02814                                 {
02815                                     value = 0;
02816                                     for(i = 0; i < elem; i++)
02817                                     {
02818                                         value += src[
02819                                             ((wi * 2) + offset[dim][i].w) * getBpp() +
02820                                             ((hi * 2) + offset[dim][i].h) * lineSize +
02821                                             ((di * 2) + offset[dim][i].d) * sliceSize +
02822                                                         channel];
02823                                     }
02824                                 *dest++ = (Int8) (value / elem);
02825                                 }
02826                             }
02827                         }
02828                     }
02829 
02830                     src += sliceSize;
02831                     w = wm;
02832                     h = hm;
02833                     d = dm;
02834                 }
02835               }
02836             }
02837             break;
02838 
02839         case OSG_UINT16_IMAGEDATA:
02840             for(frame = 0; frame < getFrameCount(); frame++)
02841             {
02842               for(side = 0; side < getSideCount(); side++) 
02843               {
02844                 src = this->getData(0, frame, side);
02845                 // sourceDataUC16 = (UInt16*) this->getData(0, frame);
02846                 dest = destImage->getData(0, frame, side);
02847                 // destDataUC16 = (UInt16*) destImage->getData(0, frame);
02848 
02849                 size = getWidth() * getHeight() * getDepth() * getBpp();
02850                 // UInt32 sizeUC16 = getWidth() * getHeight() * getDepth() * getBpp()/getComponentSize();
02851                 // for (int i = 0; i < sizeUC16; i++) destDataUC16[i] = sourceDataUC16[i];
02852 
02853                 memcpy(dest,src, size);
02854 
02855                 src = dest;
02856                 dest = src + size;
02857                 // sourceDataUC16 = destDataUC16;
02858                 // destDataUC16 = sourceDataUC16 + sizeUC16;
02859 
02860                 w = getWidth();
02861                 h = getHeight();
02862                 d = getDepth();
02863 
02864                 sourceDataUC16 = (UInt16*) src;
02865                 destDataUC16 = (UInt16*) dest;
02866 
02867                 for(mipmap = 1; mipmap < level; mipmap++)
02868                 {
02869                     lineSize = w * getBpp()/getComponentSize();
02870                     sliceSize = w * h * getBpp()/getComponentSize();
02871                     wm = (w == 1) ? w : (w >> 1);
02872                     hm = (h == 1) ? h : (h >> 1);
02873                     dm = (d == 1) ? d : (d >> 1);
02874 
02875                     dim = (d > dm) * 1 + (h > hm) * 2 + (w > wm) * 4;
02876                     elem = offsetSize[dim];
02877 
02878                     for(di = 0; di < dm; di++)
02879                     {
02880                         for(hi = 0; hi < hm; hi++)
02881                         {
02882                             for(wi = 0; wi < wm; wi++)
02883                             {
02884                                 for(channel = 0; channel < (getBpp()/getComponentSize()); channel++)
02885                                 {
02886                                     value = 0;
02887                                     for(i = 0; i < elem; i++)
02888                                     {
02889                                         value += sourceDataUC16[
02890                                             ((wi * 2) + offset[dim][i].w) * (getBpp() / getComponentSize()) +
02891                                             ((hi * 2) + offset[dim][i].h) * lineSize +
02892                                             ((di * 2) + offset[dim][i].d) * sliceSize +
02893                                                         channel];
02894                                     }
02895                                 *destDataUC16++ = (UInt16) (value / elem);
02896                                 }
02897                             }
02898                         }
02899                     }
02900 
02901                     sourceDataUC16 += sliceSize;
02902                     w = wm;
02903                     h = hm;
02904                     d = dm;
02905                 }
02906               }
02907             }
02908             break;
02909 
02910         case OSG_UINT32_IMAGEDATA:
02911             for(frame = 0; frame < getFrameCount(); frame++)
02912             {
02913               for(side = 0; side < getSideCount(); side++) 
02914               {
02915                 src = this->getData(0, frame,side);
02916                 // sourceDataUC32 = (UInt32*) this->getData(0, frame);
02917                 dest = destImage->getData(0, frame,side);
02918                 // destDataUC32 = (UInt32*) destImage->getData(0, frame);
02919 
02920                 size = getWidth() * getHeight() * getDepth() * getBpp();
02921                 // UInt32 sizeUC32 = getWidth() * getHeight() * getDepth() * getBpp()/getComponentSize();
02922 
02923                 memcpy(dest,src, size);
02924 
02925                 src = dest;
02926                 dest = src + size;
02927                 // sourceDataUC32 = destDataUC32;
02928                 // destDataUC32 = sourceDataUC32 + sizeUC32;
02929 
02930                 w = getWidth();
02931                 h = getHeight();
02932                 d = getDepth();
02933 
02934                 sourceDataUC32 = (UInt32*) src;
02935                 destDataUC32 = (UInt32*) dest;
02936 
02937                 for(mipmap = 1; mipmap < level; mipmap++)
02938                 {
02939                     lineSize = w * (getBpp() / getComponentSize());
02940                     sliceSize = w * h * (getBpp() / getComponentSize());
02941                     wm = (w == 1) ? w : (w >> 1);
02942                     hm = (h == 1) ? h : (h >> 1);
02943                     dm = (d == 1) ? d : (d >> 1);
02944 
02945                     dim = (d > dm) * 1 + (h > hm) * 2 + (w > wm) * 4;
02946                     elem = offsetSize[dim];
02947 
02948                     for(di = 0; di < dm; di++)
02949                     {
02950                         for(hi = 0; hi < hm; hi++)
02951                         {
02952                             for(wi = 0; wi < wm; wi++)
02953                             {
02954                                 for(channel = 0; channel < (getBpp()/getComponentSize()); channel++)
02955                                 {
02956                                     value = 0;
02957                                     for(i = 0; i < elem; i++)
02958                                     {
02959                                         value += (sourceDataUC32[
02960                                             ((wi * 2) + offset[dim][i].w) * (getBpp() / getComponentSize()) +
02961                                             ((hi * 2) + offset[dim][i].h) * lineSize +
02962                                             ((di * 2) + offset[dim][i].d) * sliceSize +
02963                                                         channel]/elem);
02964                                     }
02965                                 *destDataUC32++ = (UInt32) value;
02966                                 }
02967                             }
02968                         }
02969                     }
02970 
02971                     sourceDataUC32 += sliceSize;
02972                     w = wm;
02973                     h = hm;
02974                     d = dm;
02975                 }
02976               }
02977             }
02978             break;
02979 
02980         case OSG_FLOAT32_IMAGEDATA:
02981             for(frame = 0; frame < getFrameCount(); frame++)
02982             {
02983               for(side = 0; side < getSideCount(); side++) 
02984               {
02985                 src = this->getData(0, frame,side);
02986                 dest = destImage->getData(0, frame,side);
02987                 size = getWidth() * getHeight() * getDepth() * getBpp();
02988                 memcpy(dest,src, size);
02989                 src = dest;
02990                 dest = src + size;
02991                 w = getWidth();
02992                 h = getHeight();
02993                 d = getDepth();
02994 
02995                 sourceDataF32 = (Real32*) src;
02996                 destDataF32 = (Real32*) dest;
02997 
02998                 for(mipmap = 1; mipmap < level; mipmap++)
02999                 {
03000                     lineSize = w * (getBpp() / getComponentSize());
03001                     sliceSize = w * h * (getBpp() / getComponentSize());
03002                     wm = (w == 1) ? w : (w >> 1);
03003                     hm = (h == 1) ? h : (h >> 1);
03004                     dm = (d == 1) ? d : (d >> 1);
03005 
03006                     dim = (d > dm) * 1 + (h > hm) * 2 + (w > wm) * 4;
03007                     elem = offsetSize[dim];
03008 
03009                     for(di = 0; di < dm; di++)
03010                     {
03011                         for(hi = 0; hi < hm; hi++)
03012                         {
03013                             for(wi = 0; wi < wm; wi++)
03014                             {
03015                                 for(channel = 0; channel < (getBpp()/getComponentSize()); channel++)
03016                                 {
03017                                     valueFloat = 0;
03018                                     for(i = 0; i < elem; i++)
03019                                     {
03020                                         valueFloat += sourceDataF32[
03021                                             ((wi * 2) + offset[dim][i].w) * (getBpp() / getComponentSize()) +
03022                                             ((hi * 2) + offset[dim][i].h) * lineSize +
03023                                             ((di * 2) + offset[dim][i].d) * sliceSize +
03024                                                         channel];
03025                                     }
03026                                     *destDataF32++ = (Real32) (valueFloat / elem);
03027                                 }
03028                             }
03029                         }
03030                     }
03031 
03032                     sourceDataF32 += sliceSize;
03033                     w = wm;
03034                     h = hm;
03035                     d = dm;
03036                 }
03037               }
03038             }
03039             break;
03040         case OSG_FLOAT16_IMAGEDATA:
03041             for(frame = 0; frame < getFrameCount(); frame++)
03042             {
03043               for(side = 0; side < getSideCount(); side++) 
03044               {
03045                 src = this->getData(0, frame,side);
03046                 dest = destImage->getData(0, frame,side);
03047                 size = getWidth() * getHeight() * getDepth() * getBpp();
03048                 memcpy(dest,src, size);
03049                 src = dest;
03050                 dest = src + size;
03051                 w = getWidth();
03052                 h = getHeight();
03053                 d = getDepth();
03054     
03055                 sourceDataH16 = (Real16*) src;
03056                 destDataH16 = (Real16*) dest;
03057     
03058                 for(mipmap = 1; mipmap < level; mipmap++)
03059                 {
03060                     lineSize = w * (getBpp() / getComponentSize());
03061                     sliceSize = w * h * (getBpp() / getComponentSize());
03062                     wm = (w == 1) ? w : (w >> 1);
03063                     hm = (h == 1) ? h : (h >> 1);
03064                     dm = (d == 1) ? d : (d >> 1);
03065     
03066                     dim = (d > dm) * 1 + (h > hm) * 2 + (w > wm) * 4;
03067                     elem = offsetSize[dim];
03068     
03069                     for(di = 0; di < dm; di++)
03070                     {
03071                         for(hi = 0; hi < hm; hi++)
03072                         {
03073                             for(wi = 0; wi < wm; wi++)
03074                             {
03075                                 for(channel = 0; channel < (getBpp()/getComponentSize()); channel++)
03076                                 {
03077                                     valueFloat = 0;
03078                                     for(i = 0; i < elem; i++)
03079                                     {
03080                                         valueFloat += sourceDataH16[
03081                                             ((wi * 2) + offset[dim][i].w) * (getBpp() / getComponentSize()) +
03082                                             ((hi * 2) + offset[dim][i].h) * lineSize +
03083                                             ((di * 2) + offset[dim][i].d) * sliceSize +
03084                                                         channel];
03085                                     }
03086                                     *destDataH16++ = (Real16) (valueFloat / elem);
03087                                 }
03088                             }
03089                         }
03090                     }
03091                     sourceDataH16 += sliceSize;
03092                     w = wm;
03093                     h = hm;
03094                     d = dm;
03095                 }
03096               }
03097             }
03098             break;
03099             
03100         case OSG_INT16_IMAGEDATA:
03101         case OSG_INT32_IMAGEDATA:
03102             {
03103                 FFATAL((" 'createMipmap' NYI\n "));
03104             }
03105             break;
03106             
03107         default:
03108             FWARNING (( "Invalid IMAGE_DATA_TYPE\n" ));
03109             break;
03110     }
03111 
03112     // rip the data from the local destImage if necessary
03113     if(destination == NullFC)
03114     {
03115         this->set(destImage);
03116         subRefCP(destImage);
03117     }
03118 
03119     return true;
03120 }

bool Image::write ( const Char8 fileName  ) 

Write the image to the a file. The mimetype will be set automatically from the fileName suffix. Returns true on success.

Definition at line 3125 of file OSGImage.cpp.

References osg::ImageFileHandler::the(), and osg::ImageFileHandler::write().

03126 {
03127     return ImageFileHandler::the().write(ImagePtr(this), fileName);
03128 }

bool Image::read ( const Char8 fileName  ) 

Read the image data from a file. Returns true on success.

Definition at line 3132 of file OSGImage.cpp.

References osg::ImageFileHandler::read(), and osg::ImageFileHandler::the().

03133 {
03134     ImagePtr iPtr(this);
03135 
03136     return ImageFileHandler::the().read(iPtr, fileName);
03137 }

UInt64 osg::Image::store ( const Char8 mimeType,
UInt8 mem,
Int32  memSize = -1 
)

UInt64 osg::Image::restore ( const UInt8 mem,
Int32  memSize = -1 
)

Image & Image::operator= ( const Image image  ) 

Assign operator. Does a copy of the given Image object.

Definition at line 3634 of file OSGImage.cpp.

References getData(), osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getFrameCount(), osg::ImageBase::getFrameDelay(), osg::ImageBase::getHeight(), osg::ImageBase::getMipMapCount(), osg::ImageBase::getPixelFormat(), osg::ImageBase::getSideCount(), and osg::ImageBase::getWidth().

03635 {
03636     this->set((PixelFormat)image.getPixelFormat(), image.getWidth(),
03637               image.getHeight(), image.getDepth(),
03638               image.getMipMapCount(), image.getFrameCount(),
03639               image.getFrameDelay(),
03640               image.getData(),
03641               image.getDataType(),
03642               true, image.getSideCount());
03643 
03644     return *this;
03645 }

bool Image::operator< ( const Image image  ) 

Less operator; compares the data sizes of the two images

Definition at line 3649 of file OSGImage.cpp.

References getSize().

03650 {
03651     return (getSize() < image.getSize()) ? true : false;
03652 }

bool Image::operator== ( const Image image  ) 

Method to compare the object to another Image instance; Checks first all parameter and afterwards the Image data;

Definition at line 3657 of file OSGImage.cpp.

References getData(), osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getFrameCount(), osg::ImageBase::getFrameDelay(), osg::ImageBase::getHeight(), osg::ImageBase::getMipMapCount(), osg::ImageBase::getPixelFormat(), osg::ImageBase::getSideCount(), getSize(), and osg::ImageBase::getWidth().

03658 {
03659     unsigned long   i, s = getSize();
03660 
03661     if((getWidth() == image.getWidth()) &&
03662        (getHeight() == image.getHeight()) &&
03663        (getDepth() == image.getDepth()) &&
03664        (getMipMapCount() == image.getMipMapCount()) &&
03665        (getFrameCount() == image.getFrameCount()) &&
03666        (getFrameDelay() == image.getFrameDelay()) &&
03667        (getPixelFormat() == image.getPixelFormat()) &&
03668        (getDataType() == image.getDataType()) &&
03669        (getSideCount() == image.getSideCount()))
03670     {
03671         for(i = 0; i < s; ++i)
03672         {
03673             if(image.getData()[i] != getData()[i])
03674                 return false;
03675         }
03676         return true;
03677     }
03678     return false;
03679 }

bool Image::operator!= ( const Image image  ) 

Method to compare the object to another Image instance; Checks first all parameter and afterwards the Image data;

Definition at line 3684 of file OSGImage.cpp.

03685 {
03686   return !(*this == image);
03687 }

bool osg::Image::isValid ( void   )  const [inline]

Definition at line 45 of file OSGImage.inl.

References osg::MField< FieldTypeT, fieldNameSpace >::empty(), and osg::ImageBase::getPixel().

00046 {
00047     return !getPixel().empty();
00048 }

bool Image::hasAlphaChannel ( void   ) 

bool Image::isAlphaBinary ( void   ) 

Method to check, whether the alpha channel is just fully transparent/ fully opaque

Definition at line 3235 of file OSGImage.cpp.

References osg::ImageBase::getForceAlphaBinary(), osg::ImageBase::getPixelFormat(), and OSG_RGBA_DXT1.

03236 {
03237     return 
03238         getForceAlphaBinary()
03239         || getPixelFormat() == OSG_RGBA_DXT1;
03240 }

bool Image::hasColorChannel ( void   ) 

Method to check, whether the object data defines a color channel or not

Definition at line 3257 of file OSGImage.cpp.

References osg::ImageBase::getForceColorChannel(), osg::ImageBase::getPixelFormat(), OSG_A_PF, OSG_ALPHA_INTEGER_PF, OSG_I_PF, OSG_L_PF, OSG_LA_PF, and OSG_LUMINANCE_ALPHA_INTEGER_PF.

03258 {
03259     return !( getPixelFormat() == OSG_A_PF ||
03260               getPixelFormat() == OSG_I_PF ||
03261               getPixelFormat() == OSG_L_PF ||
03262               getPixelFormat() == OSG_LA_PF ||
03263               getPixelFormat() == OSG_ALPHA_INTEGER_PF ||
03264               getPixelFormat() == OSG_LUMINANCE_ALPHA_INTEGER_PF)
03265            || getForceColorChannel();
03266 }

bool Image::hasCompressedData ( void   ) 

Method to check, whether the data is compressed

Definition at line 3244 of file OSGImage.cpp.

References osg::ImageBase::getForceCompressedData(), osg::ImageBase::getPixelFormat(), OSG_RGB_DXT1, OSG_RGBA_DXT1, OSG_RGBA_DXT3, and OSG_RGBA_DXT5.

Referenced by addValue(), convertDataTypeTo(), createMipmap(), reformat(), scale(), setSubData(), slice(), and subImage().

03245 {
03246   return 
03247      getForceCompressedData()           ||
03248     (getPixelFormat() == OSG_RGB_DXT1)  ||
03249     (getPixelFormat() == OSG_RGBA_DXT1) ||
03250     (getPixelFormat() == OSG_RGBA_DXT3) ||
03251     (getPixelFormat() == OSG_RGBA_DXT5);
03252     
03253 }

UInt8 Image::getComponents ( void   )  const

Definition at line 262 of file OSGImage.cpp.

References _formatDic, FWARNING, and osg::ImageBase::getPixelFormat().

00263 {
00264     Int32 mapSizeFormat = sizeof(_formatDic) / sizeof(UInt32[2]);
00265 
00266     for(UInt16 i = 0; i < mapSizeFormat; i++)
00267     {
00268         if(_formatDic[i][0] == getPixelFormat())
00269             return _formatDic[i][1];
00270     }
00271     FWARNING(("Image::getComponents: image %p has unknown pixel format 0x%x!",
00272                 this, getPixelFormat()));
00273     return 0;
00274 }

bool Image::calcIsAlphaBinary ( void   ) 

Check all the alpha values to see if they're 0 or 1, return true if they are, false if no alpha or intermediate values. No Alpha channel is considered 0.

Definition at line 3281 of file OSGImage.cpp.

References FFATAL, FWARNING, osg::ImageBase::getBpp(), osg::ImageBase::getComponentSize(), getData(), osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getFrameCount(), osg::ImageBase::getHeight(), osg::ImageBase::getPixelFormat(), osg::ImageBase::getWidth(), hasAlphaChannel(), OSG_BGRA_PF, OSG_FLOAT16_IMAGEDATA, OSG_FLOAT32_IMAGEDATA, OSG_INT16_IMAGEDATA, OSG_INT32_IMAGEDATA, OSG_LA_PF, OSG_RGBA_DXT1, OSG_RGBA_DXT3, OSG_RGBA_DXT5, OSG_RGBA_PF, OSG_UINT16_IMAGEDATA, OSG_UINT32_IMAGEDATA, and OSG_UINT8_IMAGEDATA.

03282 {
03283     if(!hasAlphaChannel() || getPixelFormat() == OSG_RGBA_DXT1)
03284         return true;
03285     
03286     if(getPixelFormat() == OSG_RGBA_DXT3 || getPixelFormat() == OSG_RGBA_DXT5)
03287     {
03288         FWARNING(("Image::calcIsAlphaBinary: not implemenetd for DXT3 "
03289                   "and DXT5 yet, assuming false.\n"));
03290         return false;
03291     }
03292     
03293     UInt32 npix = getWidth() * getHeight() * getDepth() * getFrameCount();
03294     UInt8 pixelsize = getBpp();
03295     
03296     UInt8 *data = getData();
03297     
03298     switch(getPixelFormat())
03299     {
03300     case OSG_LA_PF:     data += getComponentSize(); break;
03301     case OSG_BGRA_PF:
03302     case OSG_RGBA_PF:   data += getComponentSize() * 3; break;
03303     default:
03304                         FWARNING(("Image::calcIsAlphaBinary: found unknown "
03305                                   "image format %x, assumning false.\n", 
03306                                   getPixelFormat()));
03307                         return false;
03308     }
03309     
03310     switch(getDataType())
03311     {
03312     case OSG_UINT8_IMAGEDATA:
03313                         for(; npix > 0; --npix, data += pixelsize)
03314                         {
03315                             if(*data != 0 && *data != 0xffU)
03316                                 break;
03317                         }
03318                         break;
03319     case OSG_UINT16_IMAGEDATA:
03320                         for(; npix > 0; --npix, data += pixelsize)
03321                         {
03322                             UInt16 *d = reinterpret_cast<UInt16*>(data);
03323                             if(*d != 0 && *d != 0xffffU)
03324                                 break;
03325                         }
03326                         break;
03327     case OSG_UINT32_IMAGEDATA:
03328                         for(; npix > 0; --npix, data += pixelsize)
03329                         {
03330                             UInt32 *d = reinterpret_cast<UInt32*>(data);
03331                             if(*d != 0 && *d != 0xffffffffU)
03332                                 break;
03333                         }
03334                         break;
03335     case OSG_FLOAT16_IMAGEDATA:
03336                         for(; npix > 0; --npix, data += pixelsize)
03337                         {
03338                             Real16 *d = reinterpret_cast<Real16*>(data);
03339                             if(*d != 0 && *d != 1)
03340                                 break;
03341                         }
03342                         break;
03343     case OSG_FLOAT32_IMAGEDATA:
03344                         for(; npix > 0; --npix, data += pixelsize)
03345                         {
03346                             Real32 *d = reinterpret_cast<Real32*>(data);
03347                             if(*d != 0 && *d != 1)
03348                                 break;
03349                         }
03350                         break;
03351     case OSG_INT16_IMAGEDATA:
03352     case OSG_INT32_IMAGEDATA:
03353         {
03354             FFATAL((" 'calcIsAlphaBinary' NYI\n "));
03355         }
03356         break;
03357     default:
03358                         FWARNING(("Image::calcIsAlphaBinary: found unknown "
03359                                   "data type %d, assumning false.\n", 
03360                                   getDataType()));
03361                         return false;
03362     }
03363     
03364     return npix == 0;
03365 }

unsigned long osg::Image::getSize ( bool  withMipmap = true,
bool  withFrames = true,
bool  withSides = true 
) const [inline]

returns the data size in bytes.

Definition at line 52 of file OSGImage.inl.

References calcMipmapSumSize(), osg::ImageBase::getFrameCount(), osg::ImageBase::getMipMapCount(), and osg::ImageBase::getSideCount().

Referenced by clear(), clearFloat(), clearHalf(), convertDataTypeTo(), createData(), dump(), operator<(), operator==(), reformat(), and swapDataEndian().

00055 { 
00056     return  ( calcMipmapSumSize((withMipmap ? getMipMapCount() : 1)) *
00057               (withSides  ? getSideCount() : 1) *
00058               (withFrames ? getFrameCount() : 1) ); 
00059 }

const UInt8 * osg::Image::getData ( UInt32  mipmapNum = 0,
UInt32  frameNum = 0,
UInt32  sideNum = 0 
) const [inline]

returns a data pointer for a single frame/mipmap chunk

Definition at line 84 of file OSGImage.inl.

References calcMipmapSumSize(), osg::ImageBase::getFrameSize(), osg::ImageBase::getPixel(), and osg::ImageBase::getSideSize().

Referenced by addValue(), calcIsAlphaBinary(), clear(), clearFloat(), clearHalf(), convertDataTypeTo(), createData(), createMipmap(), getDataByTime(), operator=(), operator==(), reformat(), setSubData(), slice(), subImage(), and swapDataEndian().

00087 {
00088     if(getPixel().empty())
00089         return NULL;
00090 
00091     const UInt8 *data = (&getPixel()[0]) + 
00092       (sideNum * getSideSize()) +
00093       (frameNum * getFrameSize());
00094     
00095     if (mipmapNum)
00096     {
00097         data += calcMipmapSumSize(mipmapNum);
00098     }
00099   
00100     return data;
00101 }

UInt8 * osg::Image::getData ( UInt32  mipmapNum = 0,
UInt32  frameNum = 0,
UInt32  sideNum = 0 
) [inline]

returns a data pointer for a single frame/mipmap chunk

Definition at line 63 of file OSGImage.inl.

References calcMipmapSumSize(), osg::ImageBase::getFrameSize(), osg::ImageBase::getPixel(), and osg::ImageBase::getSideSize().

00066 {
00067     if(getPixel().empty())
00068         return NULL;
00069 
00070     UInt8 *data = (&getPixel()[0]) + 
00071       (sideNum * getSideSize()) +
00072       (frameNum * getFrameSize());
00073     
00074     if (mipmapNum)
00075     {
00076         data += calcMipmapSumSize(mipmapNum);
00077     }
00078   
00079     return data;
00080 }

UInt8 * Image::getDataByTime ( Time  time,
UInt32  mipmapNum = 1 
)

Method returns the right frame data for the given time.

Definition at line 3270 of file OSGImage.cpp.

References calcFrameNum(), and getData().

03271 {
03272     UInt32 frameNum = calcFrameNum(time, true);
03273 
03274     return getData(0, frameNum);
03275 }

void Image::calcMipmapGeometry ( UInt32  mipmapNum,
UInt32 width,
UInt32 height,
UInt32 depth 
) const

Internal used method to calculate the next mipmap geo for the given level

Definition at line 3379 of file OSGImage.cpp.

References osg::ImageBase::getDepth(), osg::ImageBase::getHeight(), osg::ImageBase::getWidth(), and osg::osgMax().

Referenced by calcMipmapLevelSize().

03383 {
03384   width  = getWidth()  ? osgMax(getWidth()  >> mipmapNum, 1) : 0 ;
03385   height = getHeight() ? osgMax(getHeight() >> mipmapNum, 1) : 0 ;
03386   depth  = getDepth()  ? osgMax(getDepth()  >> mipmapNum, 1) : 0 ;
03387 }

UInt32 Image::calcMipmapLevelCount ( void   )  const

Internal used method to calculate the number of mipmaps levels

Definition at line 3395 of file OSGImage.cpp.

References osg::ImageBase::getDepth(), osg::ImageBase::getHeight(), and osg::ImageBase::getWidth().

Referenced by createMipmap().

03396 {
03397   UInt32  w = getWidth(), h = getHeight(), d = getDepth();
03398   UInt32 level;
03399 
03400   for (level = 1; true; level++)
03401     {
03402       if ((w == 1) && (h == 1) && (d == 1))
03403         break;
03404       else
03405         {
03406           w = (w >>= 1) ? w : 1;
03407           h = (h >>= 1) ? h : 1;
03408           d = (d >>= 1) ? d : 1;
03409         }
03410     }
03411   return level;
03412 }

UInt32 Image::calcFrameNum ( Time  time,
bool  loop = true 
) const

Method which returns the frame number for the given time

Definition at line 3369 of file OSGImage.cpp.

References osg::ImageBase::getFrameCount(), and osg::ImageBase::getFrameDelay().

Referenced by getDataByTime().

03370 {
03371   UInt64 frameNum = ((getFrameDelay() > 0) && (getFrameCount() > 0)) ?
03372         (UInt64(time / getFrameDelay()) % getFrameCount()) : 0;
03373     
03374     return ((frameNum > 0) ? UInt32(frameNum) : 0);
03375 }

void Image::clear ( UChar8  pixelValue = 0  )  [virtual]

It just fills the hole image data with the given pixel value. It is mainly used to initialize the image data.

Definition at line 2320 of file OSGImage.cpp.

References getData(), and getSize().

02321 {
02322     memset(getData(),pixelValue,getSize());
02323 }

void Image::clearFloat ( Real32  pixelValue = 0.0  )  [virtual]

It just fills the hole image data with the given pixel value. It is mainly used to initialize the image data.

Definition at line 2325 of file OSGImage.cpp.

References osg::ImageBase::getComponentSize(), getData(), and getSize().

02326 {
02327     unsigned long   n = getSize()/getComponentSize();
02328     Real32       *d = (Real32*) getData();
02329 
02330     if(n && d)
02331         while(n--)
02332             *d++ = pixelValue;
02333 }

void Image::clearHalf ( Real16  pixelValue = Real16( 0.0 )  )  [virtual]

It just fills the hole image data with the given pixel value. It is mainly used to initialize the image data.

Definition at line 2335 of file OSGImage.cpp.

References osg::ImageBase::getComponentSize(), getData(), and getSize().

02336 {
02337     unsigned long   n = getSize()/getComponentSize();
02338     Real16       *d = (Real16*) getData();
02339 
02340     if(n && d)
02341         while(n--)
02342             *d++ = pixelValue;
02343 }

bool Image::hasAttachment ( void   )  const

returns true if the image has any attachments

Definition at line 2350 of file OSGImage.cpp.

References osg::FCPtr< BasePtrTypeT, FieldContainerTypeT >::dcast(), osg::DynFieldAttachment< AttachmentDescT >::getClassType(), osg::FieldContainerType::getGroupId(), and osg::NullFC.

02351 {
02352     Image *img=const_cast<Image*>(this);
02353     ImageGenericAttPtr att=ImageGenericAttPtr::dcast(
02354         img->Inherited::findAttachment(
02355             ImageGenericAtt::getClassType().getGroupId()));
02356     if(att != NullFC && att->getType().getNumFieldDescs() > 1)
02357         return true;
02358     else
02359         return false;
02360 }

UInt32 Image::attachmentCount ( void   )  const

returns the number of attachments

Definition at line 2364 of file OSGImage.cpp.

References osg::FCPtr< BasePtrTypeT, FieldContainerTypeT >::dcast(), osg::DynFieldAttachment< AttachmentDescT >::getClassType(), osg::FieldContainerType::getGroupId(), and osg::NullFC.

02365 {
02366     Image *img=const_cast<Image*>(this);
02367     ImageGenericAttPtr att=ImageGenericAttPtr::dcast(
02368         img->Inherited::findAttachment(
02369             ImageGenericAtt::getClassType().getGroupId()));
02370     if(att != NullFC)
02371         return att->getType().getNumFieldDescs() -1;
02372     else
02373         return 0;
02374 }

void Image::setAttachmentField ( const std::string &  key,
const std::string &  data 
)

set a single string attachment for the given key/data pair

Definition at line 2378 of file OSGImage.cpp.

References osg::AttachmentContainer::addAttachment(), osg::DynFieldAttachment< AttachmentDescT >::create(), osg::FCPtr< BasePtrTypeT, FieldContainerTypeT >::dcast(), osg::AttachmentContainer::findAttachment(), osg::SField< FieldTypeT, fieldNameSpace >::getClassType(), osg::DynFieldAttachment< AttachmentDescT >::getClassType(), osg::DynFieldAttachment< AttachmentDescT >::getDynamicField(), osg::FieldContainer::getGroupId(), osg::NullFC, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

02380 {
02381     ImageGenericAttPtr att=ImageGenericAttPtr::dcast(
02382         findAttachment(
02383             ImageGenericAtt::getClassType().getGroupId()));
02384     if(att==NullFC)
02385     {
02386         att=ImageGenericAtt::create();
02387         addAttachment(att);
02388     }
02389     Field *field=att->getField(key.c_str());
02390     if(field == NULL)
02391     {
02392         FieldDescription desc(
02393             SFString::getClassType(),
02394             key.c_str(),
02395             0, 0,
02396             true,
02397             (FieldIndexAccessMethod) &ImageGenericAtt::getDynamicField);
02398 
02399         UInt32 fieldId = att->addField(desc);
02400         field=att->getField(fieldId);
02401     }
02402     SFString *strField=dynamic_cast<SFString*>(field);
02403     if(strField)
02404         strField->setValue(data);
02405 }

const std::string * Image::findAttachmentField ( const std::string &  key  )  const

returns the string attachment for the given key or Null

Definition at line 2409 of file OSGImage.cpp.

References osg::FCPtr< BasePtrTypeT, FieldContainerTypeT >::dcast(), osg::AttachmentContainer::findAttachment(), osg::DynFieldAttachment< AttachmentDescT >::getClassType(), osg::FieldContainerType::getGroupId(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), and osg::NullFC.

02410 {
02411     Image *img=const_cast<Image*>(this);
02412     ImageGenericAttPtr att=ImageGenericAttPtr::dcast(
02413         img->findAttachment(
02414             ImageGenericAtt::getClassType().getGroupId()));
02415     if(att!=NullFC)
02416     {
02417         Field *field=att->getField(key.c_str());
02418         if(field != NULL)
02419         {
02420             SFString *strField=dynamic_cast<SFString*>(field);
02421             if(strField != NULL)
02422                 return &strField->getValue();
02423         }
02424     }
02425     return NULL;
02426 }

UInt32 Image::calcMipmapLevelSize ( UInt32  mipmapNum,
UInt32  w,
UInt32  h,
UInt32  d 
) const

Method to calculate the mem sum of a mipmap level in byte

Definition at line 3424 of file OSGImage.cpp.

References osg::ImageBase::getBpp(), osg::ImageBase::getPixelFormat(), OSG_RGB_DXT1, OSG_RGBA_DXT1, OSG_RGBA_DXT3, and OSG_RGBA_DXT5.

Referenced by calcMipmapLevelSize(), and calcMipmapSumSize().

03426 {
03427     Int32 sum;
03428 
03429     switch (getPixelFormat()) 
03430     {
03431     case OSG_RGB_DXT1:
03432     case OSG_RGBA_DXT1:
03433         sum = (((w?w:1)+3)/4) * (((h?h:1)+3)/4) * 8;
03434         break;
03435     case OSG_RGBA_DXT3:
03436     case OSG_RGBA_DXT5:
03437         sum = (((w?w:1)+3)/4) * (((h?h:1)+3)/4) * 16;
03438         break;
03439     default:
03440         sum = (w?w:1) * (h?h:1) * getBpp();
03441         break;
03442     }
03443 
03444     sum *= (d?d:1);
03445 
03446     return sum;
03447 }

UInt32 Image::calcMipmapLevelSize ( UInt32  mipmapNum  )  const

MethMethod to calculate the mem of one mipmap level in byte for the current Image paramter

Definition at line 3452 of file OSGImage.cpp.

References calcMipmapGeometry(), and calcMipmapLevelSize().

03453 {
03454     UInt32 w, h, d;
03455     calcMipmapGeometry(mipmapNum, w, h, d);
03456     return calcMipmapLevelSize(mipmapNum, w, h, d);
03457 }

UInt32 Image::calcMipmapSumSize ( UInt32  mipmapNum,
UInt32  w,
UInt32  h,
UInt32  d 
) const

Method to calculate the mem sum of all mipmap levels in byte

Definition at line 3461 of file OSGImage.cpp.

References calcMipmapLevelSize().

Referenced by calcMipmapSumSize(), changed(), createData(), getData(), getSize(), and scale().

03463 {
03464     Int32 levelSum, sum = 0;
03465 
03466     if (w && h && d)
03467     { 
03468         while (mipmapNum--)
03469         {
03470             sum += calcMipmapLevelSize(mipmapNum,w,h,d);
03471       
03472             w >>= 1;
03473             h >>= 1;
03474             d >>= 1;
03475         }
03476     }
03477 
03478     return sum;
03479 }

UInt32 Image::calcMipmapSumSize ( UInt32  mipmapNum  )  const

Method to calculate the mem sum of all mipmap levels in byte for the current Image paramter

Definition at line 3484 of file OSGImage.cpp.

References calcMipmapSumSize(), osg::ImageBase::getDepth(), osg::ImageBase::getHeight(), and osg::ImageBase::getWidth().

03485 {
03486     return calcMipmapSumSize(mipmapNum,getWidth(),getHeight(),getDepth());
03487 }

bool Image::createData ( const UInt8 data,
bool  allocMem = true 
) [private]

Internal method to set the data and update related properties.

Definition at line 3494 of file OSGImage.cpp.

References _formatDic, _typeDic, osg::beginEditCP(), osg::ImageBase::BppFieldMask, calcMipmapSumSize(), osg::MField< FieldTypeT, fieldNameSpace >::clear(), osg::ImageBase::ComponentSizeFieldMask, osg::ImageBase::DimensionFieldMask, osg::endEditCP(), FFATAL, osg::ImageBase::FrameSizeFieldMask, getData(), osg::ImageBase::getDataType(), osg::ImageBase::getDepth(), osg::ImageBase::getHeight(), osg::ImageBase::getMipMapCount(), osg::ImageBase::getPixel(), osg::ImageBase::getPixelFormat(), osg::ImageBase::getSideCount(), osg::ImageBase::getSideSize(), getSize(), osg::ImageBase::PixelFieldMask, osg::MField< FieldTypeT, fieldNameSpace >::resize(), osg::ImageBase::setBpp(), osg::ImageBase::setComponentSize(), osg::ImageBase::setDimension(), osg::ImageBase::setFrameSize(), osg::ImageBase::setSideSize(), and osg::MField< FieldTypeT, fieldNameSpace >::swap().

03495 {
03496     Int32 i;
03497     Int32 mapSizeFormat = sizeof(_formatDic) / sizeof(UInt32[2]);
03498     Int32 mapSizeType = sizeof(_typeDic) / sizeof(UInt32[2]);
03499 
03500     UInt32 byteCount = 0;
03501     ImagePtr iPtr(this);
03502 
03503     beginEditCP(iPtr,
03504                 BppFieldMask           |
03505                 DimensionFieldMask     |
03506                 FrameSizeFieldMask     |
03507                 ComponentSizeFieldMask |
03508                 PixelFieldMask);
03509 
03510     // set bpp
03511     UInt32 pixelFormat = 0;
03512     UInt32 typeFormat  = 0;
03513     for(i = 0; i < mapSizeFormat; i++)
03514     {
03515         if(_formatDic[i][0] == getPixelFormat())
03516             pixelFormat = _formatDic[i][1];
03517     }
03518     for(i = 0; i < mapSizeType; i++)
03519     {
03520         if(_typeDic[i][0] == getDataType())
03521             typeFormat = _typeDic[i][1];
03522     }
03523 
03524     setComponentSize( typeFormat );
03525     setBpp( pixelFormat * typeFormat );
03526 
03527     // set dimension
03528     setDimension(0);
03529     if(getDepth() == 1)
03530     {
03531         if(getHeight() == 1)
03532         {
03533             setDimension(1);
03534         }
03535         else
03536         {
03537             setDimension(2);
03538         }
03539     }
03540     else
03541         setDimension(3);
03542 
03543     // set sideSize
03544     UInt32 mipmapSumSize = calcMipmapSumSize(getMipMapCount());
03545     setSideSize ( mipmapSumSize );
03546 
03547     // set frameSize
03548     setFrameSize( getSideSize() * getSideCount() );
03549 
03550     // copy the data
03551     if(allocMem && (byteCount = getSize()))
03552     {
03553         if(getPixel().getSize() != byteCount)
03554         {
03555             try
03556             {
03557                 if(byteCount < getPixel().getSize())
03558                 {
03559                     getPixel().clear();
03560                     // free unused memory.
03561                     MFUInt8 tmp;
03562                     tmp.swap(getPixel());
03563                 }
03564 
03565                 getPixel().resize(byteCount);
03566             }
03567             catch(...)
03568             {
03569                 FFATAL(("Image::createData : Couldn't allocate %u bytes!\n", byteCount));
03570                 return false;
03571             }
03572         }
03573         if(data)
03574             memcpy(getData(), data, byteCount);
03575     }
03576     else
03577     {
03578         getPixel().clear();
03579     }
03580 
03581     endEditCP(iPtr,
03582               BppFieldMask           |
03583               DimensionFieldMask     |
03584               FrameSizeFieldMask     |
03585               ComponentSizeFieldMask |
03586               PixelFieldMask);
03587 
03588     return (getData() != NULL);
03589 }

bool Image::scaleData ( UInt8 srcData,
Int32  srcW,
Int32  srcH,
Int32  srcD,
UInt8 destData,
Int32  destW,
Int32  destH,
Int32  destD 
) [private]

Internal method to scale image data blocks

Definition at line 3593 of file OSGImage.cpp.

References osg::ImageBase::getBpp(), p, and slice().

Referenced by scale().

03595 {
03596     Real32  sx = Real32(srcW) / Real32(destW);
03597     Real32  sy = Real32(srcH) / Real32(destH);
03598     Real32  sz = Real32(srcD) / Real32(destD);
03599     Int32   srcSize = srcW * srcH * srcD * getBpp();
03600 
03601     //  Int32 destDize = destW * destH * destD;
03602     Int32   x, y, z, p;
03603     UInt8  *slice, *line, *pixel;
03604 
03605     if(destW == srcW && destH == srcH && destD == srcD)
03606     {
03607         // same size, just copy
03608         memcpy(destData, srcData, srcSize);
03609     }
03610     else
03611     {       // different size, to 'nearest' copy
03612         for(z = 0; z < destD; z++)
03613         {
03614             slice = srcData + int(sz * z) * getBpp() * srcW * srcH;
03615             for(y = 0; y < destH; y++)
03616             {
03617                 line = slice + int(sy * y) * getBpp() * srcW;
03618                 for(x = 0; x < destW; x++)
03619                 {
03620                     pixel = line + int(sx * x) * getBpp();
03621                     p = getBpp();
03622                     while(p--)
03623                         *destData++ = *pixel++;
03624                 }
03625             }
03626         }
03627     }
03628 
03629     return true;
03630 }

void Image::initMethod ( void   )  [static, private]

Definition at line 111 of file OSGImage.cpp.

00112 {
00113 }

osg::FieldContainerType & osg::ImageBase::getClassType ( void   )  [inline, static, inherited]

Reimplemented from osg::AttachmentContainer.

Definition at line 58 of file OSGImageBase.inl.

References osg::ImageBase::_type.

Referenced by osg::ImageBase::create().

00059 {
00060     return _type; 
00061 } 

osg::UInt32 osg::ImageBase::getClassTypeId ( void   )  [inline, static, inherited]

Reimplemented from osg::AttachmentContainer.

Definition at line 65 of file OSGImageBase.inl.

References osg::ImageBase::_type, and osg::TypeBase::getId().

00066 {
00067     return _type.getId(); 
00068 } 

FieldContainerType & osg::ImageBase::getType ( void   )  [virtual, inherited]

Reimplemented from osg::AttachmentContainer.

Definition at line 360 of file OSGImageBase.cpp.

References osg::ImageBase::_type.

00361 {
00362     return _type; 
00363 } 

const FieldContainerType & osg::ImageBase::getType ( void   )  const [virtual, inherited]

Reimplemented from osg::AttachmentContainer.

Definition at line 365 of file OSGImageBase.cpp.

References osg::ImageBase::_type.

00366 {
00367     return _type;
00368 } 

UInt32 osg::ImageBase::getContainerSize ( void   )  const [virtual, inherited]

Reimplemented from osg::AttachmentContainer.

Definition at line 380 of file OSGImageBase.cpp.

00381 { 
00382     return sizeof(Image); 
00383 }

MFFieldContainerPtr * osg::ImageBase::getMFParents ( void   )  [inline, inherited]

Definition at line 101 of file OSGImageBase.inl.

References osg::ImageBase::_mfParents.

00102 {
00103     return &_mfParents;
00104 }

SFInt32 * osg::ImageBase::getSFDimension ( void   )  [inline, inherited]

Definition at line 108 of file OSGImageBase.inl.

References osg::ImageBase::_sfDimension.

00109 {
00110     return &_sfDimension;
00111 }

SFInt32 * osg::ImageBase::getSFWidth ( void   )  [inline, inherited]

Definition at line 115 of file OSGImageBase.inl.

References osg::ImageBase::_sfWidth.

00116 {
00117     return &_sfWidth;
00118 }

SFInt32 * osg::ImageBase::getSFHeight ( void   )  [inline, inherited]

Definition at line 122 of file OSGImageBase.inl.

References osg::ImageBase::_sfHeight.

00123 {
00124     return &_sfHeight;
00125 }

SFInt32 * osg::ImageBase::getSFDepth ( void   )  [inline, inherited]

Definition at line 129 of file OSGImageBase.inl.

References osg::ImageBase::_sfDepth.

00130 {
00131     return &_sfDepth;
00132 }

SFInt32 * osg::ImageBase::getSFBpp ( void   )  [inline, inherited]

Definition at line 136 of file OSGImageBase.inl.

References osg::ImageBase::_sfBpp.

00137 {
00138     return &_sfBpp;
00139 }

SFInt32 * osg::ImageBase::getSFMipMapCount ( void   )  [inline, inherited]

Definition at line 143 of file OSGImageBase.inl.

References osg::ImageBase::_sfMipMapCount.

00144 {
00145     return &_sfMipMapCount;
00146 }

SFInt32 * osg::ImageBase::getSFFrameCount ( void   )  [inline, inherited]

Definition at line 150 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameCount.

00151 {
00152     return &_sfFrameCount;
00153 }

SFTime * osg::ImageBase::getSFFrameDelay ( void   )  [inline, inherited]

Definition at line 157 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameDelay.

00158 {
00159     return &_sfFrameDelay;
00160 }

SFUInt32 * osg::ImageBase::getSFPixelFormat ( void   )  [inline, inherited]

Definition at line 164 of file OSGImageBase.inl.

References osg::ImageBase::_sfPixelFormat.

00165 {
00166     return &_sfPixelFormat;
00167 }

MFUInt8 * osg::ImageBase::getMFPixel ( void   )  [inline, inherited]

Definition at line 171 of file OSGImageBase.inl.

References osg::ImageBase::_mfPixel.

00172 {
00173     return &_mfPixel;
00174 }

SFInt32 * osg::ImageBase::getSFFrameSize ( void   )  [inline, inherited]

Definition at line 178 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameSize.

00179 {
00180     return &_sfFrameSize;
00181 }

SFString * osg::ImageBase::getSFName ( void   )  [inline, inherited]

Definition at line 185 of file OSGImageBase.inl.

References osg::ImageBase::_sfName.

00186 {
00187     return &_sfName;
00188 }

SFInt32 * osg::ImageBase::getSFDataType ( void   )  [inline, inherited]

Definition at line 192 of file OSGImageBase.inl.

References osg::ImageBase::_sfDataType.

00193 {
00194     return &_sfDataType;
00195 }

SFInt32 * osg::ImageBase::getSFSideCount ( void   )  [inline, inherited]

Definition at line 206 of file OSGImageBase.inl.

References osg::ImageBase::_sfSideCount.

00207 {
00208     return &_sfSideCount;
00209 }

SFInt32 * osg::ImageBase::getSFSideSize ( void   )  [inline, inherited]

Definition at line 213 of file OSGImageBase.inl.

References osg::ImageBase::_sfSideSize.

00214 {
00215     return &_sfSideSize;
00216 }

SFBool * osg::ImageBase::getSFForceCompressedData ( void   )  [inline, inherited]

Definition at line 220 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceCompressedData.

00221 {
00222     return &_sfForceCompressedData;
00223 }

SFBool * osg::ImageBase::getSFForceAlphaChannel ( void   )  [inline, inherited]

Definition at line 227 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceAlphaChannel.

00228 {
00229     return &_sfForceAlphaChannel;
00230 }

SFBool * osg::ImageBase::getSFForceColorChannel ( void   )  [inline, inherited]

Definition at line 234 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceColorChannel.

00235 {
00236     return &_sfForceColorChannel;
00237 }

SFBool * osg::ImageBase::getSFForceAlphaBinary ( void   )  [inline, inherited]

Definition at line 241 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceAlphaBinary.

00242 {
00243     return &_sfForceAlphaBinary;
00244 }

SFReal32 * osg::ImageBase::getSFResX ( void   )  [inline, inherited]

Definition at line 248 of file OSGImageBase.inl.

References osg::ImageBase::_sfResX.

00249 {
00250     return &_sfResX;
00251 }

SFReal32 * osg::ImageBase::getSFResY ( void   )  [inline, inherited]

Definition at line 255 of file OSGImageBase.inl.

References osg::ImageBase::_sfResY.

00256 {
00257     return &_sfResY;
00258 }

SFUInt16 * osg::ImageBase::getSFResUnit ( void   )  [inline, inherited]

Definition at line 262 of file OSGImageBase.inl.

References osg::ImageBase::_sfResUnit.

00263 {
00264     return &_sfResUnit;
00265 }

Int32 & osg::ImageBase::getDimension ( void   )  [inline, inherited]

Definition at line 270 of file OSGImageBase.inl.

References osg::ImageBase::_sfDimension, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00271 {
00272     return _sfDimension.getValue();
00273 }

const Int32 & osg::ImageBase::getDimension ( void   )  const [inline, inherited]

Definition at line 277 of file OSGImageBase.inl.

References osg::ImageBase::_sfDimension, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00278 {
00279     return _sfDimension.getValue();
00280 }

Int32 & osg::ImageBase::getWidth ( void   )  [inline, inherited]

const Int32 & osg::ImageBase::getWidth ( void   )  const [inline, inherited]

Definition at line 298 of file OSGImageBase.inl.

References osg::ImageBase::_sfWidth, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00299 {
00300     return _sfWidth.getValue();
00301 }

Int32 & osg::ImageBase::getHeight ( void   )  [inline, inherited]

const Int32 & osg::ImageBase::getHeight ( void   )  const [inline, inherited]

Definition at line 319 of file OSGImageBase.inl.

References osg::ImageBase::_sfHeight, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00320 {
00321     return _sfHeight.getValue();
00322 }

Int32 & osg::ImageBase::getDepth ( void   )  [inline, inherited]

const Int32 & osg::ImageBase::getDepth ( void   )  const [inline, inherited]

Definition at line 340 of file OSGImageBase.inl.

References osg::ImageBase::_sfDepth, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00341 {
00342     return _sfDepth.getValue();
00343 }

Int32 & osg::ImageBase::getBpp ( void   )  [inline, inherited]

const Int32 & osg::ImageBase::getBpp ( void   )  const [inline, inherited]

Definition at line 361 of file OSGImageBase.inl.

References osg::ImageBase::_sfBpp, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00362 {
00363     return _sfBpp.getValue();
00364 }

Int32 & osg::ImageBase::getMipMapCount ( void   )  [inline, inherited]

const Int32 & osg::ImageBase::getMipMapCount ( void   )  const [inline, inherited]

Definition at line 382 of file OSGImageBase.inl.

References osg::ImageBase::_sfMipMapCount, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00383 {
00384     return _sfMipMapCount.getValue();
00385 }

Int32 & osg::ImageBase::getFrameCount ( void   )  [inline, inherited]

const Int32 & osg::ImageBase::getFrameCount ( void   )  const [inline, inherited]

Definition at line 403 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameCount, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00404 {
00405     return _sfFrameCount.getValue();
00406 }

Time & osg::ImageBase::getFrameDelay ( void   )  [inline, inherited]

Definition at line 417 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameDelay, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by calcFrameNum(), createMipmap(), dump(), operator=(), operator==(), and scale().

00418 {
00419     return _sfFrameDelay.getValue();
00420 }

const Time & osg::ImageBase::getFrameDelay ( void   )  const [inline, inherited]

Definition at line 424 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameDelay, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00425 {
00426     return _sfFrameDelay.getValue();
00427 }

UInt32 & osg::ImageBase::getPixelFormat ( void   )  [inline, inherited]

const UInt32 & osg::ImageBase::getPixelFormat ( void   )  const [inline, inherited]

Definition at line 445 of file OSGImageBase.inl.

References osg::ImageBase::_sfPixelFormat, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00446 {
00447     return _sfPixelFormat.getValue();
00448 }

Int32 & osg::ImageBase::getFrameSize ( void   )  [inline, inherited]

Definition at line 459 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameSize, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by getData(), and scale().

00460 {
00461     return _sfFrameSize.getValue();
00462 }

const Int32 & osg::ImageBase::getFrameSize ( void   )  const [inline, inherited]

Definition at line 466 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameSize, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00467 {
00468     return _sfFrameSize.getValue();
00469 }

std::string & osg::ImageBase::getName ( void   )  [inline, inherited]

Definition at line 480 of file OSGImageBase.inl.

References osg::ImageBase::_sfName, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00481 {
00482     return _sfName.getValue();
00483 }

const std::string & osg::ImageBase::getName ( void   )  const [inline, inherited]

Definition at line 487 of file OSGImageBase.inl.

References osg::ImageBase::_sfName, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00488 {
00489     return _sfName.getValue();
00490 }

Int32 & osg::ImageBase::getDataType ( void   )  [inline, inherited]

const Int32 & osg::ImageBase::getDataType ( void   )  const [inline, inherited]

Definition at line 508 of file OSGImageBase.inl.

References osg::ImageBase::_sfDataType, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00509 {
00510     return _sfDataType.getValue();
00511 }

Int32 & osg::ImageBase::getSideCount ( void   )  [inline, inherited]

const Int32 & osg::ImageBase::getSideCount ( void   )  const [inline, inherited]

Definition at line 550 of file OSGImageBase.inl.

References osg::ImageBase::_sfSideCount, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00551 {
00552     return _sfSideCount.getValue();
00553 }

Int32 & osg::ImageBase::getSideSize ( void   )  [inline, inherited]

Definition at line 564 of file OSGImageBase.inl.

References osg::ImageBase::_sfSideSize, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by changed(), createData(), getData(), and scale().

00565 {
00566     return _sfSideSize.getValue();
00567 }

const Int32 & osg::ImageBase::getSideSize ( void   )  const [inline, inherited]

Definition at line 571 of file OSGImageBase.inl.

References osg::ImageBase::_sfSideSize, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00572 {
00573     return _sfSideSize.getValue();
00574 }

bool & osg::ImageBase::getForceCompressedData ( void   )  [inline, inherited]

Definition at line 585 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceCompressedData, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by hasCompressedData().

00586 {
00587     return _sfForceCompressedData.getValue();
00588 }

const bool & osg::ImageBase::getForceCompressedData ( void   )  const [inline, inherited]

Definition at line 592 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceCompressedData, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00593 {
00594     return _sfForceCompressedData.getValue();
00595 }

bool & osg::ImageBase::getForceAlphaChannel ( void   )  [inline, inherited]

Definition at line 606 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceAlphaChannel, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by hasAlphaChannel().

00607 {
00608     return _sfForceAlphaChannel.getValue();
00609 }

const bool & osg::ImageBase::getForceAlphaChannel ( void   )  const [inline, inherited]

Definition at line 613 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceAlphaChannel, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00614 {
00615     return _sfForceAlphaChannel.getValue();
00616 }

bool & osg::ImageBase::getForceColorChannel ( void   )  [inline, inherited]

Definition at line 627 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceColorChannel, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by hasColorChannel().

00628 {
00629     return _sfForceColorChannel.getValue();
00630 }

const bool & osg::ImageBase::getForceColorChannel ( void   )  const [inline, inherited]

Definition at line 634 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceColorChannel, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00635 {
00636     return _sfForceColorChannel.getValue();
00637 }

bool & osg::ImageBase::getForceAlphaBinary ( void   )  [inline, inherited]

Definition at line 648 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceAlphaBinary, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by isAlphaBinary().

00649 {
00650     return _sfForceAlphaBinary.getValue();
00651 }

const bool & osg::ImageBase::getForceAlphaBinary ( void   )  const [inline, inherited]

Definition at line 655 of file OSGImageBase.inl.

References osg::ImageBase::_sfForceAlphaBinary, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00656 {
00657     return _sfForceAlphaBinary.getValue();
00658 }

Real32 & osg::ImageBase::getResX ( void   )  [inline, inherited]

Definition at line 669 of file OSGImageBase.inl.

References osg::ImageBase::_sfResX, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00670 {
00671     return _sfResX.getValue();
00672 }

const Real32 & osg::ImageBase::getResX ( void   )  const [inline, inherited]

Definition at line 676 of file OSGImageBase.inl.

References osg::ImageBase::_sfResX, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00677 {
00678     return _sfResX.getValue();
00679 }

Real32 & osg::ImageBase::getResY ( void   )  [inline, inherited]

Definition at line 690 of file OSGImageBase.inl.

References osg::ImageBase::_sfResY, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00691 {
00692     return _sfResY.getValue();
00693 }

const Real32 & osg::ImageBase::getResY ( void   )  const [inline, inherited]

Definition at line 697 of file OSGImageBase.inl.

References osg::ImageBase::_sfResY, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00698 {
00699     return _sfResY.getValue();
00700 }

UInt16 & osg::ImageBase::getResUnit ( void   )  [inline, inherited]

Definition at line 711 of file OSGImageBase.inl.

References osg::ImageBase::_sfResUnit, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00712 {
00713     return _sfResUnit.getValue();
00714 }

const UInt16 & osg::ImageBase::getResUnit ( void   )  const [inline, inherited]

Definition at line 718 of file OSGImageBase.inl.

References osg::ImageBase::_sfResUnit, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00719 {
00720     return _sfResUnit.getValue();
00721 }

FieldContainerPtr & osg::ImageBase::getParents ( const UInt32  index  )  [inline, inherited]

Definition at line 733 of file OSGImageBase.inl.

References osg::ImageBase::_mfParents.

00734 {
00735     return _mfParents[index];
00736 }

MFFieldContainerPtr & osg::ImageBase::getParents ( void   )  [inline, inherited]

Definition at line 740 of file OSGImageBase.inl.

References osg::ImageBase::_mfParents.

00741 {
00742     return _mfParents;
00743 }

const MFFieldContainerPtr & osg::ImageBase::getParents ( void   )  const [inline, inherited]

Definition at line 747 of file OSGImageBase.inl.

References osg::ImageBase::_mfParents.

00748 {
00749     return _mfParents;
00750 }

UInt8 & osg::ImageBase::getPixel ( const UInt32  index  )  [inline, inherited]

Definition at line 754 of file OSGImageBase.inl.

References osg::ImageBase::_mfPixel.

00755 {
00756     return _mfPixel[index];
00757 }

MFUInt8 & osg::ImageBase::getPixel ( void   )  [inline, inherited]

Definition at line 761 of file OSGImageBase.inl.

References osg::ImageBase::_mfPixel.

Referenced by clearData(), createData(), getData(), isValid(), and scale().

00762 {
00763     return _mfPixel;
00764 }

const MFUInt8 & osg::ImageBase::getPixel ( void   )  const [inline, inherited]

Definition at line 768 of file OSGImageBase.inl.

References osg::ImageBase::_mfPixel.

00769 {
00770     return _mfPixel;
00771 }

void osg::ImageBase::setDimension ( const Int32 value  )  [inline, inherited]

Definition at line 284 of file OSGImageBase.inl.

References osg::ImageBase::_sfDimension, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by createData().

00285 {
00286     _sfDimension.setValue(value);
00287 }

void osg::ImageBase::setWidth ( const Int32 value  )  [inline, inherited]

Definition at line 305 of file OSGImageBase.inl.

References osg::ImageBase::_sfWidth, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00306 {
00307     _sfWidth.setValue(value);
00308 }

void osg::ImageBase::setHeight ( const Int32 value  )  [inline, inherited]

Definition at line 326 of file OSGImageBase.inl.

References osg::ImageBase::_sfHeight, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00327 {
00328     _sfHeight.setValue(value);
00329 }

void osg::ImageBase::setDepth ( const Int32 value  )  [inline, inherited]

Definition at line 347 of file OSGImageBase.inl.

References osg::ImageBase::_sfDepth, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by flipDepthFrameData().

00348 {
00349     _sfDepth.setValue(value);
00350 }

void osg::ImageBase::setBpp ( const Int32 value  )  [inline, inherited]

Definition at line 368 of file OSGImageBase.inl.

References osg::ImageBase::_sfBpp, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by createData().

00369 {
00370     _sfBpp.setValue(value);
00371 }

void osg::ImageBase::setMipMapCount ( const Int32 value  )  [inline, inherited]

Definition at line 389 of file OSGImageBase.inl.

References osg::ImageBase::_sfMipMapCount, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00390 {
00391     _sfMipMapCount.setValue(value);
00392 }

void osg::ImageBase::setFrameCount ( const Int32 value  )  [inline, inherited]

Definition at line 410 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameCount, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by flipDepthFrameData().

00411 {
00412     _sfFrameCount.setValue(value);
00413 }

void osg::ImageBase::setFrameDelay ( const Time value  )  [inline, inherited]

Definition at line 431 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameDelay, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00432 {
00433     _sfFrameDelay.setValue(value);
00434 }

void osg::ImageBase::setPixelFormat ( const UInt32 value  )  [inline, inherited]

Definition at line 452 of file OSGImageBase.inl.

References osg::ImageBase::_sfPixelFormat, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by Image().

00453 {
00454     _sfPixelFormat.setValue(value);
00455 }

void osg::ImageBase::setFrameSize ( const Int32 value  )  [inline, inherited]

Definition at line 473 of file OSGImageBase.inl.

References osg::ImageBase::_sfFrameSize, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by changed(), and createData().

00474 {
00475     _sfFrameSize.setValue(value);
00476 }

void osg::ImageBase::setName ( const std::string &  value  )  [inline, inherited]

Definition at line 494 of file OSGImageBase.inl.

References osg::ImageBase::_sfName, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00495 {
00496     _sfName.setValue(value);
00497 }

void osg::ImageBase::setDataType ( const Int32 value  )  [inline, inherited]

Definition at line 515 of file OSGImageBase.inl.

References osg::ImageBase::_sfDataType, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by addValue().

00516 {
00517     _sfDataType.setValue(value);
00518 }

void osg::ImageBase::setSideCount ( const Int32 value  )  [inline, inherited]

Definition at line 557 of file OSGImageBase.inl.

References osg::ImageBase::_sfSideCount, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00558 {
00559     _sfSideCount.setValue(value);
00560 }

void osg::ImageBase::setSideSize ( const Int32 value  )  [inline, inherited]

Definition at line 578 of file OSGImageBase.inl.

References osg::ImageBase::_sfSideSize, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by changed(), and createData().

00579 {
00580     _sfSideSize.setValue(value);
00581 }

void osg::ImageBase::setForceCompressedData ( const bool &  value  )  [inline, inherited]

void osg::ImageBase::setForceAlphaChannel ( const bool &  value  )  [inline, inherited]

void osg::ImageBase::setForceColorChannel ( const bool &  value  )  [inline, inherited]

void osg::ImageBase::setForceAlphaBinary ( const bool &  value  )  [inline, inherited]

void osg::ImageBase::setResX ( const Real32 value  )  [inline, inherited]

Definition at line 683 of file OSGImageBase.inl.

References osg::ImageBase::_sfResX, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00684 {
00685     _sfResX.setValue(value);
00686 }

void osg::ImageBase::setResY ( const Real32 value  )  [inline, inherited]

Definition at line 704 of file OSGImageBase.inl.

References osg::ImageBase::_sfResY, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00705 {
00706     _sfResY.setValue(value);
00707 }

void osg::ImageBase::setResUnit ( const UInt16 value  )  [inline, inherited]

Definition at line 725 of file OSGImageBase.inl.

References osg::ImageBase::_sfResUnit, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00726 {
00727     _sfResUnit.setValue(value);
00728 }

UInt32 osg::ImageBase::getBinSize ( const BitVector whichField  )  [virtual, inherited]

Reimplemented from osg::AttachmentContainer.

Definition at line 490 of file OSGImageBase.cpp.

References osg::ImageBase::_mfParents, osg::ImageBase::_mfPixel, osg::ImageBase::_sfBpp, osg::ImageBase::_sfComponentSize, osg::ImageBase::_sfDataType, osg::ImageBase::_sfDepth, osg::ImageBase::_sfDimension, osg::ImageBase::_sfForceAlphaBinary, osg::ImageBase::_sfForceAlphaChannel, osg::ImageBase::_sfForceColorChannel, osg::ImageBase::_sfForceCompressedData, osg::ImageBase::_sfFrameCount, osg::ImageBase::_sfFrameDelay, osg::ImageBase::_sfFrameSize, osg::ImageBase::_sfHeight, osg::ImageBase::_sfMipMapCount, osg::ImageBase::_sfName, osg::ImageBase::_sfPixelFormat, osg::ImageBase::_sfResUnit, osg::ImageBase::_sfResX, osg::ImageBase::_sfResY, osg::ImageBase::_sfSideCount, osg::ImageBase::_sfSideSize, osg::ImageBase::_sfWidth, osg::ImageBase::BppFieldMask, osg::ImageBase::ComponentSizeFieldMask, osg::ImageBase::DataTypeFieldMask, osg::ImageBase::DepthFieldMask, osg::ImageBase::DimensionFieldMask, osg::ImageBase::ForceAlphaBinaryFieldMask, osg::ImageBase::ForceAlphaChannelFieldMask, osg::ImageBase::ForceColorChannelFieldMask, osg::ImageBase::ForceCompressedDataFieldMask, osg::ImageBase::FrameCountFieldMask, osg::ImageBase::FrameDelayFieldMask, osg::ImageBase::FrameSizeFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::MField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::AttachmentContainer::getBinSize(), osg::ImageBase::HeightFieldMask, osg::ImageBase::MipMapCountFieldMask, osg::ImageBase::NameFieldMask, osg::FieldBits::NoField, osg::ImageBase::ParentsFieldMask, osg::ImageBase::PixelFieldMask, osg::ImageBase::PixelFormatFieldMask, osg::ImageBase::ResUnitFieldMask, osg::ImageBase::ResXFieldMask, osg::ImageBase::ResYFieldMask, osg::ImageBase::SideCountFieldMask, osg::ImageBase::SideSizeFieldMask, and osg::ImageBase::WidthFieldMask.

00491 {
00492     UInt32 returnValue = Inherited::getBinSize(whichField);
00493 
00494     if(FieldBits::NoField != (ParentsFieldMask & whichField))
00495     {
00496         returnValue += _mfParents.getBinSize();
00497     }
00498 
00499     if(FieldBits::NoField != (DimensionFieldMask & whichField))
00500     {
00501         returnValue += _sfDimension.getBinSize();
00502     }
00503 
00504     if(FieldBits::NoField != (WidthFieldMask & whichField))
00505     {
00506         returnValue += _sfWidth.getBinSize();
00507     }
00508 
00509     if(FieldBits::NoField != (HeightFieldMask & whichField))
00510     {
00511         returnValue += _sfHeight.getBinSize();
00512     }
00513 
00514     if(FieldBits::NoField != (DepthFieldMask & whichField))
00515     {
00516         returnValue += _sfDepth.getBinSize();
00517     }
00518 
00519     if(FieldBits::NoField != (BppFieldMask & whichField))
00520     {
00521         returnValue += _sfBpp.getBinSize();
00522     }
00523 
00524     if(FieldBits::NoField != (MipMapCountFieldMask & whichField))
00525     {
00526         returnValue += _sfMipMapCount.getBinSize();
00527     }
00528 
00529     if(FieldBits::NoField != (FrameCountFieldMask & whichField))
00530     {
00531         returnValue += _sfFrameCount.getBinSize();
00532     }
00533 
00534     if(FieldBits::NoField != (FrameDelayFieldMask & whichField))
00535     {
00536         returnValue += _sfFrameDelay.getBinSize();
00537     }
00538 
00539     if(FieldBits::NoField != (PixelFormatFieldMask & whichField))
00540     {
00541         returnValue += _sfPixelFormat.getBinSize();
00542     }
00543 
00544     if(FieldBits::NoField != (PixelFieldMask & whichField))
00545     {
00546         returnValue += _mfPixel.getBinSize();
00547     }
00548 
00549     if(FieldBits::NoField != (FrameSizeFieldMask & whichField))
00550     {
00551         returnValue += _sfFrameSize.getBinSize();
00552     }
00553 
00554     if(FieldBits::NoField != (NameFieldMask & whichField))
00555     {
00556         returnValue += _sfName.getBinSize();
00557     }
00558 
00559     if(FieldBits::NoField != (DataTypeFieldMask & whichField))
00560     {
00561         returnValue += _sfDataType.getBinSize();
00562     }
00563 
00564     if(FieldBits::NoField != (ComponentSizeFieldMask & whichField))
00565     {
00566         returnValue += _sfComponentSize.getBinSize();
00567     }
00568 
00569     if(FieldBits::NoField != (SideCountFieldMask & whichField))
00570     {
00571         returnValue += _sfSideCount.getBinSize();
00572     }
00573 
00574     if(FieldBits::NoField != (SideSizeFieldMask & whichField))
00575     {
00576         returnValue += _sfSideSize.getBinSize();
00577     }
00578 
00579     if(FieldBits::NoField != (ForceCompressedDataFieldMask & whichField))
00580     {
00581         returnValue += _sfForceCompressedData.getBinSize();
00582     }
00583 
00584     if(FieldBits::NoField != (ForceAlphaChannelFieldMask & whichField))
00585     {
00586         returnValue += _sfForceAlphaChannel.getBinSize();
00587     }
00588 
00589     if(FieldBits::NoField != (ForceColorChannelFieldMask & whichField))
00590     {
00591         returnValue += _sfForceColorChannel.getBinSize();
00592     }
00593 
00594     if(FieldBits::NoField != (ForceAlphaBinaryFieldMask & whichField))
00595     {
00596         returnValue += _sfForceAlphaBinary.getBinSize();
00597     }
00598 
00599     if(FieldBits::NoField != (ResXFieldMask & whichField))
00600     {
00601         returnValue += _sfResX.getBinSize();
00602     }
00603 
00604     if(FieldBits::NoField != (ResYFieldMask & whichField))
00605     {
00606         returnValue += _sfResY.getBinSize();
00607     }
00608 
00609     if(FieldBits::NoField != (ResUnitFieldMask & whichField))
00610     {
00611         returnValue += _sfResUnit.getBinSize();
00612     }
00613 
00614 
00615     return returnValue;
00616 }

void osg::ImageBase::copyToBin ( BinaryDataHandler pMem,
const BitVector whichField 
) [virtual, inherited]

Reimplemented from osg::AttachmentContainer.

Definition at line 618 of file OSGImageBase.cpp.

References osg::ImageBase::_mfParents, osg::ImageBase::_mfPixel, osg::ImageBase::_sfBpp, osg::ImageBase::_sfComponentSize, osg::ImageBase::_sfDataType, osg::ImageBase::_sfDepth, osg::ImageBase::_sfDimension, osg::ImageBase::_sfForceAlphaBinary, osg::ImageBase::_sfForceAlphaChannel, osg::ImageBase::_sfForceColorChannel, osg::ImageBase::_sfForceCompressedData, osg::ImageBase::_sfFrameCount, osg::ImageBase::_sfFrameDelay, osg::ImageBase::_sfFrameSize, osg::ImageBase::_sfHeight, osg::ImageBase::_sfMipMapCount, osg::ImageBase::_sfName, osg::ImageBase::_sfPixelFormat, osg::ImageBase::_sfResUnit, osg::ImageBase::_sfResX, osg::ImageBase::_sfResY, osg::ImageBase::_sfSideCount, osg::ImageBase::_sfSideSize, osg::ImageBase::_sfWidth, osg::ImageBase::BppFieldMask, osg::ImageBase::ComponentSizeFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::MField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::AttachmentContainer::copyToBin(), osg::ImageBase::DataTypeFieldMask, osg::ImageBase::DepthFieldMask, osg::ImageBase::DimensionFieldMask, osg::ImageBase::ForceAlphaBinaryFieldMask, osg::ImageBase::ForceAlphaChannelFieldMask, osg::ImageBase::ForceColorChannelFieldMask, osg::ImageBase::ForceCompressedDataFieldMask, osg::ImageBase::FrameCountFieldMask, osg::ImageBase::FrameDelayFieldMask, osg::ImageBase::FrameSizeFieldMask, osg::ImageBase::HeightFieldMask, osg::ImageBase::MipMapCountFieldMask, osg::ImageBase::NameFieldMask, osg::FieldBits::NoField, osg::ImageBase::ParentsFieldMask, osg::ImageBase::PixelFieldMask, osg::ImageBase::PixelFormatFieldMask, osg::ImageBase::ResUnitFieldMask, osg::ImageBase::ResXFieldMask, osg::ImageBase::ResYFieldMask, osg::ImageBase::SideCountFieldMask, osg::ImageBase::SideSizeFieldMask, and osg::ImageBase::WidthFieldMask.

00620 {
00621     Inherited::copyToBin(pMem, whichField);
00622 
00623     if(FieldBits::NoField != (ParentsFieldMask & whichField))
00624     {
00625         _mfParents.copyToBin(pMem);
00626     }
00627 
00628     if(FieldBits::NoField != (DimensionFieldMask & whichField))
00629     {
00630         _sfDimension.copyToBin(pMem);
00631     }
00632 
00633     if(FieldBits::NoField != (WidthFieldMask & whichField))
00634     {
00635         _sfWidth.copyToBin(pMem);
00636     }
00637 
00638     if(FieldBits::NoField != (HeightFieldMask & whichField))
00639     {
00640         _sfHeight.copyToBin(pMem);
00641     }
00642 
00643     if(FieldBits::NoField != (DepthFieldMask & whichField))
00644     {
00645         _sfDepth.copyToBin(pMem);
00646     }
00647 
00648     if(FieldBits::NoField != (BppFieldMask & whichField))
00649     {
00650         _sfBpp.copyToBin(pMem);
00651     }
00652 
00653     if(FieldBits::NoField != (MipMapCountFieldMask & whichField))
00654     {
00655         _sfMipMapCount.copyToBin(pMem);
00656     }
00657 
00658     if(FieldBits::NoField != (FrameCountFieldMask & whichField))
00659     {
00660         _sfFrameCount.copyToBin(pMem);
00661     }
00662 
00663     if(FieldBits::NoField != (FrameDelayFieldMask & whichField))
00664     {
00665         _sfFrameDelay.copyToBin(pMem);
00666     }
00667 
00668     if(FieldBits::NoField != (PixelFormatFieldMask & whichField))
00669     {
00670         _sfPixelFormat.copyToBin(pMem);
00671     }
00672 
00673     if(FieldBits::NoField != (PixelFieldMask & whichField))
00674     {
00675         _mfPixel.copyToBin(pMem);
00676     }
00677 
00678     if(FieldBits::NoField != (FrameSizeFieldMask & whichField))
00679     {
00680         _sfFrameSize.copyToBin(pMem);
00681     }
00682 
00683     if(FieldBits::NoField != (NameFieldMask & whichField))
00684     {
00685         _sfName.copyToBin(pMem);
00686     }
00687 
00688     if(FieldBits::NoField != (DataTypeFieldMask & whichField))
00689     {
00690         _sfDataType.copyToBin(pMem);
00691     }
00692 
00693     if(FieldBits::NoField != (ComponentSizeFieldMask & whichField))
00694     {
00695         _sfComponentSize.copyToBin(pMem);
00696     }
00697 
00698     if(FieldBits::NoField != (SideCountFieldMask & whichField))
00699     {
00700         _sfSideCount.copyToBin(pMem);
00701     }
00702 
00703     if(FieldBits::NoField != (SideSizeFieldMask & whichField))
00704     {
00705         _sfSideSize.copyToBin(pMem);
00706     }
00707 
00708     if(FieldBits::NoField != (ForceCompressedDataFieldMask & whichField))
00709     {
00710         _sfForceCompressedData.copyToBin(pMem);
00711     }
00712 
00713     if(FieldBits::NoField != (ForceAlphaChannelFieldMask & whichField))
00714     {
00715         _sfForceAlphaChannel.copyToBin(pMem);
00716     }
00717 
00718     if(FieldBits::NoField != (ForceColorChannelFieldMask & whichField))
00719     {
00720         _sfForceColorChannel.copyToBin(pMem);
00721     }
00722 
00723     if(FieldBits::NoField != (ForceAlphaBinaryFieldMask & whichField))
00724     {
00725         _sfForceAlphaBinary.copyToBin(pMem);
00726     }
00727 
00728     if(FieldBits::NoField != (ResXFieldMask & whichField))
00729     {
00730         _sfResX.copyToBin(pMem);
00731     }
00732 
00733     if(FieldBits::NoField != (ResYFieldMask & whichField))
00734     {
00735         _sfResY.copyToBin(pMem);
00736     }
00737 
00738     if(FieldBits::NoField != (ResUnitFieldMask & whichField))
00739     {
00740         _sfResUnit.copyToBin(pMem);
00741     }
00742 
00743 
00744 }

void osg::ImageBase::copyFromBin ( BinaryDataHandler pMem,
const BitVector whichField 
) [virtual, inherited]

Reimplemented from osg::AttachmentContainer.

Definition at line 746 of file OSGImageBase.cpp.

References osg::ImageBase::_mfParents, osg::ImageBase::_mfPixel, osg::ImageBase::_sfBpp, osg::ImageBase::_sfComponentSize, osg::ImageBase::_sfDataType, osg::ImageBase::_sfDepth, osg::ImageBase::_sfDimension, osg::ImageBase::_sfForceAlphaBinary, osg::ImageBase::_sfForceAlphaChannel, osg::ImageBase::_sfForceColorChannel, osg::ImageBase::_sfForceCompressedData, osg::ImageBase::_sfFrameCount, osg::ImageBase::_sfFrameDelay, osg::ImageBase::_sfFrameSize, osg::ImageBase::_sfHeight, osg::ImageBase::_sfMipMapCount, osg::ImageBase::_sfName, osg::ImageBase::_sfPixelFormat, osg::ImageBase::_sfResUnit, osg::ImageBase::_sfResX, osg::ImageBase::_sfResY, osg::ImageBase::_sfSideCount, osg::ImageBase::_sfSideSize, osg::ImageBase::_sfWidth, osg::ImageBase::BppFieldMask, osg::ImageBase::ComponentSizeFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::MField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::AttachmentContainer::copyFromBin(), osg::ImageBase::DataTypeFieldMask, osg::ImageBase::DepthFieldMask, osg::ImageBase::DimensionFieldMask, osg::ImageBase::ForceAlphaBinaryFieldMask, osg::ImageBase::ForceAlphaChannelFieldMask, osg::ImageBase::ForceColorChannelFieldMask, osg::ImageBase::ForceCompressedDataFieldMask, osg::ImageBase::FrameCountFieldMask, osg::ImageBase::FrameDelayFieldMask, osg::ImageBase::FrameSizeFieldMask, osg::ImageBase::HeightFieldMask, osg::ImageBase::MipMapCountFieldMask, osg::ImageBase::NameFieldMask, osg::FieldBits::NoField, osg::ImageBase::ParentsFieldMask, osg::ImageBase::PixelFieldMask, osg::ImageBase::PixelFormatFieldMask, osg::ImageBase::ResUnitFieldMask, osg::ImageBase::ResXFieldMask, osg::ImageBase::ResYFieldMask, osg::ImageBase::SideCountFieldMask, osg::ImageBase::SideSizeFieldMask, and osg::ImageBase::WidthFieldMask.

00748 {
00749     Inherited::copyFromBin(pMem, whichField);
00750 
00751     if(FieldBits::NoField != (ParentsFieldMask & whichField))
00752     {
00753         _mfParents.copyFromBin(pMem);
00754     }
00755 
00756     if(FieldBits::NoField != (DimensionFieldMask & whichField))
00757     {
00758         _sfDimension.copyFromBin(pMem);
00759     }
00760 
00761     if(FieldBits::NoField != (WidthFieldMask & whichField))
00762     {
00763         _sfWidth.copyFromBin(pMem);
00764     }
00765 
00766     if(FieldBits::NoField != (HeightFieldMask & whichField))
00767     {
00768         _sfHeight.copyFromBin(pMem);
00769     }
00770 
00771     if(FieldBits::NoField != (DepthFieldMask & whichField))
00772     {
00773         _sfDepth.copyFromBin(pMem);
00774     }
00775 
00776     if(FieldBits::NoField != (BppFieldMask & whichField))
00777     {
00778         _sfBpp.copyFromBin(pMem);
00779     }
00780 
00781     if(FieldBits::NoField != (MipMapCountFieldMask & whichField))
00782     {
00783         _sfMipMapCount.copyFromBin(pMem);
00784     }
00785 
00786     if(FieldBits::NoField != (FrameCountFieldMask & whichField))
00787     {
00788         _sfFrameCount.copyFromBin(pMem);
00789     }
00790 
00791     if(FieldBits::NoField != (FrameDelayFieldMask & whichField))
00792     {
00793         _sfFrameDelay.copyFromBin(pMem);
00794     }
00795 
00796     if(FieldBits::NoField != (PixelFormatFieldMask & whichField))
00797     {
00798         _sfPixelFormat.copyFromBin(pMem);
00799     }
00800 
00801     if(FieldBits::NoField != (PixelFieldMask & whichField))
00802     {
00803         _mfPixel.copyFromBin(pMem);
00804     }
00805 
00806     if(FieldBits::NoField != (FrameSizeFieldMask & whichField))
00807     {
00808         _sfFrameSize.copyFromBin(pMem);
00809     }
00810 
00811     if(FieldBits::NoField != (NameFieldMask & whichField))
00812     {
00813         _sfName.copyFromBin(pMem);
00814     }
00815 
00816     if(FieldBits::NoField != (DataTypeFieldMask & whichField))
00817     {
00818         _sfDataType.copyFromBin(pMem);
00819     }
00820 
00821     if(FieldBits::NoField != (ComponentSizeFieldMask & whichField))
00822     {
00823         _sfComponentSize.copyFromBin(pMem);
00824     }
00825 
00826     if(FieldBits::NoField != (SideCountFieldMask & whichField))
00827     {
00828         _sfSideCount.copyFromBin(pMem);
00829     }
00830 
00831     if(FieldBits::NoField != (SideSizeFieldMask & whichField))
00832     {
00833         _sfSideSize.copyFromBin(pMem);
00834     }
00835 
00836     if(FieldBits::NoField != (ForceCompressedDataFieldMask & whichField))
00837     {
00838         _sfForceCompressedData.copyFromBin(pMem);
00839     }
00840 
00841     if(FieldBits::NoField != (ForceAlphaChannelFieldMask & whichField))
00842     {
00843         _sfForceAlphaChannel.copyFromBin(pMem);
00844     }
00845 
00846     if(FieldBits::NoField != (ForceColorChannelFieldMask & whichField))
00847     {
00848         _sfForceColorChannel.copyFromBin(pMem);
00849     }
00850 
00851     if(FieldBits::NoField != (ForceAlphaBinaryFieldMask & whichField))
00852     {
00853         _sfForceAlphaBinary.copyFromBin(pMem);
00854     }
00855 
00856     if(FieldBits::NoField != (ResXFieldMask & whichField))
00857     {
00858         _sfResX.copyFromBin(pMem);
00859     }
00860 
00861     if(FieldBits::NoField != (ResYFieldMask & whichField))
00862     {
00863         _sfResY.copyFromBin(pMem);
00864     }
00865 
00866     if(FieldBits::NoField != (ResUnitFieldMask & whichField))
00867     {
00868         _sfResUnit.copyFromBin(pMem);
00869     }
00870 
00871 
00872 }

ImagePtr osg::ImageBase::create ( void   )  [inline, static, inherited]

ImagePtr osg::ImageBase::createEmpty ( void   )  [inline, static, inherited]

Definition at line 87 of file OSGImageBase.inl.

References osg::FieldContainer::newPtr().

00088 { 
00089     ImagePtr returnValue; 
00090     
00091     newPtr(returnValue); 
00092 
00093     return returnValue; 
00094 }

FieldContainerPtr osg::ImageBase::shallowCopy ( void   )  const [virtual, inherited]

Implements osg::FieldContainer.

Definition at line 371 of file OSGImageBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by osg::ImageBase::create().

00372 { 
00373     ImagePtr returnValue; 
00374 
00375     newPtr(returnValue, dynamic_cast<const Image *>(this)); 
00376 
00377     return returnValue; 
00378 }

SFInt32 * osg::ImageBase::getSFComponentSize ( void   )  [inline, protected, inherited]

Definition at line 199 of file OSGImageBase.inl.

References osg::ImageBase::_sfComponentSize.

00200 {
00201     return &_sfComponentSize;
00202 }

Int32 & osg::ImageBase::getComponentSize ( void   )  [inline, protected, inherited]

const Int32 & osg::ImageBase::getComponentSize ( void   )  const [inline, protected, inherited]

Definition at line 529 of file OSGImageBase.inl.

References osg::ImageBase::_sfComponentSize, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00530 {
00531     return _sfComponentSize.getValue();
00532 }

void osg::ImageBase::setComponentSize ( const Int32 value  )  [inline, protected, inherited]

Definition at line 536 of file OSGImageBase.inl.

References osg::ImageBase::_sfComponentSize, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by changed(), and createData().

00537 {
00538     _sfComponentSize.setValue(value);
00539 }

void osg::ImageBase::executeSyncImpl ( ImageBase pOther,
const BitVector whichField 
) [protected, inherited]

Definition at line 875 of file OSGImageBase.cpp.

References osg::ImageBase::_mfParents, osg::ImageBase::_mfPixel, osg::ImageBase::_sfBpp, osg::ImageBase::_sfComponentSize, osg::ImageBase::_sfDataType, osg::ImageBase::_sfDepth, osg::ImageBase::_sfDimension, osg::ImageBase::_sfForceAlphaBinary, osg::ImageBase::_sfForceAlphaChannel, osg::ImageBase::_sfForceColorChannel, osg::ImageBase::_sfForceCompressedData, osg::ImageBase::_sfFrameCount, osg::ImageBase::_sfFrameDelay, osg::ImageBase::_sfFrameSize, osg::ImageBase::_sfHeight, osg::ImageBase::_sfMipMapCount, osg::ImageBase::_sfName, osg::ImageBase::_sfPixelFormat, osg::ImageBase::_sfResUnit, osg::ImageBase::_sfResX, osg::ImageBase::_sfResY, osg::ImageBase::_sfSideCount, osg::ImageBase::_sfSideSize, osg::ImageBase::_sfWidth, osg::ImageBase::BppFieldMask, osg::ImageBase::ComponentSizeFieldMask, osg::ImageBase::DataTypeFieldMask, osg::ImageBase::DepthFieldMask, osg::ImageBase::DimensionFieldMask, osg::AttachmentContainer::executeSyncImpl(), osg::ImageBase::ForceAlphaBinaryFieldMask, osg::ImageBase::ForceAlphaChannelFieldMask, osg::ImageBase::ForceColorChannelFieldMask, osg::ImageBase::ForceCompressedDataFieldMask, osg::ImageBase::FrameCountFieldMask, osg::ImageBase::FrameDelayFieldMask, osg::ImageBase::FrameSizeFieldMask, osg::ImageBase::HeightFieldMask, osg::ImageBase::MipMapCountFieldMask, osg::ImageBase::NameFieldMask, osg::FieldBits::NoField, osg::ImageBase::ParentsFieldMask, osg::ImageBase::PixelFieldMask, osg::ImageBase::PixelFormatFieldMask, osg::ImageBase::ResUnitFieldMask, osg::ImageBase::ResXFieldMask, osg::ImageBase::ResYFieldMask, osg::ImageBase::SideCountFieldMask, osg::ImageBase::SideSizeFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::syncWith(), osg::MField< FieldTypeT, fieldNameSpace >::syncWith(), and osg::ImageBase::WidthFieldMask.

Referenced by osg::ImageBase::executeSync().

00877 {
00878 
00879     Inherited::executeSyncImpl(pOther, whichField);
00880 
00881     if(FieldBits::NoField != (ParentsFieldMask & whichField))
00882         _mfParents.syncWith(pOther->_mfParents);
00883 
00884     if(FieldBits::NoField != (DimensionFieldMask & whichField))
00885         _sfDimension.syncWith(pOther->_sfDimension);
00886 
00887     if(FieldBits::NoField != (WidthFieldMask & whichField))
00888         _sfWidth.syncWith(pOther->_sfWidth);
00889 
00890     if(FieldBits::NoField != (HeightFieldMask & whichField))
00891         _sfHeight.syncWith(pOther->_sfHeight);
00892 
00893     if(FieldBits::NoField != (DepthFieldMask & whichField))
00894         _sfDepth.syncWith(pOther->_sfDepth);
00895 
00896     if(FieldBits::NoField != (BppFieldMask & whichField))
00897         _sfBpp.syncWith(pOther->_sfBpp);
00898 
00899     if(FieldBits::NoField != (MipMapCountFieldMask & whichField))
00900         _sfMipMapCount.syncWith(pOther->_sfMipMapCount);
00901 
00902     if(FieldBits::NoField != (FrameCountFieldMask & whichField))
00903         _sfFrameCount.syncWith(pOther->_sfFrameCount);
00904 
00905     if(FieldBits::NoField != (FrameDelayFieldMask & whichField))
00906         _sfFrameDelay.syncWith(pOther->_sfFrameDelay);
00907 
00908     if(FieldBits::NoField != (PixelFormatFieldMask & whichField))
00909         _sfPixelFormat.syncWith(pOther->_sfPixelFormat);
00910 
00911     if(FieldBits::NoField != (PixelFieldMask & whichField))
00912         _mfPixel.syncWith(pOther->_mfPixel);
00913 
00914     if(FieldBits::NoField != (FrameSizeFieldMask & whichField))
00915         _sfFrameSize.syncWith(pOther->_sfFrameSize);
00916 
00917     if(FieldBits::NoField != (NameFieldMask & whichField))
00918         _sfName.syncWith(pOther->_sfName);
00919 
00920     if(FieldBits::NoField != (DataTypeFieldMask & whichField))
00921         _sfDataType.syncWith(pOther->_sfDataType);
00922 
00923     if(FieldBits::NoField != (ComponentSizeFieldMask & whichField))
00924         _sfComponentSize.syncWith(pOther->_sfComponentSize);
00925 
00926     if(FieldBits::NoField != (SideCountFieldMask & whichField))
00927         _sfSideCount.syncWith(pOther->_sfSideCount);
00928 
00929     if(FieldBits::NoField != (SideSizeFieldMask & whichField))
00930         _sfSideSize.syncWith(pOther->_sfSideSize);
00931 
00932     if(FieldBits::NoField != (ForceCompressedDataFieldMask & whichField))
00933         _sfForceCompressedData.syncWith(pOther->_sfForceCompressedData);
00934 
00935     if(FieldBits::NoField != (ForceAlphaChannelFieldMask & whichField))
00936         _sfForceAlphaChannel.syncWith(pOther->_sfForceAlphaChannel);
00937 
00938     if(FieldBits::NoField != (ForceColorChannelFieldMask & whichField))
00939         _sfForceColorChannel.syncWith(pOther->_sfForceColorChannel);
00940 
00941     if(FieldBits::NoField != (ForceAlphaBinaryFieldMask & whichField))
00942         _sfForceAlphaBinary.syncWith(pOther->_sfForceAlphaBinary);
00943 
00944     if(FieldBits::NoField != (ResXFieldMask & whichField))
00945         _sfResX.syncWith(pOther->_sfResX);
00946 
00947     if(FieldBits::NoField != (ResYFieldMask & whichField))
00948         _sfResY.syncWith(pOther->_sfResY);
00949 
00950     if(FieldBits::NoField != (ResUnitFieldMask & whichField))
00951         _sfResUnit.syncWith(pOther->_sfResUnit);
00952 
00953 
00954 }

void AttachmentContainer::executeSyncImpl ( AttachmentContainer pOther,
const BitVector whichField 
) [protected, inherited]

void osg::FieldContainer::executeSyncImpl ( FieldContainer pOther,
const BitVector whichField 
) [inline, protected, inherited]

void osg::ImageBase::executeSync ( FieldContainer other,
const BitVector whichField 
) [protected, virtual, inherited]

Reimplemented from osg::AttachmentContainer.

Definition at line 387 of file OSGImageBase.cpp.

References osg::ImageBase::executeSyncImpl().

00389 {
00390     this->executeSyncImpl((ImageBase *) &other, whichField);
00391 }

void AttachmentContainer::addAttachment ( const AttachmentPtr fieldContainerP,
UInt16  binding = 0 
) [inherited]

Definition at line 84 of file OSGAttachmentContainer.cpp.

References osg::addRefCP(), osg::beginEditCP(), osg::endEditCP(), osg::NullFC, and osg::subRefCP().

Referenced by osg::AttachmentContainer::AttachmentContainer(), osg::Node::onCreate(), and setAttachmentField().

00086 {
00087     UInt32 key;
00088 
00089     if(fieldContainerP == NullFC)
00090         return;
00091 
00092     key = (UInt32 (fieldContainerP->getGroupId()) << 16) | binding;
00093 
00094     addRefCP(fieldContainerP);
00095 
00096     beginEditCP(fieldContainerP, Attachment::ParentsFieldMask);
00097     {
00098         fieldContainerP->addParent(getPtr());
00099     }
00100     endEditCP  (fieldContainerP, Attachment::ParentsFieldMask);
00101 
00102     AttachmentMap::iterator fcI = _attachmentMap.getValue().find(key);
00103 
00104     if(fcI != _attachmentMap.getValue().end())
00105     {
00106         beginEditCP((*fcI).second, Attachment::ParentsFieldMask);
00107         {
00108             (*fcI).second->subParent(getPtr());
00109         }
00110         endEditCP  ((*fcI).second, Attachment::ParentsFieldMask);
00111 
00112         subRefCP((*fcI).second);
00113 
00114         (*fcI).second = fieldContainerP;
00115     }
00116     else
00117     {
00118         _attachmentMap.getValue()[key] = fieldContainerP;
00119     }
00120 }

void AttachmentContainer::subAttachment ( const AttachmentPtr fieldContainerP,
UInt16  binding = 0 
) [inherited]

Definition at line 122 of file OSGAttachmentContainer.cpp.

References osg::AttachmentContainer::_attachmentMap, osg::beginEditCP(), osg::endEditCP(), osg::AttachmentContainer::getPtr(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), osg::NullFC, osg::Attachment::ParentsFieldMask, and osg::subRefCP().

00124 {
00125     UInt32 key;
00126 
00127     AttachmentMap::iterator fcI;
00128 
00129     if(fieldContainerP == NullFC)
00130         return;
00131 
00132     key = (UInt32(fieldContainerP->getGroupId()) << 16) | binding;
00133 
00134     fcI = _attachmentMap.getValue().find(key);
00135 
00136     if(fcI != _attachmentMap.getValue().end())
00137     {
00138         beginEditCP(fieldContainerP, Attachment::ParentsFieldMask);
00139         {
00140             (*fcI).second->subParent(getPtr());
00141         }
00142         endEditCP  (fieldContainerP, Attachment::ParentsFieldMask);
00143 
00144         subRefCP((*fcI).second);
00145 
00146         _attachmentMap.getValue().erase(fcI);
00147     }
00148 }

AttachmentPtr AttachmentContainer::findAttachment ( UInt32  groupId,
UInt16  binding = 0 
) [inherited]

Definition at line 150 of file OSGAttachmentContainer.cpp.

References osg::AttachmentContainer::_attachmentMap, osg::SField< FieldTypeT, fieldNameSpace >::getValue(), and osg::NullFC.

Referenced by findAttachmentField(), and setAttachmentField().

00152 {
00153     UInt32 key = (UInt32(groupId) << 16) | binding;
00154 
00155     AttachmentMap::iterator fcI = _attachmentMap.getValue().find(key);
00156 
00157     if(fcI == _attachmentMap.getValue().end())
00158     {
00159         return NullFC;
00160     }
00161     else
00162     {
00163         return (*fcI).second;
00164     }
00165 }

AttachmentPtr osg::AttachmentContainer::findAttachment ( const FieldContainerType type,
UInt16  binding = 0 
) [inline, inherited]

Definition at line 57 of file OSGAttachmentContainerImpl.inl.

00060 {
00061     return findAttachment(type.getGroupId(), binding);
00062 }

SFAttachmentMap * AttachmentContainer::getSFAttachments ( void   )  [inherited]

Field Access

Definition at line 170 of file OSGAttachmentContainer.cpp.

References osg::AttachmentContainer::_attachmentMap.

00171 {
00172     return &_attachmentMap;
00173 }

AttachmentContainerPtr AttachmentContainer::getPtr ( void   )  [protected, inherited]

UInt16 osg::FieldContainer::getClassGroupId ( void   )  [inline, static, inherited]

Definition at line 71 of file OSGFieldContainerImpl.inl.

References osg::FieldContainer::_type, and osg::FieldContainerType::getGroupId().

00072 {
00073     return _type.getGroupId();
00074 }

UInt32 osg::FieldContainer::getTypeId ( void   )  const [inline, inherited]

Definition at line 77 of file OSGFieldContainerImpl.inl.

References osg::TypeBase::getId(), and osg::FieldContainer::getType().

Referenced by osg::TextureChunk::changeFrom(), and osg::CubeTextureChunk::changeFrom().

00078 {
00079     return getType().getId();
00080 }

UInt16 osg::FieldContainer::getGroupId ( void   )  const [inline, inherited]

Definition at line 83 of file OSGFieldContainerImpl.inl.

References osg::FieldContainerType::getGroupId(), and osg::FieldContainer::getType().

Referenced by osg::fcptrAttributeMap(), setAttachmentField(), and osg::stringAttributeMap().

00084 {
00085     return getType().getGroupId();
00086 }

const Char8 * osg::FieldContainer::getTypeName ( void   )  const [inline, inherited]

Definition at line 89 of file OSGFieldContainerImpl.inl.

References osg::TypeBase::getCName(), and osg::FieldContainer::getType().

00090 {
00091     return getType().getCName();
00092 }

Field * osg::FieldContainer::getField ( UInt32  fieldId  )  [inline, inherited]

Generic Field Access

Definition at line 95 of file OSGFieldContainerImpl.inl.

References osg::FieldDescription::getField(), osg::FieldContainerType::getFieldDescription(), and osg::FieldContainer::getType().

Referenced by osg::QFCItem::expand(), osg::VRMLShapeDesc::getFieldAndDesc(), osg::QFieldViewBase::getFieldPtr(), osg::QFieldEditorBase::getFieldPtr(), osg::getParentsField(), and osg::QFCItem::setup().

00096 {
00097     const FieldDescription *desc = getType().getFieldDescription(fieldId);
00098 
00099     return desc ? desc->getField(*this) : NULL;
00100 }

Field * osg::FieldContainer::getField ( const Char8 fieldName  )  [inline, inherited]

Generic Field Access

Definition at line 103 of file OSGFieldContainerImpl.inl.

References osg::FieldContainerType::findFieldDescription(), osg::FieldDescription::getField(), and osg::FieldContainer::getType().

00104 {
00105     const FieldDescription *desc =getType().findFieldDescription(fieldName);
00106 
00107     return desc ? desc->getField(*this) : NULL;
00108 }

template<class ObjectPtrT>
void osg::FieldContainer::newPtr ( ObjectPtrT &  result,
const typename ObjectPtrT::StoredObjectType *  prototypeP 
) [inline, static, protected, inherited]

Definition at line 138 of file OSGFieldContainerImpl.inl.

References osg::ChangeList::addCreated(), osg::PThreadBase::getAspect(), osg::PThreadBase::getCurrentChangeList(), osg::ThreadManager::getNumAspects(), osg::FieldContainerFactory::registerFieldContainer(), and osg::FieldContainerFactory::the().

Referenced by osg::XWindowBase::createEmpty(), osg::WIN32WindowBase::createEmpty(), osg::ViewportBase::createEmpty(), osg::VertexProgramChunkBase::createEmpty(), osg::TwoSidedLightingChunkBase::createEmpty(), osg::TransformChunkBase::createEmpty(), osg::TransformBase::createEmpty(), osg::TileCameraDecoratorBase::createEmpty(), osg::TextureTransformChunkBase::createEmpty(), osg::TextureGrabForegroundBase::createEmpty(), osg::TextureGrabBackgroundBase::createEmpty(), osg::TextureChunkBase::createEmpty(), osg::TextureBackgroundBase::createEmpty(), osg::TexGenChunkBase::createEmpty(), osg::SwitchMaterialBase::createEmpty(), osg::SwitchBase::createEmpty(), osg::SurfaceBase::createEmpty(), osg::StringAttributeMapBase::createEmpty(), osg::StereoBufferViewportBase::createEmpty(), osg::StencilChunkBase::createEmpty(), osg::StateSortingGroupBase::createEmpty(), osg::StateBase::createEmpty(), osg::SpotLightBase::createEmpty(), osg::SortFirstWindowBase::createEmpty(), osg::SolidBackgroundBase::createEmpty(), osg::SlicesBase::createEmpty(), osg::SkyBackgroundBase::createEmpty(), osg::SimpleTexturedMaterialBase::createEmpty(), osg::SimpleStatisticsForegroundBase::createEmpty(), osg::SimpleMaterialBase::createEmpty(), osg::SHLParameterChunkBase::createEmpty(), osg::SHLChunkBase::createEmpty(), osg::ShearedStereoCameraDecoratorBase::createEmpty(), osg::ShaderParameterVec4fBase::createEmpty(), osg::ShaderParameterVec3fBase::createEmpty(), osg::ShaderParameterVec2fBase::createEmpty(), osg::ShaderParameterStringBase::createEmpty(), osg::ShaderParameterRealBase::createEmpty(), osg::ShaderParameterMVec4fBase::createEmpty(), osg::ShaderParameterMVec3fBase::createEmpty(), osg::ShaderParameterMVec2fBase::createEmpty(), osg::ShaderParameterMRealBase::createEmpty(), osg::ShaderParameterMMatrixBase::createEmpty(), osg::ShaderParameterMIntBase::createEmpty(), osg::ShaderParameterMatrixBase::createEmpty(), osg::ShaderParameterIntBase::createEmpty(), osg::ShaderParameterBoolBase::createEmpty(), osg::ScreenGroupBase::createEmpty(), osg::SClipPlaneChunkBase::createEmpty(), osg::ResolutionDisplayFilterBase::createEmpty(), osg::RenderOptionsBase::createEmpty(), osg::RegisterCombinersChunkBase::createEmpty(), osg::QTWindowBase::createEmpty(), osg::ProxyGroupBase::createEmpty(), osg::ProjectionCameraDecoratorBase::createEmpty(), osg::PolygonForegroundBase::createEmpty(), osg::PolygonChunkBase::createEmpty(), osg::PolygonBackgroundBase::createEmpty(), osg::PointLightBase::createEmpty(), osg::PointChunkBase::createEmpty(), osg::PhongMaterialBase::createEmpty(), osg::PerspectiveCameraBase::createEmpty(), osg::PassiveWindowBase::createEmpty(), osg::PassiveViewportBase::createEmpty(), osg::PassiveBackgroundBase::createEmpty(), osg::ParticlesBase::createEmpty(), osg::OrthographicCameraBase::createEmpty(), osg::OffCenterPerspectiveCameraBase::createEmpty(), osg::MultiPassMaterialBase::createEmpty(), osg::MultiDisplayWindowBase::createEmpty(), osg::MatrixCameraDecoratorBase::createEmpty(), osg::MatrixCameraBase::createEmpty(), osg::MaterialPoolBase::createEmpty(), osg::MaterialGroupBase::createEmpty(), osg::MaterialChunkBase::createEmpty(), osg::LogicOpChunkBase::createEmpty(), osg::LineChunkBase::createEmpty(), osg::LightModelChunkBase::createEmpty(), osg::LightEnvBase::createEmpty(), osg::LightChunkBase::createEmpty(), osg::InverseTransformBase::createEmpty(), osg::InlineBase::createEmpty(), osg::ImageForegroundBase::createEmpty(), osg::ImageBase::createEmpty(), osg::ImageBackgroundBase::createEmpty(), osg::GroupBase::createEmpty(), osg::GraphicStatisticsForegroundBase::createEmpty(), osg::GradientBackgroundBase::createEmpty(), osg::GrabForegroundBase::createEmpty(), osg::GLUTWindowBase::createEmpty(), osg::GeometryBase::createEmpty(), osg::FresnelMaterialBase::createEmpty(), osg::FragmentProgramChunkBase::createEmpty(), osg::FileGrabForegroundBase::createEmpty(), osg::FCPtrAttributeMapBase::createEmpty(), osg::FBOViewportBase::createEmpty(), osg::FatBorderChunkBase::createEmpty(), osg::DVRVolumeTextureBase::createEmpty(), osg::DVRVolumeBase::createEmpty(), osg::DVRSimpleShaderBase::createEmpty(), osg::DVRSimpleLUTShaderBase::createEmpty(), osg::DVRMtexLUTShaderBase::createEmpty(), osg::DVRLookupTableBase::createEmpty(), osg::DVRIsoSurfaceBase::createEmpty(), osg::DVRIsoShaderBase::createEmpty(), osg::DVRGeometryBase::createEmpty(), osg::DVRClipObjectsBase::createEmpty(), osg::DVRClipGeometryBase::createEmpty(), osg::DVRAppearanceBase::createEmpty(), osg::DistortionDisplayFilterBase::createEmpty(), osg::DistanceLODBase::createEmpty(), osg::DisplayFilterForegroundBase::createEmpty(), osg::DisplayCalibrationBase::createEmpty(), osg::DirectionalLightBase::createEmpty(), osg::DepthClearBackgroundBase::createEmpty(), osg::DepthChunkBase::createEmpty(), osg::CubeTextureChunkBase::createEmpty(), osg::ComponentTransformBase::createEmpty(), osg::ColorMaskChunkBase::createEmpty(), osg::ColorDisplayFilterBase::createEmpty(), osg::ColorBufferViewportBase::createEmpty(), osg::ClusterWindowBase::createEmpty(), osg::ClipPlaneChunkBase::createEmpty(), osg::ClipPlaneBase::createEmpty(), osg::ChunkMaterialBase::createEmpty(), osg::BlendChunkBase::createEmpty(), osg::BillboardBase::createEmpty(), osg::XWindowBase::shallowCopy(), osg::WIN32WindowBase::shallowCopy(), osg::ViewportBase::shallowCopy(), osg::VertexProgramChunkBase::shallowCopy(), osg::TwoSidedLightingChunkBase::shallowCopy(), osg::TransformChunkBase::shallowCopy(), osg::TransformBase::shallowCopy(), osg::TileCameraDecoratorBase::shallowCopy(), osg::TextureTransformChunkBase::shallowCopy(), osg::TextureGrabForegroundBase::shallowCopy(), osg::TextureGrabBackgroundBase::shallowCopy(), osg::TextureChunkBase::shallowCopy(), osg::TextureBackgroundBase::shallowCopy(), osg::TexGenChunkBase::shallowCopy(), osg::SwitchMaterialBase::shallowCopy(), osg::SwitchBase::shallowCopy(), osg::SurfaceBase::shallowCopy(), osg::StringAttributeMapBase::shallowCopy(), osg::StereoBufferViewportBase::shallowCopy(), osg::StencilChunkBase::shallowCopy(), osg::StateSortingGroupBase::shallowCopy(), osg::StateBase::shallowCopy(), osg::SpotLightBase::shallowCopy(), osg::SortFirstWindowBase::shallowCopy(), osg::SolidBackgroundBase::shallowCopy(), osg::SlicesBase::shallowCopy(), osg::SkyBackgroundBase::shallowCopy(), osg::SimpleTexturedMaterialBase::shallowCopy(), osg::SimpleStatisticsForegroundBase::shallowCopy(), osg::SimpleMaterialBase::shallowCopy(), osg::SHLParameterChunkBase::shallowCopy(), osg::SHLChunkBase::shallowCopy(), osg::ShearedStereoCameraDecoratorBase::shallowCopy(), osg::ShaderParameterVec4fBase::shallowCopy(), osg::ShaderParameterVec3fBase::shallowCopy(), osg::ShaderParameterVec2fBase::shallowCopy(), osg::ShaderParameterStringBase::shallowCopy(), osg::ShaderParameterRealBase::shallowCopy(), osg::ShaderParameterMVec4fBase::shallowCopy(), osg::ShaderParameterMVec3fBase::shallowCopy(), osg::ShaderParameterMVec2fBase::shallowCopy(), osg::ShaderParameterMRealBase::shallowCopy(), osg::ShaderParameterMMatrixBase::shallowCopy(), osg::ShaderParameterMIntBase::shallowCopy(), osg::ShaderParameterMatrixBase::shallowCopy(), osg::ShaderParameterIntBase::shallowCopy(), osg::ShaderParameterBoolBase::shallowCopy(), osg::ScreenGroupBase::shallowCopy(), osg::SClipPlaneChunkBase::shallowCopy(), osg::ResolutionDisplayFilterBase::shallowCopy(), osg::RenderOptionsBase::shallowCopy(), osg::RegisterCombinersChunkBase::shallowCopy(), osg::QTWindowBase::shallowCopy(), osg::ProxyGroupBase::shallowCopy(), osg::ProjectionCameraDecoratorBase::shallowCopy(), osg::PolygonForegroundBase::shallowCopy(), osg::PolygonChunkBase::shallowCopy(), osg::PolygonBackgroundBase::shallowCopy(), osg::PointLightBase::shallowCopy(), osg::PointChunkBase::shallowCopy(), osg::PhongMaterialBase::shallowCopy(), osg::PerspectiveCameraBase::shallowCopy(), osg::PassiveWindowBase::shallowCopy(), osg::PassiveViewportBase::shallowCopy(), osg::PassiveBackgroundBase::shallowCopy(), osg::ParticlesBase::shallowCopy(), osg::OrthographicCameraBase::shallowCopy(), osg::OffCenterPerspectiveCameraBase::shallowCopy(), osg::MultiPassMaterialBase::shallowCopy(), osg::MultiDisplayWindowBase::shallowCopy(), osg::MatrixCameraDecoratorBase::shallowCopy(), osg::MatrixCameraBase::shallowCopy(), osg::MaterialPoolBase::shallowCopy(), osg::MaterialGroupBase::shallowCopy(), osg::MaterialChunkBase::shallowCopy(), osg::LogicOpChunkBase::shallowCopy(), osg::LineChunkBase::shallowCopy(), osg::LightModelChunkBase::shallowCopy(), osg::LightEnvBase::shallowCopy(), osg::LightChunkBase::shallowCopy(), osg::InverseTransformBase::shallowCopy(), osg::InlineBase::shallowCopy(), osg::ImageForegroundBase::shallowCopy(), osg::ImageBase::shallowCopy(), osg::ImageBackgroundBase::shallowCopy(), osg::GroupBase::shallowCopy(), osg::GraphicStatisticsForegroundBase::shallowCopy(), osg::GradientBackgroundBase::shallowCopy(), osg::GrabForegroundBase::shallowCopy(), osg::GLUTWindowBase::shallowCopy(), osg::GeometryBase::shallowCopy(), osg::FresnelMaterialBase::shallowCopy(), osg::FragmentProgramChunkBase::shallowCopy(), osg::FileGrabForegroundBase::shallowCopy(), osg::FCPtrAttributeMapBase::shallowCopy(), osg::FBOViewportBase::shallowCopy(), osg::FatBorderChunkBase::shallowCopy(), osg::DVRVolumeTextureBase::shallowCopy(), osg::DVRVolumeBase::shallowCopy(), osg::DVRSimpleShaderBase::shallowCopy(), osg::DVRSimpleLUTShaderBase::shallowCopy(), osg::DVRMtexLUTShaderBase::shallowCopy(), osg::DVRLookupTableBase::shallowCopy(), osg::DVRIsoSurfaceBase::shallowCopy(), osg::DVRIsoShaderBase::shallowCopy(), osg::DVRGeometryBase::shallowCopy(), osg::DVRClipObjectsBase::shallowCopy(), osg::DVRClipGeometryBase::shallowCopy(), osg::DVRAppearanceBase::shallowCopy(), osg::DistortionDisplayFilterBase::shallowCopy(), osg::DistanceLODBase::shallowCopy(), osg::DisplayFilterForegroundBase::shallowCopy(), osg::DisplayCalibrationBase::shallowCopy(), osg::DirectionalLightBase::shallowCopy(), osg::DepthClearBackgroundBase::shallowCopy(), osg::DepthChunkBase::shallowCopy(), osg::CubeTextureChunkBase::shallowCopy(), osg::ComponentTransformBase::shallowCopy(), osg::ColorMaskChunkBase::shallowCopy(), osg::ColorDisplayFilterBase::shallowCopy(), osg::ColorBufferViewportBase::shallowCopy(), osg::ClusterWindowBase::shallowCopy(), osg::ClipPlaneChunkBase::shallowCopy(), osg::ClipPlaneBase::shallowCopy(), osg::ChunkMaterialBase::shallowCopy(), osg::BlendChunkBase::shallowCopy(), and osg::BillboardBase::shallowCopy().

00141 {
00142     typedef typename ObjectPtrT::StoredObjectType ObjectType;
00143     
00144     UInt8 *pTmp;
00145     
00146     result._containerSize = sizeof(ObjectType);
00147     
00148     pTmp        = 
00149         static_cast<UInt8 *>(operator new(
00150             sizeof(Int32)      + // ReferenceCount
00151             sizeof(UInt32)     + // ContainerId
00152             sizeof(ObjectType) * ThreadManager::getNumAspects()));
00153     
00154     *(reinterpret_cast<Int32 *>(pTmp)) = 0;
00155     
00156     pTmp += sizeof(Int32);
00157     
00158     result._storeP = (pTmp + sizeof(UInt32));
00159 
00160 #ifdef OSG_DEBUG_FCPTR
00161     result._typedStoreP = reinterpret_cast<FieldContainer *>(result._storeP);
00162 #endif
00163 
00164     *(reinterpret_cast<UInt32 *>(pTmp)) = 
00165         FieldContainerFactory::the()->registerFieldContainer(result);
00166     
00167     Thread::getCurrentChangeList()->addCreated(
00168         *(reinterpret_cast<UInt32 *>(pTmp)));
00169     
00170     pTmp += sizeof(UInt32);
00171     
00172     ObjectType *aObject = reinterpret_cast<ObjectType *>(pTmp);
00173 
00174     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00175     {
00176         pTmp = 
00177             reinterpret_cast<UInt8 *>(new (pTmp) ObjectType(*prototypeP));
00178         
00179         pTmp += sizeof(ObjectType);
00180     }
00181     
00182     result->onCreate(prototypeP);
00183 
00184     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00185     {
00186         aObject[i].onCreateAspect(aObject, prototypeP);
00187     }
00188 
00189 #if defined(OSG_GV_BETA) && defined(OSG_DBG_MEM)
00190 
00191     fprintf(stderr, "GV_MEM_FC_DBG : (%u) cc (%p|%u)\n", 
00192             Thread::getAspect(),
00193             result._storeP,
00194 //            ObjectType::getClassType().getCName(),
00195             ObjectType::getClassType().getId());
00196 #endif
00197 
00198 #ifdef OSG_DEBUG_TYPED_FCPTR
00199     result.updateTypedStore();
00200 #endif
00201 }

template<class ObjectPtrT>
void osg::FieldContainer::newPtr ( ObjectPtrT &  result  )  [inline, static, protected, inherited]

Definition at line 204 of file OSGFieldContainerImpl.inl.

References osg::ChangeList::addCreated(), osg::PThreadBase::getAspect(), osg::PThreadBase::getCurrentChangeList(), osg::ThreadManager::getNumAspects(), osg::FieldContainerFactory::registerFieldContainer(), and osg::FieldContainerFactory::the().

00205 {
00206     typedef typename ObjectPtrT::StoredObjectType ObjectType;
00207     
00208     UInt8 *pTmp;
00209     
00210     result._containerSize = sizeof(ObjectType);
00211     
00212     pTmp        =             
00213         static_cast<UInt8 *>(operator new(
00214             sizeof(Int32)      + // ReferenceCount
00215             sizeof(UInt32)     + // ContainerId
00216             sizeof(ObjectType) * ThreadManager::getNumAspects()));
00217     
00218     *(reinterpret_cast<Int32 *>(pTmp)) = 0;
00219     
00220     pTmp  += sizeof(Int32);
00221     
00222     result._storeP = (pTmp + sizeof(UInt32));
00223     
00224 #ifdef OSG_DEBUG_FCPTR
00225     result._typedStoreP = reinterpret_cast<FieldContainer *>(result._storeP);
00226 #endif
00227 
00228     *(reinterpret_cast<UInt32 *>(pTmp)) = 
00229         FieldContainerFactory::the()->registerFieldContainer(result);
00230     
00231     Thread::getCurrentChangeList()->addCreated(
00232         *(reinterpret_cast<UInt32 *>(pTmp)));
00233     
00234     pTmp += sizeof(UInt32);
00235     
00236     ObjectType *aObject = reinterpret_cast<ObjectType *>(pTmp);
00237 
00238     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00239     {
00240         pTmp = reinterpret_cast<UInt8 *>(new (pTmp) ObjectType());
00241         
00242         pTmp += sizeof(ObjectType);
00243     }
00244     
00245     result->onCreate();
00246     
00247     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00248     {
00249         aObject[i].onCreateAspect(aObject);
00250     }
00251 
00252 #if defined(OSG_GV_BETA) && defined(OSG_DBG_MEM)
00253     fprintf(stderr, "GV_MEM_FC_DBG : (%u) c (%p|%u)\n", 
00254             Thread::getAspect(),
00255             result._storeP,
00256 //            ObjectType::getClassType().getCName(),
00257             ObjectType::getClassType().getId());
00258 #endif
00259     
00260 #ifdef OSG_DEBUG_TYPED_FCPTR
00261     result.updateTypedStore();
00262 #endif
00263 }

template<class FieldTypeT>
void osg::FieldContainer::beginEditX ( const BitVector whichField,
FieldTypeT &  field 
) [inline, protected, inherited]

Definition at line 285 of file OSGFieldContainerImpl.inl.

00286 {
00287 //    fieldR.beginEdit();
00288 }

template<class FieldTypeT>
void osg::FieldContainer::endEditX ( const BitVector whichField,
FieldTypeT &  field 
) [inline, protected, inherited]

Definition at line 291 of file OSGFieldContainerImpl.inl.

References osg::endEditCP().

00292 {
00293     FieldContainerPtr tmpPtr(this);
00294     endEditCP(tmpPtr, whichField);
00295 }

void osg::FieldContainer::onCreate ( const FieldContainer source = NULL  )  [inline, protected, inherited]

Definition at line 318 of file OSGFieldContainerImpl.inl.

Referenced by osg::ShaderParameterChunk::onCreate().

00319 {
00320 }

void osg::FieldContainer::onCreateAspect ( const FieldContainer aspect0,
const FieldContainer source = NULL 
) [inline, protected, inherited]

Definition at line 323 of file OSGFieldContainerImpl.inl.

00325 {
00326 }

void FieldContainer::onDestroy ( void   )  [protected, virtual, inherited]


Friends And Related Function Documentation

friend class FieldContainer [friend]

Reimplemented from osg::ImageBase.

Definition at line 401 of file OSGImage.h.

friend class ImageBase [friend]

Definition at line 402 of file OSGImage.h.


Member Data Documentation

Int32 Image::_formatDic [static, protected]

Initial value:

Static dictionary to map pixelData values to the bytes per pixel (bpp) value. Internaly used in the createData() method.

Definition at line 363 of file OSGImage.h.

Referenced by createData(), and getComponents().

Int32 Image::_typeDic [static, protected]

Initial value:

Static dictionary to map pixelData values to the bytes per pixel (bpp) value. Internaly used in the createData() method.

Definition at line 364 of file OSGImage.h.

Referenced by changed(), and createData().

Initial value:

 
    (TypeTraits<BitVector>::One << ImageBase::WidthFieldId)

Definition at line 146 of file OSGImageBase.h.

Referenced by osg::ImageBase::copyFromBin(), osg::ImageBase::copyToBin(), osg::ImageBase::executeSyncImpl(), and osg::ImageBase::getBinSize().

Initial value:

 
    (TypeTraits<BitVector>::One << ImageBase::DepthFieldId)

Definition at line 148 of file OSGImageBase.h.

Referenced by osg::ImageBase::copyFromBin(), osg::ImageBase::copyToBin(), osg::ImageBase::executeSyncImpl(), and osg::ImageBase::getBinSize().

const osg::BitVector osg::ImageBase::BppFieldMask [static, inherited]

const osg::BitVector osg::ImageBase::NameFieldMask [static, inherited]

const osg::BitVector osg::ImageBase::ResXFieldMask [static, inherited]

Initial value:

 
    (TypeTraits<BitVector>::One << ImageBase::ResXFieldId)

Definition at line 165 of file OSGImageBase.h.

Referenced by osg::ImageBase::copyFromBin(), osg::ImageBase::copyToBin(), osg::ImageBase::executeSyncImpl(), and osg::ImageBase::getBinSize().

const osg::BitVector osg::ImageBase::ResYFieldMask [static, inherited]

Initial value:

 
    (TypeTraits<BitVector>::One << ImageBase::ResYFieldId)

Definition at line 166 of file OSGImageBase.h.

Referenced by osg::ImageBase::copyFromBin(), osg::ImageBase::copyToBin(), osg::ImageBase::executeSyncImpl(), and osg::ImageBase::getBinSize().

Initial value:

 
    (Inherited::MTInfluenceMask) | 
    (static_cast<BitVector>(0x0) << Inherited::NextFieldId)

Reimplemented from osg::FieldContainer.

Definition at line 170 of file OSGImageBase.h.

Int32 osg::ImageBase::_sfDimension [protected, inherited]

Int32 osg::ImageBase::_sfWidth [protected, inherited]

Int32 osg::ImageBase::_sfHeight [protected, inherited]

Int32 osg::ImageBase::_sfDepth [protected, inherited]

Int32 osg::ImageBase::_sfBpp [protected, inherited]

Int32 osg::ImageBase::_sfMipMapCount [protected, inherited]

Int32 osg::ImageBase::_sfFrameCount [protected, inherited]

Time osg::ImageBase::_sfFrameDelay [protected, inherited]

UInt32 osg::ImageBase::_sfPixelFormat [protected, inherited]

UInt8 osg::ImageBase::_mfPixel [protected, inherited]

Int32 osg::ImageBase::_sfFrameSize [protected, inherited]

std::string osg::ImageBase::_sfName [protected, inherited]

Int32 osg::ImageBase::_sfDataType [protected, inherited]

Int32 osg::ImageBase::_sfComponentSize [protected, inherited]

Size (in byte) of a single component of the image. Necessary for High Dynamic Range and other higher-level image types.

Definition at line 349 of file OSGImageBase.h.

Referenced by osg::ImageBase::copyFromBin(), osg::ImageBase::copyToBin(), osg::ImageBase::executeSyncImpl(), osg::ImageBase::getBinSize(), osg::ImageBase::getComponentSize(), osg::ImageBase::getSFComponentSize(), and osg::ImageBase::setComponentSize().

Int32 osg::ImageBase::_sfSideCount [protected, inherited]

Int32 osg::ImageBase::_sfSideSize [protected, inherited]

bool osg::ImageBase::_sfForceCompressedData [protected, inherited]

Set to true if using the image to keep unknown data for textures. Generally used in conjunction with TextureChunk::externalFormat.

Definition at line 352 of file OSGImageBase.h.

Referenced by osg::ImageBase::copyFromBin(), osg::ImageBase::copyToBin(), osg::ImageBase::executeSyncImpl(), osg::ImageBase::getBinSize(), osg::ImageBase::getForceCompressedData(), osg::ImageBase::getSFForceCompressedData(), and osg::ImageBase::setForceCompressedData().

bool osg::ImageBase::_sfForceAlphaChannel [protected, inherited]

Set to true if using the image to keep unknown data for textures. Generally used in conjunction with TextureChunk::externalFormat.

Definition at line 353 of file OSGImageBase.h.

Referenced by osg::ImageBase::copyFromBin(), osg::ImageBase::copyToBin(), osg::ImageBase::executeSyncImpl(), osg::ImageBase::getBinSize(), osg::ImageBase::getForceAlphaChannel(), osg::ImageBase::getSFForceAlphaChannel(), and osg::ImageBase::setForceAlphaChannel().

bool osg::ImageBase::_sfForceColorChannel [protected, inherited]

Set to true if using the image to keep unknown data for textures. Generally used in conjunction with TextureChunk::externalFormat.

Definition at line 354 of file OSGImageBase.h.

Referenced by osg::ImageBase::copyFromBin(), osg::ImageBase::copyToBin(), osg::ImageBase::executeSyncImpl(), osg::ImageBase::getBinSize(), osg::ImageBase::getForceColorChannel(), osg::ImageBase::getSFForceColorChannel(), and osg::ImageBase::setForceColorChannel().

bool osg::ImageBase::_sfForceAlphaBinary [protected, inherited]

Real32 osg::ImageBase::_sfResX [protected, inherited]

Real32 osg::ImageBase::_sfResY [protected, inherited]

UInt16 osg::ImageBase::_sfResUnit [protected, inherited]

const BitVector osg::FieldContainer::NextFieldMask [static, inherited]

Initial value:

 
                    (TypeTraits<BitVector>::One << NextFieldId)

Definition at line 75 of file OSGFieldContainerImpl.h.

const bool osg::FieldContainer::isNodeCore = false [static, inherited]

Reimplemented in osg::NodeCore.

Definition at line 181 of file OSGFieldContainerImpl.h.

UInt32 osg::FieldContainer::_shares [protected, inherited]

Definition at line 199 of file OSGFieldContainerImpl.h.


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 12:05:45 2008 for OpenSG by  doxygen 1.5.5