class RMQColorFactory
Public Class Methods
build(params, dummy=nil)
click to toggle source
# File lib/project/ruby_motion_query/rmq_color.rb, line 95 def build(params, dummy=nil) # Dummy works around RM bug return RMQColor if params.empty? return from_rgba(*params) if params.count > 1 param = params.first return from_hex(params.join) if param.is_a?(String) #return from_base_color(param) if base_values(param) #return try_rgba(param) if rgba_values(param) #return try_hsva(param) if hsva_values(param) #return try_hex(param) if hex_values(param) end
from_hex(hex_string)
click to toggle source
# File lib/project/ruby_motion_query/rmq_color.rb, line 108 def from_hex(hex_string) if hex_string.length == 7 # this is #RRGGBB format - we need to add the alpha color_str = "#FF#{hex_string[1..hex_string.length]}" end RMQColor.parseColor(hex_string) end
from_rgba(r, g, b, a)
click to toggle source
# File lib/project/ruby_motion_query/rmq_color.rb, line 116 def from_rgba(r, g, b, a) android_a = a * 255 RMQColor.argb(android_a, r, g, b) end