struct IntelQA::Carrier::GA

Defined in:

color_model/from_channels.cr
color_model/from_hex.cr
color_model/mixing.cr
color_model/named_colors.cr
color_model/to_relative.cr
color_models.cr

Constant Summary

BLACK = GA.from_hex("#000000")
DARKGRAY = GA.from_hex("#A9A9A9")
DARKGREY = GA.from_hex("#A9A9A9")
DIMGRAY = GA.from_hex("#696969")
DIMGREY = GA.from_hex("#696969")
GAINSBORO = GA.from_hex("#DCDCDC")
GRAY = GA.from_hex("#808080")
GREY = GA.from_hex("#808080")
LIGHTGRAY = GA.from_hex("#D3D3D3")
LIGHTGREY = GA.from_hex("#D3D3D3")
MAX = GA.new(["UInt16::MAX"])
MAX_INTENSITY = 13
MIN = GA.new
NULL = GA.new
RESOLUTION = 16
SILVER = GA.from_hex("#C0C0C0")
WHITE = GA.from_hex("#FFFFFF")
WHITESMOKE = GA.from_hex("#F5F5F5")

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(gray : UInt16, alpha : UInt16 = UInt16::MAX) #

[View source]
def self.new #

[View source]

Class Method Detail

def self.from_g_n(g, n) #

Create a RGBA struct from n-bit red, green and blue values


[View source]
def self.from_ga_n(g, a, n) #

Create a RGBA struct from n-bit red, green, blue and alpha values


[View source]
def self.from_hex(hex : String) #

Create a RGBA struct from a hex color string.

Formats:

  • "#rgb"
  • "#rrggbb"
  • "#argb"
  • "#aarrggbb"

[View source]
def self.from_relative(r, g, b, a) #

Create a RGBA struct from float values r, #g, b, #a ranging from 0.0 to 1.0.

{1.0, 0.0, 0.0, 0.5} would be the color red with an opacity of 50%.


[View source]

Instance Method Detail

def a : UInt16 #

[View source]
def alpha : UInt16 #

def g : UInt16 #

[View source]
def gray : UInt16 #

def mix(other, t) #

Linear interpolation (mixing) of two colors. t ranges from 0.0 to 1.0.

a.mix(b, 0.0) == a
a.mix(b, 1.0) == b

[View source]
def multiply(other : GA) : GA #

Mix two colors by multiplying their values


[View source]
def over(other : GA) : GA #

Mix two colors by using Alhpa Compositing


[View source]
def to_relative #

Create a tuple {r, g, b, a}, each ranging from 0.0 to 1.0 from this color.


[View source]