FillPattern (class)
public abstract FillPattern
Import from: CURL.GUI.STANDARD. Defined in package CURL.GRAPHICS._2D.RENDERER2D.
Direct Known Subclasses: PixmapBasedFillPattern, NotifyingFillPattern

Abstract superclass for all patterns that serve as application-level textures.

Description

FillPattern and its subclasses represent textures that high-level, application code uses to draw regions. For example, various graphical options that specify the texture characteristics of graphical options are of the type FillPattern.

Although this class and its subclasses represent textures, they do not lie in the Texture class hierarchy. The Texture class and its subclasses represent low-level textures. These classes are not usually used by application code but are used at the machine level. The main subclass of Texture is Color, which represents a solid-colored texture.

When working with FillPatterns, you can use the API of a Pixmap, a Texture (such as Color), a Drawable, or a Renderer2d. The FillPattern class lets you use these interfaces by either performing automatic casting or by providing a FillPattern.to-* conversion method.

For example, to create/specify a FillPattern that has a uniform texture (solid color), you can provide a supported String, which identifies a supported color or you call the Color.from-rgb procedure, which creates a Color object. In both cases, casting is automatically performed. Refer to FillPattern.default#factory for information on what object types are supported for casting.

Note that although Textures are immutable (not able to be modified) FillPatterns may, in some cases, be mutable. If the writable? getter is true, then the mutate-fill-pattern form can be used to modify the FillPattern's underlying image.

In general FillPatterns created from Pixmaps are mutable, whereas FillPatterns created from Colors are not.

When a FillPattern is modified, Textures previously acquired using the FillPattern.to-Texture method will not change, although subsequent calls to FillPattern.to-Texture will return a Texture that represents the new image.

However, this is not true for FillPatterns made from Pixmaps or Drawables; any change to the Pixmap or Drawable made after the FillPattern is created will alter the FillPattern. In particular, if a Drawable is destroyed, any FillPatterns made from that Drawable will become invalid.

Note that mutating the FillPattern (using mutate-fill-pattern) with a Pixmap as the mutation medium will cause a Drawable-based FillPattern to take a snapshot of the Drawable; the Drawable will not be modified by the mutation, and any subsequent modifications to the Drawable will not affect the FillPattern.

Example

The following example creates a Fill (graphical) object and sets its background property to a String. Since background is a FillPattern, and "red" translates to one of the supported colors, Curl silently converts it to a FillPattern object.


Example
{Fill width=1in, height=1in, background="red"}

