5
* Created by döme on 26.10.2009.
6
* Copyright 2009 __MyCompanyName__. All rights reserved.
10
#ifndef GRAPHICSSERVICES_H
11
#define GRAPHICSSERVICES_H
13
#import "CoreGraphics/CGGeometry.h"
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
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?
37
0xFF______ apparently "source", 0x43,0x42 mouse scroll (0x00 on begin/end), 0xBF mouseDown, 0xFF mouseDrag/up
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
48
UIWindow* window; // window where event occured?
51
typedef struct GSTouchPoint* GSTouchPointRef;
53
#define kGSEventTouchesBegan 1
54
#define kGSEventTouchesMoved 2
55
#define kGSEventTouchesEnded 6
57
@interface GSEvent : NSObject
61
uint32_t type0; // 0x02010180
62
uint32_t type1; // 0x00000BB9
63
uint32_t r3; // 0x00000000
64
float avgX0; // window or view pos?
66
float avgX1; // view or window pos?
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
85
uint16_t r22_2; // 0x0000
88
struct GSTouchPoint points[10]; // contains the info on every point.
93
typedef GSEvent* GSEventRef;
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);
107
void GSEventSetBacklightFactor(int factor);
108
void GSEventSetBacklightLevel(float level); // from 0.0 (off) to 1.0 (max)
113
kGSFontTraitRegular = 0,
114
kGSFontTraitItalic = 1,
115
kGSFontTraitBold = 2,
116
kGSFontTraitBoldItalic = (kGSFontTraitBold | kGSFontTraitItalic)
120
typedef struct __GSFont *GSFontRef;
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);
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);
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);
144
// sets the color for the current context given by UICurrentContext()
145
void GSColorSetColor(CGColorRef color);
146
void GSColorSetSystemColor(CGColorRef color);