Module: Prawn::Graphics::Patterns

Included in:
Prawn::Graphics
Defined in:
lib/prawn/graphics/patterns.rb

Instance Method Summary collapse

Instance Method Details

#fill_gradient(*args) ⇒ Object

Sets the fill gradient from color1 to color2. old arguments: point, width, height, color1, color2, options = {} new arguments: from, to, color1, color1

or  from, r1, to, r2, color1, color2


18
19
20
21
22
23
24
25
26
# File 'lib/prawn/graphics/patterns.rb', line 18

def fill_gradient(*args)
  if args[1].is_a?(Array) || args[2].is_a?(Array)
    set_gradient(:fill, *args)
  else
    warn "[DEPRECATION] 'fill_gradient(point, width, height,...)' is deprecated in favor of 'fill_gradient(from, to,...)'. " +
         "Old arguments will be removed in release 1.1"
    set_gradient :fill, args[0], [args[0].first, args[0].last - args[2]], args[3], args[4]
  end
end

#stroke_gradient(*args) ⇒ Object

Sets the stroke gradient from color1 to color2. old arguments: point, width, height, color1, color2, options = {} new arguments: from, to, color1, color2

or  from, r1, to, r2, color1, color2


32
33
34
35
36
37
38
39
40
# File 'lib/prawn/graphics/patterns.rb', line 32

def stroke_gradient(*args)
  if args[1].is_a?(Array) || args[2].is_a?(Array)
    set_gradient(:stroke, *args)
  else
    warn "[DEPRECATION] 'stroke_gradient(point, width, height,...)' is deprecated in favor of 'stroke_gradient(from, to,...)'. " +
         "Old arguments will be removed in release 1.1"
    set_gradient :stroke, args[0], [args[0].first, args[0].last - args[2]], args[3], args[4]
  end
end