ChartDirector Ver 5.0 (PHP Edition)

phpchartdir.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.

Example | Description
--- | ---
Error Line Chart | The title is shaded using glass effect, with NormalGlare, lighting from Top, and raised effect of 5 pixels.
Donut Chart | Both 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 Chart | The 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 objects to apply the effect to bars.

Arguments

Argument | Default | Description
--- | --- | ---
glareSize | NormalGlare | The 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 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).
glareDirection | Top | The direction of the glare, which must be one of the predefined constants Top, Right, Bottom, Left.
raisedEffect | 5 | With 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.

© 2009 Advanced Software Engineering Limited. All rights reserved.