Sha256: 86ed01ff77aab4c81269151db7fc7081a1a70d294ea48f75a6d19951b5511547

Contents?: true

Size: 1.54 KB

Versions: 9

Compression:

Stored size: 1.54 KB

Contents

# Copyright (C) 2013  Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

module Clutter
  class Color
    class << self
      def new(*args)
        if [Symbol] == args.collect(&:class)
          name = args[0]
          get_static(name)
        else
          super
        end
      end

      def rgb(red, green, blue, alpha=255)
        rgba(red, green, blue, alpha)
      end

      def rgba(red, green, blue, alpha)
        new(red, green, blue, alpha)
      end

      def hls(hue, luminance, saturation, alpha=255)
        hlsa(hue, luminance, saturation, alpha)
      end

      def hlsa(hue, luminance, saturation, alpha)
        color = new
        color.from_hls(hue, luminance, saturation)
        color.alpha = alpha
        color
      end

      def pixel(pixel)
        color = new
        color.from_pixel(pixel)
        color
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
clutter-2.0.0-x86-mingw32 lib/clutter/color.rb
clutter-2.0.0 lib/clutter/color.rb
clutter-1.2.6 lib/clutter/color.rb
clutter-1.2.5 lib/clutter/color.rb
clutter-1.2.4 lib/clutter/color.rb
clutter-1.2.3 lib/clutter/color.rb
clutter-1.2.2 lib/clutter/color.rb
clutter-1.2.1 lib/clutter/color.rb
clutter-1.2.0 lib/clutter/color.rb