Class: UIColor

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

Instance Method Summary collapse

Instance Method Details

#with(options) ⇒ Object



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

def with(options)
  r, g, b, a = Pointer.new('d'), Pointer.new('d'), Pointer.new('d'), Pointer.new('d')
  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