![]() |
![]() |
One of the cleverest graphical features that DesktopX has is it's ability to vary the transparency of objects. This is in fact very easy to achieve. The 2 types of graphics files which can be used in DesktopX (BMP and PNG), can both be used to generate transparency. PNG
Transparency BMP
Transparency |
|
![]() |
Normal bitmap files do not store transparency information, so when you place place the object on screen the entire square bitmap is shown | ![]() |
![]() |
Despite
this, DesktopX is able to use BMP files because it considers anything that
is a 'magic pink' colour to be transparent. This pink colour is very rarely
used in images, and therefore is is safe to use. When you create objects
colour any areas you want to be transparent this shade of pink (R:255, G:0, B:255). When you do this be careful to make sure you don't use any fill or brush with anti-aliased edges. This can cause a fuzzy pink edge to objects, because the colour is not 'pure'. |
![]() |
|
OK, so now you know how to create objects which have transparent sections, but DesktopX does not stop there. Even the visible sections of the object can be made semi-transparent. If you want a solid object as per the above, you set the transparency to 'None'. Alternatively, you can have a uniform transparency of a specified percentage. The image on the right is precisely the same as the one above, using the same source image. The only difference is that this image is set to a uniform alpha-blend of 50%, so the background is partially visible through the object. One useful trick you can achieve with this if that you can create an object with 0% alpha-blend and it will be totally invisible. This means the area will function like a hotspot, because you can still attach an action to the object but it will look like it is occuring by clicking on the image behind. A variation of the above allows you to specify different levels of transparency for each frame of an animated object. You specify a transparency level for the first frame and a level for the last frame, and DesktopX works out the transparency level for each frame in between. |
![]() |
![]() |
OK, that's pretty cool but DesktopX can go even further to replicating the abilities of PNG files. Per-pixel alpha blending, means that each pixel that makes up the image can have a different level of transparency. This is done by creating a graphic split in two. The top half contains the image and the bottom half contains the transparency information. Note that you don't need to use magenta to achieve transparency, any background will do. If you study the image on the left you'll note that the bottom half is all greyscale (black and white). The blacker it is the more transparent it is. Pure black means you will only see background, pure white means you will only see the object. You can see that the object on the right uses this ability subtly to create a drop shadow effect. |
![]() |
If you select per-pixel alpha blending you have one final option which is to use the operation use to perform this alpha-blending. This is the mathematical operation by which the object and background are combined, and results in different effects. Experiment to see which creates the best effect for you.