sdlshape.inc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // from "sdl_shape.h"
  2. {** SDL_shape.h
  3. *
  4. * Header file for the shaped window API.
  5. *}
  6. const
  7. SDL_NONSHAPEABLE_WINDOW = -1;
  8. SDL_INVALID_SHAPE_ARGUMENT = -2;
  9. SDL_WINDOW_LACKS_SHAPE = -3;
  10. {**
  11. * Create a window that can be shaped with the specified position, dimensions,
  12. * and flags.
  13. *
  14. * \param title The title of the window, in UTF-8 encoding.
  15. * \param x The x position of the window, SDL_WINDOWPOS_CENTERED,
  16. * or SDL_WINDOWPOS_UNDEFINED.
  17. * \param y The y position of the window, SDL_WINDOWPOS_CENTERED,
  18. * or SDL_WINDOWPOS_UNDEFINED.
  19. * \param w The width of the window.
  20. * \param h The height of the window.
  21. * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with
  22. * any of the following: SDL_WINDOW_OPENGL,
  23. * SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_HIDDEN,
  24. * SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED,
  25. * SDL_WINDOW_MINIMIZED.
  26. * SDL_WINDOW_BORDERLESS is always set,
  27. * and SDL_WINDOW_FULLSCREEN is always unset.
  28. * \return the window created, or NIL if window creation failed.
  29. *
  30. * \since This function is available since SDL 2.0.0.
  31. *
  32. * \sa SDL_DestroyWindow
  33. *}
  34. function SDL_CreateShapedWindow(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl;
  35. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateShapedWindow' {$ENDIF} {$ENDIF};
  36. {**
  37. * Return whether the given window is a shaped window.
  38. *
  39. * \param window The window to query for being shaped.
  40. * \return SDL_TRUE if the window is a window that can be shaped,
  41. * SDL_FALSE if the window is unshaped or NIL.
  42. *
  43. * \since This function is available since SDL 2.0.0.
  44. *
  45. * \sa SDL_CreateShapedWindow
  46. *}
  47. function SDL_IsShapedWindow(window: PSDL_Window): TSDL_Bool; cdecl;
  48. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsShapedWindow' {$ENDIF} {$ENDIF};
  49. type
  50. {** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. *}
  51. PPWindowShapeMode = ^PWindowShapeMode;
  52. PWindowShapeMode = ^TWindowShapeMode;
  53. TWindowShapeMode = type Integer;
  54. const
  55. {** \brief The default mode, a binarized alpha cutoff of 1. *}
  56. ShapeModeDefault = TWindowShapeMode(0);
  57. {** \brief A binarized alpha cutoff with a given integer value. *}
  58. ShapeModeBinarizeAlpha = TWindowShapeMode(1);
  59. {** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. *}
  60. ShapeModeReverseBinarizeAlpha = TWindowShapeMode(2);
  61. {** \brief A color key is applied. *}
  62. ShapeModeColorKey = TWindowShapeMode(3);
  63. function SDL_SHAPEMODEALPHA(mode: TWindowShapeMode): Boolean;
  64. type
  65. {** A union containing parameters for shaped windows. *}
  66. PPSDL_WindowShapeParams = ^PSDL_WindowShapeParams;
  67. PSDL_WindowShapeParams = ^TSDL_WindowShapeParams;
  68. TSDL_WindowShapeParams = record
  69. case cint of
  70. {** a cutoff alpha value for binarization of the window shape's alpha channel. *}
  71. 0: (binarizationCutoff: cuint8;);
  72. 1: (colorKey: TSDL_Color;);
  73. end;
  74. {** A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. *}
  75. PPSDL_WindowShapeMode = ^PSDL_WindowShapeMode;
  76. PSDL_WindowShapeMode = ^TSDL_WindowShapeMode;
  77. TSDL_WindowShapeMode = record
  78. {** The mode of these window-shape parameters. *}
  79. mode: TWindowShapeMode;
  80. {** Window-shape parameters. *}
  81. parameters: TSDL_WindowShapeParams;
  82. end;
  83. {**
  84. * Set the shape and parameters of a shaped window.
  85. *
  86. * \param window The shaped window whose parameters should be set.
  87. * \param shape A surface encoding the desired shape for the window.
  88. * \param shape_mode The parameters to set for the shaped window.
  89. * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape
  90. * argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does
  91. * not reference a valid shaped window.
  92. *
  93. * \since This function is available since SDL 2.0.0.
  94. *
  95. * \sa SDL_WindowShapeMode
  96. * \sa SDL_GetShapedWindowMode
  97. *}
  98. function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl;
  99. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowShape' {$ENDIF} {$ENDIF};
  100. {**
  101. * Get the shape parameters of a shaped window.
  102. *
  103. * \param window The shaped window whose parameters should be retrieved.
  104. * \param shape_mode An empty shape-mode structure to fill, or NIL to check
  105. * whether the window has a shape.
  106. * \return 0 if the window has a shape and, provided shape_mode was not NIL,
  107. * shape_mode has been filled with the mode data,
  108. * SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped
  109. * window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a
  110. * shapeable window currently lacking a shape.
  111. *
  112. * \since This function is available since SDL 2.0.0.
  113. *
  114. * \sa SDL_WindowShapeMode
  115. * \sa SDL_SetWindowShape
  116. *}
  117. function SDL_GetShapedWindowMode(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl;
  118. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetShapedWindowMode' {$ENDIF} {$ENDIF};