NAME
SDL2::shape - Functions for the Shaped Window API
SYNOPSIS
use SDL2 qw[:shape];
DESCRIPTION
SDL2::shape exposes functions which allow you to create windows with custom shapes.
Functions
These functions may be imported by name or with the :shape
tag.
SDL_CreateShapedWindow( ... )
Create a window that can be shaped with the specified position, dimensions, and flags.
Expected parameters include:
title
- The title of the window, in UTF-8 encodingx
- The x position of the window,SDL_WINDOWPOS_CENTERED
, orSDL_WINDOWPOS_UNDEFINED
y
- The y position of the window,SDL_WINDOWPOS_CENTERED
, orDL_WINDOWPOS_UNDEFINED
.w
- The width of the window.h
- The height of the window.flags
-
The flags for the window, a mask of
SDL_WINDOW_BORDERLESS
with any of the following:SDL_WINDOW_OPENGL
,SDL_WINDOW_INPUT_GRABBED
,DL_WINDOW_HIDDEN
,SDL_WINDOW_RESIZABLE
,SDL_WINDOW_MAXIMIZED
,SDL_WINDOW_MINIMIZED
.SDL_WINDOW_BORDERLESS
is always set, andSDL_WINDOW_FULLSCREEN
is always unset.
Returns the window created, or undef
if window creation failed.
SDL_IsShapedWindow( ... )
Return whether the given window is a shaped window.
Expected parameters include:
Returns SDL_TRUE
if the window is a window that can be shaped, SDL_FALSE
if the window is unshaped or undef
.
SDL_SetWindowShape( ... )
Set the shape and parameters of a shaped window.
Expected parameters include:
window
- the shaped window whose parameters should be setshape
- a surface encoding the desired shape for the windowshape_mode
- the 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 SDL2::Window given does not reference a valid shaped window.
SDL_GetShapedWindowMode( ... )
Get the shape parameters of a shaped window.
Expected parameters include:
window
- the shaped window whose parameters should be retrievedshape_mode
- an empty shape-mode structure to fill, orundef
to check whether the window has a shape
Returns 0
if the window has a shape and, provided shape_mode was not undef
, shape_mode
has been filled with the mode data, SDL_NONSHAPEABLE_WINDOW
if the SDL2::Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE
if the SDL2::Window given is a shapeable window currently lacking a shape.
Defined Variables and Enumerations
Variables may be imported by name or with the :shape
tag.
SDL_NONSHAPEABLE_WINDOW
SDL_INVALID_SHAPE_ARGUMENT
SDL_WINDOW_LACKS_SHAPE
WindowShapeMode
An enum denoting the specific type of contents present in an SDL_WindowShapeParams
union. These may be imported with the :windowShapeMode
tag.
ShapeModeDefault
- The default mode, a binarized alpha cutoff of 1ShapeModeBinarizeAlpha
- A binarized alpha cutoff with a given integer valueShapeModeReverseBinarizeAlpha
- A binarized alpha cutoff with a given integer value, but with the opposite comparisonShapeModeColorKey
- A color key is applied.
LICENSE
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.
AUTHOR
Sanko Robinson <sanko@cpan.org>