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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 2016, 2017, 2018, 2019 David Thompson davet@gnu.org
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
A copy of the license is also available from the Free Software
Foundation Web site at http://www.gnu.org/licenses/fdl.html.
* Guile-SDL2: (guile-sdl2). SDL2 bindings for Guile.
The document was typeset with
http://www.texinfo.org/ (GNU Texinfo).
-->
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Surfaces (Guile-SDL2)</title>
<meta name="description" content="Surfaces (Guile-SDL2)">
<meta name="keywords" content="Surfaces (Guile-SDL2)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Index.html" rel="index" title="Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="API-Reference.html" rel="up" title="API Reference">
<link href="Rendering.html" rel="next" title="Rendering">
<link href="Rects.html" rel="prev" title="Rects">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
@media (min-width: 1140px) {
body {
margin-left: 14rem;
margin-right: 4rem;
max-width: 52rem;
}
}
@media (min-width: 800px) and (max-width: 1140px) {
body {
margin-left: 6rem;
margin-right: 4rem;
max-width: 52rem;
}
}
@media (max-width: 800px) {
body {
margin: 1rem;
}
}
-->
</style>
<link rel="stylesheet" type="text/css" href="https://dthompson.us/css/dthompson.css">
</head>
<body lang="en">
<span id="Surfaces"></span><div class="header">
<p>
Next: <a href="Rendering.html" accesskey="n" rel="next">Rendering</a>, Previous: <a href="Rects.html" accesskey="p" rel="prev">Rects</a>, Up: <a href="API-Reference.html" accesskey="u" rel="up">API Reference</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Surfaces-1"></span><h3 class="section">3.6 Surfaces</h3>
<div class="example">
<pre class="example">(use-modules (sdl2 surface))
</pre></div>
<dl>
<dt id="index-color_003f">Procedure: <strong>color?</strong> <em>c</em></dt>
<dd><p>Return <code>#t</code> if <var>c</var> is a color.
</p></dd></dl>
<dl>
<dt id="index-color_002dr">Procedure: <strong>color-r</strong> <em>c</em></dt>
</dl>
<dl>
<dt id="index-color_002dg">Procedure: <strong>color-g</strong> <em>c</em></dt>
</dl>
<dl>
<dt id="index-color_002db">Procedure: <strong>color-b</strong> <em>c</em></dt>
</dl>
<dl>
<dt id="index-color_002da">Procedure: <strong>color-a</strong> <em>c</em></dt>
</dl>
<dl>
<dt id="index-palette_003f">Procedure: <strong>palette?</strong> <em>p</em></dt>
<dd><p>Return <code>#t</code> if <var>p</var> is a palette.
</p></dd></dl>
<dl>
<dt id="index-palette_002dlength">Procedure: <strong>palette-length</strong> <em>palette</em></dt>
<dd><p>Return the number of colors in <var>palette</var>.
</p></dd></dl>
<dl>
<dt id="index-palette_002dcolors">Procedure: <strong>palette-colors</strong> <em>palette</em></dt>
<dd><p>Return the colors in <var>palette</var>.
</p></dd></dl>
<dl>
<dt id="index-pixel_002dformat_003f">Procedure: <strong>pixel-format?</strong> <em>pf</em></dt>
<dd><p>Return <code>#t</code> if <var>pf</var> is a pixel format.
</p></dd></dl>
<dl>
<dt id="index-pixel_002dformat_002dname">Procedure: <strong>pixel-format-name</strong> <em>pf</em></dt>
<dd><p>Return the symbolic name of the pixel format <var>pf</var>.
</p></dd></dl>
<dl>
<dt id="index-pixel_002dformat_002dpalette">Procedure: <strong>pixel-format-palette</strong> <em>pf</em></dt>
<dd><p>Return the palette for the pixel format <var>pf</var>.
</p></dd></dl>
<dl>
<dt id="index-pixel_002dformat_002dbits_002dper_002dpixel">Procedure: <strong>pixel-format-bits-per-pixel</strong> <em>pf</em></dt>
<dd><p>Return the number of bits per pixel for the pixel format <var>pf</var>.
</p></dd></dl>
<dl>
<dt id="index-pixel_002dformat_002dbytes_002dper_002dpixel">Procedure: <strong>pixel-format-bytes-per-pixel</strong> <em>pf</em></dt>
<dd><p>Return the number of bytes per pixel for the pixel format <var>pf</var>.
</p></dd></dl>
<dl>
<dt id="index-pixel_002dformat_002dred_002dmask">Procedure: <strong>pixel-format-red-mask</strong> <em>pf</em></dt>
<dd><p>Return the bitmask for the red component of a pixel in the pixel format
<var>pf</var>.
</p></dd></dl>
<dl>
<dt id="index-pixel_002dformat_002dgreen_002dmask">Procedure: <strong>pixel-format-green-mask</strong> <em>pf</em></dt>
<dd><p>Return the bitmask for the green component of a pixel in the pixel format
<var>pf</var>.
</p></dd></dl>
<dl>
<dt id="index-pixel_002dformat_002dblue_002dmask">Procedure: <strong>pixel-format-blue-mask</strong> <em>pf</em></dt>
<dd><p>Return the bitmask for the blue component of a pixel in the pixel format
<var>pf</var>.
</p></dd></dl>
<dl>
<dt id="index-pixel_002dformat_002dalpha_002dmask">Procedure: <strong>pixel-format-alpha-mask</strong> <em>pf</em></dt>
<dd><p>Return the bitmask for the alpha component of a pixel in the pixel format
<var>pf</var>.
</p></dd></dl>
<dl>
<dt id="index-make_002drgb_002dsurface">Procedure: <strong>make-rgb-surface</strong> <em>width height depth</em></dt>
<dd><p>Create a new SDL surface with the dimensions <var>width</var> and <var>height</var> and
<var>depth</var> bits per pixel.
</p></dd></dl>
<dl>
<dt id="index-bytevector_002d_003esurface">Procedure: <strong>bytevector->surface</strong> <em>bv width height depth pitch</em></dt>
<dd><p>Convert <var>bv</var>, a bytevector of pixel data with dimensions
<var>width</var>x<var>height</var>, to an SDL surface. Each pixel is <var>depth</var> bits in
size, and each row of pixels is <var>pitch</var> bytes in size.
</p></dd></dl>
<dl>
<dt id="index-delete_002dsurface_0021">Procedure: <strong>delete-surface!</strong> <em>surface</em></dt>
<dd><p>Free the memory used by <var>surface</var>.
</p></dd></dl>
<dl>
<dt id="index-call_002dwith_002dsurface">Procedure: <strong>call-with-surface</strong> <em>surface proc</em></dt>
<dd><p>Call <var>proc</var>, passing it <var>surface</var> and deleting <var>surface</var> upon exit
of <var>proc</var>.
</p></dd></dl>
<dl>
<dt id="index-load_002dbmp">Procedure: <strong>load-bmp</strong> <em>file</em></dt>
<dd><p>Create a new surface from the bitmap data in <var>file</var>.
</p></dd></dl>
<dl>
<dt id="index-surface_002dwidth">Procedure: <strong>surface-width</strong> <em>surface</em></dt>
<dd><p>Return the width of <var>surface</var> in pixels.
</p></dd></dl>
<dl>
<dt id="index-surface_002dheight">Procedure: <strong>surface-height</strong> <em>surface</em></dt>
<dd><p>Return the height of <var>surface</var> in pixels.
</p></dd></dl>
<dl>
<dt id="index-surface_002dpitch">Procedure: <strong>surface-pitch</strong> <em>surface</em></dt>
<dd><p>Return the length of a row of pixels in <var>surface</var> in bytes.
</p></dd></dl>
<dl>
<dt id="index-surface_002dpixels">Procedure: <strong>surface-pixels</strong> <em>surface</em></dt>
<dd><p>Return a bytevector containing the raw pixel data in <var>surface</var>.
</p></dd></dl>
<dl>
<dt id="index-surface_002dpixel_002dformat">Procedure: <strong>surface-pixel-format</strong> <em>surface</em></dt>
<dd><p>Return the pixel format for <var>surface</var>.
</p></dd></dl>
<dl>
<dt id="index-convert_002dsurface_002dformat">Procedure: <strong>convert-surface-format</strong> <em>surface format</em></dt>
<dd><p>Convert the pixels in <var>surface</var> to <var>format</var>, a symbol representing a
specific pixel format, and return a new surface object.
</p>
<p>Valid format types are:
</p>
<ul>
<li> <code>index1lsb</code>
</li><li> <code>index1msb</code>
</li><li> <code>index4lsb</code>
</li><li> <code>index4msb</code>
</li><li> <code>index8</code>
</li><li> <code>rgb332</code>
</li><li> <code>rgb444</code>
</li><li> <code>rgb555</code>
</li><li> <code>bgr555</code>
</li><li> <code>argb4444</code>
</li><li> <code>rgba4444</code>
</li><li> <code>abgr4444</code>
</li><li> <code>bgra4444</code>
</li><li> <code>argb1555</code>
</li><li> <code>rgba5551</code>
</li><li> <code>abgr1555</code>
</li><li> <code>bgra5551</code>
</li><li> <code>rgb565</code>
</li><li> <code>bgr565</code>
</li><li> <code>rgb24</code>
</li><li> <code>bgr24</code>
</li><li> <code>rgb888</code>
</li><li> <code>rgbx8888</code>
</li><li> <code>bgr888</code>
</li><li> <code>bgrx8888</code>
</li><li> <code>argb8888</code>
</li><li> <code>rgba8888</code>
</li><li> <code>abgr8888</code>
</li><li> <code>bgra8888</code>
</li><li> <code>argb2101010</code>
</li><li> <code>yv12</code>
</li><li> <code>iyuv</code>
</li><li> <code>yuy2</code>
</li><li> <code>uyvy</code>
</li><li> <code>yvyu</code>
</li></ul>
</dd></dl>
<dl>
<dt id="index-blit_002dsurface">Procedure: <strong>blit-surface</strong> <em><var>src</var> <var>src-rect</var> <var>dst</var> <var>dst-rect</var></em></dt>
<dd><p>Blit the rectangle <var>src-rect</var> from the surface <var>src</var> to
<var>dst-rect</var> of the surface <var>dst</var>.
</p></dd></dl>
<dl>
<dt id="index-blit_002dscaled">Procedure: <strong>blit-scaled</strong> <em><var>src</var> <var>src-rect</var> <var>dst</var> <var>dst-rect</var></em></dt>
<dd><p>Blit the rectangle <var>src-rect</var> from the surface <var>src</var> to
<var>dst-rect</var> of the surface <var>dst</var>, scaling the source to fit the
destination.
</p></dd></dl>
<dl>
<dt id="index-fill_002drect">Procedure: <strong>fill-rect</strong> <em><var>dst</var> <var>rect</var> <var>color</var></em></dt>
<dd><p>Fill <var>rect</var> with <var>color</var>, a 32-bit color encoded as an integer
value, in the surface <var>dst</var>.
</p></dd></dl>
<hr>
<div class="header">
<p>
Next: <a href="Rendering.html" accesskey="n" rel="next">Rendering</a>, Previous: <a href="Rects.html" accesskey="p" rel="prev">Rects</a>, Up: <a href="API-Reference.html" accesskey="u" rel="up">API Reference</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|