1 | <html> |
---|
2 | <head> |
---|
3 | <title>OgreImage.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
4 | <link type="text/css" rel="stylesheet" href="style.css"> |
---|
5 | </head> |
---|
6 | |
---|
7 | <body> |
---|
8 | <!-- Generated by Doxygen 1.3.6 --> |
---|
9 | <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> |
---|
10 | <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> |
---|
11 | 00002 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
12 | 00003 <span class="comment">This source file is part of OGRE</span> |
---|
13 | 00004 <span class="comment"> (Object-oriented Graphics Rendering Engine)</span> |
---|
14 | 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> |
---|
15 | 00006 <span class="comment"></span> |
---|
16 | 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> |
---|
17 | 00008 <span class="comment">Also see acknowledgements in Readme.html</span> |
---|
18 | 00009 <span class="comment"></span> |
---|
19 | 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> |
---|
20 | 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> |
---|
21 | 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> |
---|
22 | 00013 <span class="comment">version.</span> |
---|
23 | 00014 <span class="comment"></span> |
---|
24 | 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> |
---|
25 | 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> |
---|
26 | 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> |
---|
27 | 00018 <span class="comment"></span> |
---|
28 | 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> |
---|
29 | 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> |
---|
30 | 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> |
---|
31 | 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> |
---|
32 | 00023 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
33 | 00024 <span class="comment">*/</span> |
---|
34 | 00025 <span class="preprocessor">#ifndef _Image_H__</span> |
---|
35 | 00026 <span class="preprocessor"></span><span class="preprocessor">#define _Image_H__</span> |
---|
36 | 00027 <span class="preprocessor"></span> |
---|
37 | 00028 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span> |
---|
38 | 00029 <span class="preprocessor">#include "<a class="code" href="OgreCommon_8h.html">OgreCommon.h</a>"</span> |
---|
39 | 00030 <span class="preprocessor">#include "<a class="code" href="OgrePixelFormat_8h.html">OgrePixelFormat.h</a>"</span> |
---|
40 | 00031 <span class="preprocessor">#include "<a class="code" href="OgreDataStream_8h.html">OgreDataStream.h</a>"</span> |
---|
41 | 00032 |
---|
42 | 00033 <span class="keyword">namespace </span>Ogre { |
---|
43 | 00034 |
---|
44 | <a name="l00035"></a><a class="code" href="namespaceOgre.html#a661">00035</a> <span class="keyword">enum</span> <a class="code" href="namespaceOgre.html#a661">ImageFlags</a> |
---|
45 | 00036 { |
---|
46 | 00037 <a class="code" href="namespaceOgre.html#a661a188">IF_COMPRESSED</a> = 0x00000001, |
---|
47 | 00038 <a class="code" href="namespaceOgre.html#a661a189">IF_CUBEMAP</a> = 0x00000002, |
---|
48 | 00039 <a class="code" href="namespaceOgre.html#a661a190">IF_3D_TEXTURE</a> = 0x00000004 |
---|
49 | 00040 }; |
---|
50 | <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#a16">_OgreExport</a> Image |
---|
51 | 00053 { |
---|
52 | 00054 <span class="keyword">public</span>: |
---|
53 | <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>; |
---|
54 | <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_1TRect.html">Ogre::Rect</a> <a class="code" href="structOgre_1_1TRect.html">Rect</a>; |
---|
55 | 00057 <span class="keyword">public</span>: |
---|
56 | 00060 Image(); |
---|
57 | 00063 Image( <span class="keyword">const</span> Image &img ); |
---|
58 | 00064 |
---|
59 | 00067 <span class="keyword">virtual</span> ~Image(); |
---|
60 | 00068 |
---|
61 | 00071 Image & operator = ( <span class="keyword">const</span> Image & img ); |
---|
62 | 00072 |
---|
63 | 00092 Image & flipAroundY(); |
---|
64 | 00093 |
---|
65 | 00108 Image & flipAroundX(); |
---|
66 | 00109 |
---|
67 | 00139 Image& loadDynamicImage( <a class="code" href="namespaceOgre.html#a466">uchar</a>* pData, size_t uWidth, size_t uHeight, |
---|
68 | 00140 size_t depth, |
---|
69 | 00141 PixelFormat eFormat, <span class="keywordtype">bool</span> autoDelete = <span class="keyword">false</span>, |
---|
70 | 00142 size_t numFaces = 1, size_t numMipMaps = 0); |
---|
71 | 00143 |
---|
72 | <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#a466">uchar</a>* pData, size_t uWidth, |
---|
73 | 00166 size_t uHeight, PixelFormat eFormat) |
---|
74 | 00167 { |
---|
75 | 00168 <span class="keywordflow">return</span> loadDynamicImage(pData, uWidth, uHeight, 1, eFormat); |
---|
76 | 00169 } |
---|
77 | 00175 Image & loadRawData( |
---|
78 | 00176 <a class="code" href="classOgre_1_1SharedPtr.html">DataStreamPtr</a>& stream, |
---|
79 | 00177 size_t uWidth, size_t uHeight, size_t uDepth, |
---|
80 | 00178 PixelFormat eFormat, |
---|
81 | 00179 size_t numFaces = 1, size_t numMipMaps = 0); |
---|
82 | <a name="l00185"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imagea9">00185</a> Image & loadRawData( |
---|
83 | 00186 <a class="code" href="classOgre_1_1SharedPtr.html">DataStreamPtr</a>& stream, |
---|
84 | 00187 size_t uWidth, size_t uHeight, |
---|
85 | 00188 PixelFormat eFormat ) |
---|
86 | 00189 { |
---|
87 | 00190 <span class="keywordflow">return</span> loadRawData(stream, uWidth, uHeight, 1, eFormat); |
---|
88 | 00191 } |
---|
89 | 00192 |
---|
90 | 00207 Image & load( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& strFileName, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& groupName ); |
---|
91 | 00208 |
---|
92 | 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#a471">String</a>& type ); |
---|
93 | 00224 |
---|
94 | 00226 <span class="keywordtype">void</span> save(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& filename); |
---|
95 | 00227 |
---|
96 | 00230 <a class="code" href="namespaceOgre.html#a466">uchar</a>* getData(<span class="keywordtype">void</span>); |
---|
97 | 00231 |
---|
98 | 00234 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a466">uchar</a> * getData() <span class="keyword">const</span>; |
---|
99 | 00235 |
---|
100 | 00238 size_t getSize() <span class="keyword">const</span>; |
---|
101 | 00239 |
---|
102 | 00242 size_t getNumMipmaps() <span class="keyword">const</span>; |
---|
103 | 00243 |
---|
104 | 00246 <span class="keywordtype">bool</span> hasFlag(<span class="keyword">const</span> ImageFlags imgFlag) <span class="keyword">const</span>; |
---|
105 | 00247 |
---|
106 | 00250 size_t getWidth(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
107 | 00251 |
---|
108 | 00254 size_t getHeight(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
109 | 00255 |
---|
110 | 00258 size_t getDepth(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
111 | 00259 |
---|
112 | 00263 size_t getNumFaces(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
113 | 00264 |
---|
114 | 00267 size_t getRowSpan(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
115 | 00268 |
---|
116 | 00271 <a class="code" href="namespaceOgre.html#a671">PixelFormat</a> getFormat() <span class="keyword">const</span>; |
---|
117 | 00272 |
---|
118 | 00275 <a class="code" href="namespaceOgre.html#a466">uchar</a> getBPP() <span class="keyword">const</span>; |
---|
119 | 00276 |
---|
120 | 00279 <span class="keywordtype">bool</span> getHasAlpha() <span class="keyword">const</span>; |
---|
121 | 00280 |
---|
122 | 00286 <span class="keyword">static</span> <span class="keywordtype">void</span> applyGamma( <a class="code" href="namespaceOgre.html#a466">uchar</a> *buffer, <a class="code" href="namespaceOgre.html#a465">Real</a> gamma, size_t size, <a class="code" href="namespaceOgre.html#a466">uchar</a> bpp ); |
---|
123 | 00287 |
---|
124 | 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); |
---|
125 | 00294 |
---|
126 | 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>; |
---|
127 | 00299 |
---|
128 | <a name="l00300"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imagew8">00300</a> <span class="keyword">enum</span> Filter |
---|
129 | 00301 { |
---|
130 | 00302 FILTER_NEAREST, |
---|
131 | 00303 FILTER_LINEAR, |
---|
132 | 00304 FILTER_BILINEAR, |
---|
133 | 00305 FILTER_BOX, |
---|
134 | 00306 FILTER_TRIANGLE, |
---|
135 | 00307 FILTER_BICUBIC |
---|
136 | 00308 }; |
---|
137 | 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); |
---|
138 | 00317 |
---|
139 | 00319 <span class="keywordtype">void</span> resize(<a class="code" href="namespaceOgre.html#a467">ushort</a> width, <a class="code" href="namespaceOgre.html#a467">ushort</a> height, Filter filter = FILTER_BILINEAR); |
---|
140 | 00320 |
---|
141 | 00321 <span class="comment">// Static function to calculate size in bytes from the number of mipmaps, faces and the dimensions</span> |
---|
142 | 00322 <span class="keyword">static</span> size_t calculateSize(size_t mipmaps, size_t faces, size_t width, size_t height, size_t depth, PixelFormat format); |
---|
143 | 00323 <span class="keyword">private</span>: |
---|
144 | 00324 <span class="comment">// The width of the image in pixels</span> |
---|
145 | <a name="l00325"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager0">00325</a> size_t m_uWidth; |
---|
146 | 00326 <span class="comment">// The height of the image in pixels</span> |
---|
147 | <a name="l00327"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager1">00327</a> size_t m_uHeight; |
---|
148 | 00328 <span class="comment">// The depth of the image</span> |
---|
149 | <a name="l00329"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager2">00329</a> size_t m_uDepth; |
---|
150 | 00330 <span class="comment">// The size of the image buffer</span> |
---|
151 | <a name="l00331"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager3">00331</a> size_t m_uSize; |
---|
152 | 00332 <span class="comment">// The number of mipmaps the image contains</span> |
---|
153 | <a name="l00333"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager4">00333</a> size_t m_uNumMipmaps; |
---|
154 | 00334 <span class="comment">// Image specific flags.</span> |
---|
155 | <a name="l00335"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager5">00335</a> <span class="keywordtype">int</span> m_uFlags; |
---|
156 | 00336 |
---|
157 | 00337 <span class="comment">// The pixel format of the image</span> |
---|
158 | <a name="l00338"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager6">00338</a> <a class="code" href="namespaceOgre.html#a671">PixelFormat</a> m_eFormat; |
---|
159 | 00339 |
---|
160 | 00340 <span class="comment">// The number of bytes per pixel</span> |
---|
161 | <a name="l00341"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager7">00341</a> <a class="code" href="namespaceOgre.html#a466">uchar</a> m_ucPixelSize; |
---|
162 | <a name="l00342"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager8">00342</a> <a class="code" href="namespaceOgre.html#a466">uchar</a>* m_pBuffer; |
---|
163 | 00343 |
---|
164 | 00344 <span class="comment">// A bool to determine if we delete the buffer or the calling app does</span> |
---|
165 | <a name="l00345"></a><a class="code" href="classOgre_1_1Image.html#Ogre_1_1Imager9">00345</a> <span class="keywordtype">bool</span> m_bAutoDelete; |
---|
166 | 00346 }; |
---|
167 | 00347 |
---|
168 | 00348 } <span class="comment">// namespace</span> |
---|
169 | 00349 |
---|
170 | 00350 <span class="preprocessor">#endif</span> |
---|
171 | </pre></div><hr> |
---|
172 | <p> |
---|
173 | Copyright © 2000-2005 by The OGRE Team<br /> |
---|
174 | <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><br/> |
---|
175 | This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>.<br/> |
---|
176 | <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
---|
177 | <Work rdf:about=""> |
---|
178 | <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> |
---|
179 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" /> |
---|
180 | </Work> |
---|
181 | <License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> --> |
---|
182 | |
---|
183 | Last modified Sun Mar 12 14:37:42 2006 |
---|
184 | </p> |
---|
185 | </body> |
---|
186 | </html> |
---|