Class: Chroma::Converters::Base Abstract

Inherits:
Object
  • Object
show all
Includes:
Helpers::Bounders
Defined in:
lib/chroma/converters/base.rb

Overview

This class is abstract.

Base class for converting one color mode to another.

Direct Known Subclasses

HslConverter, HsvConverter, RgbConverter

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Bounders

#bound01, #bound_alpha, #clamp01, #to_percentage

Constructor Details

#initialize(input) ⇒ Base


10
11
12
# File 'lib/chroma/converters/base.rb', line 10

def initialize(input)
  @input = input
end

Class Method Details

.convert_hsl(hsl) ⇒ ColorModes::Rgb, ...


22
23
24
# File 'lib/chroma/converters/base.rb', line 22

def self.convert_hsl(hsl)
  new(hsl).convert_hsl
end

.convert_hsv(hsv) ⇒ ColorModes::Rgb, ...


28
29
30
# File 'lib/chroma/converters/base.rb', line 28

def self.convert_hsv(hsv)
  new(hsv).convert_hsv
end

.convert_rgb(rgb) ⇒ ColorModes::Rgb, ...


16
17
18
# File 'lib/chroma/converters/base.rb', line 16

def self.convert_rgb(rgb)
  new(rgb).convert_rgb
end