Sha256: 9c1bb31389d5a49fd43c15105d32603ecb0e1e4aa14333c3e7ef5c475e5f9daf
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
class UIColor def colorWithBrightness(brightnessComponent) hue = Pointer.new(:float) saturation = Pointer.new(:float) brightness = Pointer.new(:float) red = Pointer.new(:float) green = Pointer.new(:float) blue = Pointer.new(:float) white = Pointer.new(:float) alpha = Pointer.new(:float) if getHue(hue, saturation: saturation, brightness: brightness, alpha: alpha) UIColor.colorWithHue(hue[0], saturation: saturation[0], brightness: brightness[0] * brightnessComponent, alpha: alpha[0]) elsif getRed(red, green: green, blue: blue, alpha: alpha) UIColor.colorWithRed(red[0] * brightnessComponent, green: green[0] * brightnessComponent, blue: blue[0] * brightnessComponent, alpha: alpha[0]) elsif getWhite(white, alpha: alpha) UIColor.colorWithWhite(white[0] * brightnessComponent, alpha: alpha[0]) end end def colorWithHueOffset(hueOffset) hue = Pointer.new(:float) saturation = Pointer.new(:float) brightness = Pointer.new(:float) alpha = Pointer.new(:float) if getHue(hue, saturation: saturation, brightness: brightness, alpha: alpha) newHue = (hue[0] + hueOffset) % 1 UIColor.colorWithHue(newHue, saturation: saturation[0], brightness: brightness[0], alpha: alpha[0]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubymotionr-0.0.1 | spec/multiple-rubymotion-apps/GestureTable/app/UIColor_extensions.rb |