SDL Library

Dependents:   H261_decoder

Committer:
miruga27
Date:
Thu Sep 22 00:03:09 2016 +0000
Revision:
0:7fb6877b5d7c
SDL

Who changed what in which revision?

UserRevisionLine numberNew contents of line
miruga27 0:7fb6877b5d7c 1 /*
miruga27 0:7fb6877b5d7c 2 Simple DirectMedia Layer
miruga27 0:7fb6877b5d7c 3 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
miruga27 0:7fb6877b5d7c 4
miruga27 0:7fb6877b5d7c 5 This software is provided 'as-is', without any express or implied
miruga27 0:7fb6877b5d7c 6 warranty. In no event will the authors be held liable for any damages
miruga27 0:7fb6877b5d7c 7 arising from the use of this software.
miruga27 0:7fb6877b5d7c 8
miruga27 0:7fb6877b5d7c 9 Permission is granted to anyone to use this software for any purpose,
miruga27 0:7fb6877b5d7c 10 including commercial applications, and to alter it and redistribute it
miruga27 0:7fb6877b5d7c 11 freely, subject to the following restrictions:
miruga27 0:7fb6877b5d7c 12
miruga27 0:7fb6877b5d7c 13 1. The origin of this software must not be misrepresented; you must not
miruga27 0:7fb6877b5d7c 14 claim that you wrote the original software. If you use this software
miruga27 0:7fb6877b5d7c 15 in a product, an acknowledgment in the product documentation would be
miruga27 0:7fb6877b5d7c 16 appreciated but is not required.
miruga27 0:7fb6877b5d7c 17 2. Altered source versions must be plainly marked as such, and must not be
miruga27 0:7fb6877b5d7c 18 misrepresented as being the original software.
miruga27 0:7fb6877b5d7c 19 3. This notice may not be removed or altered from any source distribution.
miruga27 0:7fb6877b5d7c 20 */
miruga27 0:7fb6877b5d7c 21
miruga27 0:7fb6877b5d7c 22 #ifndef _SDL_shape_h
miruga27 0:7fb6877b5d7c 23 #define _SDL_shape_h
miruga27 0:7fb6877b5d7c 24
miruga27 0:7fb6877b5d7c 25 #include "SDL_stdinc.h"
miruga27 0:7fb6877b5d7c 26 #include "SDL_pixels.h"
miruga27 0:7fb6877b5d7c 27 #include "SDL_rect.h"
miruga27 0:7fb6877b5d7c 28 #include "SDL_surface.h"
miruga27 0:7fb6877b5d7c 29 #include "SDL_video.h"
miruga27 0:7fb6877b5d7c 30
miruga27 0:7fb6877b5d7c 31 #include "begin_code.h"
miruga27 0:7fb6877b5d7c 32 /* Set up for C function definitions, even when using C++ */
miruga27 0:7fb6877b5d7c 33 #ifdef __cplusplus
miruga27 0:7fb6877b5d7c 34 extern "C" {
miruga27 0:7fb6877b5d7c 35 #endif
miruga27 0:7fb6877b5d7c 36
miruga27 0:7fb6877b5d7c 37 /** \file SDL_shape.h
miruga27 0:7fb6877b5d7c 38 *
miruga27 0:7fb6877b5d7c 39 * Header file for the shaped window API.
miruga27 0:7fb6877b5d7c 40 */
miruga27 0:7fb6877b5d7c 41
miruga27 0:7fb6877b5d7c 42 #define SDL_NONSHAPEABLE_WINDOW -1
miruga27 0:7fb6877b5d7c 43 #define SDL_INVALID_SHAPE_ARGUMENT -2
miruga27 0:7fb6877b5d7c 44 #define SDL_WINDOW_LACKS_SHAPE -3
miruga27 0:7fb6877b5d7c 45
miruga27 0:7fb6877b5d7c 46 /**
miruga27 0:7fb6877b5d7c 47 * \brief Create a window that can be shaped with the specified position, dimensions, and flags.
miruga27 0:7fb6877b5d7c 48 *
miruga27 0:7fb6877b5d7c 49 * \param title The title of the window, in UTF-8 encoding.
miruga27 0:7fb6877b5d7c 50 * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
miruga27 0:7fb6877b5d7c 51 * ::SDL_WINDOWPOS_UNDEFINED.
miruga27 0:7fb6877b5d7c 52 * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
miruga27 0:7fb6877b5d7c 53 * ::SDL_WINDOWPOS_UNDEFINED.
miruga27 0:7fb6877b5d7c 54 * \param w The width of the window.
miruga27 0:7fb6877b5d7c 55 * \param h The height of the window.
miruga27 0:7fb6877b5d7c 56 * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
miruga27 0:7fb6877b5d7c 57 * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED,
miruga27 0:7fb6877b5d7c 58 * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE,
miruga27 0:7fb6877b5d7c 59 * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED,
miruga27 0:7fb6877b5d7c 60 * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
miruga27 0:7fb6877b5d7c 61 *
miruga27 0:7fb6877b5d7c 62 * \return The window created, or NULL if window creation failed.
miruga27 0:7fb6877b5d7c 63 *
miruga27 0:7fb6877b5d7c 64 * \sa SDL_DestroyWindow()
miruga27 0:7fb6877b5d7c 65 */
miruga27 0:7fb6877b5d7c 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);
miruga27 0:7fb6877b5d7c 67
miruga27 0:7fb6877b5d7c 68 /**
miruga27 0:7fb6877b5d7c 69 * \brief Return whether the given window is a shaped window.
miruga27 0:7fb6877b5d7c 70 *
miruga27 0:7fb6877b5d7c 71 * \param window The window to query for being shaped.
miruga27 0:7fb6877b5d7c 72 *
miruga27 0:7fb6877b5d7c 73 * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
miruga27 0:7fb6877b5d7c 74 * \sa SDL_CreateShapedWindow
miruga27 0:7fb6877b5d7c 75 */
miruga27 0:7fb6877b5d7c 76 extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
miruga27 0:7fb6877b5d7c 77
miruga27 0:7fb6877b5d7c 78 /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
miruga27 0:7fb6877b5d7c 79 typedef enum {
miruga27 0:7fb6877b5d7c 80 /** \brief The default mode, a binarized alpha cutoff of 1. */
miruga27 0:7fb6877b5d7c 81 ShapeModeDefault,
miruga27 0:7fb6877b5d7c 82 /** \brief A binarized alpha cutoff with a given integer value. */
miruga27 0:7fb6877b5d7c 83 ShapeModeBinarizeAlpha,
miruga27 0:7fb6877b5d7c 84 /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
miruga27 0:7fb6877b5d7c 85 ShapeModeReverseBinarizeAlpha,
miruga27 0:7fb6877b5d7c 86 /** \brief A color key is applied. */
miruga27 0:7fb6877b5d7c 87 ShapeModeColorKey
miruga27 0:7fb6877b5d7c 88 } WindowShapeMode;
miruga27 0:7fb6877b5d7c 89
miruga27 0:7fb6877b5d7c 90 #define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
miruga27 0:7fb6877b5d7c 91
miruga27 0:7fb6877b5d7c 92 /** \brief A union containing parameters for shaped windows. */
miruga27 0:7fb6877b5d7c 93 typedef union {
miruga27 0:7fb6877b5d7c 94 /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
miruga27 0:7fb6877b5d7c 95 Uint8 binarizationCutoff;
miruga27 0:7fb6877b5d7c 96 SDL_Color colorKey;
miruga27 0:7fb6877b5d7c 97 } SDL_WindowShapeParams;
miruga27 0:7fb6877b5d7c 98
miruga27 0:7fb6877b5d7c 99 /** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
miruga27 0:7fb6877b5d7c 100 typedef struct SDL_WindowShapeMode {
miruga27 0:7fb6877b5d7c 101 /** \brief The mode of these window-shape parameters. */
miruga27 0:7fb6877b5d7c 102 WindowShapeMode mode;
miruga27 0:7fb6877b5d7c 103 /** \brief Window-shape parameters. */
miruga27 0:7fb6877b5d7c 104 SDL_WindowShapeParams parameters;
miruga27 0:7fb6877b5d7c 105 } SDL_WindowShapeMode;
miruga27 0:7fb6877b5d7c 106
miruga27 0:7fb6877b5d7c 107 /**
miruga27 0:7fb6877b5d7c 108 * \brief Set the shape and parameters of a shaped window.
miruga27 0:7fb6877b5d7c 109 *
miruga27 0:7fb6877b5d7c 110 * \param window The shaped window whose parameters should be set.
miruga27 0:7fb6877b5d7c 111 * \param shape A surface encoding the desired shape for the window.
miruga27 0:7fb6877b5d7c 112 * \param shape_mode The parameters to set for the shaped window.
miruga27 0:7fb6877b5d7c 113 *
miruga27 0:7fb6877b5d7c 114 * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
miruga27 0:7fb6877b5d7c 115 * if the SDL_Window* given does not reference a valid shaped window.
miruga27 0:7fb6877b5d7c 116 *
miruga27 0:7fb6877b5d7c 117 * \sa SDL_WindowShapeMode
miruga27 0:7fb6877b5d7c 118 * \sa SDL_GetShapedWindowMode.
miruga27 0:7fb6877b5d7c 119 */
miruga27 0:7fb6877b5d7c 120 extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
miruga27 0:7fb6877b5d7c 121
miruga27 0:7fb6877b5d7c 122 /**
miruga27 0:7fb6877b5d7c 123 * \brief Get the shape parameters of a shaped window.
miruga27 0:7fb6877b5d7c 124 *
miruga27 0:7fb6877b5d7c 125 * \param window The shaped window whose parameters should be retrieved.
miruga27 0:7fb6877b5d7c 126 * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
miruga27 0:7fb6877b5d7c 127 *
miruga27 0:7fb6877b5d7c 128 * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
miruga27 0:7fb6877b5d7c 129 * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
miruga27 0:7fb6877b5d7c 130 * the SDL_Window* given is a shapeable window currently lacking a shape.
miruga27 0:7fb6877b5d7c 131 *
miruga27 0:7fb6877b5d7c 132 * \sa SDL_WindowShapeMode
miruga27 0:7fb6877b5d7c 133 * \sa SDL_SetWindowShape
miruga27 0:7fb6877b5d7c 134 */
miruga27 0:7fb6877b5d7c 135 extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode);
miruga27 0:7fb6877b5d7c 136
miruga27 0:7fb6877b5d7c 137 /* Ends C function definitions when using C++ */
miruga27 0:7fb6877b5d7c 138 #ifdef __cplusplus
miruga27 0:7fb6877b5d7c 139 }
miruga27 0:7fb6877b5d7c 140 #endif
miruga27 0:7fb6877b5d7c 141 #include "close_code.h"
miruga27 0:7fb6877b5d7c 142
miruga27 0:7fb6877b5d7c 143 #endif /* _SDL_shape_h */