include/SDL_shape.h
author Eli Gottlieb <eligottlieb@gmail.com>
Thu, 10 Jun 2010 17:37:19 -0400
changeset 4778 9838d3525a1b
parent 4776 29dcad9c58b3
child 4779 bb179250fcb3
permissions -rw-r--r--
Stubbed out the new get/set parameter functions, added the start of the enum, union, and struct for those parameters themselves, and added doxygen comments throughout the SDL_shape.h header.
eligottlieb@4766
     1
/*
eligottlieb@4766
     2
    SDL - Simple DirectMedia Layer
eligottlieb@4766
     3
    Copyright (C) 2010 Eli Gottlieb
eligottlieb@4766
     4
eligottlieb@4766
     5
    This library is free software; you can redistribute it and/or
eligottlieb@4766
     6
    modify it under the terms of the GNU Lesser General Public
eligottlieb@4766
     7
    License as published by the Free Software Foundation; either
eligottlieb@4766
     8
    version 2.1 of the License, or (at your option) any later version.
eligottlieb@4766
     9
eligottlieb@4766
    10
    This library is distributed in the hope that it will be useful,
eligottlieb@4766
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
eligottlieb@4766
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
eligottlieb@4766
    13
    Lesser General Public License for more details.
eligottlieb@4766
    14
eligottlieb@4766
    15
    You should have received a copy of the GNU Lesser General Public
eligottlieb@4766
    16
    License along with this library; if not, write to the Free Software
eligottlieb@4766
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
eligottlieb@4766
    18
eligottlieb@4766
    19
    Eli Gottlieb
eligottlieb@4766
    20
    eligottlieb@gmail.com
eligottlieb@4766
    21
*/
eligottlieb@4766
    22
eligottlieb@4769
    23
#ifndef _SDL_shape_h
eligottlieb@4769
    24
#define _SDL_shape_h
eligottlieb@4769
    25
eligottlieb@4769
    26
#include "SDL_stdinc.h"
eligottlieb@4769
    27
#include "SDL_pixels.h"
eligottlieb@4769
    28
#include "SDL_rect.h"
eligottlieb@4769
    29
#include "SDL_surface.h"
eligottlieb@4769
    30
#include "SDL_video.h"
eligottlieb@4769
    31
eligottlieb@4769
    32
#include "begin_code.h"
eligottlieb@4769
    33
/* Set up for C function definitions, even when using C++ */
eligottlieb@4769
    34
#ifdef __cplusplus
eligottlieb@4769
    35
/* *INDENT-OFF* */
eligottlieb@4769
    36
