### Home Classes Methods

### In Files

- lib/RMagick.rb

### Parent

Object

### Methods

- ::new
- #fill

### Files

- MANIFEST
- Makefile

### Class/Module Index

Quicksearch

- Magick
- Magick::DestroyedImageError
- Magick::Draw
- Magick::Enum
- Magick::FatalImageMagickError
- Magick::Geometry
- Magick::GeometryValue
- Magick::GradientFill
- Magick::HatchFill
- Magick::IPTC
- Magick::IPTC::Application
- Magick::IPTC::Envelope
- Magick::IPTC::ObjectData
- Magick::IPTC::Post_ObjectData_Descriptor
- Magick::IPTC::Pre_ObjectData_Descriptor
- Magick::Image
- Magick::Image::DrawOptions
- Magick::Image::Info
- Magick::Image::PolaroidOptions
- Magick::Image::View
- Magick::Image::View::Pixels
- Magick::Image::View::Rows
- Magick::ImageList
- Magick::ImageList::Montage
- Magick::ImageMagickError
- Magick::OptionalMethodArguments
- Magick::Pixel
- Magick::RVG
- Magick::RVG::Circle
- Magick::RVG::ClipPath
- Magick::RVG::Describable
- Magick::RVG::Duplicatable
- Magick::RVG::Ellipse
- Magick::RVG::Embellishable
- Magick::RVG::Group
- Magick::RVG::Image
- Magick::RVG::ImageConstructors
- Magick::RVG::Line
- Magick::RVG::Path
- Magick::RVG::PathData
- Magick::RVG::Pattern
- Magick::RVG::PolyShape
- Magick::RVG::Polygon
- Magick::RVG::Polyline
- Magick::RVG::PreserveAspectRatio
- Magick::RVG::Rect
- Magick::RVG::ShapeConstructors
- Magick::RVG::Stretchable
- Magick::RVG::StructureConstructors
- Magick::RVG::Stylable
- Magick::RVG::Text
- Magick::RVG::TextBase
- Magick::RVG::TextConstructors
- Magick::RVG::Transformable
- Magick::RVG::Use
- Magick::RVG::UseConstructors
- Magick::RVG::Utility
- Magick::RVG::Utility::DefaultTextStrategy
- Magick::RVG::Utility::GraphicContext
- Magick::RVG::Utility::LRTextStrategy
- Magick::RVG::Utility::RLTextStrategy
- Magick::RVG::Utility::TBTextStrategy
- Magick::RVG::Utility::TextAttributes
- Magick::RVG::Utility::TextStrategy
- Magick::TextureFill
- Object

No matching classes.

# Magick::HatchFill

Example fill class. Fills the image with the specified background color, then crosshatches with the specified crosshatch color. @dist is the number of pixels between hatch lines. See Magick::Draw examples.

### Public Class Methods

new(bgcolor, hatchcolor="white", dist=10) click to toggle source

    # File lib/RMagick.rb, line 1942
    def initialize(bgcolor, hatchcolor="white", dist=10)
       @bgcolor = bgcolor
       @hatchpixel = Pixel.from_color(hatchcolor)
       @dist = dist
    end

### Public Instance Methods

fill(img) click to toggle source

    # File lib/RMagick.rb, line 1948
    def fill(img)                # required
       img.background_color = @bgcolor
       img.erase!                # sets image to background color
       pixels = Array.new([img.rows, img.columns].max, @hatchpixel)
       @dist.step((img.columns-1)/@dist*@dist, @dist) { |x|
          img.store_pixels(x,0,1,img.rows,pixels)
       }
       @dist.step((img.rows-1)/@dist*@dist, @dist) { |y|
          img.store_pixels(0,y,img.columns,1,pixels)
       }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.