/
PSPDFDrawView.h
61 lines (41 loc) · 1.53 KB
/
PSPDFDrawView.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
//
// PSPDFDrawView.h
// PSPDFKit
//
// Copyright (c) 2012 Peter Steinberger. All rights reserved.
//
#import "PSPDFKitGlobal.h"
#import <QuartzCore/QuartzCore.h>
@class PSPDFDrawView, PSPDFDrawAction;
/// Delegate when drawing is finished.
@protocol PSPDFDrawViewDelegate <NSObject>
- (void)drawViewDidFinish:(PSPDFDrawView *)drawView;
@optional
- (void)drawViewDidBeginDrawing:(PSPDFDrawView *)drawView;
- (void)drawView:(PSPDFDrawView *)drawView didChange:(PSPDFDrawAction *)drawAction;
@end
/// Class that allows drawing on top of a PSPDFPageView.
@interface PSPDFDrawView : UIView
@property (nonatomic, strong, readonly) CAShapeLayer *shapeLayer;
@property (nonatomic, strong) UIBezierPath *path;
@property (nonatomic, strong) NSMutableArray *lines;
@property (nonatomic, strong) UIImage *currentImage;
@property (nonatomic, assign) CGFloat lineWidth;
@property (nonatomic, strong) UIColor *strokeColor;
@property (nonatomic, assign) BOOL hasChanges;
@property (nonatomic, strong) UIPopoverController *activePopover;
/// Draw Delegate.
@property (nonatomic, unsafe_unretained) id<PSPDFDrawViewDelegate> delegate;
- (void)loadImage:(UIImage *)image;
- (BOOL)canUndo;
- (BOOL)undo;
- (BOOL)canRedo;
- (BOOL)redo;
- (void)done;
@end
// Single draw action (saved for undo/redo)
@interface PSPDFDrawAction : NSObject
@property (nonatomic, strong) NSArray *points;
- (id)initWithPoints:(NSArray *)pointArray path:(UIBezierPath *)bezierPath type:(NSString *)actionType strokeColor:(UIColor *)color lineWidth:(CGFloat)width;
- (void)apply;
@end