struct Color

Defined in:

color.cr

Constant Summary

BLACK = self.new(0.0)
COMPONENTS = [:r, :g, :b]
WHITE = self.new(1.0)

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(r, g, b) #

[View source]
def self.new(default = 0.0) #

[View source]

Class Method Detail

def self.b #

def self.from_hex(hex) #

[View source]
def self.from_rgba(rgba : StumpyPNG::RGBA) #

[View source]
def self.g #

def self.one #

def self.r #

Generate some utility constants like Vector3::Y => Vector3(0.0, 1.0, 0.0)


def self.zero #

Instance Method Detail

def *(other : self) #

[View source]
def *(other : Float64) #

def **(other : Float64) #

[View source]
def +(other : self) #

def -(other : self) #

def - #

def /(other : Float64) #

def b : Float64 #

def b=(b : Float64) #

def black? #

[View source]
def de_nan #

[View source]
def dot(other : self) #

def g : Float64 #

def g=(g : Float64) #

def inspect #

[View source]
def length #

def max_component #

[View source]
def min(other : Float64) #

[View source]
def mix(other : Color, t : Float64) #

[View source]
def normalize #

If the vector has just one component precalculating the inverse would not improve the performance

TODO validate if precalculating is faster for 2 components


def r : Float64 #

def r=(r : Float64) #

def squared_length #

def to_rgba(gamma_correction = 1.0) #

[View source]