class Origami::Template::AxialGradient

Constants

C1
ColorSpace
Coords
Domain
Extend
Function
N

Public Class Methods

new(from, to, color0, color1, coeff = 1) click to toggle source
Calls superclass method Origami::Dictionary::new
# File lib/origami/template/patterns.rb, line 26
def initialize(from, to, color0, color1, coeff = 1)
    super()

    set_indirect(true)

    x, y  = from
    tx, ty = to

    c0 = Graphics::Color.to_a(color0)
    c1 = Graphics::Color.to_a(color1)

    space =
    case c0.size
    when 1 then Graphics::Color::Space::DEVICE_GRAY
    when 3 then Graphics::Color::Space::DEVICE_RGB
    when 4 then Graphics::Color::Space::DEVICE_CMYK
    end

    f = Function::Exponential.new
    f.Domain = [ 0.0, 1.0 ]
    f.N = coeff
    f.C0, f.C1 = c0, c1

    self.ColorSpace = space
    self.Coords = [ x, y, tx, ty ]
    self.Function = f
    self.Extend = [ true, true ]
end