DEADSOFTWARE

1d97b55510450508109726441dcc6574fe792a18
[d2df-sdl.git] / src / lib / sdl2 / SDL2_gfx.pas
1 unit SDL2_gfx;
3 (*
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
10 Copyright (C) 2001-2012 Andreas Schiffler
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.
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:
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.
25 2. Altered source versions must be plainly marked as such, and must not be
26 misrepresented as being the original software.
28 3. This notice may not be removed or altered from any source
29 distribution.
31 Andreas Schiffler -- aschiffler at ferzkopp dot net
33 *)
35 {$INCLUDE jedi.inc}
37 interface
38 uses SDL2;
40 const
41 {$IFDEF WINDOWS}
42 GFX_LibName = 'SDL2_gfx.dll';
43 {$ENDIF}
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}
57 {$IFDEF MACOS}
58 GFX_LibName = 'SDL2_gfx';
59 {$IFDEF FPC}
60 {$linklib libSDL2_gfx}
61 {$ENDIF}
62 {$ENDIF}
64 {$IF DEFINED(DELPHI) AND DEFINED(MACOS)}
65 {$DEFINE DELMAC}
66 {$ENDIF}
68 Procedure SDL_GFX_VERSION(Out X: TSDL_Version);
70 {---< SDL2_framerate.h >---}
72 Const
73 {*!
74 \brief Highest possible rate supported by framerate controller in Hz (1/s).
75 *}
76 FPS_UPPER_LIMIT = 200;
78 {*!
79 \brief Lowest possible rate supported by framerate controller in Hz (1/s).
80 *}
81 FPS_LOWER_LIMIT = 1;
83 {*!
84 \brief Default rate of framerate controller in Hz (1/s).
85 *}
86 FPS_DEFAULT = 30;
88 Type
89 {*!
90 \brief Structure holding the state and timing information of the framerate controller.
91 *}
93 TFPSManager = record
94 framecount : uInt32;
95 rateticks : Single; // float rateticks;
96 baseticks : uInt32;
97 lastticks : uInt32;
98 rate : uInt32;
99 end;
101 PFPSManager = ^TFPSManager;
103 Procedure SDL_initFramerate(manager: PFPSManager);
104 external GFX_LibName {$IFDEF DELMAC} name '_SDL_initFramerate' {$ENDIF};
106 Function SDL_setFramerate(manager: PFPSManager; rate: uInt32):sInt32;
107 external GFX_LibName {$IFDEF DELMAC} name '_SDL_setFramerate' {$ENDIF};
109 Function SDL_getFramerate(manager: PFPSManager):sInt32;
110 external GFX_LibName {$IFDEF DELMAC} name '_SDL_getFramerate' {$ENDIF};
112 Function SDL_getFramecount(manager: PFPSManager):sInt32;
113 external GFX_LibName {$IFDEF DELMAC} name '_SDL_getFramecount' {$ENDIF};
115 Function SDL_framerateDelay(manager: PFPSManager):uInt32;
116 external GFX_LibName {$IFDEF DELMAC} name '_SDL_framerateDelay' {$ENDIF};
119 {---< SDL2_gfxPrimitives.h >---}
121 Const
122 SDL2_GFXPRIMITIVES_MAJOR = 1;
123 SDL2_GFXPRIMITIVES_MINOR = 0;
124 SDL2_GFXPRIMITIVES_MICRO = 1;
126 (* Note: all ___Color routines expect the colour to be in format 0xRRGGBBAA *)
129 {* Pixel *}
131 Function pixelColor(renderer: PSDL_Renderer; x, y: sInt16; colour: uInt32):sInt32; cdecl;
132 external GFX_LibName {$IFDEF DELMAC} name '_pixelColor' {$ENDIF};
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};
137 { Horizontal line }
139 Function hlineColor(renderer: PSDL_Renderer; x1, x2, y: sInt16; colour: uInt32):sInt32; cdecl;
140 external GFX_LibName {$IFDEF DELMAC} name '_hlineColor' {$ENDIF};
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};
145 { Vertical line }
147 Function vlineColor(renderer: PSDL_Renderer; x, y1, y2: sInt16; colour: uInt32):sInt32; cdecl;
148 external GFX_LibName {$IFDEF DELMAC} name '_vlineColor' {$ENDIF};
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};
153 { Rectangle }
155 Function rectangleColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl;
156 external GFX_LibName {$IFDEF DELMAC} name '_rectangleColor' {$ENDIF};
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};
161 { Rounded-Corner Rectangle }
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};
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};
169 { Filled rectangle (Box) }
171 Function boxColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl;
172 external GFX_LibName {$IFDEF DELMAC} name '_boxColor' {$ENDIF};
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};
177 { Rounded-Corner Filled rectangle (Box) }
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};
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};
185 { Line }
187 Function lineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl;
188 external GFX_LibName {$IFDEF DELMAC} name '_lineColor' {$ENDIF};
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};
193 { AA Line }
195 Function aalineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl;
196 external GFX_LibName {$IFDEF DELMAC} name '_aalineColor' {$ENDIF};
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};
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};
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};
208 { Circle }
210 Function circleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl;
211 external GFX_LibName {$IFDEF DELMAC} name '_circleColor' {$ENDIF};
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};
216 { Arc }
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};
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};
224 { AA Circle }
226 Function aacircleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl;
227 external GFX_LibName {$IFDEF DELMAC} name '_aacircleColor' {$ENDIF};
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};
232 { Filled Circle }
234 Function filledCircleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl;
235 external GFX_LibName {$IFDEF DELMAC} name '_filledCircleColor' {$ENDIF};
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};
240 { Ellipse }
242 Function ellipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl;
243 external GFX_LibName {$IFDEF DELMAC} name '_ellipseColor' {$ENDIF};
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};
248 { AA Ellipse }
250 Function aaellipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl;
251 external GFX_LibName {$IFDEF DELMAC} name '_aaellipseColor' {$ENDIF};
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};
256 { Filled Ellipse }
258 Function filledEllipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl;
259 external GFX_LibName {$IFDEF DELMAC} name '_filledEllipseColor' {$ENDIF};
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};
264 { Pie }
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};
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};
272 { Filled Pie }
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};
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};
280 { Trigon }
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};
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};
288 { AA-Trigon }
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};
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};
296 { Filled Trigon }
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};
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};
304 { Polygon }
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};
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};
312 { AA-Polygon }
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};
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};
320 { Filled Polygon }
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};
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};
328 { Textured Polygon }
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};
333 { Bezier }
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};
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};
341 { Characters/Strings }
343 Procedure gfxPrimitivesSetFont(Const fontdata: Pointer; cw, ch: uInt32); cdecl;
344 external GFX_LibName {$IFDEF DELMAC} name '_gfxPrimitivesSetFont' {$ENDIF};
346 Procedure gfxPrimitivesSetFontRotation(rotation: uInt32); cdecl;
347 external GFX_LibName {$IFDEF DELMAC} name '_gfxPrimitivesSetFontRotation' {$ENDIF};
350 Function characterColor(renderer: PSDL_Renderer; x, y: sInt16; c: Char; colour: uInt32):sInt32; cdecl;
351 external GFX_LibName {$IFDEF DELMAC} name '_characterColor' {$ENDIF};
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};
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};
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};
365 {---< SDL2_imageFilter.h >---}
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. *)
372 // Detect MMX capability in CPU
373 Function SDL_imageFilterMMXdetect():sInt32; cdecl;
374 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXdetect' {$ENDIF};
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};
380 Procedure SDL_imageFilterMMXon(); cdecl;
381 external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXon' {$ENDIF};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
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};
502 {---< SDL2_rotozoom.h >---}
504 Const
505 {*!
506 \brief Disable anti-aliasing (no smoothing).
507 *}
508 SMOOTHING_OFF = 0;
510 {*!
511 \brief Enable anti-aliasing (smoothing).
512 *}
513 SMOOTHING_ON = 1;
515 { Rotozoom functions }
517 Function rotozoomSurface(src: PSDL_Surface; angle, zoom: Double; smooth: sInt32):PSDL_Surface; cdecl;
518 external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurface' {$ENDIF};
520 Function rotozoomSurfaceXY(src: PSDL_Surface; angle, zoomx, zoomy: Double; smooth: sInt32):PSDL_Surface; cdecl;
521 external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceXY' {$ENDIF};
524 Procedure rotozoomSurfaceSize(width, height: sInt32; angle, zoom: Double; dstwidth, dstheight: PuInt32); cdecl;
525 external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceSize' {$ENDIF};
527 Procedure rotozoomSurfaceSizeXY(width, height: sInt32; angle, zoomx, zoomy: Double; dstwidth, dstheight:PuInt32); cdecl;
528 external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceSizeXY' {$ENDIF};
531 { Zooming functions }
533 Function zoomSurface(src: PSDL_Surface; zoomx, zoomy: Double; smooth: sInt32):PSDL_Surface; cdecl;
534 external GFX_LibName {$IFDEF DELMAC} name '_zoomSurface' {$ENDIF};
536 Procedure zoomSurfaceSize(width, height: sInt32; zoomx, zoomy: Double; dstwidth, dstheight: PuInt32); cdecl;
537 external GFX_LibName {$IFDEF DELMAC} name '_zoomSurfaceSize' {$ENDIF};
539 { Shrinking functions }
541 Function shrinkSurface(src: PSDL_Surface; factorx, factory: sInt32):PSDL_Surface; cdecl;
542 external GFX_LibName {$IFDEF DELMAC} name '_shrinkSurface' {$ENDIF};
544 { Specialized rotation functions }
546 Function rotateSurface90Degrees(src: PSDL_Surface; numClockwiseTurns: sInt32):PSDL_Surface; cdecl;
547 external GFX_LibName {$IFDEF DELMAC} name '_rotateSurface90Degrees' {$ENDIF};
550 implementation
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;
559 end.