ChartDirector 6.0 (Perl Edition)

perlchartdir.glassEffect


Usage

glassEffect([ glareSize [, glareDirection [, raisedEffect ]]])

Description

A complex shading effect that emulates tinted glass or semi-transparent plastic material.

This effect involves glare and variation of lighting caused by reflection and refraction inside the material. It is best explained by viewing the examples.

ExampleDescription
Error Line ChartThe title is shaded using glass effect, with NormalGlare, lighting from Top, and raised effect of 5 pixels.
Donut ChartBoth the title and the sector labels are shaded using glass effect with ReducedGlare, lighting from Top, and raised effect of 5 pixels.
Glass Multi-Bar ChartThe bars are shaded using glass effect, with NormalGlare, lighting from Left, and raised effect of 5 pixels.

Currently, this effect only works well for long, thin objects, such as title bars, text boxes and bars in bar charts.

The glassEffect method returns an integer representing this effect. The integer can be used as the third argument to Box.setBackground to apply the effect to Box objects (including derived objects such as TextBox objects). It may also be used as the second argument to Layer.setBorderColor for BarLayer or BoxWhiskerLayer objects to apply the effect to bars or boxes.

Arguments

ArgumentDefaultDescription
glareSizeNormalGlareThe amount of glare. Must be one of the predefined constants NormalGlare, ReducedGlare or NoGlare. With NormalGlare and ReducedGlare, the glare will cover around 50% and 35% of the object. If NoGlare is used, there will be no glare and the effect will not look like glass at all, but is equivalent to the perlchartdir::softLighting effect.

Usually, NormalGlare is best for thin objects with lightly colored background, while ReducedGlare is best for dark background objects or not-so-thin objects (eg. text boxes using white text on a dark background, or with more than 1 line of text).
glareDirectionTopThe direction of the glare, which must be one of the predefined constants Top, Right, Bottom, Left.
raisedEffect5With glass shading effect, the object will appear to have some 3D depth. The raisedEffect argument controls the amount of 3D depth in pixels.

Return Value

An integer representing the glass effect.