sdl_gfx.pas 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. unit sdl_gfx;
  2. {
  3. $Id: sdl_gfx.pas,v 1.1 2005/01/03 19:08:32 savage Exp $
  4. }
  5. {
  6. $Log: sdl_gfx.pas,v $
  7. Revision 1.1 2005/01/03 19:08:32 savage
  8. Header for the SDL_Gfx library.
  9. }
  10. {$I jedi-sdl.inc}
  11. interface
  12. uses
  13. sdl;
  14. const
  15. {$IFDEF WIN32}
  16. SDLgfxLibName = 'SDL_gfx.dll';
  17. {$ENDIF}
  18. {$IFDEF UNIX}
  19. {$IFDEF DARWIN}
  20. SDLgfxLibName = 'libSDL_gfx.dylib';
  21. {$ELSE}
  22. SDLgfxLibName = 'libSDL_gfx.so';
  23. {$ENDIF}
  24. {$ENDIF}
  25. {$IFDEF MACOS}
  26. SDLgfxLibName = 'SDL_gfx';
  27. {$ENDIF}
  28. // Some rates in Hz
  29. FPS_UPPER_LIMIT = 200;
  30. FPS_LOWER_LIMIT = 1;
  31. FPS_DEFAULT = 30;
  32. // ---- Defines
  33. SMOOTHING_OFF = 0;
  34. SMOOTHING_ON = 1;
  35. type
  36. PFPSmanager = ^TFPSmanager;
  37. TFPSmanager = packed record
  38. framecount : Uint32;
  39. rateticks : single;
  40. lastticks : Uint32;
  41. rate : Uint32;
  42. end;
  43. // ---- Structures
  44. PColorRGBA = ^TColorRGBA;
  45. TColorRGBA = packed record
  46. r : Uint8;
  47. g : Uint8;
  48. b : Uint8;
  49. a : Uint8;
  50. end;
  51. PColorY = ^TColorY;
  52. TColorY = packed record
  53. y : Uint8;
  54. end;
  55. {
  56. SDL_framerate: framerate manager
  57. LGPL (c) A. Schiffler
  58. }
  59. procedure SDL_initFramerate( manager : PFPSmanager );
  60. cdecl; external {$IFDEF __GPC__}name 'SDL_initFramerate'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  61. {$EXTERNALSYM SDL_initFramerate}
  62. function SDL_setFramerate( manager : PFPSmanager; rate : integer ) : integer;
  63. cdecl; external {$IFDEF __GPC__}name 'SDL_setFramerate'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  64. {$EXTERNALSYM SDL_setFramerate}
  65. function SDL_getFramerate( manager : PFPSmanager ) : integer;
  66. cdecl; external {$IFDEF __GPC__}name 'SDL_getFramerate'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  67. {$EXTERNALSYM SDL_getFramerate}
  68. procedure SDL_framerateDelay( manager : PFPSmanager );
  69. cdecl; external {$IFDEF __GPC__}name 'SDL_framerateDelay'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  70. {$EXTERNALSYM SDL_framerateDelay}
  71. {
  72. SDL_gfxPrimitives: graphics primitives for SDL
  73. LGPL (c) A. Schiffler
  74. }
  75. // Note: all ___Color routines expect the color to be in format 0xRRGGBBAA
  76. // Pixel
  77. function pixelColor( dst : PSDL_Surface; x : Sint16; y : Sint16; color : Uint32 ) : integer;
  78. cdecl; external {$IFDEF __GPC__}name 'pixelColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  79. {$EXTERNALSYM pixelColor}
  80. function pixelRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  81. cdecl; external {$IFDEF __GPC__}name 'pixelRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  82. {$EXTERNALSYM pixelRGBA}
  83. // Horizontal line
  84. function hlineColor( dst : PSDL_Surface; x1: Sint16; x2 : Sint16; y : Sint16; color : Uint32 ) : integer;
  85. cdecl; external {$IFDEF __GPC__}name 'hlineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  86. {$EXTERNALSYM hlineColor}
  87. function hlineRGBA( dst : PSDL_Surface; x1: Sint16; x2 : Sint16; y : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  88. cdecl; external {$IFDEF __GPC__}name 'hlineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  89. {$EXTERNALSYM hlineRGBA}
  90. // Vertical line
  91. function vlineColor( dst : PSDL_Surface; x : Sint16; y1 : Sint16; y2 : Sint16; color : Uint32 ) : integer;
  92. cdecl; external {$IFDEF __GPC__}name 'vlineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  93. {$EXTERNALSYM vlineColor}
  94. function vlineRGBA( dst : PSDL_Surface; x : Sint16; y1 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  95. cdecl; external {$IFDEF __GPC__}name 'vlineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  96. {$EXTERNALSYM vlineRGBA}
  97. // Rectangle
  98. function rectangleColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer;
  99. cdecl; external {$IFDEF __GPC__}name 'rectangleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  100. {$EXTERNALSYM rectangleColor}
  101. function rectangleRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16;
  102. x2 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  103. cdecl; external {$IFDEF __GPC__}name 'rectangleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  104. {$EXTERNALSYM rectangleRGBA}
  105. // Filled rectangle (Box)
  106. function boxColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer;
  107. cdecl; external {$IFDEF __GPC__}name 'boxColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  108. {$EXTERNALSYM boxColor}
  109. function boxRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16;
  110. y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  111. cdecl; external {$IFDEF __GPC__}name 'boxRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  112. {$EXTERNALSYM boxRGBA}
  113. // Line
  114. function lineColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer;
  115. cdecl; external {$IFDEF __GPC__}name 'lineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  116. {$EXTERNALSYM lineColor}
  117. function lineRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16;
  118. x2 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  119. cdecl; external {$IFDEF __GPC__}name 'lineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  120. {$EXTERNALSYM lineRGBA}
  121. // AA Line
  122. function aalineColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer;
  123. cdecl; external {$IFDEF __GPC__}name 'aalineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  124. {$EXTERNALSYM aalineColor}
  125. function aalineRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16;
  126. x2 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  127. cdecl; external {$IFDEF __GPC__}name 'aalineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  128. {$EXTERNALSYM aalineRGBA}
  129. // Circle
  130. function circleColor( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Sint16; color : Uint32 ) : integer;
  131. cdecl; external {$IFDEF __GPC__}name 'circleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  132. {$EXTERNALSYM circleColor}
  133. function circleRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  134. cdecl; external {$IFDEF __GPC__}name 'circleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  135. {$EXTERNALSYM circleRGBA}
  136. // AA Circle
  137. function aacircleColor( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Sint16; color : Uint32 ) : integer;
  138. cdecl; external {$IFDEF __GPC__}name 'aacircleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  139. {$EXTERNALSYM aacircleColor}
  140. function aacircleRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16;
  141. rad : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  142. cdecl; external {$IFDEF __GPC__}name 'aacircleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  143. {$EXTERNALSYM aacircleRGBA}
  144. // Filled Circle
  145. function filledCircleColor( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Sint16; color : Uint32 ) : integer;
  146. cdecl; external {$IFDEF __GPC__}name 'filledCircleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  147. {$EXTERNALSYM filledCircleColor}
  148. function filledCircleRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16;
  149. rad : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  150. cdecl; external {$IFDEF __GPC__}name 'filledCircleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  151. {$EXTERNALSYM filledCircleRGBA}
  152. // Ellipse
  153. function ellipseColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rx : Sint16; ry : Sint16; color : Uint32 ) : integer;
  154. cdecl; external {$IFDEF __GPC__}name 'ellipseColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  155. {$EXTERNALSYM ellipseColor}
  156. function ellipseRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16;
  157. rx : Sint16; ry : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  158. cdecl; external {$IFDEF __GPC__}name 'ellipseRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  159. {$EXTERNALSYM ellipseRGBA}
  160. // AA Ellipse
  161. function aaellipseColor( dst : PSDL_Surface; xc : Sint16; yc : Sint16; rx : Sint16; ry : Sint16; color : Uint32 ) : integer;
  162. cdecl; external {$IFDEF __GPC__}name 'aaellipseColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  163. {$EXTERNALSYM aaellipseColor}
  164. function aaellipseRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16;
  165. rx : Sint16; ry : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  166. cdecl; external {$IFDEF __GPC__}name 'aaellipseRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  167. {$EXTERNALSYM aaellipseRGBA}
  168. // Filled Ellipse
  169. function filledEllipseColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rx : Sint16; ry : Sint16; color : Uint32 ) : integer;
  170. cdecl; external {$IFDEF __GPC__}name 'filledEllipseColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  171. {$EXTERNALSYM filledEllipseColor}
  172. function filledEllipseRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16;
  173. rx : Sint16; ry : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  174. cdecl; external {$IFDEF __GPC__}name 'filledEllipseRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  175. {$EXTERNALSYM filledEllipseRGBA}
  176. // Pie
  177. function pieColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16;
  178. start : Sint16; finish : Sint16; color : Uint32 ) : integer;
  179. cdecl; external {$IFDEF __GPC__}name 'pieColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  180. {$EXTERNALSYM pieColor}
  181. function pieRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16;
  182. start : Sint16; finish : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  183. cdecl; external {$IFDEF __GPC__}name 'pieRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  184. {$EXTERNALSYM pieRGBA}
  185. // Filled Pie
  186. function filledPieColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16;
  187. start : Sint16; finish : Sint16; color : Uint32 ) : integer;
  188. cdecl; external {$IFDEF __GPC__}name 'filledPieColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  189. {$EXTERNALSYM filledPieColor}
  190. function filledPieRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16;
  191. start : Sint16; finish : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  192. cdecl; external {$IFDEF __GPC__}name 'filledPieRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  193. {$EXTERNALSYM filledPieRGBA}
  194. // Trigon
  195. function trigonColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; color : Uint32 ) : integer;
  196. cdecl; external {$IFDEF __GPC__}name 'trigonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  197. {$EXTERNALSYM trigonColor}
  198. function trigonRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16;
  199. r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  200. cdecl; external {$IFDEF __GPC__}name 'trigonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  201. {$EXTERNALSYM trigonRGBA}
  202. // AA-Trigon
  203. function aatrigonColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; color : Uint32 ) : integer;
  204. cdecl; external {$IFDEF __GPC__}name 'aatrigonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  205. {$EXTERNALSYM aatrigonColor}
  206. function aatrigonRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16;
  207. r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  208. cdecl; external {$IFDEF __GPC__}name 'aatrigonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  209. {$EXTERNALSYM aatrigonRGBA}
  210. // Filled Trigon
  211. function filledTrigonColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; color : Uint32 ) : integer;
  212. cdecl; external {$IFDEF __GPC__}name 'filledTrigonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  213. {$EXTERNALSYM filledTrigonColor}
  214. function filledTrigonRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16;
  215. r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  216. cdecl; external {$IFDEF __GPC__}name 'filledTrigonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  217. {$EXTERNALSYM filledTrigonRGBA}
  218. // Polygon
  219. function polygonColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; color : Uint32 ) : integer;
  220. cdecl; external {$IFDEF __GPC__}name 'polygonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  221. {$EXTERNALSYM polygonColor}
  222. function polygonRGBA( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16;
  223. n : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  224. cdecl; external {$IFDEF __GPC__}name 'polygonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  225. {$EXTERNALSYM polygonRGBA}
  226. // AA-Polygon
  227. function aapolygonColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; color : Uint32 ) : integer;
  228. cdecl; external {$IFDEF __GPC__}name 'aapolygonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  229. {$EXTERNALSYM aapolygonColor}
  230. function aapolygonRGBA( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16;
  231. n : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  232. cdecl; external {$IFDEF __GPC__}name 'aapolygonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  233. {$EXTERNALSYM aapolygonRGBA}
  234. // Filled Polygon
  235. function filledPolygonColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; color : Uint32 ) : integer;
  236. cdecl; external {$IFDEF __GPC__}name 'filledPolygonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  237. {$EXTERNALSYM filledPolygonColor}
  238. function filledPolygonRGBA( dst : PSDL_Surface; const vx : PSint16;
  239. const vy : PSint16; n : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  240. cdecl; external {$IFDEF __GPC__}name 'filledPolygonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  241. {$EXTERNALSYM filledPolygonRGBA}
  242. // Bezier
  243. // s = number of steps
  244. function bezierColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; s : integer; color : Uint32 ) : integer;
  245. cdecl; external {$IFDEF __GPC__}name 'bezierColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  246. {$EXTERNALSYM bezierColor}
  247. function bezierRGBA( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16;
  248. n : integer; s : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  249. cdecl; external {$IFDEF __GPC__}name 'bezierRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  250. {$EXTERNALSYM bezierRGBA}
  251. // Characters/Strings
  252. function characterColor( dst : PSDL_Surface; x : Sint16; y : Sint16; c : char; color : Uint32 ) : integer;
  253. cdecl; external {$IFDEF __GPC__}name 'characterColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  254. {$EXTERNALSYM characterColor}
  255. function characterRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; c : char; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  256. cdecl; external {$IFDEF __GPC__}name 'characterRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  257. {$EXTERNALSYM characterRGBA}
  258. function stringColor( dst : PSDL_Surface; x : Sint16; y : Sint16; const c : PChar; color : Uint32 ) : integer;
  259. cdecl; external {$IFDEF __GPC__}name 'stringColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  260. {$EXTERNALSYM stringColor}
  261. function stringRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; const c : PChar; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer;
  262. cdecl; external {$IFDEF __GPC__}name 'stringRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  263. {$EXTERNALSYM stringRGBA}
  264. procedure gfxPrimitivesSetFont(const fontdata : Pointer; cw : integer; ch : integer );
  265. cdecl; external {$IFDEF __GPC__}name 'gfxPrimitivesSetFont'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  266. {$EXTERNALSYM gfxPrimitivesSetFont}
  267. {
  268. SDL_imageFilter - bytes-image "filter" routines
  269. (uses inline x86 MMX optimizations if available)
  270. LGPL (c) A. Schiffler
  271. }
  272. { Comments: }
  273. { 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. }
  274. { 2.) Data that is not within an 8 byte boundary is processed using the C routine. }
  275. { 3.) Convolution routines do not have C routines at this time. }
  276. // Detect MMX capability in CPU
  277. function SDL_imageFilterMMXdetect : integer;
  278. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMMXdetect'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  279. {$EXTERNALSYM SDL_imageFilterMMXdetect}
  280. // Force use of MMX off (or turn possible use back on)
  281. procedure SDL_imageFilterMMXoff;
  282. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMMXoff'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  283. {$EXTERNALSYM SDL_imageFilterMMXoff}
  284. procedure SDL_imageFilterMMXon;
  285. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMMXon'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  286. {$EXTERNALSYM SDL_imageFilterMMXon}
  287. //
  288. // All routines return:
  289. // 0 OK
  290. // -1 Error (internal error, parameter error)
  291. //
  292. // SDL_imageFilterAdd: D = saturation255(S1 + S2)
  293. function SDL_imageFilterAdd(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer;
  294. cdecl; external {$IFDEF __GPC__}name 'SDL_imaSDL_imageFilterAddgeFilterMMXon'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  295. {$EXTERNALSYM SDL_imageFilterAdd}
  296. // SDL_imageFilterMean: D = S1/2 + S2/2
  297. function SDL_imageFilterMean(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer;
  298. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMean'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  299. {$EXTERNALSYM SDL_imageFilterMean}
  300. // SDL_imageFilterSub: D = saturation0(S1 - S2)
  301. function SDL_imageFilterSub(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer;
  302. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSub'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  303. {$EXTERNALSYM SDL_imageFilterSub}
  304. // SDL_imageFilterAbsDiff: D = | S1 - S2 |
  305. function SDL_imageFilterAbsDiff(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer;
  306. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAbsDiff'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  307. {$EXTERNALSYM SDL_imageFilterAbsDiff}
  308. // SDL_imageFilterMult: D = saturation(S1 * S2)
  309. function SDL_imageFilterMult(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer;
  310. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMult'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  311. {$EXTERNALSYM SDL_imageFilterMult}
  312. // SDL_imageFilterMultNor: D = S1 * S2 (non-MMX)
  313. function SDL_imageFilterMultNor(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer;
  314. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultNor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  315. {$EXTERNALSYM SDL_imageFilterMultNor}
  316. // SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)
  317. function SDL_imageFilterMultDivby2(Src1 : PChar; Src2 : PChar; Dest : PChar;
  318. length : integer ) : integer;
  319. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultDivby2'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  320. {$EXTERNALSYM SDL_imageFilterMultDivby2}
  321. // SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)
  322. function SDL_imageFilterMultDivby4(Src1 : PChar; Src2 : PChar; Dest : PChar;
  323. length : integer ) : integer;
  324. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultDivby4'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  325. {$EXTERNALSYM SDL_imageFilterMultDivby4}
  326. // SDL_imageFilterBitAnd: D = S1 & S2
  327. function SDL_imageFilterBitAnd(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer;
  328. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBitAnd'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  329. {$EXTERNALSYM SDL_imageFilterBitAnd}
  330. // SDL_imageFilterBitOr: D = S1 | S2
  331. function SDL_imageFilterBitOr(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer;
  332. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBitOr'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  333. {$EXTERNALSYM SDL_imageFilterBitOr}
  334. // SDL_imageFilterDiv: D = S1 / S2 (non-MMX)
  335. function SDL_imageFilterDiv(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer;
  336. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterDiv'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  337. {$EXTERNALSYM SDL_imageFilterDiv}
  338. // SDL_imageFilterBitNegation: D = !S
  339. function SDL_imageFilterBitNegation(Src1 : PChar; Dest : PChar; length : integer ) : integer;
  340. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBitNegation'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  341. {$EXTERNALSYM SDL_imageFilterBitNegation}
  342. // SDL_imageFilterAddByte: D = saturation255(S + C)
  343. function SDL_imageFilterAddByte(Src1 : PChar; Dest : PChar; length : integer; C : char ) : integer;
  344. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAddByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  345. {$EXTERNALSYM SDL_imageFilterAddByte}
  346. // SDL_imageFilterAddUint: D = saturation255(S + (uint)C)
  347. function SDL_imageFilterAddUint(Src1 : PChar; Dest : PChar; length : integer; C : Cardinal ) : integer;
  348. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAddUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  349. {$EXTERNALSYM SDL_imageFilterAddUint}
  350. // SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)
  351. function SDL_imageFilterAddByteToHalf(Src1 : PChar; Dest : PChar; length : integer;
  352. C : char ) : integer;
  353. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAddByteToHalf'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  354. {$EXTERNALSYM SDL_imageFilterAddByteToHalf}
  355. // SDL_imageFilterSubByte: D = saturation0(S - C)
  356. function SDL_imageFilterSubByte(Src1 : PChar; Dest : PChar; length : integer; C : char ) : integer;
  357. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSubByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  358. {$EXTERNALSYM SDL_imageFilterSubByte}
  359. // SDL_imageFilterSubUint: D = saturation0(S - (uint)C)
  360. function SDL_imageFilterSubUint(Src1 : PChar; Dest : PChar; length : integer; C : Cardinal ) : integer;
  361. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSubUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  362. {$EXTERNALSYM SDL_imageFilterSubUint}
  363. // SDL_imageFilterShiftRight: D = saturation0(S >> N)
  364. function SDL_imageFilterShiftRight(Src1 : PChar; Dest : PChar; length : integer; N : char ) : integer;
  365. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  366. {$EXTERNALSYM SDL_imageFilterShiftRight}
  367. // SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N)
  368. function SDL_imageFilterShiftRightUint(Src1 : PChar; Dest : PChar; length : integer; N : char ) : integer;
  369. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftRightUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  370. {$EXTERNALSYM SDL_imageFilterShiftRightUint}
  371. // SDL_imageFilterMultByByte: D = saturation255(S * C)
  372. function SDL_imageFilterMultByByte(Src1 : PChar; Dest : PChar; length : integer; C : char ) : integer;
  373. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultByByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  374. {$EXTERNALSYM SDL_imageFilterMultByByte}
  375. // SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)
  376. function SDL_imageFilterShiftRightAndMultByByte(Src1 : PChar; Dest : PChar; length : integer;
  377. N : char; C : char ) : integer;
  378. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftRightAndMultByByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  379. {$EXTERNALSYM SDL_imageFilterShiftRightAndMultByByte}
  380. // SDL_imageFilterShiftLeftByte: D = (S << N)
  381. function SDL_imageFilterShiftLeftByte(Src1 : PChar; Dest : PChar; length : integer;
  382. N : char ) : integer;
  383. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftLeftByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  384. {$EXTERNALSYM SDL_imageFilterShiftLeftByte}
  385. // SDL_imageFilterShiftLeftUint: D = ((uint)S << N)
  386. function SDL_imageFilterShiftLeftUint(Src1 : PChar; Dest : PChar; length : integer;
  387. N : char ) : integer;
  388. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftLeftUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  389. {$EXTERNALSYM SDL_imageFilterShiftLeftUint}
  390. // SDL_imageFilterShiftLeft: D = saturation255(S << N)
  391. function SDL_imageFilterShiftLeft(Src1 : PChar; Dest : PChar; length : integer; N : char ) : integer;
  392. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftLeft'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  393. {$EXTERNALSYM SDL_imageFilterShiftLeft}
  394. // SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0
  395. function SDL_imageFilterBinarizeUsingThreshold(Src1 : PChar; Dest : PChar; length : integer;
  396. T : char ) : integer;
  397. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBinarizeUsingThreshold'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  398. {$EXTERNALSYM SDL_imageFilterBinarizeUsingThreshold}
  399. // SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0
  400. function SDL_imageFilterClipToRange(Src1 : PChar; Dest : PChar; length : integer;
  401. Tmin : Byte; Tmax : Byte ) : integer;
  402. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterClipToRange'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  403. {$EXTERNALSYM SDL_imageFilterClipToRange}
  404. // SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
  405. function SDL_imageFilterNormalizeLinear(Src1 : PChar; Dest : PChar; length : integer; Cmin : integer;
  406. Cmax : integer; Nmin : integer; Nmax : integer ) : integer;
  407. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterClipToRange'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  408. {$EXTERNALSYM SDL_imageFilterClipToRange}
  409. { !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!! }
  410. // SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... )
  411. function SDL_imageFilterConvolveKernel3x3Divide(Src : PChar; Dest : PChar; rows : integer;
  412. columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer;
  413. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel3x3Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  414. {$EXTERNALSYM SDL_imageFilterConvolveKernel3x3Divide}
  415. // SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... )
  416. function SDL_imageFilterConvolveKernel5x5Divide(Src : PChar; Dest : PChar; rows : integer;
  417. columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer;
  418. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel5x5Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  419. {$EXTERNALSYM SDL_imageFilterConvolveKernel5x5Divide}
  420. // SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... )
  421. function SDL_imageFilterConvolveKernel7x7Divide(Src : PChar; Dest : PChar; rows : integer;
  422. columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer;
  423. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel7x7Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  424. {$EXTERNALSYM SDL_imageFilterConvolveKernel7x7Divide}
  425. // SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... )
  426. function SDL_imageFilterConvolveKernel9x9Divide(Src : PChar; Dest : PChar; rows : integer;
  427. columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer;
  428. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel9x9Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  429. {$EXTERNALSYM SDL_imageFilterConvolveKernel9x9Divide}
  430. // SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
  431. function SDL_imageFilterConvolveKernel3x3ShiftRight(Src : PChar; Dest : PChar; rows : integer;
  432. columns : integer; Kernel : PShortInt;
  433. NRightShift : char ) : integer;
  434. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel3x3ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  435. {$EXTERNALSYM SDL_imageFilterConvolveKernel3x3ShiftRight}
  436. // SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
  437. function SDL_imageFilterConvolveKernel5x5ShiftRight(Src : PChar; Dest : PChar; rows : integer;
  438. columns : integer; Kernel : PShortInt;
  439. NRightShift : char ) : integer;
  440. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel5x5ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  441. {$EXTERNALSYM SDL_imageFilterConvolveKernel5x5ShiftRight}
  442. // SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
  443. function SDL_imageFilterConvolveKernel7x7ShiftRight(Src : PChar; Dest : PChar; rows : integer;
  444. columns : integer; Kernel : PShortInt;
  445. NRightShift : char ) : integer;
  446. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel7x7ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  447. {$EXTERNALSYM SDL_imageFilterConvolveKernel7x7ShiftRight}
  448. // SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... )
  449. function SDL_imageFilterConvolveKernel9x9ShiftRight(Src : PChar; Dest : PChar; rows : integer;
  450. columns : integer; Kernel : PShortInt;
  451. NRightShift : char ) : integer;
  452. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel9x9ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  453. {$EXTERNALSYM SDL_imageFilterConvolveKernel9x9ShiftRight}
  454. // SDL_imageFilterSobelX: Dij = saturation255( ... )
  455. function SDL_imageFilterSobelX(Src : PChar; Dest : PChar; rows : integer; columns : integer ) : integer;
  456. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSobelX'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  457. {$EXTERNALSYM SDL_imageFilterSobelX}
  458. // SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... )
  459. function SDL_imageFilterSobelXShiftRight(Src : PChar; Dest : PChar; rows : integer; columns : integer;
  460. NRightShift : char ) : integer;
  461. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSobelXShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  462. {$EXTERNALSYM SDL_imageFilterSobelXShiftRight}
  463. // Align/restore stack to 32 byte boundary -- Functionality untested! --
  464. procedure SDL_imageFilterAlignStack;
  465. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAlignStack'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  466. {$EXTERNALSYM SDL_imageFilterAlignStack}
  467. procedure SDL_imageFilterRestoreStack;
  468. cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterRestoreStack'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  469. {$EXTERNALSYM SDL_imageFilterRestoreStack}
  470. {
  471. SDL_rotozoom - rotozoomer
  472. LGPL (c) A. Schiffler
  473. }
  474. {
  475. rotozoomSurface()
  476. Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
  477. 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1
  478. then the destination 32bit surface is anti-aliased. If the surface is not 8bit
  479. or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
  480. }
  481. function rotozoomSurface( src : PSDL_Surface; angle : double; zoom : double; smooth : integer ) : PSDL_Surface;
  482. cdecl; external {$IFDEF __GPC__}name 'rotozoomSurface'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  483. {$EXTERNALSYM rotozoomSurface}
  484. function rotozoomSurfaceXY( src : PSDL_Surface; angle : double; zoomx : double; zoomy : double; smooth : integer ) : PSDL_Surface;
  485. cdecl; external {$IFDEF __GPC__}name 'rotozoomSurfaceXY'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  486. {$EXTERNALSYM rotozoomSurfaceXY}
  487. { Returns the size of the target surface for a rotozoomSurface() call }
  488. procedure rotozoomSurfaceSize( width : integer; height : integer; angle : double; zoom : double; var dstwidth : integer;
  489. var dstheight : integer );
  490. cdecl; external {$IFDEF __GPC__}name 'rotozoomSurfaceSize'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  491. {$EXTERNALSYM rotozoomSurfaceSize}
  492. procedure rotozoomSurfaceSizeXY
  493. ( width : integer; height : integer; angle : double; zoomx : double; zoomy : double;
  494. var dstwidth : integer; var dstheight : integer );
  495. cdecl; external {$IFDEF __GPC__}name 'rotozoomSurfaceSizeXY'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  496. {$EXTERNALSYM rotozoomSurfaceSizeXY}
  497. {
  498. zoomSurface()
  499. Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
  500. 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1
  501. then the destination 32bit surface is anti-aliased. If the surface is not 8bit
  502. or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
  503. }
  504. function zoomSurface(src : PSDL_Surface; zoomx : double; zoomy : double; smooth : integer ) : PSDL_Surface;
  505. cdecl; external {$IFDEF __GPC__}name 'zoomSurface'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  506. {$EXTERNALSYM zoomSurface}
  507. { Returns the size of the target surface for a zoomSurface() call }
  508. procedure zoomSurfaceSize( width : integer; height : integer; zoomx : double; zoomy : double; var dstwidth : integer; var dstheight : integer );
  509. cdecl; external {$IFDEF __GPC__}name 'zoomSurfaceSize'{$ELSE} SDLgfxLibName{$ENDIF __GPC__};
  510. {$EXTERNALSYM zoomSurfaceSize}
  511. implementation
  512. end.