Crystal 1.20 (17-Sep-03)

Name:     ArtWorks Crystal module
Purpose:  ArtWorks transparency module
Author:   Martin Wrthner
Requires: RISC OS 3.5 or higher, ArtWorks 2
Status:    2003 Martin Wrthner; all rights reserved; see [4] below
WWW:      http://www.mw-software.com/

The Crystal module allows you to make objects in ArtWorks transparent.

1) The Crystal module
---------------------
The Crystal module offers three types of transparency - Mix, Stained glass and
Bleach (see section 1.4 for the differences between these types). You can apply
a transparency type and a level between 0% (fully opaque) and 100% (fully
transparent) to any ArtWorks object, e.g., shapes, sprites, text lines, text
areas, blends, ...

Transparency means that the colour of an underlying object can partly be seen
through objects covering it. The transparency type and level you apply to an
object determines how the colours of underlying objects are combined with the
colour of this object.

Transparency can produce many intermediate colours, so it is a good idea to
switch to a true colour mode (32k or 16M colours) for viewing documents with
transparency. However, Crystal will also do its best to render transparency
in 256 colours or even less: In all screen modes with less than 16 million
colours, an advanced technique called error-diffused dithering is used to
simulate the full 16 million colour range using the available colours.

Rendering with transparency consumes quite a bit of extra memory, so it is a
good idea to have a couple of megabytes of RAM free when displaying documents
with transparency. However, Crystal copes well even with tight memory
conditions at the expense of slower rendering. Crystal returns memory it does
not need to the system - in order to avoid too much memory management overhead,
Crystal waits a few seconds before releasing unneeded memory.

1.1) Displaying transparency

With Crystal, there are two ways of displaying an ArtWorks document: Rendering
with transparency or normal rendering (without transparency). There is a choice
because rendering with transparency consumes more memory and is slightly slower
than normal rendering, so you might want to temporarily switch transparency off
to save memory or to work more quickly.

You can switch transparency on and off using the "Display" option button in the
Crystal Info Bar. The Crystal Info Bar is displayed while the Crystal tool is
selected in the Tool Box. The "Display" setting only affects the current
document, so you might  view one document with transparency while viewing
another document without transparency.

Depending on your preferences settings (see 1.6), the "Display" option can be
switched on automatically when you create a document, when you load a document
containing transparent objects, or when you first apply transparency to an
object.

1.2) Applying transparency

In order to apply transparency, select an object or several objects, then
select the Crystal tool in the Tool Box. The Crystal Info Bar allows you to
specify the transparency type and the transparency level (percentage) for the
selected object(s): You can choose the transparency type from the pop-up menu
next to the transparency type field (to the right of the word "transparency").

The differences between "Mix", "Stained glass" and "Bleach" transparency are
discussed in section 1.4.

You can apply a transparency level by either entering a value in the field
labelled "Percentage" or by dragging the horizontal slider next to the
percentage field. Please note that if you enter a value into the percentage
field or use the up/down arrow buttons to change it, you have to press Return
or click on the little OK button to apply the entered value.

If the option "Switch transparency on when applying transparency" is switched
on in the Crystal Choices window (see 1.6), then the "Display" option is
automatically switched on when you apply transparency to an object.

In order to removetransparency from the selected object(s), choose "None" from
the transparency type menu.

1.3) Group transparency

Group transparency is a very powerful feature that is not even offered by more
advanced programs like Xara X (the latest version of the Windows-only successor
to ArtWorks).

1.3.1) Groups

There are two ways in which Crystal can display group objects: Either, each
individual object in the group is displayed with its own transparency
properties (this is the default behaviour) or each object in the group is
displayed without transparency, but the whole group is then finally displayed
transparent on top of whatever was behind the group on the page. The second
alternative is called "group transparency".

You can switch between these two ways by selecting a group object and switching
the "Group" option in the Crystal Info Bar on and off.

Supposing you have a finished drawing you have created or a piece of clip art,
for example the famous ArtWorks apple. Such a drawing is usually made of many
objects that overlap and cover each other. Supposed, you wanted to make the
whole apple transparent. Then, simply selecting all the components of the
drawing and applying transparency to them would not achieve the desired effect
because this would make each individual component of the apple transparent, so
you could not only see the background through the apple but you could also see
parts of the apple through other parts that are supposed to cover them.

So, this a situation where you would group the objects that belong to the
drawing and switch on the "Group" option for this group. Then, the objects that
belong to the group are first allowed to cover each other in the usual way, but
the whole group is then made transparent to allow you the background to be seen
through it.

The example file "GroupTrans" shows the effect of group transparency.

