zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_shape.h File Reference
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
#include "SDL_rect.h"
#include "SDL_surface.h"
#include "SDL_video.h"
#include "begin_code.h"
#include "close_code.h"

Go to the source code of this file.

Classes

struct  SDL_WindowShapeMode
 A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. More...
 
union  SDL_WindowShapeParams
 A union containing parameters for shaped windows. More...
 

Macros

#define SDL_INVALID_SHAPE_ARGUMENT   -2
 
#define SDL_NONSHAPEABLE_WINDOW   -1
 
#define SDL_SHAPEMODEALPHA(mode)   (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
 
#define SDL_WINDOW_LACKS_SHAPE   -3
 

Typedefs

typedef struct SDL_WindowShapeMode SDL_WindowShapeMode
 A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. More...
 

Enumerations

enum  WindowShapeMode { ShapeModeDefault, ShapeModeBinarizeAlpha, ShapeModeReverseBinarizeAlpha, ShapeModeColorKey }
 An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. More...
 

Functions

DECLSPEC SDL_Window *SDLCALL SDL_CreateShapedWindow (const char *title, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Uint32 flags)
 Create a window that can be shaped with the specified position, dimensions, and flags. More...
 
DECLSPEC int SDLCALL SDL_GetShapedWindowMode (SDL_Window *window, SDL_WindowShapeMode *shape_mode)
 Get the shape parameters of a shaped window. More...
 
DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow (const SDL_Window *window)
 Return whether the given window is a shaped window. More...
 
DECLSPEC int SDLCALL SDL_SetWindowShape (SDL_Window *window, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
 Set the shape and parameters of a shaped window. More...
 

Detailed Description

Header file for the shaped window API.

Definition in file SDL_shape.h.

Macro Definition Documentation

#define SDL_INVALID_SHAPE_ARGUMENT   -2

Definition at line 43 of file SDL_shape.h.

Referenced by SDL_SetWindowShape().

#define SDL_NONSHAPEABLE_WINDOW   -1

Definition at line 42 of file SDL_shape.h.

Referenced by SDL_GetShapedWindowMode(), and SDL_SetWindowShape().

#define SDL_SHAPEMODEALPHA (   mode)    (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)

Definition at line 90 of file SDL_shape.h.

#define SDL_WINDOW_LACKS_SHAPE   -3

Definition at line 44 of file SDL_shape.h.

Referenced by SDL_GetShapedWindowMode().

Typedef Documentation

A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents.

Enumeration Type Documentation

An enum denoting the specific type of contents present in an SDL_WindowShapeParams union.

Enumerator
ShapeModeDefault 

The default mode, a binarized alpha cutoff of 1.

ShapeModeBinarizeAlpha 

A binarized alpha cutoff with a given integer value.

ShapeModeReverseBinarizeAlpha 

A binarized alpha cutoff with a given integer value, but with the opposite comparison.

ShapeModeColorKey 

A color key is applied.

Definition at line 79 of file SDL_shape.h.

Function Documentation

DECLSPEC SDL_Window* SDLCALL SDL_CreateShapedWindow ( const char *  title,
unsigned int  x,
unsigned int  y,
unsigned int  w,
unsigned int  h,
Uint32  flags 
)

Create a window that can be shaped with the specified position, dimensions, and flags.

Parameters
titleThe title of the window, in UTF-8 encoding.
xThe x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED.
yThe y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED.
wThe width of the window.
hThe height of the window.
flagsThe flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: SDL_WINDOW_OPENGL, SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_HIDDEN, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_BORDERLESS is always set, and SDL_WINDOW_FULLSCREEN is always unset.
Returns
The window created, or NULL if window creation failed.
See Also
SDL_DestroyWindow()

Definition at line 33 of file SDL_shape.c.

References SDL_WindowShapeParams::binarizationCutoff, SDL_ShapeDriver::CreateShaper, SDL_WindowShaper::hasshape, SDL_WindowShaper::mode, SDL_WindowShapeMode::mode, NULL, SDL_WindowShapeMode::parameters, SDL_CreateWindow(), SDL_DestroyWindow(), SDL_FALSE, SDL_GetVideoDevice(), SDL_WINDOW_BORDERLESS, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_RESIZABLE, SDL_VideoDevice::shape_driver, ShapeModeDefault, SDL_Window::shaper, SDL_WindowShaper::userx, and SDL_WindowShaper::usery.

DECLSPEC int SDLCALL SDL_GetShapedWindowMode ( SDL_Window window,
SDL_WindowShapeMode shape_mode 
)

Get the shape parameters of a shaped window.

Parameters
windowThe shaped window whose parameters should be retrieved.
shape_modeAn empty shape-mode structure to fill, or NULL to check whether the window has a shape.
Returns
0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window* given is a shapeable window currently lacking a shape.
See Also
SDL_WindowShapeMode
SDL_SetWindowShape

Definition at line 267 of file SDL_shape.c.

References SDL_WindowShaper::mode, NULL, SDL_IsShapedWindow(), SDL_NONSHAPEABLE_WINDOW, SDL_WINDOW_LACKS_SHAPE, SDL_WindowHasAShape(), and SDL_Window::shaper.

DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow ( const SDL_Window window)

Return whether the given window is a shaped window.

Parameters
windowThe window to query for being shaped.
Returns
SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
See Also
SDL_CreateShapedWindow

Definition at line 57 of file SDL_shape.c.

References NULL, SDL_FALSE, and SDL_Window::shaper.

Referenced by SDL_GetShapedWindowMode(), SDL_SetWindowShape(), and SDL_WindowHasAShape().

DECLSPEC int SDLCALL SDL_SetWindowShape ( SDL_Window window,
SDL_Surface shape,
SDL_WindowShapeMode shape_mode 
)

Set the shape and parameters of a shaped window.

Parameters
windowThe shaped window whose parameters should be set.
shapeA surface encoding the desired shape for the window.
shape_modeThe parameters to set for the shaped window.
Returns
0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window* given does not reference a valid shaped window.
See Also
SDL_WindowShapeMode
SDL_GetShapedWindowMode.

Definition at line 236 of file SDL_shape.c.

References SDL_WindowShaper::hasshape, SDL_WindowShaper::mode, NULL, SDL_GetVideoDevice(), SDL_INVALID_SHAPE_ARGUMENT, SDL_IsShapedWindow(), SDL_NONSHAPEABLE_WINDOW, SDL_SetWindowPosition(), SDL_TRUE, SDL_ShapeDriver::SetWindowShape, SDL_VideoDevice::shape_driver, SDL_Window::shaper, SDL_WindowShaper::userx, and SDL_WindowShaper::usery.