Causeway->Home->SVG Fills & Filters->Surface fills

Surface fills


Home
  About us
  Contact info
  Vector graphics
  SVG Fills & Filters
    Barcharts
    Surface fills
    3D Pies and Lines
Products
  Price list
  CSharp translator
  Dyalog
  APL2000
Support
  CUSP
  CausewayPro
  RainPro
  Newleaf
  Helpstuf
  Leafhtm
Tutorials
Demos
  Climate Charts
  VML graphics
  SVG examples
Free Stuff
  CSS Editor
Publications
  Seminars
  Articles
Causeway Graphical Systems
Using Backlighting and Transparency with a Surface Fill

View this example as SVG (Adobe viewer or Firefox)

This is one of my favourite examples. It uses a radial fill on the background to give the effect of back-lighting, and both the title text and the distant surface are semi-transparent to emphasise the effect.

Transparency

This can be achieved directly in the heading, simply by defining a font such as:

ch.DefineFont'AX' 'Arial,opacity:0.7'

As you can see, this syntax can be used to pass any SVG style attributes directly into the finished page. The gradients are defined in the APL code by the lines:

 ch.DefineTile 17 '#radial1'
 ch.DefineTile 23 '#fill1'
 ch.DefineTile 24 'fill:url(#fill2); opacity:0.25' 

If you simply provide a URL, RainPro assumes you mean a gradient fill and wraps it for you in the correct tag. If you want a combination (in this case a gradient and transparency are combined) you have to give both attributes in full. Incidentally SVG is case-sensitive here, so be careful to use lower-case for the attribute names.

Defining the radial fill

This has a few more options to tweak, but the principle is much the same as the linear fills:

<defs> <desc>Assorted gradient fills</desc> <radialGradient id="radial1" gradientUnits="objectBoundingBox" fx="0.25" fy="0.25"> <stop offset="0%" style="stop-color:White"/> <stop offset="100%" style="stop-color:Navy"/> </radialGradient> </defs>

This time, is is convenient to use the filled rectangle itself as the co-ordinate system for the radial fill. The bright spot is 25% of the way down (and right) from the top left corner and the fill will scale to fit the shape of the rectangle. This one just runs from a white centre to a Navy background. Note that you can have as many colours in here as you like, for example:

View this example as SVG

... which is a visual nightmare, but does illustrate the possibilities rather well:

<radialGradient id="radial1" gradientUnits="objectBoundingBox" fx="0.25" fy="0.25"> <stop offset="5%" style="stop-color:White"/> <stop offset="40%" style="stop-color:Maroon"/> <stop offset="50%" style="stop-color:Yellow"/> <stop offset="60%" style="stop-color:Green"/> <stop offset="70%" style="stop-color:Navy"/> <stop offset="80%" style="stop-color:Magenta"/> <stop offset="100%" style="stop-color:Black"/> </radialGradient>

Summary

Used carefully, transparency is a very effective tool when drawing charts with large slabs of colour. It is also a nice trick to play with the title text when this is used on top of a radial-fill backdrop.


Back to TopOn to next section

Website maintained by adrian@causeway.co.uk
Telephone: +44 (0) 1439 788413