First Revision (from Archive)
[~jspiros/WindowBlur.git] / CGSInternal / CGSTransitions.h
1 /*
2  * Copyright (C) 2007-2008 Alacatia Labs
3  * 
4  * This software is provided 'as-is', without any express or implied
5  * warranty.  In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  * 
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  * 
12  * 1. The origin of this software must not be misrepresented; you must not
13  *    claim that you wrote the original software. If you use this software
14  *    in a product, an acknowledgment in the product documentation would be
15  *    appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  *    misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  * 
20  * Joe Ranieri joe@alacatia.com
21  *
22  */
23
24 #pragma once
25 #include "CGSConnection.h"
26
27 typedef int CGSTransitionID;
28
29 typedef enum {
30         kCGSTransitionNone,
31         kCGSTransitionFade,
32         kCGSTransitionZoom,
33         kCGSTransitionReveal,
34         kCGSTransitionSlide,
35         kCGSTransitionWarpFade,
36         kCGSTransitionSwap,
37         kCGSTransitionCube,
38         kCGSTransitionWarpSwitch,
39         kCGSTransitionFlip
40 } CGSTransitionType;
41
42 typedef enum {
43         /*! Directions for the transition. Some directions don't apply to some transitions. */
44         kCGSTransitionDirectionLeft = 1 << 0,
45         kCGSTransitionDirectionRight = 1 << 1,
46         kCGSTransitionDirectionDown = 1 << 2,
47         kCGSTransitionDirectionUp = 1 << 3,
48         kCGSTransitionDirectionCenter = 1 << 4,
49         
50         /*! Reverses a transition. Doesn't apply for all transitions. */
51         kCGSTransitionFlagReversed = 1 << 5,
52         
53         /*! Ignore the background color and only transition the window. */
54         kCGSTransitionFlagTransparent = 1 << 7,
55 } CGSTransitionFlags;
56
57 typedef struct {
58         int unknown; // always set to zero
59         CGSTransitionType type;
60         CGSTransitionFlags options;
61         CGSWindowID wid; /* 0 means a full screen transition. */
62         float *backColor; /* NULL means black. */
63 } CGSTransitionSpec;
64
65 CG_EXTERN_C_BEGIN
66
67 /*! Creates a new transition from a `CGSTransitionSpec`. */
68 CG_EXTERN CGError CGSNewTransition(CGSConnectionID cid, const CGSTransitionSpec *spec, CGSTransitionID *outTransition);
69
70 /*! Invokes a transition asynchronously. Note that `duration` is in seconds. */
71 CG_EXTERN CGError CGSInvokeTransition(CGSConnectionID cid, CGSTransitionID transition, float duration);
72
73 /*! Releases a transition. */
74 CG_EXTERN CGError CGSReleaseTransition(CGSConnectionID cid, CGSTransitionID transition);
75
76 CG_EXTERN_C_END