DEADSOFTWARE

renamed some dirs; moved some files
[d2df-sdl.git] / src / lib / sdl2 / SDL2_gfx.pas
1 unit SDL2_gfx;
2
3 (*
4
5 SDL2_framerate.h: framerate manager
6 SDL2_gfxPrimitives.h: graphics primitives for SDL
7 SDL2_imageFilter.h: byte-image "filter" routines
8 SDL2_rotozoom.h: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
9
10 Copyright (C) 2001-2012 Andreas Schiffler
11
12 This software is provided 'as-is', without any express or implied
13 warranty. In no event will the authors be held liable for any damages
14 arising from the use of this software.
15
16 Permission is granted to anyone to use this software for any purpose,
17 including commercial applications, and to alter it and redistribute it
18 freely, subject to the following restrictions:
19
20 1. The origin of this software must not be misrepresented; you must not
21 claim that you wrote the original software. If you use this software
22 in a product, an acknowledgment in the product documentation would be
23 appreciated but is not required.
24
25 2. Altered source versions must be plainly marked as such, and must not be
26 misrepresented as being the original software.
27
28 3. This notice may not be removed or altered from any source
29 distribution.
30
31 Andreas Schiffler -- aschiffler at ferzkopp dot net
32
33 *)
34
35 {$INCLUDE jedi.inc}
36
37 interface
38 uses SDL2;
39
40 const
41 {$IFDEF WINDOWS}
42 GFX_LibName = 'SDL2_gfx.dll';
43 {$ENDIF}
44
45 {$IFDEF UNIX}
46 {$IFDEF DARWIN}
47 GFX_LibName = 'libSDL2_gfx.dylib';
48 {$ELSE}
49 {$IFDEF FPC}
50 GFX_LibName = 'libSDL2_gfx.so';
51 {$ELSE}
52 GFX_LibName = 'libSDL2_gfx.so.0';
53 {$ENDIF}
54 {$ENDIF}
55 {$ENDIF}
56
57 {$IFDEF MACOS}
58 GFX_LibName = 'SDL2_gfx';
59 {$IFDEF FPC}
60 {$linklib libSDL2_gfx}
61 {$ENDIF}
62 {$ENDIF}
63
64 {$IF DEFINED(DELPHI) AND DEFINED(MACOS)}
65 {$DEFINE DELMAC}
66 {$ENDIF}
67
68 Procedure SDL_GFX_VERSION(Out X: TSDL_Version);
69
70 {---< SDL2_framerate.h >---}
71
72 Const
73 {*!
74 \brief Highest possible rate supported by framerate controller in Hz (1/s).
75 *}
76 FPS_UPPER_LIMIT = 200;
77
78 {*!
79 \brief Lowest possible rate supported by framerate controller in Hz (1/s).
80 *}
81 FPS_LOWER_LIMIT = 1;
82
83 {*!
84 \brief Default rate of framerate controller in Hz (1/s).
85 *}
86 FPS_DEFAULT = 30;
87
88 Type
89 {*!
90 \brief Structure holding the state and timing information of the framerate controller.
91 *}
92
93 TFPSManager = record
94 framecount : uInt32;
95 rateticks : Single; // float rateticks;
96 baseticks : uInt32;
97 lastticks : uInt32;
98 rate : uInt32;
99 end;
100
101 PFPSManager = ^TFPSManager;
102
103 Procedure SDL_initFramerate(manager: PFPSManager);
104 external GFX_LibName {$IFDEF DELMAC} name '_SDL_initFramerate' {$ENDIF};
105
106 Function SDL_setFramerate(manager: PFPSManager; rate: uInt32):sInt32;
107 external GFX_LibName {$IFDEF DELMAC} name '_SDL_setFramerate' {$ENDIF};
108
109 Function SDL_getFramerate(manager: PFPSManager):sInt32;
110 external GFX_LibName {$IFDEF DELMAC} name '_SDL_getFramerate' {$ENDIF};
111
112 Function SDL_getFramecount(manager: PFPSManager):sInt32;
113 external GFX_LibName {$IFDEF DELMAC} name '_SDL_getFramecount' {$ENDIF};
114
115 Function SDL_framerateDelay(manager: PFPSManager):uInt32;
116 external GFX_LibName {$IFDEF DELMAC} name '_SDL_framerateDelay' {$ENDIF};
117
118
119 {---< SDL2_gfxPrimitives.h >---}
120
121 Const
122 SDL2_GFXPRIMITIVES_MAJOR = 1;
123 SDL2_GFXPRIMITIVES_MINOR = 0;
124 SDL2_GFXPRIMITIVES_MICRO = 1;
125
126 (* Note: all ___Color routines expect the colour to be in format 0xRRGGBBAA *)
127
128
129 {* Pixel *}
130
131 Function pixelColor(renderer: PSDL_Renderer; x, y: sInt16; colour: uInt32):sInt32; cdecl;
132 external GFX_LibName {$IFDEF DELMAC} name '_pixelColor' {$ENDIF};
133
134 Function pixelRGBA(renderer: PSDL_Renderer; x, y: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
135 external GFX_LibName {$IFDEF DELMAC} name '_pixelRGBA' {$ENDIF};
136
137 { Horizontal line }
138
139 Function hlineColor(renderer: PSDL_Renderer; x1, x2, y: sInt16; colour: uInt32):sInt32; cdecl;
140 external GFX_LibName {$IFDEF DELMAC} name '_hlineColor' {$ENDIF};
141
142 Function hlineRGBA(renderer: PSDL_Renderer; x1, x2, y:sInt16; r, g, b, a: uInt8):sInt32; cdecl;
143 external GFX_LibName {$IFDEF DELMAC} name '_hlineRGBA' {$ENDIF};
144
145 { Vertical line }
146
147 Function vlineColor(renderer: PSDL_Renderer; x, y1, y2: sInt16; colour: uInt32):sInt32; cdecl;
148 external GFX_LibName {$IFDEF DELMAC} name '_vlineColor' {$ENDIF};
149
150 Function vlineRGBA(renderer: PSDL_Renderer; x, y1, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
151 external GFX_LibName {$IFDEF DELMAC} name '_vlineRGBA' {$ENDIF};
152
153 { Rectangle }
154
155 Function rectangleColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl;
156 external GFX_LibName {$IFDEF DELMAC} name '_rectangleColor' {$ENDIF};
157
158 Function rectangleRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
159 external GFX_LibName {$IFDEF DELMAC} name '_rectangleRGBA' {$ENDIF};
160
161 { Rounded-Corner Rectangle }
162
163 Function roundedRectangleColor(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; colour: uInt32):sInt32; cdecl;
164 external GFX_LibName {$IFDEF DELMAC} name '_roundedRectangleColor' {$ENDIF};
165
166 Function roundedRectangleRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
167 external GFX_LibName {$IFDEF DELMAC} name '_roundedRectangleRGBA' {$ENDIF};
168
169 { Filled rectangle (Box) }
170
171 Function boxColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl;
172 external GFX_LibName {$IFDEF DELMAC} name '_boxColor' {$ENDIF};
173
174 Function boxRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
175 external GFX_LibName {$IFDEF DELMAC} name '_boxRGBA' {$ENDIF};
176
177 { Rounded-Corner Filled rectangle (Box) }
178
179 Function roundedBoxColor(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; colour: uInt32):sInt32; cdecl;
180 external GFX_LibName {$IFDEF DELMAC} name '_roundedBoxColor' {$ENDIF};
181
182 Function roundedBoxRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
183 external GFX_LibName {$IFDEF DELMAC} name '_roundedBoxRGBA' {$ENDIF};
184
185 { Line }
186
187 Function lineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl;
188 external GFX_LibName {$IFDEF DELMAC} name '_lineColor' {$ENDIF};
189
190 Function lineRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
191 external GFX_LibName {$IFDEF DELMAC} name '_lineRGBA' {$ENDIF};
192
193 { AA Line }
194
195 Function aalineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl;
196 external GFX_LibName {$IFDEF DELMAC} name '_aalineColor' {$ENDIF};
197
198 Function aalineRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
199 external GFX_LibName {$IFDEF DELMAC} name '_aalineRGBA' {$ENDIF};
200
201 { Thick Line }
202 Function thickLineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; width: uInt8; colour: uInt32):sInt32; cdecl;
203 external GFX_LibName {$IFDEF DELMAC} name '_thickLineColor' {$ENDIF};
204
205 Function thickLineRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; width, r, g, b, a: uInt8):sInt32; cdecl;
206 external GFX_LibName {$IFDEF DELMAC} name '_thickLineRGBA' {$ENDIF};
207
208 { Circle }
209
210 Function circleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl;
211 external GFX_LibName {$IFDEF DELMAC} name '_circleColor' {$ENDIF};
212
213 Function circleRGBA(renderer: PSDL_Renderer; x, y, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
214 external GFX_LibName {$IFDEF DELMAC} name '_circleRGBA' {$ENDIF};
215
216 { Arc }
217
218 Function arcColor(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; colour: uInt32):sInt32; cdecl;
219 external GFX_LibName {$IFDEF DELMAC} name '_arcColor' {$ENDIF};
220
221 Function arcRGBA(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
222 external GFX_LibName {$IFDEF DELMAC} name '_arcRGBA' {$ENDIF};
223
224 { AA Circle }
225
226 Function aacircleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl;
227 external GFX_LibName {$IFDEF DELMAC} name '_aacircleColor' {$ENDIF};
228
229 Function aacircleRGBA(renderer: PSDL_Renderer; x, y, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
230 external GFX_LibName {$IFDEF DELMAC} name '_aacircleRGBA' {$ENDIF};
231
232 { Filled Circle }
233
234 Function filledCircleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl;
235 external GFX_LibName {$IFDEF DELMAC} name '_filledCircleColor' {$ENDIF};
236
237 Function filledCircleRGBA(renderer: PSDL_Renderer; x, y, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
238 external GFX_LibName {$IFDEF DELMAC} name '_filledCircleRGBA' {$ENDIF};
239
240 { Ellipse }
241
242 Function ellipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl;
243 external GFX_LibName {$IFDEF DELMAC} name '_ellipseColor' {$ENDIF};
244
245 Function ellipseRGBA(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
246 external GFX_LibName {$IFDEF DELMAC} name '_ellipseRGBA' {$ENDIF};
247
248 { AA Ellipse }
249
250 Function aaellipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl;
251 external GFX_LibName {$IFDEF DELMAC} name '_aaellipseColor' {$ENDIF};
252
253 Function aaellipseRGBA(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
254 external GFX_LibName {$IFDEF DELMAC} name '_aaellipseRGBA' {$ENDIF};
255
256 { Filled Ellipse }
257
258 Function filledEllipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl;
259 external GFX_LibName {$IFDEF DELMAC} name '_filledEllipseColor' {$ENDIF};
260
261 Function filledEllipseRGBA(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
262 external GFX_LibName {$IFDEF DELMAC} name '_filledEllipseRGBA' {$ENDIF};
263
264 { Pie }
265
266 Function pieColor(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; colour: uInt32):sInt32; cdecl;
267 external GFX_LibName {$IFDEF DELMAC} name '_pieColor' {$ENDIF};
268
269 Function pieRGBA(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
270 external GFX_LibName {$IFDEF DELMAC} name '_pieRGBA' {$ENDIF};
271
272 { Filled Pie }
273
274 Function filledPieColor(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; colour: uInt32):sInt32; cdecl;
275 external GFX_LibName {$IFDEF DELMAC} name '_filledPieColor' {$ENDIF};
276
277 Function filledPieRGBA(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
278 external GFX_LibName {$IFDEF DELMAC} name '_filledPieRGBA' {$ENDIF};
279
280 { Trigon }
281
282 Function trigonColor(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; colour: uInt32):sInt32; cdecl;
283 external GFX_LibName {$IFDEF DELMAC} name '_trigonColor' {$ENDIF};
284
285 Function trigonRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
286 external GFX_LibName {$IFDEF DELMAC} name '_trigonRGBA' {$ENDIF};
287
288 { AA-Trigon }
289
290 Function aatrigonColor(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; colour: uInt32):sInt32; cdecl;
291 external GFX_LibName {$IFDEF DELMAC} name '_aatrigonColor' {$ENDIF};
292
293 Function aatrigonRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
294 external GFX_LibName {$IFDEF DELMAC} name '_aatrigonRGBA' {$ENDIF};
295
296 { Filled Trigon }
297
298 Function filledTrigonColor(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; colour: uInt32):sInt32; cdecl;
299 external GFX_LibName {$IFDEF DELMAC} name '_filledTrigonColor' {$ENDIF};
300
301 Function filledTrigonRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; r, g, b, a: uInt8):sInt32; cdecl;
302 external GFX_LibName {$IFDEF DELMAC} name '_filledTrigonRGBA' {$ENDIF};
303
304 { Polygon }
305
306 Function polygonColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; colour: uInt32):sInt32; cdecl;
307 external GFX_LibName {$IFDEF DELMAC} name '_polygonColor' {$ENDIF};
308
309 Function polygonRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; r, g, b, a: uInt8):sInt32; cdecl;
310 external GFX_LibName {$IFDEF DELMAC} name '_polugonRGBA' {$ENDIF};
311
312 { AA-Polygon }
313
314 Function aapolygonColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; colour: uInt32):sInt32; cdecl;
315 external GFX_LibName {$IFDEF DELMAC} name '_aapolygonColor' {$ENDIF};
316
317 Function aapolygonRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; r, g, b, a: uInt8):sInt32; cdecl;
318 external GFX_LibName {$IFDEF DELMAC} name '_aapolygonRGBA' {$ENDIF};
319
320 { Filled Polygon }
321
322 Function filledPolygonColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; colour: uInt32):sInt32; cdecl;
323 external GFX_LibName {$IFDEF DELMAC} name '_filledPolygonColor' {$ENDIF};
324
325 Function filledPolygonRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; r, g, b, a: uInt8):sInt32; cdecl;
326 external GFX_LibName {$IFDEF DELMAC} name '_filledPolygonRGBA' {$ENDIF};
327
328 { Textured Polygon }
329
330 Function texturedPolygon(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; texture: PSDL_Surface; texture_dx, texture_dy: sInt32):sInt32; cdecl;
331 external GFX_LibName {$IFDEF DELMAC} name '_texturedPolygon' {$ENDIF};
332
333 { Bezier }
334
335 Function bezierColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n, s: sInt32; colour: uInt32):sInt32; cdecl;
336 external GFX_LibName {$IFDEF DELMAC} name '_bezierColor' {$ENDIF};
337
338 Function bezierRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n, s: sInt32; r, g, b, a: uInt8):sInt32; cdecl;
339 external GFX_LibName {$IFDEF DELMAC} name '_bezierRGBA' {$ENDIF};
340
341 { Characters/Strings }
342
343 Procedure gfxPrimitivesSetFont(Const fontdata: Pointer; cw, ch: uInt32); cdecl;
344 external GFX_LibName {$IFDEF DELMAC} name '_gfxPrimitivesSetFont' {$ENDIF};
345
346 Procedure gfxPrimitivesSetFontRotation(rotation: uInt32); cdecl;
347 external GFX_LibName {$IFDEF DELMAC} name '_gfxPrimitivesSetFontRotation' {$ENDIF};
348
349
350 Function characterColor(renderer: PSDL_Renderer; x, y: sInt16; c: Char; colour: uInt32):sInt32; cdecl;
351 external GFX_LibName {$IFDEF DELMAC} name '_characterColor' {$ENDIF};
352
353 Function characterRGBA(renderer: PSDL_Renderer; x, y: sInt16; c: Char; r, g, b, a: uInt8):sInt32; cdecl;
354 external GFX_LibName {$IFDEF DELMAC} name '_characterRGBA' {$ENDIF};
355
356
357 Function stringColor(renderer: PSDL_Renderer; x, y: sInt16; Const str: PChar; colour: uInt32):sInt32; cdecl;
358 external GFX_LibName {$IFDEF DELMAC} name '_stringColor' {$ENDIF};
359
360 Function stringRGBA(renderer: PSDL_Renderer; x, y: sInt16; Const syt: PChar; r, g, b, a: uInt8):sInt32; cdecl;
361 external GFX_LibName {$IFDEF DELMAC} name '_stringRGBA' {$ENDIF};
362
363
364
365 {---< SDL2_imageFilter.h >---}
366
367 (* Comments: *
368 * 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. *
369 * 2.) Data that is not within an 8 byte boundary is processed using the C routine. *
370 * 3.) Convolution routines do not have C routines at this time. *)
371
372 // Detect MMX capability in CPU
373 Function SDL_imageFilterMMXdetect():sInt32; cdecl;
374 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXdetect' {$ENDIF};
375
376 // Force use of MMX off (or turn possible use back on)
377 Procedure SDL_imageFilterMMXoff(); cdecl;
378 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXoff' {$ENDIF};
379
380 Procedure SDL_imageFilterMMXon(); cdecl;
381 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXon' {$ENDIF};
382
383
384 // SDL_imageFilterAdd: D = saturation255(S1 + S2)
385 Function SDL_imageFilterAdd(Src1, Src2, Dest : PuInt8; Length : uInt32):sInt32; cdecl;
386 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAdd' {$ENDIF};
387
388 // SDL_imageFilterMean: D = S1/2 + S2/2
389 Function SDL_imageFilterMean(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl;
390 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMean' {$ENDIF};
391
392 // SDL_imageFilterSub: D = saturation0(S1 - S2)
393 Function SDL_imageFilterSub(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl;
394 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterSub' {$ENDIF};
395
396 // SDL_imageFilterAbsDiff: D = | S1 - S2 |
397 Function SDL_imageFilterAbsDiff(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl;
398 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAbsDiff' {$ENDIF};
399
400
401 // SDL_imageFilterMult: D = saturation(S1 * S2)
402 Function SDL_imageFilterMult(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl;
403 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMult' {$ENDIF};
404
405 // SDL_imageFilterMultNor: D = S1 * S2 (non-MMX)
406 Function SDL_imageFilterMultNor(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl;
407 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultNor' {$ENDIF};
408
409 // SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)
410 Function SDL_imageFilterMultDivby2(Src1, Src2, Dest : PuInt8; Length: uInt32):Sint32; cdecl;
411 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultDivby2' {$ENDIF};
412
413 // SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)
414 Function SDL_imageFilterMultDivby4(Src1, Src2, Dest : PuInt8; Length : uInt32):Sint32; cdecl;
415 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultDivby4' {$ENDIF};
416
417
418 // SDL_imageFilterBitAnd: D = S1 & S2
419 Function SDL_imageFilterBitAnd(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl;
420 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBitAnd' {$ENDIF};
421
422 // SDL_imageFilterBitOr: D = S1 | S2
423 Function SDL_imageFilterBitOr(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl;
424 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBitOr' {$ENDIF};
425
426
427 // SDL_imageFilterDiv: D = S1 / S2 (non-MMX)
428 Function SDL_imageFilterDiv(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl;
429 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterDiv' {$ENDIF};
430
431 // SDL_imageFilterBitNegation: D = !S
432 Function SDL_imageFilterBitNegation(Src1, Dest : PuInt8; Length:uInt32):Sint32; cdecl;
433 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBitNegation' {$ENDIF};
434
435
436 // SDL_imageFilterAddByte: D = saturation255(S + C)
437 Function SDL_imageFilterAddByte(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl;
438 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAddByte' {$ENDIF};
439
440 // SDL_imageFilterAddUsInt32: D = saturation255(S + (usInt32)C)
441 Function SDL_imageFilterAddUsInt32(Src1, Dest : PuInt8; Length:uInt32; C : uInt32):Sint32; cdecl;
442 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAddUsInt32' {$ENDIF};
443
444 // SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)
445 Function SDL_imageFilterAddByteToHalf(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl;
446 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAddByteToHalf' {$ENDIF};
447
448
449 // SDL_imageFilterSubByte: D = saturation0(S - C)
450 Function SDL_imageFilterSubByte(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl;
451 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterSubByte' {$ENDIF};
452
453 // SDL_imageFilterSubUsInt32: D = saturation0(S - (usInt32)C)
454 Function SDL_imageFilterSubUsInt32(Src1, Dest : PuInt8; Length:uInt32; C : uInt32):Sint32; cdecl;
455 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterSubUsInt32' {$ENDIF};
456
457
458 // SDL_imageFilterShiftRight: D = saturation0(S >> N)
459 Function SDL_imageFilterShiftRight(Src1, Dest : PuInt8; Length:uInt32; N : uInt8):Sint32; cdecl;
460 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftRight' {$ENDIF};
461
462 // SDL_imageFilterShiftRightUsInt32: D = saturation0((usInt32)S >> N)
463 Function SDL_imageFilterShiftRightUsInt32(Src1, Dest : PuInt8; Length:uInt32; N : uInt8):Sint32; cdecl;
464 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftRightUsInt32' {$ENDIF};
465
466
467 // SDL_imageFilterMultByByte: D = saturation255(S * C)
468 Function SDL_imageFilterMultByByte(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl;
469 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultByByte' {$ENDIF};
470
471 // SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)
472 Function SDL_imageFilterShiftRightAndMultByByte(Src1, Dest : PuInt8; Length:uInt32; N, C : uInt8):Sint32; cdecl;
473 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftRightAndMultByByte' {$ENDIF};
474
475
476 // SDL_imageFilterShiftLeftByte: D = (S << N)
477 Function SDL_imageFilterShiftLeftByte(Src1, Dest : PuInt8; Length:uInt32; N: uInt8):Sint32; cdecl;
478 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftLeftByte' {$ENDIF};
479
480 // SDL_imageFilterShiftLeftUsInt32: D = ((usInt32)S << N)
481 Function SDL_imageFilterShiftLeftUsInt32(Src1, Dest : PuInt8; Length:uInt32; N:uInt8):Sint32; cdecl;
482 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftLeftUsInt32' {$ENDIF};
483
484 // SDL_imageFilterShiftLeft: D = saturation255(S << N)
485 Function SDL_imageFilterShiftLeft(Src1, Dest : PuInt8; Length:uInt32; N : uInt8):Sint32; cdecl;
486 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftLeft' {$ENDIF};
487
488
489 // SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0
490 Function SDL_imageFilterBinarizeUsingThreshold(Src1, Dest : PuInt8; Length:uInt32; T: uInt8):Sint32; cdecl;
491 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBinarizeUsingThreshold' {$ENDIF};
492
493 // SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0
494 Function SDL_imageFilterClipToRange(Src1, Dest : PuInt8; Length:uInt32; Tmin, Tmax: uInt8):Sint32; cdecl;
495 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterClipToRange' {$ENDIF};
496
497 // SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
498 Function SDL_imageFilterNormalizeLinear(Src, Dest: PuInt8; Length, Cmin, Cmax, Nmin, Nmax: sInt32):Sint32; cdecl;
499 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterNormalizeLinear' {$ENDIF};
500
501
502 {---< SDL2_rotozoom.h >---}
503
504 Const
505 {*!
506 \brief Disable anti-aliasing (no smoothing).
507 *}
508 SMOOTHING_OFF = 0;
509
510 {*!
511 \brief Enable anti-aliasing (smoothing).
512 *}
513 SMOOTHING_ON = 1;
514
515 { Rotozoom functions }
516
517 Function rotozoomSurface(src: PSDL_Surface; angle, zoom: Double; smooth: sInt32):PSDL_Surface; cdecl;
518 external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurface' {$ENDIF};
519
520 Function rotozoomSurfaceXY(src: PSDL_Surface; angle, zoomx, zoomy: Double; smooth: sInt32):PSDL_Surface; cdecl;
521 external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceXY' {$ENDIF};
522
523
524 Procedure rotozoomSurfaceSize(width, height: sInt32; angle, zoom: Double; dstwidth, dstheight: PuInt32); cdecl;
525 external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceSize' {$ENDIF};
526
527 Procedure rotozoomSurfaceSizeXY(width, height: sInt32; angle, zoomx, zoomy: Double; dstwidth, dstheight:PuInt32); cdecl;
528 external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceSizeXY' {$ENDIF};
529
530
531 { Zooming functions }
532
533 Function zoomSurface(src: PSDL_Surface; zoomx, zoomy: Double; smooth: sInt32):PSDL_Surface; cdecl;
534 external GFX_LibName {$IFDEF DELMAC} name '_zoomSurface' {$ENDIF};
535
536 Procedure zoomSurfaceSize(width, height: sInt32; zoomx, zoomy: Double; dstwidth, dstheight: PuInt32); cdecl;
537 external GFX_LibName {$IFDEF DELMAC} name '_zoomSurfaceSize' {$ENDIF};
538
539 { Shrinking functions }
540
541 Function shrinkSurface(src: PSDL_Surface; factorx, factory: sInt32):PSDL_Surface; cdecl;
542 external GFX_LibName {$IFDEF DELMAC} name '_shrinkSurface' {$ENDIF};
543
544 { Specialized rotation functions }
545
546 Function rotateSurface90Degrees(src: PSDL_Surface; numClockwiseTurns: sInt32):PSDL_Surface; cdecl;
547 external GFX_LibName {$IFDEF DELMAC} name '_rotateSurface90Degrees' {$ENDIF};
548
549
550 implementation
551
552 Procedure SDL_GFX_VERSION(Out X: TSDL_Version);
553 begin
554 X.Major := SDL2_GFXPRIMITIVES_MAJOR;
555 X.Minor := SDL2_GFXPRIMITIVES_MINOR;
556 X.Patch := SDL2_GFXPRIMITIVES_MICRO
557 end;
558
559 end.