include/SDL_shape.h
changeset 7191 75360622e65f
parent 6885 700f1b25f77f
child 7480 d0bfce3937e0
equal deleted inserted replaced
7190:11612d544fcd 7191:75360622e65f
    29 #include "SDL_video.h"
    29 #include "SDL_video.h"
    30 
    30 
    31 #include "begin_code.h"
    31 #include "begin_code.h"
    32 /* Set up for C function definitions, even when using C++ */
    32 /* Set up for C function definitions, even when using C++ */
    33 #ifdef __cplusplus
    33 #ifdef __cplusplus
    34 /* *INDENT-OFF* */
       
    35 extern "C" {
    34 extern "C" {
    36 /* *INDENT-ON* */
       
    37 #endif
    35 #endif
    38 
    36 
    39 /** \file SDL_shape.h
    37 /** \file SDL_shape.h
    40  *
    38  *
    41  * Header file for the shaped window API.
    39  * Header file for the shaped window API.
    45 #define SDL_INVALID_SHAPE_ARGUMENT -2
    43 #define SDL_INVALID_SHAPE_ARGUMENT -2
    46 #define SDL_WINDOW_LACKS_SHAPE -3
    44 #define SDL_WINDOW_LACKS_SHAPE -3
    47 
    45 
    48 /**
    46 /**
    49  *  \brief Create a window that can be shaped with the specified position, dimensions, and flags.
    47  *  \brief Create a window that can be shaped with the specified position, dimensions, and flags.
    50  *  
    48  *
    51  *  \param title The title of the window, in UTF-8 encoding.
    49  *  \param title The title of the window, in UTF-8 encoding.
    52  *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or 
    50  *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
    53  *               ::SDL_WINDOWPOS_UNDEFINED.
    51  *               ::SDL_WINDOWPOS_UNDEFINED.
    54  *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or 
    52  *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
    55  *               ::SDL_WINDOWPOS_UNDEFINED.
    53  *               ::SDL_WINDOWPOS_UNDEFINED.
    56  *  \param w     The width of the window.
    54  *  \param w     The width of the window.
    57  *  \param h     The height of the window.
    55  *  \param h     The height of the window.
    58  *  \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: 
    56  *  \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
    59  *               ::SDL_WINDOW_OPENGL,     ::SDL_WINDOW_INPUT_GRABBED,
    57  *               ::SDL_WINDOW_OPENGL,     ::SDL_WINDOW_INPUT_GRABBED,
    60  *               ::SDL_WINDOW_SHOWN,      ::SDL_WINDOW_RESIZABLE,
    58  *               ::SDL_WINDOW_SHOWN,      ::SDL_WINDOW_RESIZABLE,
    61  *               ::SDL_WINDOW_MAXIMIZED,  ::SDL_WINDOW_MINIMIZED,
    59  *               ::SDL_WINDOW_MAXIMIZED,  ::SDL_WINDOW_MINIMIZED,
    62  *		 ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
    60  *       ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
    63  *  
    61  *
    64  *  \return The window created, or NULL if window creation failed.
    62  *  \return The window created, or NULL if window creation failed.
    65  *  
    63  *
    66  *  \sa SDL_DestroyWindow()
    64  *  \sa SDL_DestroyWindow()
    67  */
    65  */
    68 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
    66 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
    69 
    67 
    70 /**
    68 /**
    71  * \brief Return whether the given window is a shaped window. 
    69  * \brief Return whether the given window is a shaped window.
    72  *
    70  *
    73  * \param window The window to query for being shaped.
    71  * \param window The window to query for being shaped.
    74  *
    72  *
    75  * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
    73  * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
    76  * \sa SDL_CreateShapedWindow
    74  * \sa SDL_CreateShapedWindow
    77  */
    75  */
    78 extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
    76 extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
    79 
    77 
    80 /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
    78 /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
    81 typedef enum {
    79 typedef enum {
    82 	/** \brief The default mode, a binarized alpha cutoff of 1. */
    80     /** \brief The default mode, a binarized alpha cutoff of 1. */
    83 	ShapeModeDefault,
    81     ShapeModeDefault,
    84 	/** \brief A binarized alpha cutoff with a given integer value. */
    82     /** \brief A binarized alpha cutoff with a given integer value. */
    85 	ShapeModeBinarizeAlpha,
    83     ShapeModeBinarizeAlpha,
    86 	/** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
    84     /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
    87 	ShapeModeReverseBinarizeAlpha,
    85     ShapeModeReverseBinarizeAlpha,
    88 	/** \brief A color key is applied. */
    86     /** \brief A color key is applied. */
    89 	ShapeModeColorKey
    87     ShapeModeColorKey
    90 } WindowShapeMode;
    88 } WindowShapeMode;
    91 
    89 
    92 #define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
    90 #define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
    93 
    91 
    94 /** \brief A union containing parameters for shaped windows. */
    92 /** \brief A union containing parameters for shaped windows. */
    95 typedef union {
    93 typedef union {
    96 	/** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
    94     /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
    97 	Uint8 binarizationCutoff;
    95     Uint8 binarizationCutoff;
    98 	SDL_Color colorKey;
    96     SDL_Color colorKey;
    99 } SDL_WindowShapeParams;
    97 } SDL_WindowShapeParams;
   100 
    98 
   101 /** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
    99 /** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
   102 typedef struct SDL_WindowShapeMode {
   100 typedef struct SDL_WindowShapeMode {
   103 	/** \brief The mode of these window-shape parameters. */
   101     /** \brief The mode of these window-shape parameters. */
   104 	WindowShapeMode mode;
   102     WindowShapeMode mode;
   105 	/** \brief Window-shape parameters. */
   103     /** \brief Window-shape parameters. */
   106 	SDL_WindowShapeParams parameters;
   104     SDL_WindowShapeParams parameters;
   107 } SDL_WindowShapeMode;
   105 } SDL_WindowShapeMode;
   108 
   106 
   109 /**
   107 /**
   110  * \brief Set the shape and parameters of a shaped window.
   108  * \brief Set the shape and parameters of a shaped window.
   111  *
   109  *
   136  */
   134  */
   137 extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode);
   135 extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode);
   138 
   136 
   139 /* Ends C function definitions when using C++ */
   137 /* Ends C function definitions when using C++ */
   140 #ifdef __cplusplus
   138 #ifdef __cplusplus
   141 /* *INDENT-OFF* */
       
   142 }
   139 }
   143 /* *INDENT-ON* */
       
   144 #endif
   140 #endif
   145 #include "close_code.h"
   141 #include "close_code.h"
   146 
   142 
   147 #endif /* _SDL_shape_h */
   143 #endif /* _SDL_shape_h */