RSS

(root)/iphone/tappity : 46 : tappity/source/GraphicsServices/GraphicsServices.h

To get this branch, use:
bzr branch /browse/iphone/tappity

« back to all changes in this revision

Viewing changes to tappity/source/GraphicsServices/GraphicsServices.h

Dömötör Gulyás
2009-10-27 01:03:19
Revision ID: dognotdog@gmail.com-20091027000319-1vrkixkgf9lkud6g
adds tappity project

Show diffs side-by-side

added added

removed removed

 
1
/*
 
2
 *  GraphicsServices.h
 
3
 *  tappity
 
4
 *
 
5
 *  Created by döme on 26.10.2009.
 
6
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 
7
 *
 
8
 */
 
9
 
 
10
#ifndef GRAPHICSSERVICES_H
 
11
#define GRAPHICSSERVICES_H
 
12
 
 
13
#import "CoreGraphics/CGGeometry.h"
 
14
 
 
15
#define kGSEventTypeOneFingerDown   1
 
16
#define kGSEventTypeAllFingersUp    2
 
17
#define kGSEventTypeOneFingerUp     5
 
18
/* A "gesture" is either one finger dragging or two fingers down. */
 
19
#define kGSEventTypeGesture         6
 
20
 
 
21
#ifdef __cplusplus
 
