forked from rFlex/SCRecorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCContext.h
96 lines (77 loc) · 2.24 KB
/
SCContext.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//
// SCContext.h
// SCRecorder
//
// Created by Simon CORSIN on 28/05/15.
// Copyright (c) 2015 rFlex. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreImage/CoreImage.h>
#import <Metal/Metal.h>
typedef NS_ENUM(NSInteger, SCContextType) {
/**
Automatically choose an appropriate SCContext context
*/
SCContextTypeAuto,
/**
Create a hardware accelerated SCContext with Metal
*/
SCContextTypeMetal,
/**
Create a hardware accelerated SCContext with CoreGraphics
*/
SCContextTypeCoreGraphics,
/**
Create a hardware accelerated SCContext with EAGL (OpenGL)
*/
SCContextTypeEAGL,
/**
Creates a standard SCContext hardware accelerated.
*/
SCContextTypeDefault,
/**
Create a software rendered SCContext (no hardware acceleration)
*/
SCContextTypeCPU
};
extern NSString *__nonnull const SCContextOptionsCGContextKey;
extern NSString *__nonnull const SCContextOptionsEAGLContextKey;
extern NSString *__nonnull const SCContextOptionsMTLDeviceKey;
/**
Simple abstraction over CIContext.
*/
@interface SCContext : NSObject
/**
The CIContext
*/
@property (readonly, nonatomic) CIContext *__nonnull CIContext;
/**
The type with with which this SCContext was created
*/
@property (readonly, nonatomic) SCContextType type;
/**
Will be non null if the type is SCContextTypeEAGL
*/
@property (readonly, nonatomic) EAGLContext *__nullable EAGLContext;
/**
Will be non null if the type is SCContextTypeMetal
*/
@property (readonly, nonatomic) id<MTLDevice> __nullable MTLDevice;
/**
Will be non null if the type is SCContextTypeCoreGraphics
*/
@property (readonly, nonatomic) CGContextRef __nullable CGContext;
/**
Create and returns a new context with the given type. You must check
whether the contextType is supported by calling +[SCContext supportsType:] before.
*/
+ (SCContext *__nonnull)contextWithType:(SCContextType)type options:(NSDictionary *__nullable)options;
/**
Returns whether the contextType can be safely created and used using +[SCContext contextWithType:]
*/
+ (BOOL)supportsType:(SCContextType)contextType;
/**
The context that will be used when using an Auto context type;
*/
+ (SCContextType)suggestedContextType;
@end