### Home Classes Methods

### In Files

- lib/prawn/graphics/gradient.rb

### Methods

- #fill_gradient
- #stroke_gradient

### Files

- COPYING
- GPLv2
- GPLv3
- LICENSE

### Class/Module Index

Quicksearch

- Prawn
- Prawn::Core
- Prawn::Core::Page
- Prawn::Core::Page::GraphicsState
- Prawn::Core::Reference
- Prawn::Document
- Prawn::Document::BoundingBox
- Prawn::Document::ColumnBox
- Prawn::Document::GraphicsState
- Prawn::Document::Grid
- Prawn::Document::Internals
- Prawn::Document::PageGeometry
- Prawn::Document::Security
- Prawn::Document::Snapshot
- Prawn::Encoding
- Prawn::Errors
- Prawn::Font
- Prawn::Font::AFM
- Prawn::Font::DFont
- Prawn::Font::TTF
- Prawn::GraphicState
- Prawn::GraphicStateStack
- Prawn::Graphics
- Prawn::Graphics::CapStyle
- Prawn::Graphics::Color
- Prawn::Graphics::Dash
- Prawn::Graphics::Gradient
- Prawn::Graphics::JoinStyle
- Prawn::Graphics::Transformation
- Prawn::Graphics::Transparency
- Prawn::Images
- Prawn::Images::JPG
- Prawn::Images::PNG
- Prawn::Layout
- Prawn::Measurements
- Prawn::Outline
- Prawn::Stamp
- Prawn::Table
- Prawn::Table::Cell
- Prawn::Table::Cell::InTable
- Prawn::Table::Cell::Subtable
- Prawn::Table::Cell::Text
- Prawn::Table::Cells
- Prawn::Text
- Prawn::Text::Box
- Prawn::Text::Formatted
- Prawn::Text::Formatted::Box
- Prawn::Text::Formatted::Fragment
- Prawn::Text::Formatted::Parser
- Arcfour
- Numeric

No matching classes.

# 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.