Sha256: 61c50f09a189c521cebc02106c5671afe29ff2cfcf399a07c121d013511fd8bd
Contents?: true
Size: 620 Bytes
Versions: 2
Compression:
Stored size: 620 Bytes
Contents
module Motion ; module Xray class XrayGradientView < UIView attr_accessor :start_color attr_accessor :final_color def drawRect(rect) context = UIGraphicsGetCurrentContext() color_space = CGColorSpaceCreateDeviceRGB() cgcolors = [ (start_color || :white).uicolor.CGColor, (final_color || :light_gray).uicolor.CGColor, ] points = [0, 1] gradient = CGGradientCreateWithColors(color_space, cgcolors, points.to_pointer(:float)) CGContextDrawLinearGradient(context, gradient, self.bounds.top_left, self.bounds.bottom_left, 0) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
motion-xray-1.0.8 | lib/motion-xray/views/xray_gradient_view.rb |
motion-xray-1.0.7 | lib/motion-xray/views/xray_gradient_view.rb |