Please note that the "Group" option only has an effect if you have actually
applied transparency to the group object itself, that is, after creating the
group. It is not enough to group some transparent objects, even if they have
the same transparency type and level.

1.3.2) Blends and Replicates

Blends and Replicates always have group transparency. The "Group" option has no
effect for those objects. Please note that this means that you cannot replicate
transparent objects and that you cannot blend between transparent objects
because transparency inside Blends and Replicates is ignored. However, nothing
stops you from then making the complete Blend or Replicate transparent by
applying transparency to it in the usual way.


1.4) Transparency types

The three transparency types "Mix", "Stained glass" and "Bleach" simulate
different models of transparency. Each of these types has its own typical
application area.

1.4.1) "Mix" transparency

The colour of a transparent object is blended with colours displayed underneath
according to the transparency percentage of the object (0% = opaque, i.e., not
transparent, 50% = average of the two colours, 100% = fully transparent, i.e.,
invisible). In mathematical terms, this is simply a weighted average of the two
colours where the percentage determines the weight of the top colour.

"Mix transparency" does not have any direct correspondence in the world of
physics but often yields good results because the brightness of the colours is
averaged as well. It also usually yields the result you tend to expect from
transparency.

1.4.2) "Stained glass" transparency

"Stained glass" transparency simulates light being filtered through stained
glass (subtractive colour mix). Glass filters some of the light, so the
resulting colour is always darker than either of the involved colours. If the
transparency percentage is 0%, then the colour components not present in the
transparent object are removed from the colour underneath completely (e.g., a
red object removes all but red light from below). Other percentage values cause
the colour underneath to be mixed with the resulting colour after filtering
(again, this is a weighted average as above).

"Stained glass" transparency is normally used to draw objects made of glass or
other transparent material. The results, though physically more accurate, often
look duller than those obtained using "Mix" transparency, so you might consider
trying "Mix" as well.

"Stained glass" transparency with a white object does not have any effect - it
corresponds to viewing the document through normal uncoloured window glass.

The lack of effect of stained glass transparency with white can be used for
interesting effects: If you have an object with a colour graduation towards
white and apply "Stained glass" transparency to it, then the result is
graduated transparency: The more the colour tends towards white, the more
transparent it becomes.

1.4.3) "Bleach" transparency

"Bleach" transparency simulates additive colour mixing, i.e., several slides
being projected onto a screen simultaneously. Several light sources contribute
to the result, so the resulting colour is always lighter than any of the
involved colours.

"Bleach" transparency is normally used to add spotlight effects to a scene.

"Bleach transparency" with a black object does not have any effect (corresponds
to "projecting" an additional image using a slide projector that is actually
switched off).

The lack of effect of bleaching with black can be used for interesting effects:
If you have an object with a colour graduation towards black and apply "Bleach"
transparency to it, then the result is graduated transparency: The more the
colour tends towards black, the more transparent it becomes. The brighter the
colour gets, the more opacity the object has. In contrast to Mix transparency,
"Bleach" transparency is often used with 0% transparency.


1.5) Printing

When you print an ArtWorks document, its "Display" setting is taken into
account, so if you display a document with transparency ("Display on"), it is
printed with transparency.

1.5.1) Non-PostScript printing

When printing to a non-PostScript printer (e.g., most inkjet and LaserJet
printers), you should not notice any difference between normal and transparent
printing, apart from the fact that transparent printing might take slightly
longer due to the extra processing involved. The amount of data that is sent to
the printer is roughly the same.

1.5.2) PostScript printing

When printing to a PostScript printer, you should bear in mind that PostScript
does not support transparency natively. So, in order to print transparency to
PostScript, Crystal actually prints a bitmap representation of the document.
This might take quite a bit longer than normal non-transparent printing due to
the large amount of data that has to be sent to the printer.

When printing to a PostScript printer, you have to specify the resolution that
is to be used (the default is 300dpi). See 1.6.2. for further details on how to
configure the resolution.

Due to the way the RISC OS PostScript printer driver works, printing as colour
PostScript usually yields better results than printing as monochrome PostScript
(you can switch on colour PostScript printing by selecting the Colour option in
the PostScript printer configuration window). Some printers or imagesetters
might actually refuse to render monochrome files because bitmaps are
represented in an unusualy way by the printer driver (to the technically
minded: greyscale bitmaps are printed as a separate imagemask for every colour
that is present in the bitmap). This is a limitation of the RISC OS PostScript
printer driver and not of Crystal. If you experience any problems printing to
monochrome PostScript printers, you might consider printing as colour
PostScript even though the target printer is monochrome.

1.5.3) Colour separation

