In Files

Parent

Methods

Class Index [+]

Quicksearch

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
1942:    def initialize(bgcolor, hatchcolor="white", dist=10)
1943:       @bgcolor = bgcolor
1944:       @hatchpixel = Pixel.from_color(hatchcolor)
1945:       @dist = dist
1946:    end

Public Instance Methods

fill(img) click to toggle source
      # File lib/RMagick.rb, line 1948
1948:    def fill(img)                # required
1949:       img.background_color = @bgcolor
1950:       img.erase!                # sets image to background color
1951:       pixels = Array.new([img.rows, img.columns].max, @hatchpixel)
1952:       @dist.step((img.columns-1)/@dist*@dist, @dist) { |x|
1953:          img.store_pixels(x,0,1,img.rows,pixels)
1954:       }
1955:       @dist.step((img.rows-1)/@dist*@dist, @dist) { |y|
1956:          img.store_pixels(0,y,img.columns,1,pixels)
1957:       }
1958:    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.