Revision: 14467
          http://sourceforge.net/p/skim-app/code/14467
Author:   hofman
Date:     2024-09-22 16:06:04 +0000 (Sun, 22 Sep 2024)
Log Message:
-----------
Scale position and rectangle default attribute values for transition filters

Modified Paths:
--------------
    trunk/SKTransitionController.m

Modified: trunk/SKTransitionController.m
===================================================================
--- trunk/SKTransitionController.m      2024-09-22 15:29:35 UTC (rev 14466)
+++ trunk/SKTransitionController.m      2024-09-22 16:06:04 UTC (rev 14467)
@@ -287,6 +287,7 @@
     
     for (NSString *key in [transitionFilter inputKeys]) {
         id value = nil;
+        NSString *type = [[[transitionFilter attributes] objectForKey:key] 
objectForKey:kCIAttributeType];
         if ([key isEqualToString:kCIInputExtentKey]) {
             CGRect extent = [info shouldRestrict] ? rect : bounds;
             value = [CIVector vectorWithCGRect:extent];
@@ -308,15 +309,23 @@
             value = inputShadingImage;
         } else if ([key isEqualToString:kCIInputBacksideImageKey]) {
             value = initialImage;
-        } else if ([[[[transitionFilter attributes] objectForKey:key] 
objectForKey:kCIAttributeType] isEqualToString:kCIAttributeTypeBoolean]) {
+        } else if ([type isEqualToString:kCIAttributeTypeBoolean]) {
             if ([[NSSet setWithObjects:@"inputBackward", @"inputRight", 
@"inputReversed", nil] containsObject:key])
                 value = [NSNumber numberWithBool:forward == NO];
             else if ([[NSSet setWithObjects:@"inputForward", @"inputLeft", 
nil] containsObject:key])
                 value = [NSNumber numberWithBool:forward];
-        } else if ([[[[transitionFilter attributes] objectForKey:key] 
objectForKey:kCIAttributeType] isEqualToString:kCIAttributeTypeDistance]) {
+        } else if ([type isEqualToString:kCIAttributeTypeDistance]) {
             CGFloat width = [[transitionFilter valueForKey:key] doubleValue];
             value = [NSNumber numberWithDouble:scale * width];
-        } else if ([[[[transitionFilter attributes] objectForKey:key] 
objectForKey:kCIAttributeClass] isEqualToString:@"CIImage"]) {
+        } else if ([type isEqualToString:kCIAttributeTypePosition]) {
+            if ([transitionFilter valueForKey:key] == nil) continue;
+            CGPoint point = [[transitionFilter valueForKey:key] CGPointValue];
+            value = [CIVector vectorWithCGPoint:CGPointMake(scale * point.x, 
scale * point.y)];
+        } else if ([type isEqualToString:kCIAttributeTypeRectangle]) {
+            if ([transitionFilter valueForKey:key] == nil) continue;
+            CGRect r = [[transitionFilter valueForKey:key] CGRectValue];
+            value = [CIVector vectorWithCGRect:CGRectMake(scale * 
CGRectGetMinX(r), scale * CGRectGetMinY(r), scale * CGRectGetWidth(r), scale * 
CGRectGetHeight(r))];
+        } else if ([type isEqualToString:kCIAttributeTypeImage]) {
             // Scale and translate our mask image to match the transition area 
size.
             static CIImage *inputMaskImage = nil;
             if (inputMaskImage == nil)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to