21 #include "../SDL_internal.h" 77 Uint32 pixel_value = 0,mask_value = 0;
78 int bytes_per_scanline = (shape->
w + (ppb - 1)) / ppb;
79 Uint8 *bitmap_scanline;
83 for(y = 0;y<shape->
h;y++) {
84 bitmap_scanline = bitmap + y * bytes_per_scanline;
85 for(x=0;x<shape->
w;x++) {
91 pixel_value = *(
Uint8*)pixel;
94 pixel_value = *(
Uint16*)pixel;
100 pixel_value = *(
Uint32*)pixel;
106 mask_value = (
alpha >= 1 ? 1 : 0);
116 mask_value = ((key.
r != r || key.
g !=
g || key.
b !=
b) ? 1 : 0);
119 bitmap_scanline[x / ppb] |= mask_value << (x % ppb);
133 int last_opaque = -1;
138 for(
y=dimensions.
y;
y<dimensions.
y + dimensions.
h;
y++) {
139 for(x=dimensions.
x;x<dimensions.
x + dimensions.
w;x++) {
144 pixel_value = *(
Uint8*)pixel;
147 pixel_value = *(
Uint16*)pixel;
153 pixel_value = *(
Uint32*)pixel;
172 if(last_opaque == -1)
173 last_opaque = pixel_opaque;
174 if(last_opaque != pixel_opaque) {
175 const int halfwidth = dimensions.
w / 2;
176 const int halfheight = dimensions.
h / 2;
180 next.
x = dimensions.
x;
181 next.
y = dimensions.
y;
186 next.
x = dimensions.
x + halfwidth;
187 next.
w = dimensions.
w - halfwidth;
190 next.
x = dimensions.
x;
192 next.
y = dimensions.
y + halfheight;
193 next.
h = dimensions.
h - halfheight;
196 next.
x = dimensions.
x + halfwidth;
197 next.
w = dimensions.
w - halfwidth;
220 dimensions.
w = shape->
w;
221 dimensions.
h = shape->
h;
242 function(tree,closure);
269 if(shape_mode !=
NULL)
293 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)
GLint GLint GLint GLint GLint x
struct SDL_ShapeTree * upright
GLfloat GLfloat GLfloat GLfloat h
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)
GLfloat GLfloat GLfloat alpha
#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
#define SDL_NONSHAPEABLE_WINDOW
GLubyte GLubyte GLubyte GLubyte w
#define SDL_WINDOW_LACKS_SHAPE
The default mode, a binarized alpha cutoff of 1.
SDL_WindowShapeParams parameters
Window-shape parameters.
GLint GLint GLint GLint GLint GLint y
#define SDL_assert(condition)
A binarized alpha cutoff with a given integer value.
SDL_WindowShaper *(* CreateShaper)(SDL_Window *window)
EGLSurface EGLNativeWindowType * window
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
SDL_VideoDevice * SDL_GetVideoDevice(void)
SDL_ShapeDriver shape_driver
Uint8 binarizationCutoff
A cutoff alpha value for binarization of the window shape's alpha channel.
A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents...
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
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)