22
extern "C" {
 
23
#endif
 
24
 
 
25
/*
 
26
        device:
 
27
        unk0:
 
28
                bit 17 (0x00020000) on when touchesBegan/moved, off on ended
 
29
                bit 16 (0x00010000) unknown, maybe signals short tap?
 
30
                others (0x000_0_0_) constant 0
 
31
                others (0x____FF__) touch id, starting at 2 when less than 5 touches, starting at 1 when 5 touches
 
32
                others (0x______0F) marks something about how/where touch first occured?
 
33
        sim:
 
34
        unk0:
 
35
                bit 17 same as device
 
36
                bit 16 !bit16
 
37
                0xFF______ apparently "source", 0x43,0x42 mouse scroll (0x00 on begin/end), 0xBF mouseDown, 0xFF mouseDrag/up
 
38
                0x______02 constant
 
39
                0x____02__ constant
 
40
*/
 
41
 
 
42
struct GSTouchPoint {
 
43
        uint32_t unk0; // some flags? different on sim and device
 
44
        float unk1; // 0.0 (device) 1.0 (sim)
 
45
        float touchSize; // 1.0 (sim), touch size on device
 
46
        float x;
 
47
        float y;
 
48
        UIWindow* window; // window where event occured?
 
49
};
 
50
 
 
51
typedef struct GSTouchPoint* GSTouchPointRef;
 
52
 
 
53
#define kGSEventTouchesBegan   1
 
54
#define kGSEventTouchesMoved   2
 
55
#define kGSEventTouchesEnded   6
 
56
 
 
57
@interface GSEvent : NSObject
 
58
{
 
59
//      unsigned int isa;
 
60
@public
 
61
        uint32_t type0;         // 0x02010180
 
62
        uint32_t type1;         // 0x00000BB9
 
63
        uint32_t r3;            // 0x00000000
 
64
        float avgX0;            // window or view pos?
 
65
        float avgY0;            
 
66
        float avgX1;            // view or window pos?
 
67
        float avgY1;
 
68
        uint32_t processId; // contains PID(?) on touchBegan
 
69
        uint64_t timestamp;     // contains some timesamp in ns
 
70
        UIWindow* window;       // event window
 
71
        uint32_t r11;           // 0x00000000
 
72
        uint32_t type12;        // 0x00000018 (device) 0x00007284 (sim)
 
73
        uint32_t gesture13;     // 3C(0011 1100) = 1 finger, 54(0101 0100) = 2 fingers, 6C(0110 1100) = 3 fingers, 84(1000 0100) = 4 fingers, 9C(1001 1100) = 5 fingers, 24(0010 0100) = 6 fingers/cancel
 
74
        uint32_t gesture14; // gesture? 1 = touchBegan, 2 = touchMoved, 6 = touchEnded, 5 = additionalTap in move
 
75
        uint16_t numInitialTouches; // number of initial touches
 
76
        uint16_t numCurrentTouches; // number of current touches
 
77
        uint32_t r16;           // 0x00000000
 
78
        uint32_t r17;           // 0x00000000
 
79
        uint32_t r18;           // 0x00000000
 
80
        uint32_t r19;           // 0x00000000
 
81
        uint32_t r20;           // 0x00000000
 
82
        uint32_t r21;           // 0x00000000
 
83
        uint8_t  r22_0;         // 0x00
 
84
        uint8_t numPoints;
 
85
        uint16_t r22_2;         // 0x0000
 
86
//      uint32_t r22;
 
87
//      uint32_t r23;
 
88
        struct GSTouchPoint points[10]; // contains the info on every point.
 
89
}
 
90
 
 
91
@end
 
92
 
 
93
typedef GSEvent* GSEventRef;
 
94
 
 
95
 
 
96
int GSEventIsChordingHandEvent(GSEventRef ev); // 0-one finger down 1-two fingers down
 
97
int GSEventGetClickCount(GSEventRef ev); // seems to be always 1
 
98
CGRect GSEventGetLocationInWindow(GSEventRef ev); // the rect will have width and height during a swipe event
 
99
float GSEventGetDeltaX(GSEventRef ev); // number of fingers gesture started with
 
100
float GSEventGetDeltaY(GSEventRef ev); // actual fingerCount
 
101
CGPoint GSEventGetInnerMostPathPosition(GSEventRef ev); // position finger 1 ?
 
102
CGPoint GSEventGetOuterMostPathPosition(GSEventRef ev); // position finger 2 ?
 
103
unsigned int GSEventGetSubType(GSEventRef ev); // seems to be always 0
 
104
unsigned int GSEventGetType(GSEventRef ev);
 
105
int GSEventDeviceOrientation(GSEventRef ev);
 
106
 
 
107
void GSEventSetBacklightFactor(int factor);
 
108
void GSEventSetBacklightLevel(float level); // from 0.0 (off) to 1.0 (max)
 
109
 
 
110
// fonts
 
111
 
 
112
typedef enum {
 
113
        kGSFontTraitRegular = 0,
 
114
    kGSFontTraitItalic = 1,
 
115
    kGSFontTraitBold = 2,
 
116
    kGSFontTraitBoldItalic = (kGSFontTraitBold | kGSFontTraitItalic)
 
117
} GSFontTrait;
 
118
 
 
119
struct __GSFont;
 
120
typedef struct __GSFont *GSFontRef;
 
121
 
 
122
GSFontRef GSFontCreateWithName(char *name, GSFontTrait traits, float size);
 
123
char *GSFontGetFamilyName(GSFontRef font);
 
124
char *GSFontGetFullName(GSFontRef font);
 
125
BOOL GSFontIsBold(GSFontRef font);
 
126
BOOL GSFontIsFixedPitch(GSFontRef font);
 
127
GSFontTrait GSFontGetTraits(GSFontRef font);
 
128
 
 
129
// colors
 
130
 
 
131
CGColorRef GSColorCreate(CGColorSpaceRef colorspace, const float components[]);
 
132
CGColorRef GSColorCreateBlendedColorWithFraction(CGColorRef color, CGColorRef blendedColor, float fraction);
 
133
CGColorRef GSColorCreateColorWithDeviceRGBA(float red, float green, float blue, float alpha);
 
134
CGColorRef GSColorCreateWithDeviceWhite(float white, float alpha);
 
135
CGColorRef GSColorCreateHighlightWithLevel(CGColorRef originalColor, float highlightLevel);
 
136
CGColorRef GSColorCreateShadowWithLevel(CGColorRef originalColor, float shadowLevel);
 
137
 
 
138
float GSColorGetRedComponent(CGColorRef color);
 
139
float GSColorGetGreenComponent(CGColorRef color);
 
140
float GSColorGetBlueComponent(CGColorRef color);
 
141
float GSColorGetAlphaComponent(CGColorRef color);
 
142
const float *GSColorGetRGBAComponents(CGColorRef color);
 
143
 
 
144
// sets the color for the current context given by UICurrentContext()
 
145
void GSColorSetColor(CGColorRef color);
 
146
void GSColorSetSystemColor(CGColorRef color);
 
147
 
 
148
#ifdef __cplusplus
 
149
}
 
150
#endif
 
151
 
 
152
#endif
 
153
 

Loggerhead 1.17 is a web-based interface for Bazaar branches