Constructors
clone-from:Constructs a copy of the given FillPattern.
constructor protected {FillPattern.clone-from other:FillPattern}
default:Used internally.
constructor protected {FillPattern.default}
default:Constructs a FillPattern.
factory public {FillPattern.default source:Object}:FillPattern
from-color:Constructs a FillPattern from a Color.
factory public implicit {FillPattern.from-color color:Color}:FillPattern
from-drawable:Constructs a FillPattern from a Drawable.
factory public implicit inline {FillPattern.from-drawable
    drawable:Drawable
}:FillPattern
from-pixmap:Constructs a FillPattern from a Pixmap.
factory public implicit inline {FillPattern.from-pixmap
    pixmap:Pixmap
}:FillPattern
from-rgb:Constructs a FillPattern from rgb values between 0 and 1
factory public inline {FillPattern.from-rgb
    red:Fraction,
    green:Fraction,
    blue:Fraction,
    opacity:Fraction = 1.0
}:FillPattern
from-string:Constructs a FillPattern from a StringInterface.
factory public implicit {FillPattern.from-string
    string:StringInterface
}:FillPattern
from-texture:Constructs a FillPattern from a Texture.
factory public implicit inline {FillPattern.from-texture
    texture:Texture
}:FillPattern
from-url:Constructs a FillPattern from a Url.
factory public implicit {FillPattern.from-url url:Url}:FillPattern
Properties
ignore-alpha?:Indicates if the alpha channel (semi-transparency) should be ignored while rendering.
accessor public FillPattern.ignore-alpha?:bool
readable?:Returns true if this FillPattern is readable
accessor public abstract FillPattern.readable?:bool
uniform?:Indicates whether the FillPattern has a solid color.
accessor public abstract FillPattern.uniform?:bool
writable?:Returns true if this FillPattern is writable
accessor public abstract FillPattern.writable?:bool
Class Variables and Constants
aqua:A FillPattern that represents the color aqua (aqua).
public constant FillPattern.aqua:FillPattern ={FillPattern.from-color {Palette.get-aqua}}
beige:A FillPattern that represents the color beige (beige).
public constant FillPattern.beige:FillPattern ={FillPattern.from-color {Palette.get-beige}}
black:A FillPattern that represents the color black (black).
public constant FillPattern.black:FillPattern ={FillPattern.from-color {Palette.get-black}}
blue:A FillPattern that represents the color blue (blue).
public constant FillPattern.blue:FillPattern ={FillPattern.from-color {Palette.get-blue}}
brown:A FillPattern that represents the color brown (brown).
public constant FillPattern.brown:FillPattern ={FillPattern.from-color {Palette.get-brown}}
cyan:A FillPattern that represents the color cyan (cyan).
public constant FillPattern.cyan:FillPattern ={FillPattern.from-color {Palette.get-cyan}}
fuchsia:A FillPattern that represents the color fuchsia (fuchsia).
public constant FillPattern.fuchsia:FillPattern ={FillPattern.from-color {Palette.get-fuchsia}}
gray:A FillPattern that represents the color gray (gray).
public constant FillPattern.gray:FillPattern ={FillPattern.from-color {Palette.get-gray}}
green:A FillPattern that represents the color green (green).
public constant FillPattern.green:FillPattern ={FillPattern.from-color {Palette.get-green}}
lime:A FillPattern that represents the color lime (lime).
public constant FillPattern.lime:FillPattern ={FillPattern.from-color {Palette.get-lime}}
magenta:A FillPattern that represents the color magenta (magenta).
public constant FillPattern.magenta:FillPattern ={FillPattern.from-color {Palette.get-magenta}}
maroon:A FillPattern that represents the color maroon (maroon).
public constant FillPattern.maroon:FillPattern ={FillPattern.from-color {Palette.get-maroon}}
navy:A FillPattern that represents the color navy (navy).
public constant FillPattern.navy:FillPattern ={FillPattern.from-color {Palette.get-navy}}
olive:A FillPattern that represents the color olive (olive).
public constant FillPattern.olive:FillPattern ={FillPattern.from-color {Palette.get-olive}}
orange:A FillPattern that represents the color orange (orange).
public constant FillPattern.orange:FillPattern ={FillPattern.from-color {Palette.get-orange}}
pink:A FillPattern that represents the color pink (pink).
public constant FillPattern.pink:FillPattern ={FillPattern.from-color {Palette.get-pink}}
purple:A FillPattern that represents the color purple (purple).
public constant FillPattern.purple:FillPattern ={FillPattern.from-color {Palette.get-purple}}
red:A FillPattern that represents the color red (red).
public constant FillPattern.red:FillPattern ={FillPattern.from-color {Palette.get-red}}
silver:A FillPattern that represents the color silver (silver).
public constant FillPattern.silver:FillPattern ={FillPattern.from-color {Palette.get-silver}}
teal:A FillPattern that represents the color teal (teal).
public constant FillPattern.teal:FillPattern ={FillPattern.from-color {Palette.get-teal}}
transparent:A FillPattern that represents the color transparent (transparent).
public constant FillPattern.transparent:FillPattern ={FillPattern.from-color {Palette.get-transparent}}
violet:A FillPattern that represents the color violet (violet).
public constant FillPattern.violet:FillPattern ={FillPattern.from-color {Palette.get-violet}}
wheat:A FillPattern that represents the color wheat (wheat).
public constant FillPattern.wheat:FillPattern ={FillPattern.from-color {Palette.get-wheat}}
white:A FillPattern that represents the color white (white).
public constant FillPattern.white:FillPattern ={FillPattern.from-color {Palette.get-white}}
yellow:A FillPattern that represents the color yellow (yellow).
public constant FillPattern.yellow:FillPattern ={FillPattern.from-color {Palette.get-yellow}}
Class Procedures
get-aqua:Returns a FillPattern that represents the color aqua. This is the same color as cyan.
public {FillPattern.get-aqua}:FillPattern
get-beige:Returns a FillPattern that represents the color beige.
public {FillPattern.get-beige}:FillPattern
get-black:Returns a FillPattern that represents the color black.
public {FillPattern.get-black}:FillPattern
get-blue:Returns a FillPattern that represents the color blue.
public {FillPattern.get-blue}:FillPattern
get-brown:Returns a FillPattern that represents the color brown.
public {FillPattern.get-brown}:FillPattern
get-cyan:Returns a FillPattern that represents the color cyan. This is the same color as aqua.
public {FillPattern.get-cyan}:FillPattern
get-fuchsia:Returns a FillPattern that represents the color fuchsia. This is the same color as magenta.
public {FillPattern.get-fuchsia}:FillPattern
get-gray:Returns a FillPattern that represents the color gray.
public {FillPattern.get-gray}:FillPattern
get-green:Returns a FillPattern that represents the color green.
public {FillPattern.get-green}:FillPattern
get-lime:Returns a FillPattern that represents the color lime.
public {FillPattern.get-lime}:FillPattern
get-magenta:Returns a FillPattern that represents the color magenta. This is the same color as fuchsia.
public {FillPattern.get-magenta}:FillPattern
get-maroon:Returns a FillPattern that represents the color maroon.
public {FillPattern.get-maroon}:FillPattern
get-navy:Returns a FillPattern that represents the color navy.
public {FillPattern.get-navy}:FillPattern
get-olive:Returns a FillPattern that represents the color olive.
public {FillPattern.get-olive}:FillPattern
get-orange:Returns a FillPattern that represents the color orange.
public {FillPattern.get-orange}:FillPattern
get-pink:Returns a FillPattern that represents the color pink.
public {FillPattern.get-pink}:FillPattern
get-purple:Returns a FillPattern that represents the color purple.
public {FillPattern.get-purple}:FillPattern
get-red:Returns a FillPattern that represents the color red.
public {FillPattern.get-red}:FillPattern
get-silver:Returns a FillPattern that represents the color silver.
public {FillPattern.get-silver}:FillPattern
get-teal:Returns a FillPattern that represents the color teal.
public {FillPattern.get-teal}:FillPattern
get-transparent:Returns a FillPattern that is transparent.
public {FillPattern.get-transparent}:FillPattern
get-violet:Returns a FillPattern that represents the color violet.
public {FillPattern.get-violet}:FillPattern
get-wheat:Returns a FillPattern that represents the color wheat.
public {FillPattern.get-wheat}:FillPattern
get-white:Returns a FillPattern that represents the color white.

