Difference between revisions of "NCVibrantLightStyling"

From iPhone Development Wiki
Jump to: navigation, search
(Source Code)
 
Line 5: Line 5:
 
@implementation NTXVibrantLightStyling
 
@implementation NTXVibrantLightStyling
 
- (_UIVisualEffectLayerConfig *)_layerConfig {
 
- (_UIVisualEffectLayerConfig *)_layerConfig {
 
+
  NSDictionary *filterAttributes = @{@"inputReversed":[NSNumber numberWithBool:[self _inputReversed]]};
NSDictionary *filterAttributes = @{@"inputReversed":[NSNumber numberWithBool:[self _inputReversed]]};
+
  _UIVisualEffectVibrantLayerConfig *layerConfig;
_UIVisualEffectVibrantLayerConfig *layerConfig;
+
  layerConfig = [_UIVisualEffectVibrantLayerConfig layerWithVibrantColor:[self _burnColor]
layerConfig = [_UIVisualEffectVibrantLayerConfig layerWithVibrantColor:[self _burnColor]
+
tintColor:[self _darkenColor]
tintColor:[self _darkenColor]
+
      filterType:[self blendMode]
  filterType:[self blendMode]
+
        filterAttributes:filterAttributes];
filterAttributes:filterAttributes];
+
  return layerConfig;
return layerConfig;
 
 
}
 
}
 
- (NSString *)blendMode {
 
- (NSString *)blendMode {
return kCAFilterVibrantLight;
+
  return kCAFilterVibrantLight;
 
}
 
}
 
- (CAFilter *)composedFilter {
 
- (CAFilter *)composedFilter {
if (![self valueForKey:@"_composedFilter"]) {
+
  if (![self valueForKey:@"_composedFilter"]) {
CAFilter *composedFilter = [CAFilter filterWithType:[self blendMode]];
+
CAFilter *composedFilter = [CAFilter filterWithType:[self blendMode]];
[composedFilter setValue:(id)[[self _burnColor] CGColor] forKey:@"inputColor0"];
+
[composedFilter setValue:(id)[[self _burnColor] CGColor] forKey:@"inputColor0"];
[composedFilter setValue:(id)[[self _darkenColor] CGColor] forKey:@"inputColor1"];
+
[composedFilter setValue:(id)[[self _darkenColor] CGColor] forKey:@"inputColor1"];
[composedFilter setValue:[NSNumber numberWithBool:[self _inputReversed]] forKey:@"inputReversed"];
+
[composedFilter setValue:[NSNumber numberWithBool:[self _inputReversed]] forKey:@"inputReversed"];
[self setValue:composedFilter forKey:@"_composedFilter"];
+
[self setValue:composedFilter forKey:@"_composedFilter"];
}
+
  }
return (CAFilter *)[self valueForKey:@"_composedFilter"];
+
  return (CAFilter *)[self valueForKey:@"_composedFilter"];
 
}
 
}
 
@end
 
@end

Latest revision as of 00:43, 23 December 2016

NCVibrantLightStyling is a subclass of NCVibrantStyling

Source Code

@implementation NTXVibrantLightStyling
- (_UIVisualEffectLayerConfig *)_layerConfig {
   NSDictionary *filterAttributes = @{@"inputReversed":[NSNumber numberWithBool:[self _inputReversed]]};
   _UIVisualEffectVibrantLayerConfig *layerConfig;
   layerConfig = [_UIVisualEffectVibrantLayerConfig layerWithVibrantColor:[self _burnColor]
								tintColor:[self _darkenColor]
							       filterType:[self blendMode]
						         filterAttributes:filterAttributes];
   return layerConfig;
}
- (NSString *)blendMode {
   return kCAFilterVibrantLight;
}
- (CAFilter *)composedFilter {
   if (![self valueForKey:@"_composedFilter"]) {
	CAFilter *composedFilter = [CAFilter filterWithType:[self blendMode]];
	[composedFilter setValue:(id)[[self _burnColor] CGColor] forKey:@"inputColor0"];
	[composedFilter setValue:(id)[[self _darkenColor] CGColor] forKey:@"inputColor1"];
	[composedFilter setValue:[NSNumber numberWithBool:[self _inputReversed]] forKey:@"inputReversed"];
	[self setValue:composedFilter forKey:@"_composedFilter"];
   }
   return (CAFilter *)[self valueForKey:@"_composedFilter"];
}
@end