SDL 2.0
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"
+ Include dependency graph for SDL_shape.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

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

Macros

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

Enumerations

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

Functions

SDL_WindowSDL_CreateShapedWindow (const char *title, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Uint32 flags)
 
SDL_bool SDL_IsShapedWindow (const SDL_Window *window)
 
int SDL_SetWindowShape (SDL_Window *window, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
 
int SDL_GetShapedWindowMode (SDL_Window *window, SDL_WindowShapeMode *shape_mode)
 

Detailed Description

Header file for the shaped window API.

Definition in file SDL_shape.h.

Macro Definition Documentation

◆ SDL_INVALID_SHAPE_ARGUMENT

#define SDL_INVALID_SHAPE_ARGUMENT   -2

Definition at line 43 of file SDL_shape.h.

◆ SDL_NONSHAPEABLE_WINDOW

#define SDL_NONSHAPEABLE_WINDOW   -1

Definition at line 42 of file SDL_shape.h.

◆ SDL_SHAPEMODEALPHA

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

Definition at line 96 of file SDL_shape.h.

◆ SDL_WINDOW_LACKS_SHAPE

#define SDL_WINDOW_LACKS_SHAPE   -3

Definition at line 44 of file SDL_shape.h.

Enumeration Type Documentation

◆ WindowShapeMode

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 85 of file SDL_shape.h.

85 {
86 /** \brief The default mode, a binarized alpha cutoff of 1. */
88 /** \brief A binarized alpha cutoff with a given integer value. */
90 /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
92 /** \brief A color key is applied. */
WindowShapeMode
An enum denoting the specific type of contents present in an SDL_WindowShapeParams union.
Definition SDL_shape.h:85
@ ShapeModeBinarizeAlpha
A binarized alpha cutoff with a given integer value.
Definition SDL_shape.h:89
@ ShapeModeColorKey
A color key is applied.
Definition SDL_shape.h:93
@ ShapeModeDefault
The default mode, a binarized alpha cutoff of 1.
Definition SDL_shape.h:87
@ ShapeModeReverseBinarizeAlpha
A binarized alpha cutoff with a given integer value, but with the opposite comparison.
Definition SDL_shape.h:91

Function Documentation

◆ SDL_CreateShapedWindow()

SDL_Window * 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.
Since
This function is available since SDL 2.0.0.
See also
SDL_DestroyWindow

◆ SDL_GetShapedWindowMode()

int 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.
Since
This function is available since SDL 2.0.0.
See also
SDL_WindowShapeMode
SDL_SetWindowShape

◆ SDL_IsShapedWindow()

SDL_bool 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.
Since
This function is available since SDL 2.0.0.
See also
SDL_CreateShapedWindow

◆ SDL_SetWindowShape()

int 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 an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does not reference a valid shaped window.
Since
This function is available since SDL 2.0.0.
See also
SDL_WindowShapeMode
SDL_GetShapedWindowMode