Example

This is a Fill with a white background FillPattern and a black border.
Example: White FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    border-color = {FillPattern.get-black},
    border-width = 2pt,
    background = {FillPattern.get-white}
}
public {FillPattern.get-white}:FillPattern
get-yellow:Returns a FillPattern that represents the color yellow.
public {FillPattern.get-yellow}:FillPattern
Methods
clone:Returns an identical copy of the fill-pattern
public abstract {FillPattern.clone}:FillPattern
paint:Paints this FillPattern onto the given Renderer2d in the specified bounds.
public abstract {FillPattern.paint
    r2d:Renderer2d,
    x:Distance,
    y:Distance,
    width:Distance,
    height:Distance,
    uv1:Fraction2d,
    uv2:Fraction2d
}:void
to-Pixel:Returns a Pixel that approximates the value of this FillPattern.
public abstract {FillPattern.to-Pixel
    hints:FillPatternHints = FillPatternHints.none
}:Pixel
to-Pixmap:Returns a Pixmap representing this FillPattern.
public abstract {FillPattern.to-Pixmap
    out:#Pixmap = null,
    hints:FillPatternHints = FillPatternHints.none
}:Pixmap
to-Texture:Returns a texture from this FillPattern.
public {FillPattern.to-Texture
    hints:FillPatternHints = FillPatternHints.none
}:Texture
to-uniform-FillPattern:Returns a uniform FillPattern that approximates the value of this FillPattern.
public sealed {FillPattern.to-uniform-FillPattern}:FillPattern
Methods inherited from Object: object-describe, object-describe-for-debugging, object-serialize

