Commit | Line | Data |
cf23a5da |
1 | <div class="pod"> |
2 | <!-- INDEX START --> |
3 | <h3 id="TOP">Index</h3> |
4 | |
5 | <ul><li><a href="#NAME">NAME</a></li> |
6 | <li><a href="#CATEGORY">CATEGORY</a></li> |
7 | <li><a href="#DESCRIPTION">DESCRIPTION</a></li> |
8 | <li><a href="#METHODS">METHODS</a> |
9 | <ul><li><a href="#pixel">pixel</a></li> |
10 | <li><a href="#hline">hline</a></li> |
11 | <li><a href="#vline">vline</a></li> |
12 | <li><a href="#rectangle">rectangle</a></li> |
13 | <li><a href="#box">box</a></li> |
14 | <li><a href="#line">line</a></li> |
15 | <li><a href="#aaline">aaline</a></li> |
16 | <li><a href="#circle">circle</a></li> |
17 | <li><a href="#arc">arc</a></li> |
18 | <li><a href="#aacircle">aacircle</a></li> |
19 | <li><a href="#filled_circle">filled_circle</a></li> |
20 | <li><a href="#ellipse">ellipse</a></li> |
21 | <li><a href="#aaellipse">aaellipse</a></li> |
22 | <li><a href="#filled_ellipse">filled_ellipse</a></li> |
23 | <li><a href="#pie">pie</a></li> |
24 | <li><a href="#filled_pie">filled_pie</a></li> |
25 | <li><a href="#trigon">trigon</a></li> |
26 | <li><a href="#aatrigon">aatrigon</a></li> |
27 | <li><a href="#filled_trigon">filled_trigon</a></li> |
28 | <li><a href="#polygon">polygon</a></li> |
29 | <li><a href="#aapolygon">aapolygon</a></li> |
30 | <li><a href="#filled_polygon">filled_polygon</a></li> |
31 | <li><a href="#textured_polygon">textured_polygon</a></li> |
32 | <li><a href="#filled_polygon_MT">filled_polygon_MT</a></li> |
33 | <li><a href="#textured_polygon_MT">textured_polygon_MT</a></li> |
34 | <li><a href="#bezier">bezier</a></li> |
35 | <li><a href="#character">character</a></li> |
36 | <li><a href="#string">string</a></li> |
37 | <li><a href="#set_font">set_font</a></li> |
38 | </ul> |
39 | </li> |
40 | <li><a href="#AUTHORS">AUTHORS</a> |
41 | </li> |
42 | </ul><hr /> |
43 | <!-- INDEX END --> |
44 | |
45 | <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p> |
46 | <div id="NAME_CONTENT"> |
47 | <p>SDL::GFX::Primitives - basic drawing functions</p> |
48 | |
49 | </div> |
50 | <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p> |
51 | <div id="CATEGORY_CONTENT"> |
b5d537cc |
52 | <p>GFX</p> |
cf23a5da |
53 | |
54 | </div> |
55 | <h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p> |
56 | <div id="DESCRIPTION_CONTENT"> |
57 | <p>All <code>color</code> values for the <code>_color</code> functions are <code>0xRRGGBBAA</code> (32bit), even if the surface uses e. g. 8bit colors.</p> |
58 | |
59 | </div> |
60 | <h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p> |
61 | <div id="METHODS_CONTENT"> |
62 | |
63 | </div> |
64 | <h2 id="pixel">pixel</h2> |
65 | <div id="pixel_CONTENT"> |
66 | <pre> int SDL::GFX::Primitives::pixel_color( $surface, $x, $y, $color ); |
67 | int SDL::GFX::Primitives::pixel_RGBA( $surface, $x, $y, $r, $g, $b, $a ); |
68 | |
69 | </pre> |
70 | <p>Draws a pixel at point <code>x</code>/<code>$y</code>. You can pass the color by <code>0xRRGGBBAA</code> or by passing 4 values. One for red, green, blue and alpha.</p> |
71 | <pre> use SDL; |
72 | use SDL::Video; |
73 | use SDL::Surface; |
74 | use SDL::GFX::Primitives; |
75 | |
76 | my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE); |
77 | |
78 | SDL::GFX::Primitives::pixel_color($display, 2, 2, 0xFF0000FF); # red pixcel |
79 | SDL::GFX::Primitives::pixel_RGBA( $display, 4, 4, 0x00, 0xFF, 0x00, 0xFF); # green pixel |
80 | |
81 | </pre> |
82 | |
83 | </div> |
84 | <h2 id="hline">hline</h2> |
85 | <div id="hline_CONTENT"> |
86 | <pre> int SDL::GFX::Primitives::hline_color( $surface, $x1, $x2, $y, $color ); |
87 | int SDL::GFX::Primitives::hline_RGBA( $surface, $x1, $x2, $y, $r, $g, $b, $a ); |
88 | |
89 | </pre> |
90 | <p>Draws a line horizontally from <code>$x1</code>/<code>$y</code> to <code>$x2</code>/<code>$y</code>.</p> |
91 | |
92 | </div> |
93 | <h2 id="vline">vline</h2> |
94 | <div id="vline_CONTENT"> |
95 | <pre> int SDL::GFX::Primitives::vline_color( $surface, $x, $y1, $y2, $color ); |
96 | int SDL::GFX::Primitives::vline_RGBA( $surface, $x, $y1, $y2, $r, $g, $b, $a ); |
97 | |
98 | </pre> |
99 | <p>Draws a line vertically from <code>$x</code>/<code>$y1</code> to <code>$x</code>/<code>$y2</code>.</p> |
100 | |
101 | </div> |
102 | <h2 id="rectangle">rectangle</h2> |
103 | <div id="rectangle_CONTENT"> |
104 | <pre> int SDL::GFX::Primitives::rectangle_color( $surface, $x1, $y1, $x2, $y2, $color ); |
105 | int SDL::GFX::Primitives::rectangle_RGBA( $surface, $x1, $y1, $x2, $y2, $r, $g, $b, $a ); |
106 | |
107 | </pre> |
108 | <p>Draws a rectangle. Upper left edge will be at <code>$x1</code>/<code>$y1</code> and lower right at <code>$x2</code>/<code>$y</code>. The colored border has a width of 1 pixel.</p> |
109 | |
110 | </div> |
111 | <h2 id="box">box</h2> |
112 | <div id="box_CONTENT"> |
113 | <pre> int SDL::GFX::Primitives::box_color( $surface, $x1, $y1, $x2, $y2, $color ); |
114 | int SDL::GFX::Primitives::box_RGBA( $surface, $x1, $y1, $x2, $y2, $r, $g, $b, $a ); |
115 | |
116 | </pre> |
117 | <p>Draws a filled rectangle.</p> |
118 | |
119 | </div> |
120 | <h2 id="line">line</h2> |
121 | <div id="line_CONTENT"> |
122 | <pre> int SDL::GFX::Primitives::line_color( $surface, $x1, $y1, $x2, $y2, $color ); |
123 | int SDL::GFX::Primitives::line_RGBA( $surface, $x1, $y1, $x2, $y2, $r, $g, $b, $a ); |
124 | |
125 | </pre> |
126 | <p>Draws a free line from <code>$x1</code>/<code>$y1</code> to <code>$x2</code>/<code>$y</code>.</p> |
127 | |
128 | </div> |
129 | <h2 id="aaline">aaline</h2> |
130 | <div id="aaline_CONTENT"> |
131 | <pre> int SDL::GFX::Primitives::aaline_color( $surface, $x1, $y1, $x2, $y2, $color ); |
132 | int SDL::GFX::Primitives::aaline_RGBA( $surface, $x1, $y1, $x2, $y2, $r, $g, $b, $a ); |
133 | |
134 | </pre> |
135 | <p>Draws a free line from <code>$x1</code>/<code>$y1</code> to <code>$x2</code>/<code>$y</code>. This line is anti aliased.</p> |
136 | |
137 | </div> |
138 | <h2 id="circle">circle</h2> |
139 | <div id="circle_CONTENT"> |
140 | <pre> int SDL::GFX::Primitives::circle_color( $surface, $x, $y, $r, $color ); |
141 | int SDL::GFX::Primitives::circle_RGBA( $surface, $x, $y, $rad, $r, $g, $b, $a ); |
142 | |
143 | </pre> |
144 | |
145 | </div> |
146 | <h2 id="arc">arc</h2> |
147 | <div id="arc_CONTENT"> |
148 | <pre> int SDL::GFX::Primitives::arc_color( $surface, $x, $y, $r, $start, $end, $color ); |
149 | int SDL::GFX::Primitives::arc_RGBA( $surface, $x, $y, $rad, $start, $end, $r, $g, $b, $a ); |
150 | |
151 | </pre> |
152 | <p><strong>Note</strong>: You need lib SDL_gfx 2.0.17 or greater for this function.</p> |
153 | |
154 | </div> |
155 | <h2 id="aacircle">aacircle</h2> |
156 | <div id="aacircle_CONTENT"> |
157 | <pre> int SDL::GFX::Primitives::aacircle_color( $surface, $x, $y, $r, $color ); |
158 | int SDL::GFX::Primitives::aacircle_RGBA( $surface, $x, $y, $rad, $r, $g, $b, $a ); |
159 | |
160 | </pre> |
161 | <p><strong>Note</strong>: You need lib SDL_gfx 2.0.17 or greater for this function.</p> |
162 | |
163 | </div> |
164 | <h2 id="filled_circle">filled_circle</h2> |
165 | <div id="filled_circle_CONTENT"> |
166 | <pre> int SDL::GFX::Primitives::filled_circle_color( $surface, $x, $y, $r, $color ); |
167 | int SDL::GFX::Primitives::filled_circle_RGBA( $surface, $x, $y, $rad, $r, $g, $b, $a ); |
168 | |
169 | </pre> |
170 | |
171 | </div> |
172 | <h2 id="ellipse">ellipse</h2> |
173 | <div id="ellipse_CONTENT"> |
174 | <pre> int SDL::GFX::Primitives::ellipse_color( $surface, $x, $y, $rx, $ry, $color ); |
175 | int SDL::GFX::Primitives::ellipse_RGBA( $surface, $x, $y, $rx, $ry, $r, $g, $b, $a ); |
176 | |
177 | </pre> |
178 | |
179 | </div> |
180 | <h2 id="aaellipse">aaellipse</h2> |
181 | <div id="aaellipse_CONTENT"> |
182 | <pre> int SDL::GFX::Primitives::aaellipse_color( $surface, $xc, $yc, $rx, $ry, $color ); |
183 | int SDL::GFX::Primitives::aaellipse_RGBA( $surface, $x, $y, $rx, $ry, $r, $g, $b, $a ); |
184 | |
185 | </pre> |
186 | |
187 | </div> |
188 | <h2 id="filled_ellipse">filled_ellipse</h2> |
189 | <div id="filled_ellipse_CONTENT"> |
190 | <pre> int SDL::GFX::Primitives::filled_ellipse_color( $surface, $x, $y, $rx, $ry, $color ); |
191 | int SDL::GFX::Primitives::filled_ellipse_RGBA( $surface, $x, $y, $rx, $ry, $r, $g, $b, $a ); |
192 | |
193 | </pre> |
194 | |
195 | </div> |
196 | <h2 id="pie">pie</h2> |
197 | <div id="pie_CONTENT"> |
198 | <pre> int SDL::GFX::Primitives::pie_color( $surface, $x, $y, $rad, $start, $end, $color ); |
199 | int SDL::GFX::Primitives::pie_RGBA( $surface, $x, $y, $rad, $start, $end, $r, $g, $b, $a ); |
200 | |
201 | </pre> |
202 | <p>This draws an opened pie. <code>$start</code> and <code>$end</code> are degree values. <code>0</code> is at right, <code>90</code> at bottom, <code>180</code> at left and <code>270</code> degrees at top.</p> |
203 | |
204 | </div> |
205 | <h2 id="filled_pie">filled_pie</h2> |
206 | <div id="filled_pie_CONTENT"> |
207 | <pre> int SDL::GFX::Primitives::filled_pie_color( $surface, $x, $y, $rad, $start, $end, $color ); |
208 | int SDL::GFX::Primitives::filled_pie_RGBA( $surface, $x, $y, $rad, $start, $end, $r, $g, $b, $a ); |
209 | |
210 | </pre> |
211 | |
212 | </div> |
213 | <h2 id="trigon">trigon</h2> |
214 | <div id="trigon_CONTENT"> |
215 | <pre> int SDL::GFX::Primitives::trigon_color( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $color ); |
216 | int SDL::GFX::Primitives::trigon_RGBA( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $r, $g, $b, $a ); |
217 | |
218 | </pre> |
219 | |
220 | </div> |
221 | <h2 id="aatrigon">aatrigon</h2> |
222 | <div id="aatrigon_CONTENT"> |
223 | <pre> int SDL::GFX::Primitives::aatrigon_color( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $color ); |
224 | int SDL::GFX::Primitives::aatrigon_RGBA( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $r, $g, $b, $a ); |
225 | |
226 | </pre> |
227 | |
228 | </div> |
229 | <h2 id="filled_trigon">filled_trigon</h2> |
230 | <div id="filled_trigon_CONTENT"> |
231 | <pre> int SDL::GFX::Primitives::filled_trigon_color( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $color ); |
232 | int SDL::GFX::Primitives::filled_trigon_RGBA( $surface, $x1, $y1, $x2, $y2, $x3, $y3, $r, $g, $b, $a ); |
233 | |
234 | </pre> |
235 | |
236 | </div> |
237 | <h2 id="polygon">polygon</h2> |
238 | <div id="polygon_CONTENT"> |
239 | <pre> int SDL::GFX::Primitives::polygon_color( $surface, $vx, $vy, $n, $color ); |
240 | int SDL::GFX::Primitives::polygon_RGBA( $surface, $vx, $vy, $n, $r, $g, $b, $a ); |
241 | |
242 | </pre> |
243 | <p>Example:</p> |
244 | <pre> SDL::GFX::Primitives::polygon_color($display, [262, 266, 264, 266, 262], [243, 243, 245, 247, 247], 5, 0xFF0000FF); |
245 | |
246 | </pre> |
247 | |
248 | </div> |
249 | <h2 id="aapolygon">aapolygon</h2> |
250 | <div id="aapolygon_CONTENT"> |
251 | <pre> int SDL::GFX::Primitives::aapolygon_color( $surface, $vx, $vy, $n, $color ); |
252 | int SDL::GFX::Primitives::aapolygon_RGBA( $surface, $vx, $vy, $n, $r, $g, $b, $a ); |
253 | |
254 | </pre> |
255 | |
256 | </div> |
257 | <h2 id="filled_polygon">filled_polygon</h2> |
258 | <div id="filled_polygon_CONTENT"> |
259 | <pre> int SDL::GFX::Primitives::filled_polygon_color( $surface, $vx, $vy, $n, $color ); |
260 | int SDL::GFX::Primitives::filled_polygon_RGBA( $surface, $vx, $vy, $n, $r, $g, $b, $a ); |
261 | |
262 | </pre> |
263 | |
264 | </div> |
265 | <h2 id="textured_polygon">textured_polygon</h2> |
266 | <div id="textured_polygon_CONTENT"> |
267 | <pre> int SDL::GFX::Primitives::textured_polygon( $surface, $vx, $vy, $n, $texture, $texture_dx, $texture_dy ); |
268 | |
269 | </pre> |
270 | |
271 | </div> |
272 | <h2 id="filled_polygon_MT">filled_polygon_MT</h2> |
273 | <div id="filled_polygon_MT_CONTENT"> |
274 | <pre> int SDL::GFX::Primitives::filled_polygon_color_MT( $surface, $vx, $vy, $n, $color, $polyInts, $polyAllocated ); |
275 | int SDL::GFX::Primitives::filled_polygon_RGBA_MT( $surface, $vx, $vy, $n, $r, $g, $b, $a, $polyInts, $polyAllocated ); |
276 | |
277 | </pre> |
278 | <p><strong>Note</strong>: You need lib SDL_gfx 2.0.17 or greater for this function.</p> |
279 | |
280 | </div> |
281 | <h2 id="textured_polygon_MT">textured_polygon_MT</h2> |
282 | <div id="textured_polygon_MT_CONTENT"> |
283 | <pre> int SDL::GFX::Primitives::textured_polygon_MT( $surface, $vx, $vy, $n, $texture, $texture_dx, $texture_dy, $polyInts, $polyAllocated ); |
284 | |
285 | </pre> |
286 | <p><strong>Note</strong>: You need lib SDL_gfx 2.0.17 or greater for this function.</p> |
287 | |
288 | </div> |
289 | <h2 id="bezier">bezier</h2> |
290 | <div id="bezier_CONTENT"> |
291 | <pre> int SDL::GFX::Primitives::bezier_color( $surface, $vx, $vy, $n, $s, $color ); |
292 | int SDL::GFX::Primitives::bezier_RGBA( $surface, $vx, $vy, $n, $s, $r, $g, $b, $a ); |
293 | |
294 | </pre> |
295 | <p><code>$n</code> is the number of elements in <code>$vx</code> and <code>$vy</code>, and <code>$s</code> is the number of steps. So the bigger <code>$s</code> is, the smother it becomes.</p> |
296 | <p>Example:</p> |
297 | <pre> SDL::GFX::Primitives::bezier_color($display, [390, 392, 394, 396], [243, 255, 235, 247], 4, 20, 0xFF00FFFF); |
298 | |
299 | </pre> |
300 | |
301 | </div> |
302 | <h2 id="character">character</h2> |
303 | <div id="character_CONTENT"> |
304 | <pre> int SDL::GFX::Primitives::character_color( $surface, $x, $y, $c, $color ); |
305 | int SDL::GFX::Primitives::character_RGBA( $surface, $x, $y, $c, $r, $g, $b, $a ); |
306 | |
307 | </pre> |
308 | <p><code>$c</code> is the character that will be drawn at <code>$x</code>,<code>$y</code>.</p> |
309 | |
310 | </div> |
311 | <h2 id="string">string</h2> |
312 | <div id="string_CONTENT"> |
313 | <pre> int SDL::GFX::Primitives::string_color( $surface, $x, $y, $c, $color ); |
314 | int SDL::GFX::Primitives::string_RGBA( $surface, $x, $y, $c, $r, $g, $b, $a ); |
315 | |
316 | </pre> |
317 | |
318 | </div> |
319 | <h2 id="set_font">set_font</h2> |
320 | <div id="set_font_CONTENT"> |
321 | <pre> void SDL::GFX::Primitives::set_font(fontdata, $cw, $ch ); |
322 | |
323 | </pre> |
324 | <p>The fontsets are included in the SDL_gfx distribution. Check <a href="http://www.ferzkopp.net/joomla/content/view/19/14/">http://www.ferzkopp.net/joomla/content/view/19/14/</a> for more.</p> |
325 | <p>Example:</p> |
326 | <pre> my $font = ''; |
327 | open(FH, '<', 'data/5x7.fnt'); |
328 | binmode(FH); |
329 | read(FH, $font, 4096); |
330 | close(FH); |
331 | |
332 | SDL::GFX::Primitives::set_font($font, 5, 7); |
333 | |
334 | </pre> |
335 | |
336 | </div> |
337 | <h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p> |
338 | <div id="AUTHORS_CONTENT"> |
339 | <p>Tobias Leich [FROGGS] |
340 | </p> |
341 | |
342 | </div> |
343 | </div> |