|
@@ -14,7 +14,7 @@
|
|
|
|
|
|
@interface KMDocumentAIPDFView()<NSPopoverDelegate>
|
|
@interface KMDocumentAIPDFView()<NSPopoverDelegate>
|
|
|
|
|
|
-@property(nonatomic,retain) NSMutableArray<COCRResult *> * results;
|
|
|
|
|
|
+//@property(nonatomic,retain) NSMutableArray<COCRResult *> * results;
|
|
|
|
|
|
@property(nonatomic,assign) CGRect drawRecognitionEreaRect;
|
|
@property(nonatomic,assign) CGRect drawRecognitionEreaRect;
|
|
|
|
|
|
@@ -22,7 +22,7 @@
|
|
|
|
|
|
@property (nonatomic, assign) NSUInteger selectionPageIndex;
|
|
@property (nonatomic, assign) NSUInteger selectionPageIndex;
|
|
|
|
|
|
-@property (nonatomic, retain) COCRResult * activeResult;
|
|
|
|
|
|
+//@property (nonatomic, retain) COCRResult * activeResult;
|
|
|
|
|
|
@property (nonatomic, assign) NSInteger activeResultIndex;
|
|
@property (nonatomic, assign) NSInteger activeResultIndex;
|
|
|
|
|
|
@@ -46,7 +46,7 @@
|
|
__block typeof(self) blockSelf = self;
|
|
__block typeof(self) blockSelf = self;
|
|
self.documentAIPopViewController.callback = ^(NSInteger result) {
|
|
self.documentAIPopViewController.callback = ^(NSInteger result) {
|
|
if(result == 1) {
|
|
if(result == 1) {
|
|
- blockSelf.results[blockSelf.activeResultIndex].text = blockSelf.documentAIPopViewController.contentTextView.string?:@"";
|
|
|
|
|
|
+// blockSelf.results[blockSelf.activeResultIndex].text = blockSelf.documentAIPopViewController.contentTextView.string?:@"";
|
|
[blockSelf setNeedsDisplayAnnotationViewForPage:blockSelf.activeResultPage];
|
|
[blockSelf setNeedsDisplayAnnotationViewForPage:blockSelf.activeResultPage];
|
|
}
|
|
}
|
|
if(blockSelf.popOver.isShown)
|
|
if(blockSelf.popOver.isShown)
|
|
@@ -60,43 +60,43 @@
|
|
}
|
|
}
|
|
|
|
|
|
- (void)mouseDown:(NSEvent *)event {
|
|
- (void)mouseDown:(NSEvent *)event {
|
|
- if ([self doOCRResultWithEvent:event]) {
|
|
|
|
- if(self.popOver.isShown) {
|
|
|
|
- [self.popOver performClose:nil];
|
|
|
|
- } else {
|
|
|
|
- CGRect rect = [self convertRect:self.activeResult.textBounds fromPage:self.currentPage];
|
|
|
|
- [self.popOver showRelativeToRect:rect ofView:self preferredEdge:NSRectEdgeMinY];
|
|
|
|
- self.documentAIPopViewController.contentTextView.string = self.activeResult.text?:@"";
|
|
|
|
- }
|
|
|
|
- } else if ([self isRecognitionErea]) {
|
|
|
|
- [self doSelectWithEvent:event];
|
|
|
|
- }
|
|
|
|
|
|
+// if ([self doOCRResultWithEvent:event]) {
|
|
|
|
+// if(self.popOver.isShown) {
|
|
|
|
+// [self.popOver performClose:nil];
|
|
|
|
+// } else {
|
|
|
|
+// CGRect rect = [self convertRect:self.activeResult.textBounds fromPage:self.currentPage];
|
|
|
|
+// [self.popOver showRelativeToRect:rect ofView:self preferredEdge:NSRectEdgeMinY];
|
|
|
|
+// self.documentAIPopViewController.contentTextView.string = self.activeResult.text?:@"";
|
|
|
|
+// }
|
|
|
|
+// } else if ([self isRecognitionErea]) {
|
|
|
|
+// [self doSelectWithEvent:event];
|
|
|
|
+// }
|
|
}
|
|
}
|
|
|
|
|
|
-- (COCRResult *)doOCRResultWithEvent:(NSEvent *)theEvent {
|
|
|
|
- COCRResult *result = nil;
|
|
|
|
- NSPoint point = NSZeroPoint;
|
|
|
|
- CPDFPage *page = [self pageAndPoint:&point forEvent:theEvent nearest:YES];
|
|
|
|
-
|
|
|
|
- for (NSInteger i = 0;i<self.results.count;i++) {
|
|
|
|
- COCRResult *tResult = self.results[i];
|
|
|
|
- if(CGRectContainsPoint(tResult.textBounds, point)){
|
|
|
|
- result = tResult;
|
|
|
|
- self.activeResultIndex = i;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(result) {
|
|
|
|
- self.activeResult = result;
|
|
|
|
- self.activeResultPage = page;
|
|
|
|
- } else {
|
|
|
|
- self.activeResult = nil;
|
|
|
|
- self.activeResultPage = nil;
|
|
|
|
- self.activeResultIndex = -1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
|
|
+//- (COCRResult *)doOCRResultWithEvent:(NSEvent *)theEvent {
|
|
|
|
+// COCRResult *result = nil;
|
|
|
|
+// NSPoint point = NSZeroPoint;
|
|
|
|
+// CPDFPage *page = [self pageAndPoint:&point forEvent:theEvent nearest:YES];
|
|
|
|
+//
|
|
|
|
+// for (NSInteger i = 0;i<self.results.count;i++) {
|
|
|
|
+// COCRResult *tResult = self.results[i];
|
|
|
|
+// if(CGRectContainsPoint(tResult.textBounds, point)){
|
|
|
|
+// result = tResult;
|
|
|
|
+// self.activeResultIndex = i;
|
|
|
|
+// break;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// if(result) {
|
|
|
|
+// self.activeResult = result;
|
|
|
|
+// self.activeResultPage = page;
|
|
|
|
+// } else {
|
|
|
|
+// self.activeResult = nil;
|
|
|
|
+// self.activeResultPage = nil;
|
|
|
|
+// self.activeResultIndex = -1;
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// return result;
|
|
|
|
+//}
|
|
|
|
|
|
- (void)mouseMoved:(NSEvent *)event {
|
|
- (void)mouseMoved:(NSEvent *)event {
|
|
}
|
|
}
|
|
@@ -300,128 +300,128 @@
|
|
return page;
|
|
return page;
|
|
}
|
|
}
|
|
|
|
|
|
-- (void)updateResult:(NSArray<COCRResult *> *)results recognitionRect:(CGRect)recognitionRect {
|
|
|
|
- self.results = [NSMutableArray arrayWithArray:results];
|
|
|
|
- self.drawRecognitionEreaRect = recognitionRect;
|
|
|
|
- [self setNeedsDisplayAnnotationViewForPage:self.currentPage];
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-- (void)drawPage:(CPDFPage *)page toContext:(CGContextRef)context {
|
|
|
|
- if(self.resultDics.count > 0) {
|
|
|
|
- NSInteger currentIndex = [self.document indexForPage:page];
|
|
|
|
- NSArray<COCRResult *> *currentResults = @[];
|
|
|
|
- for (NSDictionary *dic in self.resultDics) {
|
|
|
|
- if(dic[@"page"] && [dic[@"page"] integerValue] == currentIndex) {
|
|
|
|
- if(dic[@"results"]) {
|
|
|
|
- currentResults = dic[@"results"];
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (currentResults.count>0) {
|
|
|
|
- [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:context flipped:NO]];
|
|
|
|
-
|
|
|
|
- CGContextSaveGState(context);
|
|
|
|
- CGContextAddRect(context, self.drawRecognitionEreaRect);
|
|
|
|
- CGContextSetRGBFillColor(context, 1, 1, 1, 0.7);
|
|
|
|
- CGContextFillPath(context);
|
|
|
|
- CGContextRestoreGState(context);
|
|
|
|
-
|
|
|
|
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
|
- [dic setValue:[NSColor blackColor] forKey:NSForegroundColorAttributeName];
|
|
|
|
-
|
|
|
|
- for (COCRResult * cOcrResult in currentResults) {
|
|
|
|
- CGContextSaveGState(context);
|
|
|
|
-
|
|
|
|
- CGRect rect = cOcrResult.textBounds;
|
|
|
|
-
|
|
|
|
- NSString *strChar = cOcrResult.text;
|
|
|
|
- CGFloat fontsize = 1.0;
|
|
|
|
- NSFont *font = [NSFont systemFontOfSize:fontsize];
|
|
|
|
- CGSize strSize = [strChar sizeWithAttributes:@{NSFontAttributeName:font}];
|
|
|
|
- while ((fontsize<127) && !(strSize.width>=cOcrResult.textBounds.size.width || strSize.height>=cOcrResult.textBounds.size.height)) {
|
|
|
|
- fontsize += 1.0;
|
|
|
|
- font = [NSFont systemFontOfSize:fontsize];
|
|
|
|
- strSize = [strChar sizeWithAttributes:@{NSFontAttributeName:font}];
|
|
|
|
- }
|
|
|
|
- NSFont *drawFont = [NSFont systemFontOfSize:fontsize-1];
|
|
|
|
-
|
|
|
|
- strSize = [strChar sizeWithAttributes:@{NSFontAttributeName:drawFont}];
|
|
|
|
- CGFloat k = (cOcrResult.textBounds.size.width - strSize.width)/(strChar.length);
|
|
|
|
-
|
|
|
|
- NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
|
|
|
|
-
|
|
|
|
- NSDictionary *attriDict = @{NSParagraphStyleAttributeName:style,NSKernAttributeName:@(k),NSFontAttributeName:drawFont};
|
|
|
|
-
|
|
|
|
- NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:strChar attributes:attriDict];
|
|
|
|
- [attributeString drawInRect:rect];
|
|
|
|
-
|
|
|
|
- CGContextAddRect(context, rect);
|
|
|
|
- CGContextSetLineWidth(context, 1.0);
|
|
|
|
- CGContextSetStrokeColorWithColor(context, [NSColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0].CGColor);
|
|
|
|
- CGContextStrokePath(context);
|
|
|
|
-
|
|
|
|
- CGContextRestoreGState(context);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(!CGRectEqualToRect(self.recognitionEreaRect, CGRectZero)) {
|
|
|
|
- @synchronized (self) {
|
|
|
|
- CGContextSaveGState(context);
|
|
|
|
-
|
|
|
|
- CGFloat size = DOCUMENT_SIZE;
|
|
|
|
- CGContextSetLineWidth(context, 5.0);
|
|
|
|
- CGContextSetStrokeColorWithColor(context, [NSColor colorWithRed:23.0/255.0 green:112.0/255.0 blue:244.0/255.0 alpha:1.0].CGColor);
|
|
|
|
-
|
|
|
|
- CGContextMoveToPoint(context, CGRectGetMidX(self.recognitionEreaRect)-size/2, CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMidX(self.recognitionEreaRect)+size/2, CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
-
|
|
|
|
- CGContextMoveToPoint(context, CGRectGetMidX(self.recognitionEreaRect)-size/2, CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMidX(self.recognitionEreaRect)+size/2, CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
-
|
|
|
|
- CGContextMoveToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMidY(self.recognitionEreaRect)-size/2);
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMidY(self.recognitionEreaRect)+size/2);
|
|
|
|
-
|
|
|
|
- CGContextMoveToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMidY(self.recognitionEreaRect)-size/2);
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMidY(self.recognitionEreaRect)+size/2);
|
|
|
|
-
|
|
|
|
- CGContextMoveToPoint(context, CGRectGetMaxX(self.recognitionEreaRect)-size/2, CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMinY(self.recognitionEreaRect)+ size/2);
|
|
|
|
-
|
|
|
|
- CGContextMoveToPoint(context, CGRectGetMinX(self.recognitionEreaRect)+size/2, CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMinY(self.recognitionEreaRect)+ size/2);
|
|
|
|
-
|
|
|
|
- CGContextMoveToPoint(context, CGRectGetMinX(self.recognitionEreaRect)+size/2, CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMaxY(self.recognitionEreaRect) - size/2);
|
|
|
|
-
|
|
|
|
- CGContextMoveToPoint(context, CGRectGetMaxX(self.recognitionEreaRect)-size/2, CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
- CGContextAddLineToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMaxY(self.recognitionEreaRect) - size/2);
|
|
|
|
-
|
|
|
|
- CGContextStrokePath(context);
|
|
|
|
-
|
|
|
|
- CGContextSetLineCap(context, kCGLineCapRound);
|
|
|
|
- CGContextSetLineWidth(context, 2.0);
|
|
|
|
- CGContextRestoreGState(context);
|
|
|
|
-
|
|
|
|
- CGContextSetStrokeColorWithColor(context, [NSColor colorWithRed:23.0/255.0 green:112.0/255.0 blue:244.0/255.0 alpha:1.0].CGColor);
|
|
|
|
- CGContextBeginPath(context);
|
|
|
|
- CGContextMoveToPoint(context, self.recognitionEreaRect.origin.x, self.recognitionEreaRect.origin.y);
|
|
|
|
- CGContextAddLineToPoint(context, self.recognitionEreaRect.origin.x+ self.recognitionEreaRect.size.width,self.recognitionEreaRect.origin.y);
|
|
|
|
- CGContextAddLineToPoint(context, self.recognitionEreaRect.origin.x + self.recognitionEreaRect.size.width,self.recognitionEreaRect.origin.y + + self.recognitionEreaRect.size.height);
|
|
|
|
- CGContextAddLineToPoint(context, self.recognitionEreaRect.origin.x,self.recognitionEreaRect.origin.y + + self.recognitionEreaRect.size.height);
|
|
|
|
- CGContextClosePath(context);
|
|
|
|
- CGFloat lengths[] = {10,5};
|
|
|
|
- CGContextSetLineDash(context, 0, lengths,2);
|
|
|
|
- CGContextStrokePath(context);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+//- (void)updateResult:(NSArray<COCRResult *> *)results recognitionRect:(CGRect)recognitionRect {
|
|
|
|
+// self.results = [NSMutableArray arrayWithArray:results];
|
|
|
|
+// self.drawRecognitionEreaRect = recognitionRect;
|
|
|
|
+// [self setNeedsDisplayAnnotationViewForPage:self.currentPage];
|
|
|
|
+//}
|
|
|
|
+//
|
|
|
|
+//- (void)drawPage:(CPDFPage *)page toContext:(CGContextRef)context {
|
|
|
|
+// if(self.resultDics.count > 0) {
|
|
|
|
+// NSInteger currentIndex = [self.document indexForPage:page];
|
|
|
|
+// NSArray<COCRResult *> *currentResults = @[];
|
|
|
|
+// for (NSDictionary *dic in self.resultDics) {
|
|
|
|
+// if(dic[@"page"] && [dic[@"page"] integerValue] == currentIndex) {
|
|
|
|
+// if(dic[@"results"]) {
|
|
|
|
+// currentResults = dic[@"results"];
|
|
|
|
+// break;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// if (currentResults.count>0) {
|
|
|
|
+// [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:context flipped:NO]];
|
|
|
|
+//
|
|
|
|
+// CGContextSaveGState(context);
|
|
|
|
+// CGContextAddRect(context, self.drawRecognitionEreaRect);
|
|
|
|
+// CGContextSetRGBFillColor(context, 1, 1, 1, 0.7);
|
|
|
|
+// CGContextFillPath(context);
|
|
|
|
+// CGContextRestoreGState(context);
|
|
|
|
+//
|
|
|
|
+// NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
|
+// [dic setValue:[NSColor blackColor] forKey:NSForegroundColorAttributeName];
|
|
|
|
+//
|
|
|
|
+// for (COCRResult * cOcrResult in currentResults) {
|
|
|
|
+// CGContextSaveGState(context);
|
|
|
|
+//
|
|
|
|
+// CGRect rect = cOcrResult.textBounds;
|
|
|
|
+//
|
|
|
|
+// NSString *strChar = cOcrResult.text;
|
|
|
|
+// CGFloat fontsize = 1.0;
|
|
|
|
+// NSFont *font = [NSFont systemFontOfSize:fontsize];
|
|
|
|
+// CGSize strSize = [strChar sizeWithAttributes:@{NSFontAttributeName:font}];
|
|
|
|
+// while ((fontsize<127) && !(strSize.width>=cOcrResult.textBounds.size.width || strSize.height>=cOcrResult.textBounds.size.height)) {
|
|
|
|
+// fontsize += 1.0;
|
|
|
|
+// font = [NSFont systemFontOfSize:fontsize];
|
|
|
|
+// strSize = [strChar sizeWithAttributes:@{NSFontAttributeName:font}];
|
|
|
|
+// }
|
|
|
|
+// NSFont *drawFont = [NSFont systemFontOfSize:fontsize-1];
|
|
|
|
+//
|
|
|
|
+// strSize = [strChar sizeWithAttributes:@{NSFontAttributeName:drawFont}];
|
|
|
|
+// CGFloat k = (cOcrResult.textBounds.size.width - strSize.width)/(strChar.length);
|
|
|
|
+//
|
|
|
|
+// NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
|
|
|
|
+//
|
|
|
|
+// NSDictionary *attriDict = @{NSParagraphStyleAttributeName:style,NSKernAttributeName:@(k),NSFontAttributeName:drawFont};
|
|
|
|
+//
|
|
|
|
+// NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:strChar attributes:attriDict];
|
|
|
|
+// [attributeString drawInRect:rect];
|
|
|
|
+//
|
|
|
|
+// CGContextAddRect(context, rect);
|
|
|
|
+// CGContextSetLineWidth(context, 1.0);
|
|
|
|
+// CGContextSetStrokeColorWithColor(context, [NSColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0].CGColor);
|
|
|
|
+// CGContextStrokePath(context);
|
|
|
|
+//
|
|
|
|
+// CGContextRestoreGState(context);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// if(!CGRectEqualToRect(self.recognitionEreaRect, CGRectZero)) {
|
|
|
|
+// @synchronized (self) {
|
|
|
|
+// CGContextSaveGState(context);
|
|
|
|
+//
|
|
|
|
+// CGFloat size = DOCUMENT_SIZE;
|
|
|
|
+// CGContextSetLineWidth(context, 5.0);
|
|
|
|
+// CGContextSetStrokeColorWithColor(context, [NSColor colorWithRed:23.0/255.0 green:112.0/255.0 blue:244.0/255.0 alpha:1.0].CGColor);
|
|
|
|
+//
|
|
|
|
+// CGContextMoveToPoint(context, CGRectGetMidX(self.recognitionEreaRect)-size/2, CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMidX(self.recognitionEreaRect)+size/2, CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
+//
|
|
|
|
+// CGContextMoveToPoint(context, CGRectGetMidX(self.recognitionEreaRect)-size/2, CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMidX(self.recognitionEreaRect)+size/2, CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
+//
|
|
|
|
+// CGContextMoveToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMidY(self.recognitionEreaRect)-size/2);
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMidY(self.recognitionEreaRect)+size/2);
|
|
|
|
+//
|
|
|
|
+// CGContextMoveToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMidY(self.recognitionEreaRect)-size/2);
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMidY(self.recognitionEreaRect)+size/2);
|
|
|
|
+//
|
|
|
|
+// CGContextMoveToPoint(context, CGRectGetMaxX(self.recognitionEreaRect)-size/2, CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMinY(self.recognitionEreaRect)+ size/2);
|
|
|
|
+//
|
|
|
|
+// CGContextMoveToPoint(context, CGRectGetMinX(self.recognitionEreaRect)+size/2, CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMinY(self.recognitionEreaRect));
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMinY(self.recognitionEreaRect)+ size/2);
|
|
|
|
+//
|
|
|
|
+// CGContextMoveToPoint(context, CGRectGetMinX(self.recognitionEreaRect)+size/2, CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMinX(self.recognitionEreaRect), CGRectGetMaxY(self.recognitionEreaRect) - size/2);
|
|
|
|
+//
|
|
|
|
+// CGContextMoveToPoint(context, CGRectGetMaxX(self.recognitionEreaRect)-size/2, CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMaxY(self.recognitionEreaRect));
|
|
|
|
+// CGContextAddLineToPoint(context, CGRectGetMaxX(self.recognitionEreaRect), CGRectGetMaxY(self.recognitionEreaRect) - size/2);
|
|
|
|
+//
|
|
|
|
+// CGContextStrokePath(context);
|
|
|
|
+//
|
|
|
|
+// CGContextSetLineCap(context, kCGLineCapRound);
|
|
|
|
+// CGContextSetLineWidth(context, 2.0);
|
|
|
|
+// CGContextRestoreGState(context);
|
|
|
|
+//
|
|
|
|
+// CGContextSetStrokeColorWithColor(context, [NSColor colorWithRed:23.0/255.0 green:112.0/255.0 blue:244.0/255.0 alpha:1.0].CGColor);
|
|
|
|
+// CGContextBeginPath(context);
|
|
|
|
+// CGContextMoveToPoint(context, self.recognitionEreaRect.origin.x, self.recognitionEreaRect.origin.y);
|
|
|
|
+// CGContextAddLineToPoint(context, self.recognitionEreaRect.origin.x+ self.recognitionEreaRect.size.width,self.recognitionEreaRect.origin.y);
|
|
|
|
+// CGContextAddLineToPoint(context, self.recognitionEreaRect.origin.x + self.recognitionEreaRect.size.width,self.recognitionEreaRect.origin.y + + self.recognitionEreaRect.size.height);
|
|
|
|
+// CGContextAddLineToPoint(context, self.recognitionEreaRect.origin.x,self.recognitionEreaRect.origin.y + + self.recognitionEreaRect.size.height);
|
|
|
|
+// CGContextClosePath(context);
|
|
|
|
+// CGFloat lengths[] = {10,5};
|
|
|
|
+// CGContextSetLineDash(context, 0, lengths,2);
|
|
|
|
+// CGContextStrokePath(context);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//}
|
|
|
|
|
|
#pragma Mark - menuForEvent
|
|
#pragma Mark - menuForEvent
|
|
|
|
|