Constructor Details
clone-from (constructor)
protected {FillPattern.clone-from other:FillPattern}

Constructs a copy of the given FillPattern.

other: The FillPattern to clone.

Overriding

This is intended to be used by the FillPattern.clone method. See FillPattern.clone for more information.


default (constructor)
protected {FillPattern.default}

Used internally.

Description

See the default factory for the arguments for initializing a FillPattern.


default (factory)
public {FillPattern.default source:Object}:FillPattern

Constructs a FillPattern.

Description

You may explicitly create a FillPattern object by supplying as an argument one of the objects that can be converted to a FillPattern.

An easier way is to supply the object directly and avoid explicitly calling FillPattern. For example: let a:FillPattern = "red"
source: An object that can be converted to a FillPattern.

This factory can silently convert the following object types to a suitable FillPattern:

This factory is called when you supply an object of any of these data types where a FillPattern is needed.

Converting Strings

This factory can silently convert a supported string to a FillPattern by attempting various conversions. The following string values are valid:

Notes

In general, when you create a FillPattern from a mutable object (Pixmap or Drawable), any change to the source object affects the FillPattern. In particular, if a Drawable is destroyed, any FillPatterns made from that Drawable will become invalid.

Note that mutating the FillPattern (using mutate-fill-pattern) with a Pixmap as the mutation medium will cause a Drawable-based FillPattern to take a snapshot of the Drawable; the Drawable will not be modified by the mutation, and any subsequent modifications to the Drawable will not affect the FillPattern.

On the other hand, if a FillPattern is mutated using a Pixmap, then the source Pixmap (if any) and the returned Pixmaps of any previous calls to FillPattern.to-Pixmap will reflect the changes made during the mutation.

Example

The following example uses the url format.
Example: Creating a FillPattern from a Url
{value
    let t:FillPattern = {url "curl://install/docs/default/images/grass.jpg"}
    {Fill width=1in, height=1in, background=t}
}

Example

The following example creates a FillPattern from a Color.
Example: Creating a FillPattern from a Color
{import * from CURL.GRAPHICS.RENDERER3D} || for Color
{value
    || Initializing a FillPattern by calling a procedure that
    || returns a Color object, which can be automatically
    || converted to a FillPattern.
    let moss:FillPattern = {FillPattern {Color.from-rgb 0.3, 0.9, 0.2}}
    || The following is fine too
    || let moss:FillPattern = {Color.from-rgb 0.3, 0.9, 0.2}
    {Frame
        border-width=2pt,
        border-color=moss,
        margin=0.5cm,
        height=2cm,
        {text color=moss, MOSS MAN!}
    }
}


from-color (factory)
public implicit {FillPattern.from-color color:Color}:FillPattern

Constructs a FillPattern from a Color.



from-drawable (factory)
public implicit inline {FillPattern.from-drawable
    drawable:Drawable
}:FillPattern

Constructs a FillPattern from a Drawable.



from-pixmap (factory)
public implicit inline {FillPattern.from-pixmap
    pixmap:Pixmap
}:FillPattern

Constructs a FillPattern from a Pixmap.



from-rgb (factory)
public inline {FillPattern.from-rgb
    red:Fraction,
    green:Fraction,
    blue:Fraction,
    opacity:Fraction = 1.0
}:FillPattern

Constructs a FillPattern from rgb values between 0 and 1



from-string (factory)
public implicit {FillPattern.from-string
    string:StringInterface
}:FillPattern

Constructs a FillPattern from a StringInterface.



from-texture (factory)
public implicit inline {FillPattern.from-texture
    texture:Texture
}:FillPattern

Constructs a FillPattern from a Texture.



from-url (factory)
public implicit {FillPattern.from-url url:Url}:FillPattern

Constructs a FillPattern from a Url.



Property Details
ignore-alpha? (accessor)
accessor public FillPattern.ignore-alpha?:bool

Indicates if the alpha channel (semi-transparency) should be ignored while rendering.

Description

The default value is false, and the alpha channel should come under consideration.


