sdlsurface.inc 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. //from "sdl_surface.h"
  2. const
  3. {**
  4. * Surface flags
  5. *
  6. * These are the currently supported flags for the ::SDL_surface.
  7. *
  8. * Used internally (read-only).
  9. *}
  10. SDL_SWSURFACE = 0; {**< Just here for compatibility *}
  11. SDL_PREALLOC = $00000001; {**< Surface uses preallocated memory *}
  12. SDL_RLEACCEL = $00000002; {**< Surface is RLE encoded *}
  13. SDL_DONTFREE = $00000004; {**< Surface is referenced internally *}
  14. SDL_SIMD_ALIGNED = $00000008; {**< Surface uses aligned memory *}
  15. type
  16. {**
  17. * A collection of pixels used in software blitting.
  18. *
  19. * This structure should be treated as read-only, except for \c pixels,
  20. * which, if not NULL, contains the raw pixel data for the surface.
  21. *}
  22. PPSDL_BlitMap = ^PSDL_BlitMap;
  23. PSDL_BlitMap = ^TSDL_BlitMap;
  24. TSDL_BlitMap = record
  25. map: Pointer;
  26. end;
  27. PPSDL_Surface = ^PSDL_Surface;
  28. PSDL_Surface = ^TSDL_Surface;
  29. TSDL_Surface = record
  30. flags: cuint32; {**< Read-only *}
  31. format: PSDL_PixelFormat; {**< Read-only *}
  32. w, h: cint; {**< Read-only *}
  33. pitch: cint; {**< Read-only *}
  34. pixels: Pointer; {**< Read-write *}
  35. {** Application data associated with the surface *}
  36. userdata: Pointer; {**< Read-write *}
  37. {** information needed for surfaces requiring locks *}
  38. locked: cint; {**< Read-only *}
  39. //lock_data: Pointer; {**< Read-only *} // field gone in or before 2.0.14?
  40. {** list of BlitMap that hold a reference to this surface *}
  41. list_blitmap: Pointer; {**< Private *}
  42. {** clipping information *}
  43. clip_rect: TSDL_Rect; {**< Read-only *}
  44. {** info for fast blit mapping to other surfaces *}
  45. map: Pointer; {**< Private *} // TODO: Check: Why Pointer and not PSDL_BlitMap used here?
  46. {** Reference count -- used when freeing surface *}
  47. refcount: cint; {**< Read-mostly *}
  48. end;
  49. // Evaluates to true if the surface needs to be locked before access.
  50. function SDL_MUSTLOCK(Const S:PSDL_Surface):Boolean;
  51. type
  52. {**
  53. * The type of function used for surface blitting functions.
  54. *}
  55. PPSDL_Blit = ^PSDL_Blit;
  56. PSDL_Blit = ^TSDL_Blit;
  57. TSDL_Blit = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint;
  58. type
  59. {**
  60. * \brief The formula used for converting between YUV and RGB
  61. *}
  62. TSDL_YUV_CONVERSION_MODE = type Integer;
  63. const
  64. SDL_YUV_CONVERSION_JPEG = TSDL_YUV_CONVERSION_MODE(0); {**< Full range JPEG *}
  65. SDL_YUV_CONVERSION_BT601 = TSDL_YUV_CONVERSION_MODE(1); {**< BT.601 (the default) *}
  66. SDL_YUV_CONVERSION_BT709 = TSDL_YUV_CONVERSION_MODE(2); {**< BT.709 *}
  67. SDL_YUV_CONVERSION_AUTOMATIC = TSDL_YUV_CONVERSION_MODE(3); {**< BT.601 for SD content, BT.709 for HD content *}
  68. {**
  69. * Allocate and free an RGB surface.
  70. *
  71. * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
  72. * If the depth is greater than 8 bits, the pixel format is set using the
  73. * flags '[RGB]mask'.
  74. *
  75. * If the function runs out of memory, it will return NULL.
  76. *
  77. * \param flags The \c flags are obsolete and should be set to 0.
  78. * \param width The width in pixels of the surface to create.
  79. * \param height The height in pixels of the surface to create.
  80. * \param depth The depth in bits of the surface to create.
  81. * \param Rmask The red mask of the surface to create.
  82. * \param Gmask The green mask of the surface to create.
  83. * \param Bmask The blue mask of the surface to create.
  84. * \param Amask The alpha mask of the surface to create.
  85. *}
  86. function SDL_CreateRGBSurface(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl;
  87. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurface' {$ENDIF} {$ENDIF};
  88. {* !!! FIXME for 2.1: why does this ask for depth? Format provides that. *}
  89. function SDL_CreateRGBSurfaceWithFormat(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl;
  90. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormat' {$ENDIF} {$ENDIF};
  91. function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl;
  92. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceFrom' {$ENDIF} {$ENDIF};
  93. function SDL_CreateRGBSurfaceWithFormatFrom(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl;
  94. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormatFrom' {$ENDIF} {$ENDIF};
  95. procedure SDL_FreeSurface(surface: PSDL_Surface); cdecl;
  96. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeSurface' {$ENDIF} {$ENDIF};
  97. {**
  98. * Set the palette used by a surface.
  99. *
  100. * 0, or -1 if the surface format doesn't use a palette.
  101. *
  102. * A single palette can be shared with many surfaces.
  103. *}
  104. function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl;
  105. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfacePalette' {$ENDIF} {$ENDIF};
  106. {**
  107. * Sets up a surface for directly accessing the pixels.
  108. *
  109. * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
  110. * to and read from surface.pixels, using the pixel format stored in
  111. * surface.format. Once you are done accessing the surface, you should
  112. * use SDL_UnlockSurface() to release it.
  113. *
  114. * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
  115. * to 0, then you can read and write to the surface at any time, and the
  116. * pixel format of the surface will not change.
  117. *
  118. * No operating system or library calls should be made between lock/unlock
  119. * pairs, as critical system locks may be held during this time.
  120. *
  121. * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
  122. *
  123. * SDL_UnlockSurface()
  124. *}
  125. function SDL_LockSurface(surface: PSDL_Surface): cint; cdecl;
  126. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockSurface' {$ENDIF} {$ENDIF};
  127. {** SDL_LockSurface() *}
  128. procedure SDL_UnlockSurface(surface: PSDL_Surface); cdecl;
  129. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockSurface' {$ENDIF} {$ENDIF};
  130. {**
  131. * Load a surface from a seekable SDL data stream (memory or file).
  132. *
  133. * If freesrc is non-zero, the stream will be closed after being read.
  134. *
  135. * The new surface should be freed with SDL_FreeSurface().
  136. *
  137. * the new surface, or NULL if there was an error.
  138. *}
  139. function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl;
  140. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadBMP_RW' {$ENDIF} {$ENDIF};
  141. {**
  142. * Load a surface from a file.
  143. *
  144. * Convenience macro.
  145. *}
  146. function SDL_LoadBMP(_file: PAnsiChar): PSDL_Surface;
  147. {**
  148. * Save a surface to a seekable SDL data stream (memory or file).
  149. *
  150. * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
  151. * BMP directly. Other RGB formats with 8-bit or higher get converted to a
  152. * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
  153. * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
  154. * not supported.
  155. *
  156. * If \c freedst is non-zero, the stream will be closed after being written.
  157. *
  158. * \return 0 if successful or -1 if there was an error.
  159. *}
  160. function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl;
  161. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveBMP_RW' {$ENDIF} {$ENDIF};
  162. {**
  163. * Save a surface to a file.
  164. *
  165. * Convenience macro.
  166. *}
  167. { TODO : Check: Why AnsiString instead of PAnsiChar used here? Compare SDL_LoadBMP macro. }
  168. function SDL_SaveBMP(const surface: PSDL_Surface; const filename:AnsiString): cint;
  169. {**
  170. * Sets the RLE acceleration hint for a surface.
  171. *
  172. * 0 on success, or -1 if the surface is not valid
  173. *
  174. * If RLE is enabled, colorkey and alpha blending blits are much faster,
  175. * but the surface must be locked before directly accessing the pixels.
  176. *}
  177. function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: cint): cint; cdecl;
  178. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceRLE' {$ENDIF} {$ENDIF};
  179. {**
  180. * \brief Returns whether the surface is RLE enabled
  181. *
  182. * \return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled
  183. *}
  184. function SDL_HasSurfaceRLE(surface: PSDL_Surface): TSDL_Bool; cdecl;
  185. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSurfaceRLE' {$ENDIF} {$ENDIF};
  186. {**
  187. * Sets the color key (transparent pixel) in a blittable surface.
  188. *
  189. * surface The surface to update
  190. * flag Non-zero to enable colorkey and 0 to disable colorkey
  191. * key The transparent pixel in the native surface format
  192. *
  193. * 0 on success, or -1 if the surface is not valid
  194. *
  195. * You can pass SDL_RLEACCEL to enable RLE accelerated blits.
  196. *}
  197. function SDL_SetColorKey(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl;
  198. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetColorKey' {$ENDIF} {$ENDIF};
  199. {**
  200. * \brief Returns whether the surface has a color key
  201. *
  202. * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key
  203. *}
  204. function SDL_HasColorKey(surface: PSDL_Surface): TSDL_Bool; cdecl;
  205. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasColorKey' {$ENDIF} {$ENDIF};
  206. {**
  207. * Gets the color key (transparent pixel) in a blittable surface.
  208. *
  209. * surface The surface to update
  210. * key A pointer filled in with the transparent pixel in the native
  211. * surface format
  212. *
  213. * 0 on success, or -1 if the surface is not valid or colorkey is not
  214. * enabled.
  215. *}
  216. function SDL_GetColorKey(surface: PSDL_Surface; key: pcuint32): cint; cdecl;
  217. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetColorKey' {$ENDIF} {$ENDIF};
  218. {**
  219. * Set an additional color value used in blit operations.
  220. *
  221. * surface The surface to update.
  222. * r The red color value multiplied into blit operations.
  223. * g The green color value multiplied into blit operations.
  224. * b The blue color value multiplied into blit operations.
  225. *
  226. * 0 on success, or -1 if the surface is not valid.
  227. *
  228. * SDL_GetSurfaceColorMod()
  229. *}
  230. function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl;
  231. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceColorMod' {$ENDIF} {$ENDIF};
  232. {**
  233. * Get the additional color value used in blit operations.
  234. *
  235. * surface The surface to query.
  236. * r A pointer filled in with the current red color value.
  237. * g A pointer filled in with the current green color value.
  238. * b A pointer filled in with the current blue color value.
  239. *
  240. * 0 on success, or -1 if the surface is not valid.
  241. *
  242. * SDL_SetSurfaceColorMod()
  243. *}
  244. function SDL_GetSurfaceColorMod(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl;
  245. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceColorMod' {$ENDIF} {$ENDIF};
  246. {**
  247. * Set an additional alpha value used in blit operations.
  248. *
  249. * surface The surface to update.
  250. * alpha The alpha value multiplied into blit operations.
  251. *
  252. * 0 on success, or -1 if the surface is not valid.
  253. *
  254. * SDL_GetSurfaceAlphaMod()
  255. *}
  256. function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: cuint8): cint; cdecl;
  257. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceAlphaMod' {$ENDIF} {$ENDIF};
  258. {**
  259. * Get the additional alpha value used in blit operations.
  260. *
  261. * surface The surface to query.
  262. * alpha A pointer filled in with the current alpha value.
  263. *
  264. * 0 on success, or -1 if the surface is not valid.
  265. *
  266. * SDL_SetSurfaceAlphaMod()
  267. *}
  268. function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl;
  269. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceAlphaMod' {$ENDIF} {$ENDIF};
  270. {**
  271. * Set the blend mode used for blit operations.
  272. *
  273. * surface The surface to update.
  274. * blendMode ::SDL_BlendMode to use for blit blending.
  275. *
  276. * 0 on success, or -1 if the parameters are not valid.
  277. *
  278. * SDL_GetSurfaceBlendMode()
  279. *}
  280. function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl;
  281. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceBlendMode' {$ENDIF} {$ENDIF};
  282. {**
  283. * Get the blend mode used for blit operations.
  284. *
  285. * surface The surface to query.
  286. * blendMode A pointer filled in with the current blend mode.
  287. *
  288. * 0 on success, or -1 if the surface is not valid.
  289. *
  290. * SDL_SetSurfaceBlendMode()
  291. *}
  292. function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl;
  293. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceBlendMode' {$ENDIF} {$ENDIF};
  294. {**
  295. * Sets the clipping rectangle for the destination surface in a blit.
  296. *
  297. * If the clip rectangle is NULL, clipping will be disabled.
  298. *
  299. * If the clip rectangle doesn't intersect the surface, the function will
  300. * return SDL_FALSE and blits will be completely clipped. Otherwise the
  301. * function returns SDL_TRUE and blits to the surface will be clipped to
  302. * the intersection of the surface area and the clipping rectangle.
  303. *
  304. * Note that blits are automatically clipped to the edges of the source
  305. * and destination surfaces.
  306. *}
  307. function SDL_SetClipRect(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl;
  308. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetClipRect' {$ENDIF} {$ENDIF};
  309. {**
  310. * Gets the clipping rectangle for the destination surface in a blit.
  311. *
  312. * rect must be a pointer to a valid rectangle which will be filled
  313. * with the correct values.
  314. *}
  315. procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl;
  316. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClipRect' {$ENDIF} {$ENDIF};
  317. {*
  318. * Creates a new surface identical to the existing surface
  319. *}
  320. function SDL_DuplicateSurface(surface: PSDL_Surface): PSDL_Surface; cdecl;
  321. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DuplicateSurface' {$ENDIF} {$ENDIF};
  322. {**
  323. * Creates a new surface of the specified format, and then copies and maps
  324. * the given surface to it so the blit of the converted surface will be as
  325. * fast as possible. If this function fails, it returns NULL.
  326. *
  327. * The flags parameter is passed to SDL_CreateRGBSurface() and has those
  328. * semantics. You can also pass SDL_RLEACCEL in the flags parameter and
  329. * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
  330. * surface.
  331. *}
  332. function SDL_ConvertSurface(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl;
  333. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurface' {$ENDIF} {$ENDIF};
  334. function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl;
  335. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurfaceFormat' {$ENDIF} {$ENDIF};
  336. {**
  337. * Copy a block of pixels of one format to another format
  338. *
  339. * 0 on success, or -1 if there was an error
  340. *}
  341. function SDL_ConvertPixels(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl;
  342. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertPixels' {$ENDIF} {$ENDIF};
  343. {**
  344. * Performs a fast fill of the given rectangle with color.
  345. *
  346. * If rect is NULL, the whole surface will be filled with color.
  347. *
  348. * The color should be a pixel of the format used by the surface, and
  349. * can be generated by the SDL_MapRGB() function.
  350. *
  351. * 0 on success, or -1 on error.
  352. *}
  353. function SDL_FillRect(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl;
  354. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRect' {$ENDIF} {$ENDIF};
  355. function SDL_FillRects(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl;
  356. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRects' {$ENDIF} {$ENDIF};
  357. {**
  358. * Performs a fast blit from the source surface to the destination surface.
  359. *
  360. * This assumes that the source and destination rectangles are
  361. * the same size. If either \c srcrect or \c dstrect are NULL, the entire
  362. * surface ( src or dst) is copied. The final blit rectangles are saved
  363. * in srcrect and dstrect after all clipping is performed.
  364. *
  365. * If the blit is successful, it returns 0, otherwise it returns -1.
  366. *
  367. * The blit function should not be called on a locked surface.
  368. *
  369. * The blit semantics for surfaces with and without alpha and colorkey
  370. * are defined as follows:
  371. *
  372. RGBA->RGB:
  373. SDL_SRCALPHA set:
  374. alpha-blend (using alpha-channel).
  375. SDL_SRCCOLORKEY ignored.
  376. SDL_SRCALPHA not set:
  377. copy RGB.
  378. if SDL_SRCCOLORKEY set, only copy the pixels matching the
  379. RGB values of the source colour key, ignoring alpha in the
  380. comparison.
  381. RGB->RGBA:
  382. SDL_SRCALPHA set:
  383. alpha-blend (using the source per-surface alpha value);
  384. set destination alpha to opaque.
  385. SDL_SRCALPHA not set:
  386. copy RGB, set destination alpha to source per-surface alpha value.
  387. both:
  388. if SDL_SRCCOLORKEY set, only copy the pixels matching the
  389. source colour key.
  390. RGBA->RGBA:
  391. SDL_SRCALPHA set:
  392. alpha-blend (using the source alpha channel) the RGB values;
  393. leave destination alpha untouched. [Note: is this correct?]
  394. SDL_SRCCOLORKEY ignored.
  395. SDL_SRCALPHA not set:
  396. copy all of RGBA to the destination.
  397. if SDL_SRCCOLORKEY set, only copy the pixels matching the
  398. RGB values of the source colour key, ignoring alpha in the
  399. comparison.
  400. RGB->RGB:
  401. SDL_SRCALPHA set:
  402. alpha-blend (using the source per-surface alpha value).
  403. SDL_SRCALPHA not set:
  404. copy RGB.
  405. both:
  406. if SDL_SRCCOLORKEY set, only copy the pixels matching the
  407. source colour key.r
  408. *
  409. * You should call SDL_BlitSurface() unless you know exactly how SDL
  410. * blitting works internally and how to use the other blit functions.
  411. *}
  412. (* SDL_surface.h uses #define to change all SDL_BlitSurface() calls into SDL_UpperBlit() calls. *
  413. * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurface() to SDL_UpperBlit(). *)
  414. function SDL_BlitSurface(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl;
  415. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_UpperBlit' {$ELSE} 'SDL_UpperBlit' {$IFEND};
  416. {**
  417. * This is the public blit function, SDL_BlitSurface(), and it performs
  418. * rectangle validation and clipping before passing it to SDL_LowerBlit()
  419. *}
  420. function SDL_UpperBlit(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl;
  421. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpperBlit' {$ENDIF} {$ENDIF};
  422. {**
  423. * This is a semi-private blit function and it performs low-level surface
  424. * blitting only.
  425. *}
  426. function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl;
  427. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LowerBlit' {$ENDIF} {$ENDIF};
  428. {**
  429. * Perform a fast, low quality, stretch blit between two surfaces of the
  430. * same pixel format.
  431. *
  432. * This function uses a static buffer, and is not thread-safe.
  433. *}
  434. function SDL_SoftStretch(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl;
  435. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SoftStretch' {$ENDIF} {$ENDIF};
  436. (* SDL_surface.h uses #define to change all SDL_BlitSurfaceScaled() calls into SDL_UpperBlitScaled() calls. *
  437. * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurfaceScaled() to SDL_UpperBlitScaled(). *)
  438. function SDL_BlitSurfaceScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl;
  439. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_UpperBlitScaled' {$ELSE} 'SDL_UpperBlitScaled' {$IFEND};
  440. {**
  441. * This is the public scaled blit function, SDL_BlitScaled(), and it performs
  442. * rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
  443. *}
  444. function SDL_UpperBlitScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl;
  445. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpperBlitScaled' {$ENDIF} {$ENDIF};
  446. {**
  447. * This is a semi-private blit function and it performs low-level surface
  448. * scaled blitting only.
  449. *}
  450. function SDL_LowerBlitScaled(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl;
  451. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LowerBlitScaled' {$ENDIF} {$ENDIF};
  452. {**
  453. * \brief Set the YUV conversion mode
  454. *}
  455. procedure SDL_SetYUVConversionMode(mode: TSDL_YUV_CONVERSION_MODE); cdecl;
  456. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetYUVConversionMode' {$ENDIF} {$ENDIF};
  457. {**
  458. * \brief Get the YUV conversion mode
  459. *}
  460. function SDL_GetYUVConversionMode: TSDL_YUV_CONVERSION_MODE; cdecl;
  461. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionMode' {$ENDIF} {$ENDIF};
  462. {**
  463. * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
  464. *}
  465. function SDL_GetYUVConversionModeForResolution(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl;
  466. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionModeForResolution' {$ENDIF} {$ENDIF};