Rendering and printing with transparency (i.e., with the "Display" option on)
is purely RGB based, so separations may look different from what you expect. In
particular, there is no overprinting (see page 12 of the Commercial Printing
Guide for details about overprinting) and CMYK colours are most likely to be
represented differently from what you expect. The reason is that Crystal
converts CMYK colours to RGB when rendering the document, so when finally
separating the resulting RGB representation of the document into CMYK, there is
the usual black-generation problem, i.e., it is not clear which value of K to
choose for each colour. Generally, the colour separated result is the same as
separating a full-colour RGB bitmap.


1.6) The Crystal Choices window

Crystal offers several configurable options that you can change in the Crystal
Choices window. To open this window, choose "Choices" from the ArtWorks icon
bar menu, then click on the "Crystal" panel.

1.6.1) Switching "Display" on automatically

The first group of options is labelled "Switch transparency on". This group
relates to the setting of Crystal's "Display" option.
- "When creating creating a new document": When switched on, the "Display"
  option is automatically switched on for every new document you create,
  otherwise new documents are created with "Display" off (which is the
  default).
- "When loading a document with transparency": When switched on, then Crystal
  checks each document for transparent objects as it is loaded. If it finds
  any, it switches the "Display" option on for this document, otherwise
  "Display" is always off for newly loaded documents.
- "When applying transparency": When switched on, Crystal switches the
  "Display" option on for a document as soon as you apply transparency to one
  of the objects in the document.

1.6.2) PostScript printing

When printing to PostScript, Crystal has to sendthe document in bitmap format
because PostScript does not understand transparency. In contrast to
non-PostScript printers that have a defined resolution, PostScript is
device-independent, so Crystal has no way of finding out the printer
resolution. Therefore, you can specify the resolution in the "Resolution"
field. For colour printing, the default value of 300dpi should usually be
enough, but you can enter higher values if necessary. Please note that the
PostScript file size increases roughly by a factor of 4 if you double the
resolution!

1.6.3) Render intermediate stages

When rendering a complex document, Crystal shows intermediate stages to give
you an idea of its progress.  Of course, displaying these intermediate stages
takes extra processing time, so the overall rendering is slower with frequent
intermediate updates (although it actually "appears" quicker because you can
see the rendering progress). The default value is 200 centiseconds, i.e., the
screen is updated roughly every 2 seconds, which is a good compromise between
allowing you to see progress and not using too much processing power for the
intermediate stages. If you want to speed up the overall rendering of complex
documents, you can increase the value (so updates are less frequent), e.g., to
500 to see updates only every 5 seconds. Alternatively, if you want to see more
frequent updates, then decrease the value - less than 50 (i.e., two times a
second) is not sensible because then most of the processing time is spent
rendering intermediate stages.

Please bear in mind that this setting is only relevant for complex documents
that take a long time to render. Simple documents usually render so quick that
there are no intermediate stages, and you see the final rendering result right
away.


1.7) Notes about rendering with transparency

Rendering with transparency is very different from the standard way ArtWorks
used to render documents: Instead of drawing one object at a time to the
screen, the document is rendered in stages, so you only see a change every
couple of seconds. The delay between intermediate stages can be configured (see
1.6). Due to this new way of rendering, it may first seem that rendering with
transparency is a lot slower than normal rendering, because for several
seconds, nothing seems to happen on screen. However, in reality, provided there
is enough free memory, rendering with transparency is only slightly slower than
without. Under some circumstances (e.g., under software emulation of a RISC OS
machine that needs to do extra work when video memory is being accessed) it can
even be faster than the standard non-transparent rendering.

Rendering with transparency uses a different way of dithering. Dithering is a
technique to simulate a larger number of colours that the current screen mode
provides. The method used is called error-diffused dithering. The patterns
produced by this method are less regular than those of ordered dithering, which
ArtWorks normally uses. Therefore, the display can seem a bit grainy in 256
colour modes. However, this method allows a larger range of colours to be
simulated with higher accuracy than the standard ordered dithering approach.

In 32.000 colour modes, the display with Crystal is much more accurate than
normally. You will notice this in particular if your document contains 16M
colour sprites. Usually, these are not rendered very well in 32.000 colour
screen modes. With Crystal, you will find it hard to actually notice a
difference between 32.000 and 16 million colour screen mode. Again, this is
because Crystal uses error-diffused dithering to display everything.

Finally, you may have noticed that ArtWorks normally redraws the selected
window (the one with the Tool Box) differently from unselected windows:
Unselected windows are redrawn in the background, so you do not have to wait
for them to be finished before you can work with other windows. Due to
technical reasons, this feature is no longer available for windows showing a
document with transparency switched on. Such windows are always fully redrawn
before control is returned to you. Windows for documents that are not displayed
with transparency are not affected.


