-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMyController.m
57 lines (40 loc) · 1.14 KB
/
MyController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
File: MyController.m
*/
#import "MyController.h"
@implementation MyController
//SAFE should not crash
- (IBAction)screenSnapshotSafe:(id)sender
{
// Create a screen reader object
screenFuck = [[ScreenFuck alloc] init];
NSAssert( screenFuck != 0, @"ScreenFuck alloc failed");
int sr = 0;
// Read the screen bits
[screenFuck readFullScreenToBuffer:sr];
// Bufferfucker
[screenFuck manipulateBuffer:sr];
// Write our image to a TIFF file on disk
[screenFuck createTIFFImageFileOnDesktop];
// Finished, so let's cleanup
[screenFuck release];
screenFuck = nil;
}
//SAFE may crash sometimes
- (IBAction)screenSnapshotRisky:(id)sender
{
// Create a screen reader object
screenFuck = [[ScreenFuck alloc] init];
NSAssert( screenFuck != 0, @"ScreenFuck alloc failed");
int sr = 1;
// Read the screen bits
[screenFuck readFullScreenToBuffer:sr];
// Bufferfucker
[screenFuck manipulateBuffer:sr];
// Write our image to a TIFF file on disk
[screenFuck createTIFFImageFileOnDesktop];
// Finished, so let's cleanup
[screenFuck release];
screenFuck = nil;
}
@end