extern "C" {
eligottlieb@4769
    37
/* *INDENT-ON* */
eligottlieb@4769
    38
#endif
eligottlieb@4766
    39
eligottlieb@4766
    40
/**
eligottlieb@4766
    41
 *  \brief Create a shaped window with the specified position, dimensions, and flags.
eligottlieb@4766
    42
 *  
eligottlieb@4766
    43
 *  \param title The title of the window, in UTF-8 encoding.
eligottlieb@4766
    44
 *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or 
eligottlieb@4766
    45
 *               ::SDL_WINDOWPOS_UNDEFINED.
eligottlieb@4766
    46
 *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or 
eligottlieb@4766
    47
 *               ::SDL_WINDOWPOS_UNDEFINED.
eligottlieb@4766
    48
 *  \param w     The width of the window.
eligottlieb@4766
    49
 *  \param h     The height of the window.
eligottlieb@4766
    50
 *  \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: 
eligottlieb@4767
    51
 *               ::SDL_WINDOW_OPENGL,     ::SDL_WINDOW_INPUT_GRABBED,
eligottlieb@4766
    52
 *               ::SDL_WINDOW_SHOWN,      ::SDL_WINDOW_RESIZABLE,
eligottlieb@4766
    53
 *               ::SDL_WINDOW_MAXIMIZED,  ::SDL_WINDOW_MINIMIZED,
eligottlieb@4767
    54
 *		 ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
eligottlieb@4766
    55
 *  
eligottlieb@4766
    56
 *  \return The id of the window created, or zero if window creation failed.
eligottlieb@4766
    57
 *  
eligottlieb@4766
    58
 *  \sa SDL_DestroyWindow()
eligottlieb@4766
    59
 */
eligottlieb@4768
    60
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
eligottlieb@4766
    61
eligottlieb@4778
    62
/**
eligottlieb@4778
    63
 * \brief Return whether the given window is a shaped window. 
eligottlieb@4778
    64
 *
eligottlieb@4778
    65
 * \param window The window to query for being shaped.
eligottlieb@4778
    66
 *
eligottlieb@4778
    67
 * \return SDL_TRUE if the window is a shaped window and SDL_FALSE otherwise.
eligottlieb@4778
    68
 * \sa SDL_CreateShapedWindow
eligottlieb@4778
    69
 */
eligottlieb@4769
    70
extern DECLSPEC SDL_bool SDLCALL SDL_WindowIsShaped(const SDL_Window *window);
eligottlieb@4778
    71
eligottlieb@4778
    72
/**
eligottlieb@4778
    73
 * \brief Select the shape of a given window as a rendering target.
eligottlieb@4778
    74
 *
eligottlieb@4778
    75
 * \param window The window whose shape should become the current rendering target.
eligottlieb@4778
    76
 *
eligottlieb@4778
    77
 * \return 0 on success, -1 if something other than a valid shaped window is passed into \c window.
eligottlieb@4778
    78
 *
eligottlieb@4778
    79
 * The shape of the window given in \c window is selected as the new render target, and in the default mode (see
eligottlieb@4778
    80
 * SDL_WindowShapeParams) the alpha channel of that render target determines which pixels of the window are part of its
eligottlieb@4778
    81
 * visible shape and which are not according to a cutoff value.  All normal SDL rendering functions can be used on it,
eligottlieb@4778
    82
 * and its own specific parameters can be examined and set with SDL_GetShapeParameters() and SDL_SetShapeParameters().
eligottlieb@4778
    83
 * The final shape will be computed and the actual appearance of the window changed only upon a call to
eligottlieb@4778
    84
 * SDL_RenderPresent().
eligottlieb@4778
    85
 *
eligottlieb@4778
    86
 * \sa SDL_GetShapeParameters
eligottlieb@4778
    87
 * \sa SDL_SetShapeParameters
eligottlieb@4778
    88
 * \sa SDL_RenderPresent
eligottlieb@4778
    89
 */
eligottlieb@4768
    90
extern DECLSPEC int SDLCALL SDL_SelectShapeRenderer(const SDL_Window *window);
eligottlieb@4766
    91
eligottlieb@4778
    92
/** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
eligottlieb@4778
    93
typedef enum {ShapeModeDefault, ShapeModeBinarizeAlpha} WindowShapeMode;
eligottlieb@4778
    94
/** \brief A union containing parameters for shaped windows. */
eligottlieb@4778
    95
typedef union {
eligottlieb@4778
    96
	/** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
eligottlieb@4778
    97
	Uint8 binarizationCutoff;
eligottlieb@4778
    98
} SDL_WindowShapeParams;
eligottlieb@4778
    99
eligottlieb@4778
   100
/** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
eligottlieb@4778
   101
typedef struct SDL_WindowShapeMode {
eligottlieb@4778
   102
	WindowShapeMode mode;
eligottlieb@4778
   103
	SDL_WindowShapeParams parameters;
eligottlieb@4778
   104
} SDL_WindowShapeMode;
eligottlieb@4778
   105
eligottlieb@4778
   106
/**
eligottlieb@4778
   107
 * \brief Set the shape parameters of a shaped window.
eligottlieb@4778
   108
 *
eligottlieb@4778
   109
 * \param window The shaped window whose parameters should be set.
eligottlieb@4778
   110
 * \param shapeMode The parameters to set for the shaped window.
eligottlieb@4778
   111
 *
eligottlieb@4778
   112
 * \return 0 on success, -1 on invalid parameters in the shapeMode argument, or -2 if the SDL_Window given is not a
eligottlieb@4778
   113
 *         shaped window.
eligottlieb@4778
   114
 *
eligottlieb@4778
   115
 * \sa SDL_WindowShapeMode
eligottlieb@4778
   116
 * \sa SDL_GetShapeParameters
eligottlieb@4778
   117
 */
eligottlieb@4778
   118
extern DECLSPEC int SDLCALL SDL_SetShapeParameters(SDL_Window *window,SDL_WindowShapeMode shapeMode);
eligottlieb@4778
   119
eligottlieb@4778
   120
/**
eligottlieb@4778
   121
 * \brief Set the shape parameters of a shaped window.
eligottlieb@4778
   122
 *
eligottlieb@4778
   123
 * \param window The shaped window whose parameters should be retrieved.
eligottlieb@4778
   124
 * \param shapeMode An empty shape-parameters structure to fill.
eligottlieb@4778
   125
 *
eligottlieb@4778
   126
 * \return 0 on success, -1 on a null shapeMode, or -2 if the SDL_Window given is not a shaped window.
eligottlieb@4778
   127
 *
eligottlieb@4778
   128
 * \sa SDL_WindowShapeMode
eligottlieb@4778
   129
 * \sa SDL_SetShapeParameters
eligottlieb@4778
   130
 */
eligottlieb@4778
   131
extern DECLSPEC int SDLCALL SDL_GetShapeParameters(SDL_Window *window,SDL_WindowShapeMode *shapeMode);
eligottlieb@4778
   132
eligottlieb@4769
   133
/* Ends C function definitions when using C++ */
eligottlieb@4769
   134
#ifdef __cplusplus
eligottlieb@4769
   135
/* *INDENT-OFF* */
eligottlieb@4769
   136
}
eligottlieb@4769
   137
/* *INDENT-ON* */
eligottlieb@4769
   138
#endif
eligottlieb@4769
   139
#include "close_code.h"
eligottlieb@4769
   140
eligottlieb@4769
   141
#endif /* _SDL_shape_h */