1.8) Exporting bitmaps with transparency

The option "Bitmap..." in the "File => Export" menu allows you to export sprite
and GIF bitmap representations of ArtWorks documents. This functionality is
offered by the BMExport module. BMExport can take the transparency properties
of objects into account if desired. To this effect, the bitmap export dialogue
box has an option "Transparency (Crystal)" that can be switched on. You can
find further information in the BMExport !Help file, which you can open by
clicking on the little help icon in the bitmap export dialogue box.


1.9) Transparent ArtWorks documents in Impression, Ovation Pro, etc.

Dropping an ArtWorks file with transparency into Impression, Ovation Pro,
Composition or any other application that accepts ArtWorks files results in the
file being displayed as with the "Display" option off, i.e., the transparency
properties of objects are ignored. It is likely that an updated version of
AWRender (the piece of software that is use by third-party products to render
ArtWorks files) will be made available some time in the future.


1.10) Draw/EPS export

Transparency is ignored when exporting as Draw or EPS (any flavour) as these
formats do not support the concept of transparency. The only way to export
transparency to these formats would be to export a bitmap image, so you are
advised to simply use BMExport instead to export a bitmap in the first place.

Future versions of Crystal might be able to embed a bitmap representation of
the document in Draw/EPS files if there is demand for this feature. There might
also be support for transparencyin Illustrator EPS if I can get hold of the
appropriate technical specifications.


1.11) Limitations

- Rendering and printing with "Display" on (i.e., with transparency) is purely
  RGB based, so separations may look different from what you expect. See 1.5.3
  for further details.
- When ArtWorks crashes or is quit using Alt-Break (the so-called Wimp
  "watchdog"), then the Crystal dynamic area is not deleted and remains in the
  "Dynamic areas" section of the Task display. If ArtWorks is launched again, a
  new dynamic area with the same title is created, so the memory that was
  allocated to Crystal when ArtWorks crashed is lost until you reboot (unless
  you know how to kill the superfluous dynamic area, e.g., using the !KillDA
  utility). This limitation applies to most applications using dynamic areas.
- As indicated in 1.3.2, Blends and Replicates have group transparency, so
  there is no transparency inside Blends and Replicates, just the whole
  resulting Blend/Replicate objects can be made transparent.
- Transparency is currently not supported by AWRender - see 1.9 for details.
- Transparency is ignored when exporting as Draw or EPS - see 1.10 for details.
- While printing with "Display" switched on, the progress bar that shows the
  printing progress is not updated. This might be fixed in a later release.


2) History
----------
Version 1.20 (17-Sep-03)
- "Extra grids" are now displayed when transparency is on - they are always
  rendered on top of the illustration (earlier versions of Crystal caused the
  grid to disappear completely)

Version 1.18 (17-Jul-03)
- added help message for Crystal tool

Version 1.17 (14-Jul-03)
- the first layer was always printed, if if it was a background layer - this is
  fixed now

Version 1.16 (18-Jun-03)
- removed some remaining 26-bit instructions

Version 1.15 (17-May-03)
- fixed transparent printing with more than 64M of free memory available 
- dynamic area limit changed to 64M

Version 1.14 (07-May-03)
- the preferences box did not show the chosen options correctly

Version 1.13 (07-May-03)
- fixed problems with Extra grids being switched on during bitmap export (and
  possibly printing) with transparency

Version 1.12 (05-May-03)
- dynamic area size limited to 32MB to avoid problems with machines with lots
  of RAM
- 32-bit compatible version for ArtWorks 2

Version 1.09 (07-Jun-02)
- fixed rendering bug that could lead to screen corruption or a crash
  during rendering, bitmap export or printing under very rare
  circumstances
- speeded up bitmap export

Version 1.08 (13-May-02)
- added little OK button next to percentage field

Version 1.07 (02-Apr-02)
- first release version


3) Contacting me
----------------
Martin Wuerthner
Mannheimer Str. 18
67655 Kaiserslautern
Germany

Phone: +49-(0)631-3608205
Fax:   +49-(0)631-3608203

e-mail: martin@mw-software.com
WWW:    http://www.mw-software.com/


4) Copyright
------------
The ArtWorks Crystal module, related documentation and files are  Copyright
2003 by Martin Wrthner. All rights reserved. The software and documentation
may not, in  whole or part, be copied or transmitted by any means without the
explicit written consent of the copyright owner. Unless you have purchased a
site licence for this  software, it may be used on only one stand-alone
computer system at any time.

In order to use this software, you need a licence from the copyright owner. If
you do not have such a licence, you must delete this software, the Crystal
module and its related files, now.
