Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGImage.inl

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *               Copyright (C) 2000-2002 by the OpenSG Forum                 *
00006  *                                                                           *
00007  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00008  *                                                                           *
00009 \*---------------------------------------------------------------------------*/
00010 /*---------------------------------------------------------------------------*\
00011  *                                License                                    *
00012  *                                                                           *
00013  * This library is free software; you can redistribute it and/or modify it   *
00014  * under the terms of the GNU Library General Public License as published    *
00015  * by the Free Software Foundation, version 2.                               *
00016  *                                                                           *
00017  * This library is distributed in the hope that it will be useful, but       *
00018  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00020  * Library General Public License for more details.                          *
00021  *                                                                           *
00022  * You should have received a copy of the GNU Library General Public         *
00023  * License along with this library; if not, write to the Free Software       *
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00025  *                                                                           *
00026 \*---------------------------------------------------------------------------*/
00027 /*---------------------------------------------------------------------------*\
00028  *                                Changes                                    *
00029  *                                                                           *
00030  *                                                                           *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035 \*---------------------------------------------------------------------------*/
00036 
00037 //---------------------------------------------------------------------------
00038 //  Includes
00039 //---------------------------------------------------------------------------
00040 
00041 #include <OSGConfig.h>
00042 
00043 OSG_BEGIN_NAMESPACE
00044 
00047 inline unsigned long Image::getSize ( bool withMipmap,
00048                                       bool withFrames,
00049                                       bool withSides ) const
00050 { 
00051     return  ( calcMipmapSumSize((withMipmap ? getMipMapCount() : 1)) *
00052               (withSides  ? getSideCount() : 1) *
00053               (withFrames ? getFrameCount() : 1) ); 
00054 }
00055 
00058 inline UInt8 *Image::getData( UInt32 mipmapNum, 
00059                               UInt32 frameNum,
00060                               UInt32 sideNum )
00061 {
00062     if(getPixel().empty())
00063         return NULL;
00064 
00065     UInt8 *data = (&getPixel()[0]) + 
00066       (sideNum * getSideSize()) +
00067       (frameNum * getFrameSize());
00068     
00069     if (mipmapNum)
00070     {
00071         data += calcMipmapSumSize(mipmapNum);
00072     }
00073   
00074     return data;
00075 }
00076 
00079 inline const UInt8 *Image::getData( UInt32 mipmapNum, 
00080                                     UInt32 frameNum,
00081                                     UInt32 sideNum ) const
00082 {
00083     if(getPixel().empty())
00084         return NULL;
00085 
00086     const UInt8 *data = (&getPixel()[0]) + 
00087       (sideNum * getSideSize()) +
00088       (frameNum * getFrameSize());
00089     
00090     if (mipmapNum)
00091     {
00092         data += calcMipmapSumSize(mipmapNum);
00093     }
00094   
00095     return data;
00096 }
00097 
00098 // Specialization for Image we need this to support VRML PixelTextures.
00099 template <> inline
00100 void SFImagePtr::pushValueByStr(const Char8 *str)
00101 {
00102     if(getValue() != NullFC)
00103         getValue()->addValue(str);
00104 }
00105 
00106 OSG_END_NAMESPACE
00107 
00108 #define OSGIMAGE_INLINE_CVSID "@(#)$Id: $"
00109 

Generated on Thu Aug 25 04:06:01 2005 for OpenSG by  doxygen 1.4.3