diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-01-09 13:27:17 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-01-09 17:46:26 +0100 |
commit | 9d96d035d3b7af53256ee64b5ddb0ad8bcf8df38 (patch) | |
tree | 408cbbb72315089db1b8efe58bce322f8734bb1b /platform/ios/Classes/MuInkView.m | |
parent | 50b39c939345c36eb5e95c8a71ccdb8cd24c9aad (diff) | |
download | mupdf-9d96d035d3b7af53256ee64b5ddb0ad8bcf8df38.tar.xz |
Remove platform/ios directory.
The iOS viewer has been moved to its own git repository.
Diffstat (limited to 'platform/ios/Classes/MuInkView.m')
-rw-r--r-- | platform/ios/Classes/MuInkView.m | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/platform/ios/Classes/MuInkView.m b/platform/ios/Classes/MuInkView.m deleted file mode 100644 index 75799941..00000000 --- a/platform/ios/Classes/MuInkView.m +++ /dev/null @@ -1,82 +0,0 @@ -#include "common.h" -#import "MuInkView.h" - -@implementation MuInkView -{ - CGSize pageSize; - NSMutableArray *curves; - UIColor *color; -} - -- (instancetype) initWithPageSize:(CGSize)_pageSize -{ - self = [super initWithFrame:CGRectMake(0, 0, 100, 100)]; - if (self) { - [self setOpaque:NO]; - pageSize = _pageSize; - color = [[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0] retain]; - curves = [[NSMutableArray array] retain]; - UIPanGestureRecognizer *rec = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(onDrag:)]; - [self addGestureRecognizer:rec]; - [rec release]; - } - return self; -} - -@synthesize curves; - --(void)dealloc -{ - [curves release]; - [color release]; - [super dealloc]; -} - --(void) onDrag:(UIPanGestureRecognizer *)rec -{ - CGSize scale = fitPageToScreen(pageSize, self.bounds.size); - CGPoint p = [rec locationInView:self]; - p.x /= scale.width; - p.y /= scale.height; - - if (rec.state == UIGestureRecognizerStateBegan) - [curves addObject:[NSMutableArray array]]; - - NSMutableArray *curve = curves.lastObject; - [curve addObject:[NSValue valueWithCGPoint:p]]; - - [self setNeedsDisplay]; -} - -- (void)drawRect:(CGRect)rect -{ - CGSize scale = fitPageToScreen(pageSize, self.bounds.size); - CGContextRef cref = UIGraphicsGetCurrentContext(); - CGContextScaleCTM(cref, scale.width, scale.height); - - [color set]; - CGContextSetLineWidth(cref, 5.0); - - for (NSArray *curve in curves) - { - if (curve.count >= 2) - { - CGPoint pt = [curve[0] CGPointValue]; - CGContextBeginPath(cref); - CGContextMoveToPoint(cref, pt.x, pt.y); - CGPoint lpt = pt; - - for (int i = 1; i < curve.count; i++) - { - pt = [curve[i] CGPointValue]; - CGContextAddQuadCurveToPoint(cref, lpt.x, lpt.y, (pt.x + lpt.x)/2, (pt.y + lpt.y)/2); - lpt = pt; - } - - CGContextAddLineToPoint(cref, pt.x, pt.y); - CGContextStrokePath(cref); - } - } -} - -@end |