Skip to content

Commit 7cf2863

Browse files
committed
Supported more type of parameters.
1 parent 51595dc commit 7cf2863

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

FilterDemo/FilterDetailCategory.m

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ + (void)configureFilter:(CIFilter*)filter
118118
float minimumValue = [[attributeDictionary valueForKey:kCIAttributeSliderMin] floatValue];
119119

120120
float randomValue = randFloat(minimumValue, maximumValue);
121-
NSLog(@"min:%f, max:%f, random:%f", minimumValue, maximumValue, randomValue);
122121

123122
NSLog(@"Setting %f for key %@ of type Decimal", randomValue, key);
124123
[filter setValue:[NSNumber numberWithFloat:randomValue] forKey:key];
@@ -142,6 +141,22 @@ + (void)configureFilter:(CIFilter*)filter
142141
CIImage *ciimage = [CIImage imageWithCGImage:uiimage.CGImage];
143142
[filter setValue:ciimage forKey:key];
144143
}
144+
else if ([[attributeDictionary objectForKey:kCIAttributeClass] isEqualToString:@"CIVector"]) {
145+
146+
CIVector *vector = [CIVector vectorWithCGPoint:CGPointMake(arc4random() % 50,
147+
arc4random() % 50)];
148+
NSLog(@"Setting %@ for key %@ of type CIVector", vector, key);
149+
[filter setValue:vector forKey:key];
150+
}
151+
else if ([[attributeDictionary objectForKey:kCIAttributeClass] isEqualToString:@"CIColor"]) {
152+
153+
CIColor *color = [CIColor colorWithRed:randFloat(0, 1)
154+
green:randFloat(0, 1)
155+
blue:randFloat(0, 1)
156+
alpha:1.0];
157+
NSLog(@"Setting %@ for key %@ of type CIColor", color, key);
158+
[filter setValue:color forKey:key];
159+
}
145160
}
146161
}
147162

0 commit comments

Comments
 (0)