readable? (accessor)
accessor public abstract FillPattern.readable?:bool

Returns true if this FillPattern is readable



uniform? (accessor)
accessor public abstract FillPattern.uniform?:bool

Indicates whether the FillPattern has a solid color.

Overriding

The default implementation returns true. Subclasses should override it such that it returns true if FillPattern.tget-square returns the same value for all arguments.


writable? (accessor)
accessor public abstract FillPattern.writable?:bool

Returns true if this FillPattern is writable



Class Variable and Constant Details
aqua (class constant)
public constant FillPattern.aqua:FillPattern ={FillPattern.from-color {Palette.get-aqua}}

A FillPattern that represents the color aqua (aqua).



beige (class constant)
public constant FillPattern.beige:FillPattern ={FillPattern.from-color {Palette.get-beige}}

A FillPattern that represents the color beige (beige).



black (class constant)
public constant FillPattern.black:FillPattern ={FillPattern.from-color {Palette.get-black}}

A FillPattern that represents the color black (black).



blue (class constant)
public constant FillPattern.blue:FillPattern ={FillPattern.from-color {Palette.get-blue}}

A FillPattern that represents the color blue (blue).



brown (class constant)
public constant FillPattern.brown:FillPattern ={FillPattern.from-color {Palette.get-brown}}

A FillPattern that represents the color brown (brown).



cyan (class constant)
public constant FillPattern.cyan:FillPattern ={FillPattern.from-color {Palette.get-cyan}}

A FillPattern that represents the color cyan (cyan).



fuchsia (class constant)
public constant FillPattern.fuchsia:FillPattern ={FillPattern.from-color {Palette.get-fuchsia}}

A FillPattern that represents the color fuchsia (fuchsia).



gray (class constant)
public constant FillPattern.gray:FillPattern ={FillPattern.from-color {Palette.get-gray}}

A FillPattern that represents the color gray (gray).



green (class constant)
public constant FillPattern.green:FillPattern ={FillPattern.from-color {Palette.get-green}}

A FillPattern that represents the color green (green).



lime (class constant)
public constant FillPattern.lime:FillPattern ={FillPattern.from-color {Palette.get-lime}}

A FillPattern that represents the color lime (lime).



magenta (class constant)
public constant FillPattern.magenta:FillPattern ={FillPattern.from-color {Palette.get-magenta}}

A FillPattern that represents the color magenta (magenta).



maroon (class constant)
public constant FillPattern.maroon:FillPattern ={FillPattern.from-color {Palette.get-maroon}}

A FillPattern that represents the color maroon (maroon).



navy (class constant)
public constant FillPattern.navy:FillPattern ={FillPattern.from-color {Palette.get-navy}}

A FillPattern that represents the color navy (navy).



olive (class constant)
public constant FillPattern.olive:FillPattern ={FillPattern.from-color {Palette.get-olive}}

A FillPattern that represents the color olive (olive).



orange (class constant)
public constant FillPattern.orange:FillPattern ={FillPattern.from-color {Palette.get-orange}}

A FillPattern that represents the color orange (orange).



pink (class constant)
public constant FillPattern.pink:FillPattern ={FillPattern.from-color {Palette.get-pink}}

A FillPattern that represents the color pink (pink).



purple (class constant)
public constant FillPattern.purple:FillPattern ={FillPattern.from-color {Palette.get-purple}}

A FillPattern that represents the color purple (purple).



red (class constant)
public constant FillPattern.red:FillPattern ={FillPattern.from-color {Palette.get-red}}

A FillPattern that represents the color red (red).



silver (class constant)
public constant FillPattern.silver:FillPattern ={FillPattern.from-color {Palette.get-silver}}

A FillPattern that represents the color silver (silver).



teal (class constant)
public constant FillPattern.teal:FillPattern ={FillPattern.from-color {Palette.get-teal}}

A FillPattern that represents the color teal (teal).



transparent (class constant)
public constant FillPattern.transparent:FillPattern ={FillPattern.from-color {Palette.get-transparent}}

A FillPattern that represents the color transparent (transparent).



violet (class constant)
public constant FillPattern.violet:FillPattern ={FillPattern.from-color {Palette.get-violet}}

