ShadingAttributes Object

A ShadingAttributes object describes the way a region is filled or shaded, eg: with a background color or pattern.

ShadingAttributes Type Commands

ShadingAttributes.newInvisible v2.0.7

Returns invisible shading attributes that draw nothing on screen.

ShadingAttributes.newWithSolidColor color v2.0.7

Returns attributes that draw as a solid filled color.

ShadingAttributes.newWithBlendColors foreground, background, [ratio] v2.0.7

Returns attributes that draw as a solid filled color, but derived by blending the given foreground and background colors. For more on the blend ratio value, see the blendRatio property; if unspecified, the default value is 0.5 (even blending of the colors).

ShadingAttributes.newWithGradientColors start, end, [rotation] v2.0.7

Returns attributes that draw as a linear gradient going from the given start color to the end color. For more on the rotation value, see the rotation property; the default is 0° (no rotation).

ShadingAttributes.newWithImage image v2.0.7

Returns attributes that draw the given Image object as a background.

ShadingAttributes.newWithPatternType patternName v2.0.7

Returns attributes that draw using a particular pattern of the foreground and background colors:

Pattern Name

Pattern Preview

"None"


"Blend"


"RightDiagonal"


"RightDiagonalDark"


"LeftDiagonal"


"LeftDiagonalDark"


"Horizontal"


"HorizontalDark"


"Vertical"


"VerticalDark"


"Grid"


"GridDark"


"Trellis"


"TrellisDark"


ShadingAttributes Object Properties

.patternType v2.0.7

Returns the name of the pattern used to draw the shading, which can be one of those listed in ShadingAttributes.newWithPatternType, or the special values "image" or "gradient". Solid fills have a type of "blend" where the blend ratio is 1 (foreground only).

If you set this property, other properties are preserved if possible (eg: foreground color).

.isVisible v2.0.7

Returns @true if the shader draws any visible markings on screen at all. Read-only.

.opacity v2.0.7

Returns a number describing how opaque the shading is. This number ranges from 0.0 for completely transparent, to 1.0 for completely opaque.

.foregroundColor v2.0.7

The Color object used for the foreground. The returned object follows value semantics, ie: changes to the returned color object will not automatically update the shading attributes.

.backgroundColor v2.0.7

The Color object used for the background. The returned object follows value semantics, ie: changes to the returned color object will not automatically update the shading attributes.

.blendRatio v2.0.7

The ratio is a value from 1.0 to 0.0 (inclusive) that specifies how the foreground and background colors should be combined. The value gives the weight of the foreground color: a ratio of 1.0 means to draw just the foreground color, while a ratio of 0.5 means to give the colors equal weight.

If the shading has no concept of blending (eg: an image), this property always returns 1.0, and setting the property has no effect.

.rotation v2.0.7

The rotation is an angle (in degrees) which the gradient should be rotated from the horizontal axis. The default is 0°, which means the start color is on the left, and the end color is on the right, producing a gradient which looks like vertical lines.

Warning: rotations that are not exactly horizontal/vertical may not persist when a file is reopened.

This property only applies to gradient shading. Other kinds of shading always return 0, and setting the property has no effect.

.image v2.0.7

Returns an Image object that is used to fill the shading, or the @undefined value if none.


Previous Chapter
TableCell Object
<<  index  >>
 
Next Chapter
LineAttributes Object