Class: UIColor

Inherits:
Object show all
Defined in:
lib/project/ext/ui_color.rb

Instance Method Summary collapse

Instance Method Details

#with(options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/project/ext/ui_color.rb', line 3

def with(options)
  type = CGSize.type[/(f|d)/]
  r, g, b, a = Pointer.new(type), Pointer.new(type), Pointer.new(type), Pointer.new(type)
  self.getRed(r, green: g, blue: b, alpha: a)

  r = options[:r] || options[:red] || r.value
  g = options[:g] || options[:green] || g.value
  b = options[:b] || options[:blue] || b.value
  a = options[:a] || options[:alpha] || a.value

  UIColor.colorWithRed(r, green: g, blue: b, alpha: a)
end