瀏覽代碼

IPU标准版:整理截屏类插件

liufl5 3 年之前
父節點
當前提交
edb77e95e5

+ 22 - 8
IPUMobileFunc/IPUMobileFunc/IPUScreenCapture.h

10
10
11
@interface IPUScreenCapture : IPUPlugin
11
@interface IPUScreenCapture : IPUPlugin
12
12
13
/*
14
 全屏截屏
13
#pragma mark - JS
14
/**
15
 对当前可见视图部分(含状态栏)进行截屏
15
 参数1:0-文件路径,1-base64编码
16
 参数1:0-文件路径,1-base64编码
16
 */
17
 */
17
- (void)fullScreenCapture:(NSArray *)params;
18
- (void)fullScreenCapture:(NSArray *)params;
18
19
19
/*
20
 无状态栏截屏
20
/**
21
 对当前可见视图部分(不含状态栏)进行截屏
21
 参数1:0-文件路径,1-base64编码
22
 参数1:0-文件路径,1-base64编码
22
 */
23
 */
23
- (void)noStatusScreenCapture:(NSArray *)params;
24
- (void)noStatusScreenCapture:(NSArray *)params;
24
25
25
/*
26
 手动截屏
26
/**
27
 可通过手势拖动/移动自定义截图范围
27
 参数1:0-文件路径,1-base64编码
28
 参数1:0-文件路径,1-base64编码
28
 */
29
 */
29
- (void)handMovementScreenCapture:(NSArray *)params;
30
- (void)handMovementScreenCapture:(NSArray *)params;
30
31
31
/*
32
 webview长图截屏
32
/**
33
 对当前Web视图(包括不可见部分)进行截图
33
 参数1:0-文件路径,1-base64编码
34
 参数1:0-文件路径,1-base64编码
34
 */
35
 */
35
- (void)webviewScreenCapture:(NSArray *)params;
36
- (void)webviewScreenCapture:(NSArray *)params;
36
37
38
#pragma mark - OC
39
/**
40
 对当前可见视图部分(含状态栏)进行截屏
41
 iOS内部使用
42
 */
37
- (UIImage *)screenFullShot;
43
- (UIImage *)screenFullShot;
38
44
45
/**
46
对当前可见视图部分(不含状态栏)进行截屏
47
iOS内部使用
48
*/
39
- (UIImage *)screenNoStatusShot;
49
- (UIImage *)screenNoStatusShot;
40
50
51
/**
52
对当前Web视图(包括不可见部分)进行截图
53
iOS内部使用
54
*/
41
- (UIImage *)screenWebviewShot;
55
- (UIImage *)screenWebviewShot;
42
56
43
@end
57
@end

+ 30 - 2
IPUMobileFunc/IPUMobileFunc/IPUScreenCapture.m

35
35
36
@implementation IPUScreenCapture
36
@implementation IPUScreenCapture
37
37
38
#pragma mark - JS
39
/**
40
 对当前可见视图部分(含状态栏)进行截屏
41
 参数1:0-文件路径,1-base64编码
42
 */
38
- (void)fullScreenCapture:(NSArray *)params {
43
- (void)fullScreenCapture:(NSArray *)params {
39
    if (params.count && params[0] != [NSNull null]) {
44
    if (params.count && params[0] != [NSNull null]) {
40
        if (![params[0] integerValue]) {
45
        if (![params[0] integerValue]) {
73
    }
78
    }
74
}
79
}
75
80
81
/**
82
 对当前可见视图部分(不含状态栏)进行截屏
83
 参数1:0-文件路径,1-base64编码
84
 */
76
- (void)noStatusScreenCapture:(NSArray *)params {
85
- (void)noStatusScreenCapture:(NSArray *)params {
77
    if (params.count && params[0] != [NSNull null]) {
86
    if (params.count && params[0] != [NSNull null]) {
78
        if (![params[0] integerValue]) {
87
        if (![params[0] integerValue]) {
111
    }
120
    }
112
}
121
}
113
122
123
/**
124
 可通过手势拖动/移动自定义截图范围
125
 参数1:0-文件路径,1-base64编码
126
 */
114
- (void)handMovementScreenCapture:(NSArray *)params {
127
- (void)handMovementScreenCapture:(NSArray *)params {
115
    if (params.count > 0 && params[0] != [NSNull null]) {
128
    if (params.count > 0 && params[0] != [NSNull null]) {
116
        if ([params[0] integerValue] == 0) {
129
        if ([params[0] integerValue] == 0) {
135
    [self addPanGesture];
148
    [self addPanGesture];
136
}
149
}
137
150
151
/**
152
 对当前Web视图(包括不可见部分)进行截图
153
 参数1:0-文件路径,1-base64编码
154
 */
138
- (void)webviewScreenCapture:(NSArray *)params {
155
- (void)webviewScreenCapture:(NSArray *)params {
139
    if (params.count > 0 && params[0] != [NSNull null]) {
156
    if (params.count > 0 && params[0] != [NSNull null]) {
140
        if ([params[0] integerValue] == 0) {
157
        if ([params[0] integerValue] == 0) {
174
    }
191
    }
175
}
192
}
176
193
177
#pragma mark - 内部调用方法
178
194
#pragma mark - OC
195
/**
196
 对当前可见视图部分(含状态栏)进行截屏
197
 iOS内部使用
198
 */
179
- (UIImage *)screenFullShot {
199
- (UIImage *)screenFullShot {
180
    UIViewController *vc = [self getViewController];
200
    UIViewController *vc = [self getViewController];
181
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
201
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
185
    return screenShotImage;
205
    return screenShotImage;
186
}
206
}
187
207
208
/**
209
对当前可见视图部分(不含状态栏)进行截屏
210
iOS内部使用
211
*/
188
- (UIImage *)screenNoStatusShot {
212
- (UIImage *)screenNoStatusShot {
189
    UIView *webview = (UIView *)[self getWebView];
213
    UIView *webview = (UIView *)[self getWebView];
190
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
214
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
194
    return screenShotImage;
218
    return screenShotImage;
195
}
219
}
196
220
221
/**
222
对当前Web视图(包括不可见部分)进行截图
223
iOS内部使用
224
*/
197
- (UIImage *)screenWebviewShot {
225
- (UIImage *)screenWebviewShot {
198
    IPUCommonWebView webview = [self.mobileDelegate getCurrentView];
226
    IPUCommonWebView webview = [self.mobileDelegate getCurrentView];
199
    
227
    

二進制
display-center/display-center.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate