Skip to content

Instantly share code, notes, and snippets.

@sholloway
Created July 8, 2012 16:11
Show Gist options
  • Save sholloway/3071549 to your computer and use it in GitHub Desktop.
Save sholloway/3071549 to your computer and use it in GitHub Desktop.
List out all Core Image filters with macruby
framework "Quartz"
# Available Categories:
=begin
KCICategoryDistortionEffect - Distortion effects, such as bump, twirl, hole
KCICategoryGeometryAdjustment - Geometry adjustment, such as affine transform, crop, perspective transform
KCICategoryCompositeOperation - Compositing, such as source over, minimum, source atop, color dodge blend mode
KCICategoryHalftoneEffect - Halftone effects, such as screen, line screen, hatched
KCICategoryColorAdjustment - Color adjustment, such as gamma adjust, white point adjust, exposure
KCICategoryColorEffect - Color effect, such as hue adjust, posterize
KCICategoryTransition - Transitions between images, such as dissolve, disintegrate with mask, swipe
KCICategoryTileEffect - Tile effect, such as parallelogram, triangle, op
KCICategoryGenerator - Image generator, such as stripes, constant color, checkerboard
KCICategoryGradient - Gradient, such as axial, radial, Gaussian
KCICategoryStylize - Stylize, such as pixellate, crystallize
KCICategorySharpen - Sharpen, luminance
KCICategoryBlur - Blur, such as Gaussian, zoom, motion
=end
filters = CIFilter.filterNamesInCategories([KCICategoryCompositeOperation])
filters.each do |filter_name|
puts filter_name
filter = CIFilter.filterWithName(filter_name)
attributes_hash = filter.attributes
attributes_hash.each_pair do |key, value|
if value.instance_of?(Hash)
puts "\t#{key} - {"
value.each_pair do |k,v|
puts "\t\t#{k} - #{v}"
end
puts "\t}"
elsif value.instance_of?(Array)
puts "\t#{key} - ["
value.each{|j| puts "\t\t#{j}"}
puts "\t]"
elsif value.instance_of?(NSURL)
puts "\t#{key} - #{value.absoluteString}"
else
puts "\t#{key} - #{value}"
end
end
puts ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment