src/video/SDL_shape_internals.h
author Eli Gottlieb <eligottlieb@gmail.com>
Sun, 01 Aug 2010 21:10:42 -0400
changeset 4817 c68e7490e4cf
parent 4814 4f7133445367
child 4830 3dfe779900f5
permissions -rw-r--r--
Fixed a couple of bugs in the general and X11 shape code, and fixed a bug in testshape that was keeping it from recognizing surfaces without alpha. Thanks to Andreas's bit-bashing tip, X11 shaped windows now work entirely, AFAICT.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 2010 Eli Gottlieb
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Eli Gottlieb
    20     eligottlieb@gmail.com
    21 */
    22 #include "SDL_config.h"
    23 
    24 #ifndef _SDL_shape_internals_h
    25 #define _SDL_shape_internals_h
    26 
    27 #include "SDL_rect.h"
    28 #include "SDL_shape.h"
    29 #include "SDL_surface.h"
    30 
    31 #include "begin_code.h"
    32 /* Set up for C function definitions, even when using C++ */
    33 #ifdef __cplusplus
    34 /* *INDENT-OFF* */
    35 extern "C" {
    36 /* *INDENT-ON* */
    37 #endif
    38 
    39 typedef struct {
    40 	struct SDL_ShapeTree *upleft,*upright,*downleft,*downright;
    41 } SDL_QuadTreeChildren;
    42 
    43 typedef union {
    44 	SDL_QuadTreeChildren children;
    45 	SDL_Rect shape;
    46 } SDL_ShapeUnion;
    47 
    48 typedef enum { QuadShape,TransparentShape,OpaqueShape } SDL_ShapeKind;
    49 
    50 typedef struct {
    51 	SDL_ShapeKind kind;
    52 	SDL_ShapeUnion data;
    53 } SDL_ShapeTree;
    54 
    55 extern void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb);
    56 extern SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape,SDL_bool invert);
    57 extern void SDL_TraverseShapeTree(SDL_ShapeTree *tree,void(*function)(SDL_ShapeTree*,void*),void* closure);
    58 extern void SDL_FreeShapeTree(SDL_ShapeTree** shapeTree);
    59 
    60 /* Ends C function definitions when using C++ */
    61 #ifdef __cplusplus
    62 /* *INDENT-OFF* */
    63 }
    64 /* *INDENT-ON* */
    65 #endif
    66 #include "close_code.h"
    67 
    68 #endif