A Guide to Transparency in Cadcorp SIS Introduction Cadcorp SIS enables graphical items to be displayed in such a way that other items can be seen when overlapped. This is generally referred to as 'transparency', but there are some inconsistencies in the use and meaning of the word. This guide explains the different types of 'transparency', and how you can achieve the effect you want on your maps. In an attempt to avoid further confusion, the following words are used in this guide to refer to the different effects: Transparent Completely 'see-through', like clear window glass Translucent 'See-through', but with a coloured tint, like stained glass Opaque 'Solid' colour, like paper www.dictionary.com defines translucent rather differently: Transparent Translucent Opaque Capable of transmitting light so that objects or images can be seen as if there were no intervening material Transmitting light but causing sufficient diffusion to prevent perception of distinct images Impenetrable by light; neither transparent nor translucent Additionally, Cadcorp SIS enables certain raster images to be 'faded' to reduce their visual impact on a map. Confusingly, this is also referred to in SIS as 'transparency'! SIS Items and Objects Affecting Transparency Area items have their interior filled with a brush. A Brush is either an explicitly named object stored in a Named Object Library (NOL), or is an 'implicit' brush where the exact definition of its appearance is held by the item or overlay to which it applies. There are also sub-classes of Area items which have different purposes, but which have a Brush property. Topological Polygons , Photos and raster images (bitmaps) have a Brush property, and the setting for this can affect the way other items are displayed when overlapped. Symbols are displayed by assigning a 'Shape' to a Point item. To achieve transparency in symbols you must set the transparency of the constituent graphics (vector or raster) before building them into a Shape object. You can vary the transparency of Overlays which display raster datasets, the results depending on the type and 'colour depth' of raster data being displayed, and the 'override' settings applied to the overlay. A guide to transparency in Cadcorp SIS 2 'Transparent' Brushes Most of the pre-defined Brushes supplied with Cadcorp SIS are set as 'transparent'. In the terminology of this guide they are in fact translucent, in that they have a defined colour in which they will appear on a white background, but they will not obscure the shape of underlying graphics. The colour will generally appear darker when the brush overlaps other graphics, just as a sheet of stained glass would appear darker. SIS endeavours to emulated the 'stained glass effect'. A sheet of green stained glass overlaid on a red background will appear black, as none of the red light can pass through the green glass. If the same green is overlaid on a yellow background it appears to make the yellow invisible. This is because yellow is made up from red and green light. The red component is completely filtered, and the green component is completely unobstructed. Thus all you can see is the green component. If real-world objects and real stained glass were sufficiently 'pure' colours you would see the same effect. Figure 1 shows translucent red, green and blue stripes over a series of different coloured squares. For this reason, the Edit Brush dialog has a tick box enabling you to review the way your brush will appear over red, green and blue stripes. If you un-tick the 'Transparent' box on the Edit Brush dialog you will create an opaque brush, which will obliterate underlying graphics. Levels When graphical items are stored on different overlays the graphics are 'painted' on the screen in the order the overlays appear in the overlay list. The first overlay in the list is painted first, then the next overlay, etc. Individual items on a single overlay are normally painted in the order they were edited, with the most recently edited item at the 'back of the pile', i.e. painted first. You can affect the order in which items in a single overlay are painted by assigning a value to their Level property. Items are normally created on level 0, but any value up to 255 can be set. A guide to transparency in Cadcorp SIS 3 Changing the level of a graphical item is analogous to the 'send to back / bring to front' facility found in some desktop publishing programs. In a map with multiple overlays, items are painted in the order of their level (0-255) then the next overlay is painted. It is not possible to 'interlace' items which reside on separate overlays. You will see from the above that different combinations of translucent and opaque brushes, with different levels and on different overlays can significantly affect the appearance of your map image. Hollow Brushes The Edit Brush dialog lets you set the 'Fill Style' to Solid, Hollow, Hatch or Pattern. A 'solid' style is a continuous, even colour, and should not be confused with 'opaque', which is the result of un-ticking the 'Transparent' box as described above. A 'hollow' style causes the brush to ignore the colour setting, so a 'hollow red' brush is identical to a 'hollow blue' brush. An area drawn with a hollow brush will appear as a simple outline with no colour fill. An area with a hollow brush can still be selected by clicking anywhere within its boundary. This is not to be confused with the Alter>Unfill (V6.1) or Alter>Fill>Unfill Geometry (V6.2) command, which converts the selected area item to a closed line item, which only has a boundary and no interior. A 'hatched' style consists of hatching lines in the main colour, and a background colour as a continuous 'solid' tone. A 'pattern' style enables you to embed bitmaps or symbols into the brush, or line hatching at specified spacings. Solid, hatched or patterned styles can be translucent or opaque, as controlled by the 'Transparent' tick box. It is irrelevant if a hollow style is translucent or opaque. 'Transparent' Overlays The Overlays Dialog, Styles tab, gives you a slider bar to set a 'Transparency Override' for bitmap overlays. This affects overlays which reference a raster dataset (e.g. a TIFF file or an ECW file) and overlays containing individual raster items such as logos. If an individual raster item (perhaps added using Edit>Paste From…) has its 'Bitmap Transparency' set (more of which later) then the Overlay 'Transparency Override' does NOT override the item's settings! The 'Transparency Override' setting actually fades the image. This is marvellous for reducing the overall visual impact of a raster overlay, but is not quite the same as truly 'transparent'. To make a raster map transparent, so the map background does not interfere with underlying graphics, but still leaving the raster detail (roads, rivers, etc.) shown in full colour, you should set the Overlay Brush to 'Hollow' and tick the Override box. The white (RGB=255,255,255) pixels of the raster image become fully transparent. If you combine a hollow brush override with a faded 'transparency' setting, the raster image becomes translucent, although the white pixels in the image will also be apparent, albeit faded with the other colour pixels. A guide to transparency in Cadcorp SIS 4 Example Figure 2 below shows an overlay containing green, blue and red rectangles. The green rectangle's brush is not transparent, so it obscures part of the blue rectangle. The map window also contains a raster overlay which is currently set to invisible. Figure 2 If the raster overlay is made visible it will obliterate the rectangles, because it is painted on the screen after the rectangles overlay. (Figure 3.) Note that moving the Transparency slider fades the image but does not make it translucent so the rectangles are still obliterated. (Figure 4.) Figure 3 A guide to transparency in Cadcorp SIS Figure 4 To make the raster overlay truly transparent you should set its brush to Hollow and tick the Override box. Figure 5 below shows a translucent, faded image, while Figure 6 shows a translucent image with full strength colour. Figure 5 5 A guide to transparency in Cadcorp SIS 6 Figure 6 Of course, if you want the faded effect raster overlay but with full colour rectangles, simply move the rectangles overlay to draw over the raster. Note the appearance of transparent bushes over the raster. (Figure 7.) Figure 7 A guide to transparency in Cadcorp SIS 7 'Transparent' Raster Items A Cadcorp SIS Base Dataset (BDS) file, and an Internal Overlay, can hold many different items in the same dataset, including raster items such as BMP, JPEG, TIFF, GIF and even ECW images. GIF (CompuServe Graphics Interchange Format) files support transparency, in that a single colour value can be defined as the 'transparent' colour. When a GIF file is pasted into an overlay, this transparent colour is read into a special attribute, GBitmapTransparentColour$, as a space-separated string of RGB values, e.g. "255 255 255". Other formats can also utilise this attribute, but you will need to apply it manually, whereas SIS reads GIF transparency and assigns the attribute value automatically. Creating a SIS Shape from a Raster Image SIS Shapes are named objects stored in a Named Object Library (NOL). Shapes can consist of vector graphics drawn using Cadcorp SIS, or raster images such as GIF files, or a combination of both. Figure 8 shows an image of a UK road sign (motor vehicles prohibited). The image is black, red and white, but because the sign is circular the area outside of the circle has been coloured blue. Using image editing software such as Paint Shop Pro the blue 'background' colour can be defined as the 'transparent' colour and the image can be saved as a GIF file. Figure 8 To create a SIS Shape of this road sign start Cadcorp SIS Map Editor or Map Modeller. Start a new blank document and set its projection to 'Paper'. You will now need to decide how large you want the symbol to be when displayed on a map. This example suggest 12mm (1/2 inch) square. Create a 12mm square using the Construct>Geometry 2d>Rectangle command, then zoom to the full extent of this square. The 'map' view is now zoomed in to 12mm, so you can delete the square you have just drawn. Select the Edit>Paste From… command and browse to the location of the GIF file on your PC. Select the file and click OK. You will see the image fill the current map view and, provided the image is in GIF format with transparency set to the blue background, you will see the circular road sign without any blue in the image. Display the item's properties and you will see an attribute, GBitmapTransparentColour$ has been added, with its value set to "0 0 255". This is the red/green/blue value of the pixels that you want to be transparent. All that remains is to change the item's pen to 'Blank' and its brush to 'Hollow', then store it as a Shape in a NOL using Construct>Shape (V6.1) or Construct>Miscellaneous>Shape (V6.2). 8 A guide to transparency in Cadcorp SIS Figure 9 shows this Shape used as a symbol on a map: If your symbol images are not in GIF format and you do not have access to image editing software, you can still create SIS Shapes with a transparent pixel colour. The same image as a Windows Bitmap (BMP) would appear with the blue background, as BMP format does not hold transparency information. After pasting the image into your 'Paper' map but before storing the item as a Shape, right-click on the image and choose Properties… from the pop-up menu. 46 40 50 60 M 132.87m T CB HILLWORTHROAD LB 4 5 1 TH EM OO RL A ND S 1 On the Attributes tab of the Properties dialog, click Add… and create GBitmapTransparentColour as a new string attribute. Set its value to the RGB of the pixel colour to become transparent: 11 1 5 Figure 9 Figure 10 Blue has been used as the background colour in this example because the image contains white pixels which are essential to the image. Frequently the background colour will be white, in which case you would set the transparent colour to "255 255 255". Figure 10 9 A guide to transparency in Cadcorp SIS Creating a Watermark on a Print Template Frequently when you print maps using the Cadcorp SIS Print Wizard you will want to apply a watermark over the map area to discourage unauthorised distribution. Typically a watermark will require a transparent background, and the image itself should be faded to avoid obscuring the detail of the map itself. Figure 11 shows the Cadcorp 'globe' logo. In this case the background has been left as white. Using the same technique as described above for creating transparent Shapes, you can paste the logo onto a Print Template, settings its pen and brush to Blank and hollow respectively. Figure 11 All that remains is to fade the image. You can do this by selecting the image and right-clicking on it to select the Set Transparency… option, Figure 12. This enables you to set a value between 0 (no fade) and 255 (total fade). You will notice that after setting the 'transparency' (actually fade) then the Properties tab of the Workspace Window shows this 'Bitmap Transparency' as a slider bar with which you can fine tune the degree of fade, Figure 13. Figure 12 Figure 13