DEADSOFTWARE

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