Merge branch 'master' of git.shadowcat.co.uk:SDL-Site
[sdlgit/SDL-Site.git] / pages / SDL-PixelFormat.html-inc
CommitLineData
162a0989 1<div class="pod">
2<!-- INDEX START -->
3<h3 id="TOP">Index</h3>
4
60f74f6f 5<ul><li><a href="#NAME">NAME</a>
6<ul><li><a href="#CATEGORY">CATEGORY</a></li>
7</ul>
8</li>
162a0989 9<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
10<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
11<li><a href="#METHODS">METHODS</a>
12<ul><li><a href="#palette">palette</a></li>
13<li><a href="#BitsPerPixel">BitsPerPixel </a></li>
14<li><a href="#BytesPerPixel">BytesPerPixel</a></li>
15<li><a href="#RGBA_loss">[RGBA]loss</a></li>
16<li><a href="#RGBA_shift">[RGBA]shift</a></li>
17<li><a href="#RGBA_mask">[RGBA]mask</a></li>
18<li><a href="#colorkey">colorkey</a></li>
19<li><a href="#alpha">alpha</a></li>
20</ul>
21</li>
c7e8d3c6 22<li><a href="#SEE_ALSO">SEE ALSO</a></li>
23<li><a href="#AUTHORS">AUTHORS</a>
162a0989 24</li>
25</ul><hr />
26<!-- INDEX END -->
27
28<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
29<div id="NAME_CONTENT">
30<p>SDL::PixelFormat - Stores surface format information</p>
31
32</div>
60f74f6f 33<h2 id="CATEGORY">CATEGORY</h2>
34<div id="CATEGORY_CONTENT">
35<p>Core, Video, Structure</p>
36
37</div>
162a0989 38<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
39<div id="SYNOPSIS_CONTENT">
40<pre> my $surface = SDL::Surface-&gt;new( ...
41 $surface-&gt;format; #this returns the PixelFormat object attached to this surface
42
43</pre>
44<p>PixelFormat is only created in a <code>SDL::Surface</code>. This module only provides getters to the surface's pixelformat. Later on we will provide setting capability.</p>
45
46
47
48
49
50</div>
51<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
52<div id="DESCRIPTION_CONTENT">
53<p>An <code>SDL::PixelFormat </code> stores surface format information</p>
54
55</div>
56<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
57<div id="METHODS_CONTENT">
58
59</div>
60<h2 id="palette">palette</h2>
61<div id="palette_CONTENT">
62<pre> $surface-&gt;format-&gt;palette;
63
64</pre>
55bbf7a2 65<p>Returns the <code>SDL_Palette</code> and <a href="SDL-Palette.html">SDL::Palette</a> of the format of the surface.</p>
162a0989 66
67</div>
68<h2 id="BitsPerPixel">BitsPerPixel </h2>
69<div id="BitsPerPixel_CONTENT">
70<pre> $surface-&gt;format-&gt;BitsPerPixel;
71
72</pre>
73<p>The number of bits used to represent each pixel in a surface. Usually 8, 16, 24 or 32. (1 to 7 are not allowed when creating a surface or open a video mode</p>
74
75</div>
76<h2 id="BytesPerPixel">BytesPerPixel</h2>
77<div id="BytesPerPixel_CONTENT">
78<pre> $surface-&gt;format-&gt;BytesPerPixel;
79
80</pre>
81<p>The number of bytes used to represent each pixel in a surface. Usually one to four.</p>
82
83</div>
84<h2 id="RGBA_loss">[RGBA]loss</h2>
85<div id="RGBA_loss_CONTENT">
86<pre> $surface-&gt;format-&gt;Rloss; #red loss
87 $surface-&gt;format-&gt;Bloss; #blue loss
88 $surface-&gt;format-&gt;Gloss; #green loss
89 $surface-&gt;format-&gt;Aloss; #alpha loss
90
91</pre>
92<p>Precision loss of each color component (2[RGBA]loss)</p>
93
94</div>
95<h2 id="RGBA_shift">[RGBA]shift</h2>
96<div id="RGBA_shift_CONTENT">
97<pre> $surface-&gt;format-&gt;Rshift; #red shift
98 $surface-&gt;format-&gt;Bshift; #blue shift
99 $surface-&gt;format-&gt;Gshift; #green shift
100 $surface-&gt;format-&gt;Ashift; #alpha shift
101
102</pre>
103<p>Binary left shift of each color component in the pixel value</p>
104
105
106
107
108
109</div>
110<h2 id="RGBA_mask">[RGBA]mask</h2>
111<div id="RGBA_mask_CONTENT">
112<pre> $surface-&gt;format-&gt;Rmask; #red mask
113 $surface-&gt;format-&gt;Bmask; #blue mask
114 $surface-&gt;format-&gt;Gmask; #green mask
115 $surface-&gt;format-&gt;Amask; #alpha mask
116
117</pre>
118<p>Binary left shift of each color component in the pixel value</p>
119
120</div>
121<h2 id="colorkey">colorkey</h2>
122<div id="colorkey_CONTENT">
123<pre> $surface-&gt;format-&gt;colorkey;
124
125</pre>
126<p>Pixel value of transparent pixels. </p>
127
128</div>
129<h2 id="alpha">alpha</h2>
130<div id="alpha_CONTENT">
131<pre> $surface-&gt;format-&gt;alpha;
132
133</pre>
134<p>Overall surface alpha value</p>
135
136
137
138
139
140
141
142
143</div>
144<h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
145<div id="SEE_ALSO_CONTENT">
55bbf7a2 146<p><a href="SDL-Surface.html">SDL::Surface</a></p>
162a0989 147
148</div>
c7e8d3c6 149<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
150<div id="AUTHORS_CONTENT">
1dbe1697 151<p>See <a href="/SDL.html#AUTHORS">/SDL.html#AUTHORS</a>.</p>
c7e8d3c6 152
153</div>
162a0989 154</div>