1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SFML - Simple and Fast Multimedia Library</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="tabs.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="logo">
<img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" />
</div>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.htm"><span>Main Page</span></a></li>
<li><a href="namespaces.htm"><span>Namespaces</span></a></li>
<li><a href="annotated.htm"><span>Classes</span></a></li>
<li class="current"><a href="files.htm"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.htm"><span>File List</span></a></li>
</ul>
</div>
<h1>Image.hpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// SFML - Simple and Fast Multimedia Library</span>
<a name="l00004"></a>00004 <span class="comment">// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)</span>
<a name="l00005"></a>00005 <span class="comment">//</span>
<a name="l00006"></a>00006 <span class="comment">// This software is provided 'as-is', without any express or implied warranty.</span>
<a name="l00007"></a>00007 <span class="comment">// In no event will the authors be held liable for any damages arising from the use of this software.</span>
<a name="l00008"></a>00008 <span class="comment">//</span>
<a name="l00009"></a>00009 <span class="comment">// Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00010"></a>00010 <span class="comment">// including commercial applications, and to alter it and redistribute it freely,</span>
<a name="l00011"></a>00011 <span class="comment">// subject to the following restrictions:</span>
<a name="l00012"></a>00012 <span class="comment">//</span>
<a name="l00013"></a>00013 <span class="comment">// 1. The origin of this software must not be misrepresented;</span>
<a name="l00014"></a>00014 <span class="comment">// you must not claim that you wrote the original software.</span>
<a name="l00015"></a>00015 <span class="comment">// If you use this software in a product, an acknowledgment</span>
<a name="l00016"></a>00016 <span class="comment">// in the product documentation would be appreciated but is not required.</span>
<a name="l00017"></a>00017 <span class="comment">//</span>
<a name="l00018"></a>00018 <span class="comment">// 2. Altered source versions must be plainly marked as such,</span>
<a name="l00019"></a>00019 <span class="comment">// and must not be misrepresented as being the original software.</span>
<a name="l00020"></a>00020 <span class="comment">//</span>
<a name="l00021"></a>00021 <span class="comment">// 3. This notice may not be removed or altered from any source distribution.</span>
<a name="l00022"></a>00022 <span class="comment">//</span>
<a name="l00024"></a>00024 <span class="comment"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#ifndef SFML_IMAGE_HPP</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define SFML_IMAGE_HPP</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="comment">// Headers</span>
<a name="l00031"></a>00031 <span class="comment"></span><span class="preprocessor">#include <SFML/System/Resource.hpp></span>
<a name="l00032"></a>00032 <span class="preprocessor">#include <SFML/Graphics/Color.hpp></span>
<a name="l00033"></a>00033 <span class="preprocessor">#include <SFML/Graphics/Rect.hpp></span>
<a name="l00034"></a>00034 <span class="preprocessor">#include <string></span>
<a name="l00035"></a>00035 <span class="preprocessor">#include <vector></span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037
<a name="l00038"></a>00038 <span class="keyword">namespace </span>sf
<a name="l00039"></a>00039 {
<a name="l00040"></a>00040 <span class="keyword">class </span>RenderWindow;
<a name="l00041"></a>00041
<a name="l00046"></a><a class="code" href="classsf_1_1Image.htm">00046</a> <span class="keyword">class </span>SFML_API <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a> : <span class="keyword">public</span> <a class="code" href="classsf_1_1Resource.htm" title="Base class for every resource that needs to notify dependent classes about its destruction...">Resource</a><Image>
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048 <span class="keyword">public</span> :
<a name="l00049"></a>00049
<a name="l00054"></a>00054 <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>();
<a name="l00055"></a>00055
<a name="l00062"></a>00062 <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>& Copy);
<a name="l00063"></a>00063
<a name="l00072"></a>00072 <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Width, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Height, <span class="keyword">const</span> <a class="code" href="classsf_1_1Color.htm" title="Color is an utility class for manipulating 32-bits RGBA colors.">Color</a>& Col = <a class="code" href="classsf_1_1Color.htm" title="Color is an utility class for manipulating 32-bits RGBA colors.">Color</a>(0, 0, 0, 255));
<a name="l00073"></a>00073
<a name="l00082"></a>00082 <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Width, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Height, <span class="keyword">const</span> Uint8* Data);
<a name="l00083"></a>00083
<a name="l00088"></a>00088 ~<a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>();
<a name="l00089"></a>00089
<a name="l00098"></a>00098 <span class="keywordtype">bool</span> LoadFromFile(<span class="keyword">const</span> std::string& Filename);
<a name="l00099"></a>00099
<a name="l00109"></a>00109 <span class="keywordtype">bool</span> LoadFromMemory(<span class="keyword">const</span> <span class="keywordtype">char</span>* Data, std::size_t SizeInBytes);
<a name="l00110"></a>00110
<a name="l00121"></a>00121 <span class="keywordtype">bool</span> LoadFromPixels(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Width, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Height, <span class="keyword">const</span> Uint8* Data);
<a name="l00122"></a>00122
<a name="l00131"></a>00131 <span class="keywordtype">bool</span> SaveToFile(<span class="keyword">const</span> std::string& Filename) <span class="keyword">const</span>;
<a name="l00132"></a>00132
<a name="l00143"></a>00143 <span class="keywordtype">bool</span> Create(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Width, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Height, <a class="code" href="classsf_1_1Color.htm" title="Color is an utility class for manipulating 32-bits RGBA colors.">Color</a> Col = <a class="code" href="classsf_1_1Color.htm" title="Color is an utility class for manipulating 32-bits RGBA colors.">Color</a>(0, 0, 0, 255));
<a name="l00144"></a>00144
<a name="l00152"></a>00152 <span class="keywordtype">void</span> CreateMaskFromColor(<a class="code" href="classsf_1_1Color.htm" title="Color is an utility class for manipulating 32-bits RGBA colors.">Color</a> ColorKey, Uint8 Alpha = 0);
<a name="l00153"></a>00153
<a name="l00166"></a>00166 <span class="keywordtype">void</span> Copy(<span class="keyword">const</span> <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>& Source, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> DestX, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> DestY, <span class="keyword">const</span> <a class="code" href="classsf_1_1Rect.htm">IntRect</a>& SourceRect = <a class="code" href="classsf_1_1Rect.htm">IntRect</a>(0, 0, 0, 0), <span class="keywordtype">bool</span> ApplyAlpha = <span class="keyword">false</span>);
<a name="l00167"></a>00167
<a name="l00178"></a>00178 <span class="keywordtype">bool</span> CopyScreen(<a class="code" href="classsf_1_1RenderWindow.htm" title="Simple wrapper for sf::Window that allows easy 2D rendering.">RenderWindow</a>& <a class="code" href="classsf_1_1Window.htm" title="Window is a rendering window ; it can create a new window or connect to an existing...">Window</a>, <span class="keyword">const</span> <a class="code" href="classsf_1_1Rect.htm">IntRect</a>& SourceRect = <a class="code" href="classsf_1_1Rect.htm">IntRect</a>(0, 0, 0, 0));
<a name="l00179"></a>00179
<a name="l00188"></a>00188 <span class="keywordtype">void</span> SetPixel(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> X, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Y, <span class="keyword">const</span> <a class="code" href="classsf_1_1Color.htm" title="Color is an utility class for manipulating 32-bits RGBA colors.">Color</a>& Col);
<a name="l00189"></a>00189
<a name="l00199"></a>00199 <span class="keyword">const</span> <a class="code" href="classsf_1_1Color.htm" title="Color is an utility class for manipulating 32-bits RGBA colors.">Color</a>& GetPixel(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> X, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Y) <span class="keyword">const</span>;
<a name="l00200"></a>00200
<a name="l00209"></a>00209 <span class="keyword">const</span> Uint8* GetPixelsPtr() <span class="keyword">const</span>;
<a name="l00210"></a>00210
<a name="l00215"></a>00215 <span class="keywordtype">void</span> Bind() <span class="keyword">const</span>;
<a name="l00216"></a>00216
<a name="l00224"></a>00224 <span class="keywordtype">void</span> SetSmooth(<span class="keywordtype">bool</span> Smooth);
<a name="l00225"></a>00225
<a name="l00232"></a>00232 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetWidth() <span class="keyword">const</span>;
<a name="l00233"></a>00233
<a name="l00240"></a>00240 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetHeight() <span class="keyword">const</span>;
<a name="l00241"></a>00241
<a name="l00248"></a>00248 <span class="keywordtype">bool</span> IsSmooth() <span class="keyword">const</span>;
<a name="l00249"></a>00249
<a name="l00259"></a>00259 <a class="code" href="classsf_1_1Rect.htm">FloatRect</a> GetTexCoords(<span class="keyword">const</span> <a class="code" href="classsf_1_1Rect.htm">IntRect</a>& <a class="code" href="classsf_1_1Rect.htm" title="Rect is an utility class for manipulating rectangles.">Rect</a>) <span class="keyword">const</span>;
<a name="l00260"></a>00260
<a name="l00269"></a>00269 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetValidTextureSize(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Size);
<a name="l00270"></a>00270
<a name="l00279"></a>00279 <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>& operator =(<span class="keyword">const</span> <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">Image</a>& Other);
<a name="l00280"></a>00280
<a name="l00281"></a>00281 <span class="keyword">private</span> :
<a name="l00282"></a>00282
<a name="l00289"></a>00289 <span class="keywordtype">bool</span> CreateTexture();
<a name="l00290"></a>00290
<a name="l00295"></a>00295 <span class="keywordtype">void</span> EnsureTextureUpdate() <span class="keyword">const</span>;
<a name="l00296"></a>00296
<a name="l00301"></a>00301 <span class="keywordtype">void</span> EnsureArrayUpdate() <span class="keyword">const</span>;
<a name="l00302"></a>00302
<a name="l00307"></a>00307 <span class="keywordtype">void</span> Reset();
<a name="l00308"></a>00308
<a name="l00313"></a>00313 <span class="keywordtype">void</span> DestroyTexture();
<a name="l00314"></a>00314
<a name="l00316"></a>00316 <span class="comment">// Member data</span>
<a name="l00318"></a>00318 <span class="comment"></span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> myWidth;
<a name="l00319"></a>00319 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> myHeight;
<a name="l00320"></a>00320 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> myTextureWidth;
<a name="l00321"></a>00321 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> myTextureHeight;
<a name="l00322"></a>00322 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> myTexture;
<a name="l00323"></a>00323 <span class="keywordtype">bool</span> myIsSmooth;
<a name="l00324"></a>00324 <span class="keyword">mutable</span> std::vector<Color> myPixels;
<a name="l00325"></a>00325 <span class="keyword">mutable</span> <span class="keywordtype">bool</span> myNeedTextureUpdate;
<a name="l00326"></a>00326 <span class="keyword">mutable</span> <span class="keywordtype">bool</span> myNeedArrayUpdate;
<a name="l00327"></a>00327 };
<a name="l00328"></a>00328
<a name="l00329"></a>00329 } <span class="comment">// namespace sf</span>
<a name="l00330"></a>00330
<a name="l00331"></a>00331
<a name="l00332"></a>00332 <span class="preprocessor">#endif // SFML_IMAGE_HPP</span>
</pre></div></div>
<p id="footer">
:: Copyright © 2007-2008 Laurent Gomila, all rights reserved ::
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> ::
</p>
</body>
</html>
|