Prawn::Graphics::Gradient

Public Instance Methods

fill_gradient(point, width, height, color1, color2, options = {}) click to toggle source

Sets the fill gradient from color1 to color2.

It accepts CMYK and RGB colors, like fill_color. Both colors must be of the same type.

point, width and height define a bounding box in which the gradient will be rendered. For example, if you want to have page full of text with gradually changing color:

pdf.fill_gradient [0, pdf.bounds.height], pdf.bounds.width,
  pdf.bounds.height, 'FF0000', '0000FF'
pdf.text 'lots of text'*1000

:stroke_bounds - draw gradient bounds

# File lib/prawn/graphics/gradient.rb, line 25
def fill_gradient(point, width, height, color1, color2, options = {})
  set_gradient(:fill, point, width, height, color1, color2, options)
end
stroke_gradient(point, width, height, color1, color2, options = {}) click to toggle source

Sets the stroke gradient from color1 to color2.

See fill_gradient for details.

# File lib/prawn/graphics/gradient.rb, line 32
def stroke_gradient(point, width, height, color1, color2, options = {})
  set_gradient(:stroke, point, width, height, color1, color2, options)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.