<html> <head> <title>OgreImage.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link type="text/css" rel="stylesheet" href="style.css"> </head> <body> <!-- Generated by Doxygen 1.3.6 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> <h1>OgreImage.h</h1><a href="OgreImage_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> 00002 <span class="comment">-----------------------------------------------------------------------------</span> 00003 <span class="comment">This source file is part of OGRE</span> 00004 <span class="comment"> (Object-oriented Graphics Rendering Engine)</span> 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> 00006 <span class="comment"></span> 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> 00008 <span class="comment">Also see acknowledgements in Readme.html</span> 00009 <span class="comment"></span> 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> 00013 <span class="comment">version.</span> 00014 <span class="comment"></span> 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> 00018 <span class="comment"></span> 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> 00023 <span class="comment">-----------------------------------------------------------------------------</span> 00024 <span class="comment">*/</span> 00025 <span class="preprocessor">#ifndef _Image_H__</span> 00026 <span class="preprocessor"></span><span class="preprocessor">#define _Image_H__</span> 00027 <span class="preprocessor"></span> 00028 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span> 00029 <span class="preprocessor">#include "<a class="code" href="OgreCommon_8h.html">OgreCommon.h</a>"</span> 00030 <span class="preprocessor">#include "<a class="code" href="OgrePixelFormat_8h.html">OgrePixelFormat.h</a>"</span> 00031 <span class="preprocessor">#include "<a class="code" href="OgreDataStream_8h.html">OgreDataStream.h</a>"</span> 00032 00033 <span class="keyword">namespace </span>Ogre { 00034 <a name="l00035"></a><a class="code" href="namespaceOgre.html#a656">00035</a> <span class="keyword">enum</span> <a class="code" href="namespaceOgre.html#a656">ImageFlags</a> 00036 { 00037 <a class="code" href="namespaceOgre.html#a656a160">IF_COMPRESSED</a> = 0x00000001, 00038 <a class="code" href="namespaceOgre.html#a656a161">IF_CUBEMAP</a> = 0x00000002, 00039 <a class="code" href="namespaceOgre.html#a656a162">IF_3D_TEXTURE</a> = 0x00000004 00040 }; <a name="l00052"></a><a class="code" href="classOgre_1_1Image.html">00052</a> <span class="keyword">class </span><a class="code" href="OgrePlatform_8h.html#a13">_OgreExport</a> Image 00053 { 00054 <span class="keyword">public</span>: <a name="l00055"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imagew0">00055</a> <span class="keyword">typedef</span> <a class="code" href="structOgre_1_1Box.html">Ogre::Box</a> <a class="code" href="structOgre_1_1Box.html">Box</a>; <a name="l00056"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imagew1">00056</a> <span class="keyword">typedef</span> <a class="code" href="structOgre_1_1Rect.html">Ogre::Rect</a> <a class="code" href="structOgre_1_1Rect.html">Rect</a>; 00057 <span class="keyword">public</span>: 00060 Image(); 00063 Image( <span class="keyword">const</span> Image &img ); 00064 00067 <span class="keyword">virtual</span> ~Image(); 00068 00071 Image & operator = ( <span class="keyword">const</span> Image & img ); 00072 00092 Image & flipAroundY(); 00093 00108 Image & flipAroundX(); 00109 00139 Image& Image::loadDynamicImage( <a class="code" href="namespaceOgre.html#a421">uchar</a>* pData, size_t uWidth, size_t uHeight, 00140 size_t depth, 00141 PixelFormat eFormat, <span class="keywordtype">bool</span> autoDelete = <span class="keyword">false</span>, 00142 size_t numFaces = 1, size_t numMipMaps = 0); 00143 <a name="l00165"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imagea7">00165</a> Image& loadDynamicImage( <a class="code" href="namespaceOgre.html#a421">uchar</a>* pData, size_t uWidth, 00166 size_t uHeight, PixelFormat eFormat) 00167 { 00168 <span class="keywordflow">return</span> loadDynamicImage(pData, uWidth, uHeight, 1, eFormat); 00169 } 00175 Image & loadRawData( 00176 <a class="code" href="classOgre_1_1SharedPtr.html">DataStreamPtr</a>& stream, 00177 size_t uWidth, size_t uHeight, size_t uDepth, 00178 PixelFormat eFormat, 00179 size_t numFaces = 1, size_t numMipMaps = 0); <a name="l00185"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imagea9">00185</a> Image & loadRawData( 00186 <a class="code" href="classOgre_1_1SharedPtr.html">DataStreamPtr</a>& stream, 00187 size_t uWidth, size_t uHeight, 00188 PixelFormat eFormat ) 00189 { 00190 <span class="keywordflow">return</span> loadRawData(stream, uWidth, uHeight, 1, eFormat); 00191 } 00192 00207 Image & load( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& strFileName, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& groupName ); 00208 00223 Image & load(<a class="code" href="classOgre_1_1SharedPtr.html">DataStreamPtr</a>& stream, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& type ); 00224 00226 <span class="keywordtype">void</span> save(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& filename); 00227 00230 <a class="code" href="namespaceOgre.html#a421">uchar</a>* getData(<span class="keywordtype">void</span>); 00231 00234 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a421">uchar</a> * getData() <span class="keyword">const</span>; 00235 00238 size_t getSize() <span class="keyword">const</span>; 00239 00242 size_t getNumMipmaps() <span class="keyword">const</span>; 00243 00246 <span class="keywordtype">bool</span> hasFlag(<span class="keyword">const</span> ImageFlags imgFlag) <span class="keyword">const</span>; 00247 00250 size_t getWidth(<span class="keywordtype">void</span>) <span class="keyword">const</span>; 00251 00254 size_t getHeight(<span class="keywordtype">void</span>) <span class="keyword">const</span>; 00255 00258 size_t getDepth(<span class="keywordtype">void</span>) <span class="keyword">const</span>; 00259 00263 size_t getNumFaces(<span class="keywordtype">void</span>) <span class="keyword">const</span>; 00264 00267 size_t getRowSpan(<span class="keywordtype">void</span>) <span class="keyword">const</span>; 00268 00271 <a class="code" href="namespaceOgre.html#a666">PixelFormat</a> getFormat() <span class="keyword">const</span>; 00272 00275 <a class="code" href="namespaceOgre.html#a421">uchar</a> getBPP() <span class="keyword">const</span>; 00276 00279 <span class="keywordtype">bool</span> getHasAlpha() <span class="keyword">const</span>; 00280 00286 <span class="keyword">static</span> <span class="keywordtype">void</span> applyGamma( <a class="code" href="namespaceOgre.html#a421">uchar</a> *buffer, <a class="code" href="namespaceOgre.html#a420">Real</a> gamma, size_t size, <a class="code" href="namespaceOgre.html#a421">uchar</a> bpp ); 00287 00293 <a class="code" href="classOgre_1_1ColourValue.html">ColourValue</a> getColourAt(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> z); 00294 00298 <a class="code" href="classOgre_1_1PixelBox.html">PixelBox</a> getPixelBox(size_t face = 0, size_t mipmap = 0) <span class="keyword">const</span>; 00299 <a name="l00300"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imagew8">00300</a> <span class="keyword">enum</span> Filter 00301 { 00302 FILTER_NEAREST, 00303 FILTER_LINEAR, 00304 FILTER_BILINEAR, 00305 FILTER_BOX, 00306 FILTER_TRIANGLE, 00307 FILTER_BICUBIC 00308 }; 00316 <span class="keyword">static</span> <span class="keywordtype">void</span> scale(<span class="keyword">const</span> <a class="code" href="classOgre_1_1PixelBox.html">PixelBox</a> &src, <span class="keyword">const</span> <a class="code" href="classOgre_1_1PixelBox.html">PixelBox</a> &dst, Filter filter = FILTER_BILINEAR); 00317 00319 <span class="keywordtype">void</span> resize(<a class="code" href="namespaceOgre.html#a422">ushort</a> width, <a class="code" href="namespaceOgre.html#a422">ushort</a> height, Filter filter = FILTER_BILINEAR); 00320 00321 00322 <span class="keyword">private</span>: 00323 <span class="comment">// The width of the image in pixels</span> <a name="l00324"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager0">00324</a> size_t m_uWidth; 00325 <span class="comment">// The height of the image in pixels</span> <a name="l00326"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager1">00326</a> size_t m_uHeight; 00327 <span class="comment">// The depth of the image</span> <a name="l00328"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager2">00328</a> size_t m_uDepth; 00329 <span class="comment">// The size of the image buffer</span> <a name="l00330"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager3">00330</a> size_t m_uSize; 00331 <span class="comment">// The number of mipmaps the image contains</span> <a name="l00332"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager4">00332</a> size_t m_uNumMipmaps; 00333 <span class="comment">// Image specific flags.</span> <a name="l00334"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager5">00334</a> <span class="keywordtype">int</span> m_uFlags; 00335 00336 <span class="comment">// The pixel format of the image</span> <a name="l00337"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager6">00337</a> <a class="code" href="namespaceOgre.html#a666">PixelFormat</a> m_eFormat; 00338 00339 <span class="comment">// The number of bytes per pixel</span> <a name="l00340"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager7">00340</a> <a class="code" href="namespaceOgre.html#a421">uchar</a> m_ucPixelSize; <a name="l00341"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager8">00341</a> <a class="code" href="namespaceOgre.html#a421">uchar</a>* m_pBuffer; 00342 00343 <span class="comment">// A bool to determine if we delete the buffer or the calling app does</span> <a name="l00344"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager9">00344</a> <span class="keywordtype">bool</span> m_bAutoDelete; 00345 }; 00346 00347 } <span class="comment">// namespace</span> 00348 00349 <span class="preprocessor">#endif</span> </pre></div><p> Copyright © 2000-2005 by The OGRE Team<br /> Last modified Wed Feb 23 00:19:07 2005 </p> </body> </html>