|
@@ -11,10 +11,7 @@ import Foundation
|
|
class func annotationImage(annotationModel: CPDFAnnotationModel) -> NSImage? {
|
|
class func annotationImage(annotationModel: CPDFAnnotationModel) -> NSImage? {
|
|
var image: NSImage?
|
|
var image: NSImage?
|
|
// let bounds = CGRectMake(0, 0, annotationModel.noteWidth(), annotationModel.noteHeight())
|
|
// let bounds = CGRectMake(0, 0, annotationModel.noteWidth(), annotationModel.noteHeight())
|
|
- var bounds = CGRectMake(0, 0, 20, 20)
|
|
|
|
- if (annotationModel.stampAnnotationType() == .signDot) {
|
|
|
|
- bounds = CGRectMake(0, 0, 40, 40)
|
|
|
|
- }
|
|
|
|
|
|
+ let bounds = CGRectMake(0, 0, 50, 50)
|
|
image = NSImage(size: bounds.size)
|
|
image = NSImage(size: bounds.size)
|
|
image?.lockFocus()
|
|
image?.lockFocus()
|
|
NSGraphicsContext.current?.imageInterpolation = .high
|
|
NSGraphicsContext.current?.imageInterpolation = .high
|
|
@@ -61,11 +58,13 @@ import Foundation
|
|
paintColor.set()
|
|
paintColor.set()
|
|
path.fill()
|
|
path.fill()
|
|
} else if (annotationModel.stampAnnotationType() == .signDot) {
|
|
} else if (annotationModel.stampAnnotationType() == .signDot) {
|
|
- let r = 16.0
|
|
|
|
- let path = NSBezierPath(roundedRect: CGRectInset(bounds, annotationModel.noteWidth(), annotationModel.noteWidth()), xRadius: r, yRadius: r)
|
|
|
|
- path.lineWidth = lineWidth
|
|
|
|
- paintColor.set()
|
|
|
|
- path.fill()
|
|
|
|
|
|
+ context?.setStrokeColor(red: 0, green: 0, blue: 0, alpha: 1.0)
|
|
|
|
+ context?.setLineWidth(1.0)
|
|
|
|
+ let radius = min(bounds.width / 2.0 - 1, bounds.height / 2.0 - 1)
|
|
|
|
+ context?.addArc(center: CGPoint(x: bounds.midX, y: bounds.midY), radius: radius, startAngle: 0, endAngle: CGFloat.pi * 2, clockwise: true)
|
|
|
|
+ context?.setStrokeColor(paintColor.cgColor)
|
|
|
|
+ context?.setFillColor(paintColor.cgColor)
|
|
|
|
+ context?.fillPath()
|
|
} else {
|
|
} else {
|
|
if let stampAnnotation = annotationModel.annotation as? CPDFStampAnnotation {
|
|
if let stampAnnotation = annotationModel.annotation as? CPDFStampAnnotation {
|
|
image = stampAnnotation.stampImage()
|
|
image = stampAnnotation.stampImage()
|