class UIColor
Public Instance Methods
alpha()
click to toggle source
# File lib/purplish-red/non-ui/ui_color.rb, line 39 def alpha if grayscale_colorspace? components[1] else components[3] end end
blue()
click to toggle source
# File lib/purplish-red/non-ui/ui_color.rb, line 34 def blue (components[2]*255).round end
color_with_alpha(a)
click to toggle source
# File lib/purplish-red/non-ui/ui_color.rb, line 53 def color_with_alpha(a) comps = components UIColor.alloc.initWithRed(comps[0], green:comps[1], blue:comps[2], alpha:a) end
components()
click to toggle source
# File lib/purplish-red/non-ui/ui_color.rb, line 7 def components if grayscale_colorspace? white = Pointer.new(:float) alpha = Pointer.new(:float) self.getWhite(white, alpha:alpha) [white[0], alpha[0]] else red = Pointer.new(:float) green = Pointer.new(:float) blue = Pointer.new(:float) alpha = Pointer.new(:float) self.getRed(red, green:green, blue:blue, alpha:alpha) [red[0], green[0], blue[0], alpha[0]] end end
grayscale_colorspace?()
click to toggle source
# File lib/purplish-red/non-ui/ui_color.rb, line 2 def grayscale_colorspace? CGColorGetNumberOfComponents(self.CGColor) == 2 end
green()
click to toggle source
# File lib/purplish-red/non-ui/ui_color.rb, line 29 def green (components[1]*255).round end
red()
click to toggle source
# File lib/purplish-red/non-ui/ui_color.rb, line 24 def red (components[0]*255).round end
white()
click to toggle source
# File lib/purplish-red/non-ui/ui_color.rb, line 48 def white components[0] end