|
@@ -585,21 +585,45 @@ CGFloat DEFAULT_SNAPSHOT_HEIGHT = 200.0;
|
|
|
[self setNeedsDisplayAnnotation:annotation];
|
|
|
}
|
|
|
|
|
|
+- (void)rotateSignatureAnnotation:(CPDFListSignatureAnnotation *)annotation rotateAngle:(NSInteger)angle {
|
|
|
+ if([annotation isKindOfClass:[CPDFListSignatureAnnotation class]]) {
|
|
|
+ CPDFListSignatureAnnotation *signatureAnnotation = (CPDFListSignatureAnnotation *)annotation;
|
|
|
+ NSInteger rotation = signatureAnnotation.rotation;
|
|
|
+ rotation = rotation - angle;
|
|
|
+
|
|
|
+ if (rotation < 0) {
|
|
|
+ rotation += 360;
|
|
|
+ } else if (rotation >= 360) {
|
|
|
+ rotation-=360;
|
|
|
+ }
|
|
|
+
|
|
|
+ [signatureAnnotation setRotation:rotation];
|
|
|
+ rotation = [signatureAnnotation appearanceStreamRotation];
|
|
|
+
|
|
|
+ NSImage *oldImage = [annotation.pImage copy];
|
|
|
+ NSImage *newImage = [self changeImage:oldImage alphaValue:annotation.opacity];
|
|
|
+ [annotation updateAppearanceStreamWithImage:newImage rotation:annotation.rotation];
|
|
|
+ [self setNeedsDisplayAnnotationViewForPage:annotation.page];
|
|
|
+
|
|
|
+ [[[self undoManager] prepareWithInvocationTarget:self] rotateSignatureAnnotation:annotation rotateAngle:-angle];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
- (void)setSignatureAnnotation:(CPDFListSignatureAnnotation *)annotation forImageAlpha:(CGFloat)alpha {
|
|
|
[[[self undoManager] prepareWithInvocationTarget:self] setSignatureAnnotation:annotation forImageAlpha:annotation.opacity];
|
|
|
|
|
|
- if (annotation.opacity > 0.99) {
|
|
|
- self.originImage = annotation.pImage;
|
|
|
- }
|
|
|
+// if (annotation.opacity > 0.99) {
|
|
|
+// self.originImage = annotation.pImage;
|
|
|
+// }
|
|
|
annotation.opacity = alpha;
|
|
|
NSImage *oldImage = self.originImage ?: [annotation.pImage copy];
|
|
|
NSImage *newImage = [self changeImage:oldImage alphaValue:alpha];
|
|
|
|
|
|
- self.stampObject = [[CStampSignatureObject alloc]initWithSignatureImage:newImage];
|
|
|
-// annotation.stamp = stampObject;
|
|
|
-// [annotation setImage:newImage];
|
|
|
-// annotation.bounds = annotation.bounds;
|
|
|
- [self updateAlphaAnnotation:annotation];
|
|
|
+// self.stampObject = [[CStampSignatureObject alloc]initWithSignatureImage:newImage];
|
|
|
+// [self updateAlphaAnnotation:annotation];
|
|
|
+
|
|
|
+ [annotation updateAppearanceStreamWithImage:newImage rotation:annotation.rotation];
|
|
|
+ [self setNeedsDisplayAnnotation:annotation];
|
|
|
}
|
|
|
|
|
|
- (void)updateAlphaAnnotation:(CPDFListSignatureAnnotation *)annotation{
|