A FillPattern that represents the color violet (violet).



wheat (class constant)
public constant FillPattern.wheat:FillPattern ={FillPattern.from-color {Palette.get-wheat}}

A FillPattern that represents the color wheat (wheat).



white (class constant)
public constant FillPattern.white:FillPattern ={FillPattern.from-color {Palette.get-white}}

A FillPattern that represents the color white (white).



yellow (class constant)
public constant FillPattern.yellow:FillPattern ={FillPattern.from-color {Palette.get-yellow}}

A FillPattern that represents the color yellow (yellow).



Class Procedure Details
get-aqua (class proc)
public {FillPattern.get-aqua}:FillPattern

Returns a FillPattern that represents the color aqua. This is the same color as cyan.

Example


Example: Aqua FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-aqua}
}


get-beige (class proc)
public {FillPattern.get-beige}:FillPattern

Returns a FillPattern that represents the color beige.

Example


Example: Beige FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-beige}
}


get-black (class proc)
public {FillPattern.get-black}:FillPattern

Returns a FillPattern that represents the color black.

Example


Example: Black FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-black}
}


get-blue (class proc)
public {FillPattern.get-blue}:FillPattern

Returns a FillPattern that represents the color blue.

Example


Example: Blue FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-blue}
}


get-brown (class proc)
public {FillPattern.get-brown}:FillPattern

Returns a FillPattern that represents the color brown.

Example


Example: Brown FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-brown}
}


get-cyan (class proc)
public {FillPattern.get-cyan}:FillPattern

Returns a FillPattern that represents the color cyan. This is the same color as aqua.

Example


Example: Cyan FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-cyan}
}


get-fuchsia (class proc)
public {FillPattern.get-fuchsia}:FillPattern

Returns a FillPattern that represents the color fuchsia. This is the same color as magenta.

Example


Example: Fuchsia FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-fuchsia}
}


get-gray (class proc)
public {FillPattern.get-gray}:FillPattern

Returns a FillPattern that represents the color gray.

Example


Example: Gray FillPattern
{Fill
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-gray}
}


get-green (class proc)
public {FillPattern.get-green}:FillPattern

Returns a FillPattern that represents the color green.

Example


Example: Green FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-green}
}


get-lime (class proc)
public {FillPattern.get-lime}:FillPattern

Returns a FillPattern that represents the color lime.

Example


Example: Lime FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-lime}
}


get-magenta (class proc)
public {FillPattern.get-magenta}:FillPattern

Returns a FillPattern that represents the color magenta. This is the same color as fuchsia.

Example


Example: Magenta FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-magenta}
}


get-maroon (class proc)
public {FillPattern.get-maroon}:FillPattern

Returns a FillPattern that represents the color maroon.

Example


Example: Maroon FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-maroon}
}


get-navy (class proc)
public {FillPattern.get-navy}:FillPattern

Returns a FillPattern that represents the color navy.

Example


Example: Navy FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-navy}
}


get-olive (class proc)
public {FillPattern.get-olive}:FillPattern

Returns a FillPattern that represents the color olive.

Example


Example: Olive FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-olive}
}


get-orange (class proc)
public {FillPattern.get-orange}:FillPattern

Returns a FillPattern that represents the color orange.

Example


Example: Orange FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-orange}
}


get-pink (class proc)
public {FillPattern.get-pink}:FillPattern

Returns a FillPattern that represents the color pink.

Example


Example: Pink FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-pink}
}


get-purple (class proc)
public {FillPattern.get-purple}:FillPattern

Returns a FillPattern that represents the color purple.

Example


Example: Purple FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-purple}
}


get-red (class proc)
public {FillPattern.get-red}:FillPattern

Returns a FillPattern that represents the color red.

Example


Example: Red FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-red}
}


get-silver (class proc)
public {FillPattern.get-silver}:FillPattern

Returns a FillPattern that represents the color silver.

Example


Example: Silver FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-silver}
}


get-teal (class proc)
public {FillPattern.get-teal}:FillPattern

Returns a FillPattern that represents the color teal.

Example


Example: Teal FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-teal}
}


