Mercurial > sdl-ios-xcode
comparison include/SDL_shape.h @ 4780:4f915a47b995
Replaced the model of treating a window's shape as a render target with treating a window's shape as a surface passed into an SDL_SetWindowShape() function. I'll send this off to Andreas and Sam and start coding.
author | Eli Gottlieb <eligottlieb@gmail.com> |
---|---|
date | Sat, 19 Jun 2010 23:10:57 -0400 |
parents | bb179250fcb3 |
children | fc4c775b468a |
comparison
equal
deleted
inserted
replaced
4779:bb179250fcb3 | 4780:4f915a47b995 |
---|---|
72 * \return SDL_TRUE if the window is a shaped window and SDL_FALSE otherwise. | 72 * \return SDL_TRUE if the window is a shaped window and SDL_FALSE otherwise. |
73 * \sa SDL_CreateShapedWindow | 73 * \sa SDL_CreateShapedWindow |
74 */ | 74 */ |
75 extern DECLSPEC SDL_bool SDLCALL SDL_WindowIsShaped(const SDL_Window *window); | 75 extern DECLSPEC SDL_bool SDLCALL SDL_WindowIsShaped(const SDL_Window *window); |
76 | 76 |
77 /** | |
78 * \brief Select the shape of a given window as a rendering target. | |
79 * | |
80 * \param window The window whose shape should become the current rendering target. | |
81 * | |
82 * \return 0 on success, -1 if something other than a valid shaped window is passed into \c window. | |
83 * | |
84 * The shape of the window given in \c window is selected as the new render target, and in the default mode (see | |
85 * SDL_WindowShapeParams) the alpha channel of that render target determines which pixels of the window are part of its | |
86 * visible shape and which are not according to a cutoff value. All normal SDL rendering functions can be used on it, | |
87 * and its own specific parameters can be examined and set with SDL_GetShapeParameters() and SDL_SetShapeParameters(). | |
88 * The final shape will be computed and the actual appearance of the window changed only upon a call to | |
89 * SDL_RenderPresent(). | |
90 * | |
91 * \sa SDL_GetShapeParameters | |
92 * \sa SDL_SetShapeParameters | |
93 * \sa SDL_RenderPresent | |
94 */ | |
95 extern DECLSPEC int SDLCALL SDL_SelectShapeRenderer(const SDL_Window *window); | |
96 | |
97 /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */ | 77 /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */ |
98 typedef enum {ShapeModeDefault, ShapeModeBinarizeAlpha} WindowShapeMode; | 78 typedef enum {ShapeModeDefault, ShapeModeBinarizeAlpha} WindowShapeMode; |
99 /** \brief A union containing parameters for shaped windows. */ | 79 /** \brief A union containing parameters for shaped windows. */ |
100 typedef union { | 80 typedef union { |
101 /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ | 81 /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ |
109 /** \brief Window-shape parameters. */ | 89 /** \brief Window-shape parameters. */ |
110 SDL_WindowShapeParams parameters; | 90 SDL_WindowShapeParams parameters; |
111 } SDL_WindowShapeMode; | 91 } SDL_WindowShapeMode; |
112 | 92 |
113 /** | 93 /** |
114 * \brief Set the shape parameters of a shaped window. | 94 * \brief Set the shape and parameters of a shaped window. |
115 * | 95 * |
116 * \param window The shaped window whose parameters should be set. | 96 * \param window The shaped window whose parameters should be set. |
117 * \param shapeMode The parameters to set for the shaped window. | 97 * \param shape A surface encoding the desired shape for the window as a bitmap mask. |
98 * \param parameters The parameters to set for the shaped window. | |
118 * | 99 * |
119 * \return 0 on success, -1 on invalid parameters in the shapeMode argument, or -2 if the SDL_Window given is not a | 100 * \return 0 on success, -1 on invalid an invalid shape argument, or -2 if the SDL_Window* given does not reference |
120 * shaped window. | 101 * a valid shaped window. |
121 * | 102 * |
122 * \sa SDL_WindowShapeMode | 103 * \sa SDL_WindowShapeMode |
123 * \sa SDL_GetShapeParameters | 104 * \sa SDL_GetShapeParameters. |
124 */ | 105 */ |
125 extern DECLSPEC int SDLCALL SDL_SetShapeParameters(SDL_Window *window,SDL_WindowShapeMode shapeMode); | 106 extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode parameters); |
126 | 107 |
127 /** | 108 /** |
128 * \brief Set the shape parameters of a shaped window. | 109 * \brief Set the shape parameters of a shaped window. |
129 * | 110 * |
130 * \param window The shaped window whose parameters should be retrieved. | 111 * \param window The shaped window whose parameters should be retrieved. |