<- Prev | Contents | Next -> |
Table Of Contents |
|
What is a Fill class?The Image#new and ImageList#new_image methods accept a fill object as an optional third argument. A fill object is an instance of a Fill class. Fill classes are designed to support custom background fills. Each Fill class defines only two methods, initialize and fill. The initialize method is called from the application to create an instance of the fill class. It accepts any arguments and does whatever is necessary to create the fill. The fill method is called from the initialize method of the new image object, after the image is completely initialized. The fill method gets the image as its only argument and sends whatever methods are necessary to the image to fill the image's background. RMagick supplies three Fill classes, HatchFill, GradientFill, and TextureFill. These classes are explained below. The HatchFill class is intended as an example of how to write a Fill class and is written in pure Ruby. You can read it in RMagick.rb. |
|
class HatchFill | |
class methods |
|
new | Magick::HatchFill.new(background_color, hatch_color='white', dist=10) -> aHatchFill |
Description |
Creates a cross-hatched fill. |
Arguments |
|
Returns | A new HatchFill object |
Example | ![]() |
class GradientFill | |
class methods |
|
new | Magick::GradientFill.new(x1, y1, x2, y2, start_color, end_color) -> aGradientFill |
Description |
Creates a gradient fill. The If x1 == x2 and y1 == y2, the gradient radiates from
the specified point, gradually transforming from
The line or point does not have to lie within the image bounds. |
Arguments |
|
Returns | A new GradientFill object |
Example | ![]() |
class TextureFill | |
class methods |
|
new | Magick::TextureFill.new(texture_image) -> aTextureFill |
Description |
Creates a texture fill. The texture is tiled to fill the image. |
Arguments | The texture to be used as the background. May be an
image or imagelist. If texture is an
imagelist, uses the current image. |
Returns | A new TextureFill object |
Example | ![]() |
<- Prev | Contents | Next -> |