get-transparent (class proc)
public {FillPattern.get-transparent}:FillPattern

Returns a FillPattern that is transparent.



get-violet (class proc)
public {FillPattern.get-violet}:FillPattern

Returns a FillPattern that represents the color violet.

Example


Example: Violet FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-violet}
}


get-wheat (class proc)
public {FillPattern.get-wheat}:FillPattern

Returns a FillPattern that represents the color wheat.

Example


Example: Wheat FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-wheat}
}


get-white (class proc)
public {FillPattern.get-white}:FillPattern

Returns a FillPattern that represents the color white.

Example

This is a Fill with a white background FillPattern and a black border.
Example: White FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    border-color = {FillPattern.get-black},
    border-width = 2pt,
    background = {FillPattern.get-white}
}



get-yellow (class proc)
public {FillPattern.get-yellow}:FillPattern

Returns a FillPattern that represents the color yellow.

Example


Example: Yellow FillPattern
{Fill 
    width = 1in, 
    height = 1in, 
    background = {FillPattern.get-yellow}
}


Method Details
clone (method)
public abstract {FillPattern.clone}:FillPattern

Returns an identical copy of the fill-pattern

Overriding

Each class which inherits from FillPattern should implement a clone-from constructor, which copies its fields and calls construct-super.clone-from.

clone should then be implemented as just constructing a new top-level object and calling its clone-from constructor, such as:
{define-class final Foo
{inherits FillPattern}

field my-field:int

{constructor {clone-from
other:Foo
}
{construct-super.clone-from other}
set self.my-field = other.my-field
}

{method {clone}:FillPattern {return {Foo.clone-from self}}}

...
}


paint (method)
public abstract {FillPattern.paint
    r2d:Renderer2d,
    x:Distance,
    y:Distance,
    width:Distance,
    height:Distance,
    uv1:Fraction2d,
    uv2:Fraction2d
}:void

Paints this FillPattern onto the given Renderer2d in the specified bounds.

r2d: The Renderer2d to paint onto.
x, y: The upper-left corner of the rectangle to be filled.
width, height: The width and height of the rectangle to be filled. width and height must be non-negative.
uv1: The texture coordinate at the upper-left corner of the rectangle.
uv2: The texture coordinate at the bottom-right corner of the rectangle.

Description

It is important that the FillPattern does not attempt to render (or cause anything to be rendered) using itself as a fill-pattern since this would cause an infinite loop.


to-Pixel (method)
public abstract {FillPattern.to-Pixel
    hints:FillPatternHints = FillPatternHints.none
}:Pixel

Returns a Pixel that approximates the value of this FillPattern.

Overriding

Override this method. The default method has no implementation.

Notes

The default implementation of FillPattern.uniform? calls to-Pixel.


to-Pixmap (method)
public abstract {FillPattern.to-Pixmap
    out:#Pixmap = null,
    hints:FillPatternHints = FillPatternHints.none
}:Pixmap

Returns a Pixmap representing this FillPattern.

Overriding

Override this method. The default method has no implementation.

You may mutate, free, etc. the resulting pixmap.
out: A Pixmap that can be used by the FillPattern for dumping its output.


to-Texture (method)
public {FillPattern.to-Texture
    hints:FillPatternHints = FillPatternHints.none
}:Texture

Returns a texture from this FillPattern.

Description

The default implementation calls to-Pixmap, which, in this class is not implemented. A Texture is created from the Pixmap and returned.

If you just implement to-Pixmap, then each time you make a to-Texture call, a new Pixmap object is first created, from which, the Texture is then created and returned.

This may not be most efficient way to return a Texture for your application. You may want to override this method directly for efficiency.


to-uniform-FillPattern (method)
public sealed {FillPattern.to-uniform-FillPattern}:FillPattern

Returns a uniform FillPattern that approximates the value of this FillPattern.

Description

The returned FillPattern should be identical to the FillPattern obtained by calling {FillPattern {Color.from-rgb r, g, b, opacity=opacity}}, where the components are of a Pixel obtained by calling {{self.to-Texture}.to-Pixel} on the original FillPattern.

Note that this may return a new FillPattern even if self.uniform? is true.