21 #include "../SDL_internal.h" 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;
132 for(
y=dimensions.
y;
y<dimensions.
y + dimensions.
h;
y++) {
133 for(x=dimensions.
x;x<dimensions.
x + dimensions.
w;x++) {
138 pixel_value = *(
Uint8*)pixel;
141 pixel_value = *(
Uint16*)pixel;
147 pixel_value = *(
Uint32*)pixel;
166 if(last_opaque == -1)
167 last_opaque = pixel_opaque;
168 if(last_opaque != pixel_opaque) {
169 const int halfwidth = dimensions.
w / 2;
170 const int halfheight = dimensions.
h / 2;
174 next.
x = dimensions.
x;
175 next.
y = dimensions.
y;
180 next.
x = dimensions.
x + halfwidth;
181 next.
w = dimensions.
w - halfwidth;
184 next.
x = dimensions.
x;
186 next.
y = dimensions.
y + halfheight;
187 next.
h = dimensions.
h - halfheight;
190 next.
x = dimensions.
x + halfwidth;
191 next.
w = dimensions.
w - halfwidth;
209 SDL_Rect dimensions = {0,0,shape->
w,shape->
h};
230 function(tree,closure);
257 if(shape_mode !=
NULL)
281 if(shape_mode ==
NULL) {
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
void SDL_FreeShapeTree(SDL_ShapeTree **shape_tree)
GLdouble GLdouble GLdouble r
int SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
Set the shape and parameters of a shaped window.
#define SDL_UnlockSurface
SDL_ShapeTree * SDL_CalculateShapeTree(SDL_WindowShapeMode mode, SDL_Surface *shape)
uint32_t Uint32
An unsigned 32-bit integer type.
struct SDL_ShapeTree * upright
A collection of pixels used in software blitting.
SDL_bool SDL_IsShapedWindow(const SDL_Window *window)
Return whether the given window is a shaped window.
int SDL_GetShapedWindowMode(SDL_Window *window, SDL_WindowShapeMode *shape_mode)
Get the shape parameters of a shaped window.
static SDL_bool SDL_WindowHasAShape(SDL_Window *window)
GLint GLint GLint GLint GLint x
#define SDL_INVALID_SHAPE_ARGUMENT
int(* SetWindowShape)(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
void(* SDL_TraversalFunction)(SDL_ShapeTree *, void *)
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.
SDL_WindowShaper * shaper
uint8_t Uint8
An unsigned 8-bit integer type.
#define SDL_NONSHAPEABLE_WINDOW
#define SDL_WINDOW_LACKS_SHAPE
The default mode, a binarized alpha cutoff of 1.
SDL_WindowShapeParams parameters
Window-shape parameters.
#define SDL_assert(condition)
A binarized alpha cutoff with a given integer value.
SDL_WindowShaper *(* CreateShaper)(SDL_Window *window)
GLint GLint GLint GLint GLint GLint y
A binarized alpha cutoff with a given integer value, but with the opposite comparison.
The type used to identify a window.
void SDL_TraverseShapeTree(SDL_ShapeTree *tree, SDL_TraversalFunction function, void *closure)
struct SDL_ShapeTree * upleft
uint16_t Uint16
An unsigned 16-bit integer type.
SDL_VideoDevice * SDL_GetVideoDevice(void)
SDL_ShapeDriver shape_driver
Uint8 binarizationCutoff
a cutoff alpha value for binarization of the window shape's alpha channel.
GLfloat GLfloat GLfloat sw_64
A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents...
GLubyte GLubyte GLubyte GLubyte w
static SDL_ShapeTree * RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode, SDL_Surface *mask, SDL_Rect dimensions)
WindowShapeMode mode
The mode of these window-shape parameters.
GLboolean GLboolean GLboolean GLboolean a
#define SDL_DestroyWindow
GLboolean GLboolean GLboolean b
struct SDL_ShapeTree * downright
#define SDL_SetWindowPosition
SDL_QuadTreeChildren children
GLfloat GLfloat GLfloat GLfloat h
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)