73 Uint32 bitmap_pixel,pixel_value = 0,mask_value = 0;
77 for(y = 0;y<shape->
h;y++) {
78 for(x=0;x<shape->
w;x++) {
84 pixel_value = *(
Uint8*)pixel;
87 pixel_value = *(
Uint16*)pixel;
93 pixel_value = *(
Uint32*)pixel;
97 bitmap_pixel = y*shape->
w +
x;
100 mask_value = (
alpha >= 1 ? 1 : 0);
110 mask_value = ((key.
r != r || key.
g !=
g || key.
b !=
b) ? 1 : 0);
113 bitmap[bitmap_pixel / ppb] |= mask_value << (7 - ((ppb - 1) - (bitmap_pixel % ppb)));
127 int last_opaque = -1;
131 for(
y=dimensions.
y;
y<dimensions.
y + dimensions.
h;
y++) {
132 for(x=dimensions.
x;x<dimensions.
x + dimensions.
w;x++) {
137 pixel_value = *(
Uint8*)pixel;
140 pixel_value = *(
Uint16*)pixel;
146 pixel_value = *(
Uint32*)pixel;
165 if(last_opaque == -1)
166 last_opaque = pixel_opaque;
167 if(last_opaque != pixel_opaque) {
170 next.
w = dimensions.
w / 2;
171 next.
h = dimensions.
h / 2;
173 next.
x = dimensions.
x;
174 next.
y = dimensions.
y;
179 next.
x = dimensions.
x;
198 SDL_Rect dimensions = {0,0,shape->
w,shape->
h};
219 function(tree,closure);
246 if(shape_mode !=
NULL)
270 if(shape_mode ==
NULL) {
void SDL_FreeShapeTree(SDL_ShapeTree **shape_tree)
GLfloat GLfloat GLfloat GLfloat h
SDL_ShapeTree * SDL_CalculateShapeTree(SDL_WindowShapeMode mode, SDL_Surface *shape)
struct SDL_ShapeTree * upright
A collection of pixels used in software blitting.
DECLSPEC void SDLCALL SDL_free(void *mem)
DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window, SDL_WindowShapeMode *shape_mode)
Get the shape parameters of a shaped window.
GLboolean GLboolean GLboolean GLboolean a
static SDL_bool SDL_WindowHasAShape(SDL_Window *window)
uint32_t Uint32
An unsigned 32-bit integer type.
#define SDL_INVALID_SHAPE_ARGUMENT
DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface)
DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window)
Return whether the given window is a shaped window.
int(* SetWindowShape)(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
SDL_WindowShaper * shaper
#define SDL_NONSHAPEABLE_WINDOW
#define SDL_WINDOW_LACKS_SHAPE
The default mode, a binarized alpha cutoff of 1.
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
SDL_WindowShapeParams parameters
Window-shape parameters.
void(* SDL_TraversalFunction)(SDL_ShapeTree *, void *)
GLclampf GLclampf GLclampf alpha
SDL_WindowShaper *(* CreateShaper)(SDL_Window *window)
#define SDL_assert(condition)
EGLSurface EGLint EGLint y
A binarized alpha cutoff with a given integer value.
DECLSPEC SDL_Window *SDLCALL SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
Create a window with the specified position, dimensions, and flags.
DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get the RGBA components from a pixel of the specified format.
DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y)
Set the position of a window.
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
uint8_t Uint8
An unsigned 8-bit integer type.
A binarized alpha cutoff with a given integer value, but with the opposite comparison.
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
Set the shape and parameters of a shaped window.
void SDL_TraverseShapeTree(SDL_ShapeTree *tree, SDL_TraversalFunction function, void *closure)
struct SDL_ShapeTree * upleft
DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble b
SDL_VideoDevice * SDL_GetVideoDevice(void)
SDL_ShapeDriver shape_driver
Uint8 binarizationCutoff
a cutoff alpha value for binarization of the window shape's alpha channel.
GLint GLint GLint GLint GLint w
uint16_t Uint16
An unsigned 16-bit integer type.
A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents...
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
static SDL_ShapeTree * RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode, SDL_Surface *mask, SDL_Rect dimensions)
WindowShapeMode mode
The mode of these window-shape parameters.
struct SDL_ShapeTree * downright
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.
DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface)
Sets up a surface for directly accessing the pixels.
SDL_QuadTreeChildren children
A rectangle, with the origin at the upper left.
struct SDL_ShapeTree * downleft
void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode, SDL_Surface *shape, Uint8 *bitmap, Uint8 ppb)