Drop shadows are a perfect use for filters. The shadow automatically updates when the source object changes. Here is a step-by-step tutorial on creating a drop shadow:
Procedura 14.1. Drop Shadow
We will construct a compound filter that creates a drop shadow when applied to a text object.
Create a text object. In the example, I've used the text «Drop Shadow». Give the text a color. I've used dark red.
Add Gaussian Blur
Select the text. Use the Riempimento e Contorni dialog to add a Sfocatura Gaussiana by dragging the Blur slider to a non-zero value. Doing so automatically creates a Sfocatura Gaussiana filter and attaches it to the text.
The blurred text has the attributes of the original text, in this case, the dark red color. As the blurred text will become the shadow, we'll change the color to black in a moment.
We used the Riempimento e Contorni dialog to rapidly create a filter object for the text. Further work will need to be done with the Filtri dialog. Open the dialog. Select the new filter (with a name like «filter3362») by clicking on it. You should see something like:
Let's first give our filter a new name: «MyDropShadow». Clicking on the filter name when selected allows editing the name.
Our filter consists at the moment of a single Sfocatura Gaussiana, as shown under the Effect column. The line connecting a triangle to the right of «Gaussian Blur» label to a square dot in the Source Graphics column shows that the input for the Sfocatura Gaussiana filter is the original source object (in this case the text). The default height of the dialog is too short to show the complete column labels. The dialog can be stretched so that the labels are completely visible.
To get a black shadow, we'll use Source Alpha for the input to the Sfocatura Gaussiana primitive. To make the link, left-drag the mouse from the triangle next to the Gaussian Blur label to the Source Alpha column. The Filtri dialog should look like:
The amount of blurring can be changed by using the Standard Deviation sliders at the bottom of Filtri dialog (when the Sfocatura Gaussiana primitive is selected). There are two sliders: the top for x and the bottom for y. By default, the sliders are linked together so the blur is the same in both directions. Note that the blur amount (Standard Deviations) is defined in terms of pixels in this dialog while it is defined in terms of a percentage of 1/8 of the perimeter of the quadro delimitatore in the Riempimento e Contorni dialog.
The shadow should be shifted relative to the text. This can be achieved through the use of the Proiezione primitive. To add such the primitive, select it from the drop-down menu next to the Add Effect: button and then click on the button to make the addition. Note the bent line connecting the triangle to the right of the «Offset» entry under the Effect column to the «Gaussian Blur» entry above. This (the default) indicates that the Proiezione primitive is using the output of the Sfocatura Gaussiana primitive as its input. The amount of the offset can be changed by the Delta X and Delta Y sliders at the bottom of the Filtri dialog when the Offset label is highlighted. Set the offsets both to 3 (pixels). You should see the shadow text shift as the sliders are dragged.
Now that we have the shadow, we need to add back in the original text. This can be done with the Mischia primitive which merges graphics from multiple inputs. Select the Mischia primitive in the drop-down menu list of Filtro primitives. Click on the Add Effect: button to add the primitive.
When first created, there are no inputs defined. Left-dragging the mouse from the triangle at the right of the «Merge» label to the «Offset» label above, to create a link from the output of the Proiezione primitive to the input of the Mischia primitive.
When an input link to a Mischia primitive is made, a new, empty input node (triangle) is created. To add back in the original text, unmodified, left-drag the mouse from the empty triangle to the «Source Graphic» column.
The drop shadow is now complete. You can modify the amount of blur or the amount of offset by selecting the appropriate Filtro primitive under the Effects: column and using the sliders at the bottom of the Filtri dialog.
|© 2005-2008 Tavmjong Bah.||Get the book.|