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