Commit | Line | Data |
30fd24c2 |
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="#SYNOPSIS">SYNOPSIS</a></li> |
8 | <li><a href="#DESCRIPTION">DESCRIPTION</a></li> |
807ae0cd |
9 | <li><a href="#CONSTRUCTOR">CONSTRUCTOR </a> |
30fd24c2 |
10 | <ul><li><a href="#new">new</a></li> |
807ae0cd |
11 | <li><a href="#display">display</a></li> |
12 | <li><a href="#duplicate">duplicate</a></li> |
13 | </ul> |
14 | </li> |
15 | <li><a href="#ATTRIBUTES">ATTRIBUTES</a> |
16 | <ul><li><a href="#surface">surface</a></li> |
17 | <li><a href="#w_h_format_pitch_flags">w, h, format, pitch, flags</a></li> |
18 | <li><a href="#clip_rect">clip_rect</a></li> |
30fd24c2 |
19 | </ul> |
20 | </li> |
21 | <li><a href="#EXTENSIONS">EXTENSIONS</a> |
22 | <ul><li><a href="#blit">blit </a></li> |
23 | <li><a href="#flip">flip</a></li> |
24 | <li><a href="#update">update</a></li> |
807ae0cd |
25 | <li><a href="#draw_rect">draw_rect</a></li> |
26 | <li><a href="#draw_line">draw_line</a></li> |
30fd24c2 |
27 | </ul> |
28 | </li> |
29 | <li><a href="#AUTHOR">AUTHOR</a> |
30 | </li> |
31 | </ul><hr /> |
32 | <!-- INDEX END --> |
33 | |
34 | <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p> |
35 | <div id="NAME_CONTENT"> |
36 | <p>SDLx::Surface - Graphic surface matrix extension</p> |
37 | |
38 | </div> |
39 | <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p> |
40 | <div id="CATEGORY_CONTENT"> |
41 | <p>Extension</p> |
42 | |
43 | </div> |
44 | <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p> |
45 | <div id="SYNOPSIS_CONTENT"> |
46 | <pre> use SDL; |
47 | use SDL::Video; |
48 | use SDLx::Surface; |
49 | |
50 | # Create the main surface (display) |
51 | SDL::init(SDL_INIT_VIDEO); |
52 | my $display = SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE); |
53 | |
54 | my $surf_matrix = SDLx::Surface->new( surface => $display); |
55 | |
807ae0cd |
56 | $surf_matrix->[10][10] = 0xFFFF; #for 16bpp write white at x = 10 and y=10 |
30fd24c2 |
57 | |
58 | $surf_matrix->surface( $new_surface ); |
59 | |
60 | my $orig_surface = $surf_matrix->surface(); |
61 | |
62 | </pre> |
63 | |
64 | </div> |
65 | <h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p> |
66 | <div id="DESCRIPTION_CONTENT"> |
67 | <p>An <code>SDLx::Surface</code> allows matrix read and write to a surface, safely. </p> |
68 | |
69 | </div> |
807ae0cd |
70 | <h1 id="CONSTRUCTOR">CONSTRUCTOR </h1><p><a href="#TOP" class="toplink">Top</a></p> |
71 | <div id="CONSTRUCTOR_CONTENT"> |
30fd24c2 |
72 | |
73 | </div> |
74 | <h2 id="new">new</h2> |
75 | <div id="new_CONTENT"> |
76 | <p>Takes a SDL::Surface in hash format.</p> |
77 | <p>If a surface is passed to 'surface =>' that is loaded. Otherwise you can define at least a width and a height. </p> |
78 | <pre> SDLx::Surface->new( surface => $surface) # The $surface is loaded |
79 | |
80 | SDLx::Surface->new( width=> 400, height=>200) |
81 | # A SDL::Surface->new( SDL_ANYFORMAT, 400, 200, 32) is loaded |
82 | |
83 | SDLx::Surface->new( width=> 400, height=>200, flags=> SDL_SWSURFACE, depth=>24 ) |
84 | # A SDL::Surface->new( SDL_SWSURFACE, 400, 200, 24) is loaded |
85 | |
86 | SDLx::Surface->new( width=> 400, height=>200, flags=> SDL_SWSURFACE, depth=>32, greenmask=>0xFF000000 ) |
87 | # A SDL::Surface->new( SDL_ANYFORMAT, 400, 200, 32, 0, 0xFF000000,0, 0, 0 ) is loaded |
88 | |
30fd24c2 |
89 | |
807ae0cd |
90 | |
91 | |
92 | </pre> |
30fd24c2 |
93 | |
94 | </div> |
807ae0cd |
95 | <h2 id="display">display</h2> |
96 | <div id="display_CONTENT"> |
30fd24c2 |
97 | <p>If <a href="http://search.cpan.org/perldoc?SDLx::App::new">SDLx::App::new</a> or <a href="/SDL-Video.html#get_video_mode">SDL::Video::get_video_mode</a> called before then:</p> |
807ae0cd |
98 | <pre> my $appx = SDLx::Surface::display(); |
30fd24c2 |
99 | |
100 | </pre> |
101 | <p>gets the display if it is already made. Passed options are ignored. Otherwise you can quickly make the display with :</p> |
807ae0cd |
102 | <pre> SDLx::Surface::display( width => 20, height => 20) #depth => 32 and SDL_ANYFORMAT used |
30fd24c2 |
103 | |
104 | </pre> |
105 | <p>or you can also pass flags and depth. </p> |
807ae0cd |
106 | <pre> SDLx::Surface::display( width => 20, height => 20, flags=> SDL_HWSURFACE, depth=>24) |
30fd24c2 |
107 | |
108 | </pre> |
109 | <p>Get or create the main display surface and attach to a SDLx::Surface.</p> |
110 | |
111 | </div> |
807ae0cd |
112 | <h2 id="duplicate">duplicate</h2> |
113 | <div id="duplicate_CONTENT"> |
114 | <p>Does a attributes only, no pixel, copy of another SDLx::Surface. </p> |
115 | |
116 | </div> |
117 | <h1 id="ATTRIBUTES">ATTRIBUTES</h1><p><a href="#TOP" class="toplink">Top</a></p> |
118 | <div id="ATTRIBUTES_CONTENT"> |
119 | |
120 | </div> |
121 | <h2 id="surface">surface</h2> |
122 | <div id="surface_CONTENT"> |
123 | <p>If a SDL::Surface is passed it is attached to the matrix. Returns the SDL::Surface that is currently attached to this SDLx::Surface</p> |
124 | |
125 | </div> |
126 | <h2 id="w_h_format_pitch_flags">w, h, format, pitch, flags</h2> |
127 | <div id="w_h_format_pitch_flags_CONTENT"> |
128 | <p>Returns the inner SDL::Surface's respective attribute. See <code>SDL::Surface</code>.</p> |
129 | |
130 | </div> |
131 | <h2 id="clip_rect">clip_rect</h2> |
132 | <div id="clip_rect_CONTENT"> |
133 | <p>Sets the passed <code>SDL::Rect</code> as the new clip_rect for the surface. Returns the SDL::Surface's clip_rect. See <code>SDL::Video::get_clip_rect</code> and <code>SDL::Video::set_clip_rect</code>.</p> |
134 | |
135 | </div> |
30fd24c2 |
136 | <h1 id="EXTENSIONS">EXTENSIONS</h1><p><a href="#TOP" class="toplink">Top</a></p> |
137 | <div id="EXTENSIONS_CONTENT"> |
138 | |
139 | </div> |
140 | <h2 id="blit">blit </h2> |
141 | <div id="blit_CONTENT"> |
142 | <pre> $sdlx_surface->blit( $dest, $src_rect, $dest_rect ); |
143 | |
144 | </pre> |
145 | <p>Blits SDLx::Surface onto $dest surface. |
146 | $src_rect or $dest_rect are optional. $src_rect or $dest_rect can be array refs or SDL::Rect. $dest can be SDLx::Surface or SDL::Surface. </p> |
147 | <p>Returns $self</p> |
148 | |
149 | </div> |
150 | <h2 id="flip">flip</h2> |
151 | <div id="flip_CONTENT"> |
152 | <p>Applies <a href="/SDL-Video.html#flip">SDL::Video::flip</a> to the Surface, with error checking.</p> |
153 | <p>Returns $self</p> |
154 | |
155 | </div> |
156 | <h2 id="update">update</h2> |
157 | <div id="update_CONTENT"> |
158 | <pre> $sdlx_surface->update(); # whole surface is updated |
159 | $sdlx_surface->update([0,0,1,1]); # only that area (0,0,1,1) is updated |
160 | |
161 | $sdlx_surface->update( [ SDL::Rect->new(0,0,1,2) ... ]); # defined rects are updated |
162 | |
163 | </pre> |
164 | <p>Applies <a href="/SDL-Video.html#update_rect">SDL::Video::update_rect</a> for no rect or 1 array ref. Applies <a href="/SDL-Video.html#update_rects">SDL::Video::update_rects</a> for array of <a href="SDL-Rect.html">SDL::Rect</a>s. </p> |
165 | <p>Returns $self</p> |
166 | |
807ae0cd |
167 | |
168 | |
169 | |
170 | |
30fd24c2 |
171 | </div> |
807ae0cd |
172 | <h2 id="draw_rect">draw_rect</h2> |
173 | <div id="draw_rect_CONTENT"> |
174 | <pre> $sdlx_surface->draw_rect( [$x,$y,$w,$h], 0xFFFF00FF ); |
175 | $sdlx_surface->draw_rect( SDL::Rect->new($x,$y,$w,$h), 0xFFFF00FF ); |
30fd24c2 |
176 | |
807ae0cd |
177 | </pre> |
178 | <p>Draws a rect on the surface with the given color. </p> |
179 | <p>Returns $self</p> |
30fd24c2 |
180 | |
807ae0cd |
181 | </div> |
182 | <h2 id="draw_line">draw_line</h2> |
183 | <div id="draw_line_CONTENT"> |
184 | <pre> $sdlx_surface->draw_line( [$x1, $y1], [$x2, $y2], $color, $antialias); # $color is a number |
185 | $sdlx_surface->draw_line( [$x1, $y1], [$x2, $y2], \@color, $antialias); # |
186 | |
187 | </pre> |
188 | <p>Draws a line on the surface. Antialias is turned on if $antialias is defined. </p> |
189 | <p>Returns $self</p> |
30fd24c2 |
190 | |
807ae0cd |
191 | </div> |
192 | <h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p> |
193 | <div id="AUTHOR_CONTENT"> |
194 | <pre> kthakore |
30fd24c2 |
195 | |
196 | </pre> |
197 | |
198 | </div> |
199 | </div> |