Browse Source

【综合】【注释】添加图片调节透明度无效(已修复)

tangchao 10 months ago
parent
commit
288f57745d

+ 5 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Extension.m

@@ -551,7 +551,11 @@ CGFloat DEFAULT_SNAPSHOT_HEIGHT = 200.0;
 
     annotation.opacity = alpha;
     annotation.bounds = annotation.bounds;
-    [self setNeedsDisplay:YES];
+    NSImage *oldImage = [annotation.pImage copy];
+    NSImage *newImage = [self changeImage:oldImage alphaValue:alpha];
+    
+    [annotation updateAppearanceStreamWithImage:newImage];
+    [self setNeedsDisplayAnnotation:annotation];
 }
 
 - (void)setSignatureAnnotation:(CPDFListSignatureAnnotation *)annotation forImageAlpha:(CGFloat)alpha {

+ 20 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMStampManager.swift

@@ -473,6 +473,26 @@ let CPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
                     }
                     newDictionary[tag] = stampDictionary
                     
+                    if (newDictionary as NSDictionary).write(toFile: kStampPlistPath.path, atomically: true) {
+                        stamp.stampKey = tag
+                        stamps.append(stamp)
+                        return true
+                    }
+                } else {
+                    var newDictionary = NSMutableDictionary()
+                    
+                    let stamp = CStampObject(imageStampFilePath: rPath)
+                    stamp.nameString = nameString
+                    
+                    var stampDictionary: [String: Any] = [:]
+                    stampDictionary[kStampOfImagePathKey] = (rPath as NSString).lastPathComponent
+                    stampDictionary[kStampOfDateKey] = Date()
+                    stampDictionary[kStampOfCategoryKey] = categoryString.rawValue
+                    if !nameString.isEmpty {
+                        stampDictionary[kStampOfNameKey] = nameString
+                    }
+                    newDictionary[tag] = stampDictionary
+                    
                     if (newDictionary as NSDictionary).write(toFile: kStampPlistPath.path, atomically: true) {
                         stamp.stampKey = tag
                         stamps.append(stamp)