groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Groff] Drop shadows in pic


From: Ted Harding
Subject: RE: [Groff] Drop shadows in pic
Date: Sun, 14 Feb 2010 18:28:30 -0000 (GMT)

Hi Larry,

On 09-Feb-10 15:06:10, Larry Kollar wrote:
> I looked for "drop shadows" in the archives, and didn't see anything.
> Is there an easier way to do them than to lay down the shadows first,
> then draw more boxes on top of them like this?
> 
> .PS 4i
> .ft HB
> .ps -1
> linethick=1;
> 
># lay down drop-shadows first
> box wid 2 ht 1.5 color "slateblue";
> move to last box.s;
> down;
> move 0.6;
> box wid 2 ht 1 color "slateblue";
> move 0.6;
> X: box wid 2 ht 1 color "slateblue";
> move 0.6;
> box wid 2 ht 1 color "slateblue";
> move to X.s;
> move left 2.4 down 0.6;
> box wid 2 ht 1 color "slateblue";
> move to X.s;
> move right 2.4 down 0.6;
> box wid 2 ht 1 color "slateblue";
> 
># now draw on top of the drop-shadows
> move to 1st box.n+(-0.1,0.1);
> 
> box wid 2 ht 1.5 color "skyblue" outline "black" \
>       "natter" "natter natter" "natter";
> move to last box.s;
> down;
> line 0.6;
> box wid 2 ht 1 color "skyblue" outline "black" \
>       "gromish" "natter natter";
> line 0.6;
> box wid 2 ht 1 color "skyblue" outline "black" \
>       "natter natter" "gromish gromish";
> line 0.6;
> box wid 2 ht 1 color "skyblue" outline "black" \
>       "natter" "natter";
> 
> move to last line .n;
> line left 2.4 down 0.6;
> box wid 2 ht 1 color "skyblue" outline "black" \
>       "natter" "gromish";
> 
> move to last line .n;
> line right 2.4 down 0.6;
> box wid 2 ht 1 color "skyblue" outline "black" \
>       "natter" "gromish";
> .PE
> 
> I don't have the coding skills to add a "shadow" attribute to boxes,
> which would be the proper solution. Anything relative to the box should
> pretend the shadow isn't there, so (as in the example) lines exit the
> box on top rather than the shadow.
> 
> Am I missing something obvious?
> -- Larry

Interesting question! The best I can think of (again without
dismantling pic altogether) is to define a macro. The following
is an example, where the "shadowed box" is call "shbox".
I have tried to apply it to your example (not sure if the
shadowing for the larger top box as produced by your code is
what you really intended; mine comes out different).

The definition of "shbox" could be extended to allow a greater
range of shadowing effects, which could allow repoducing exactly
what came out of your code.

### 8< -------------------------------------------------

.ft HB
.blm
.PS 4i
linethick = 1
define shbox {
  bwid  = $1 ; bht   = $2 ; xoff  = $3 ; yoff  = $4
  move right xoff ; move down yoff
  box wid bwid ht bht color $6
  box wid bwid ht bht color $5  \
    at last box + (-xoff,yoff)  outline "black"
}

shbox(2, 1.5 ,0.1, 0.1, "skyblue", "slateblue") 
   "natter" "natter natter" "natter" at last box     #[1]
move to last box.s ; move down 0.6
shbox(2, 1.0 ,0.1, 0.1, "skyblue", "slateblue")
   "gromish" "natter natter" at last box             #[2]
line from 3rd last box.s to last box .n
move to last box.s ; move down 0.6
shbox(2, 1.0 ,0.1, 0.1, "skyblue", "slateblue")
   "natter natter" "gromish gromish" at last box     #[X: 3]
line from 3rd last box.s to last box .n
move to last box.s ; move down 0.6
shbox(2, 1.0 ,0.1, 0.1, "skyblue", "slateblue")
   "natter" "natter" at last box                     #[4]
move to 3rd last box.s + (-2.4,-0.6)
shbox(2, 1.0 ,0.1, 0.1, "skyblue", "slateblue")
   "natter" "gromish" at last box                    #[5]
move to 5th last box.s + (2.4,-0.6)
shbox(2, 1.0 ,0.1, 0.1, "skyblue", "slateblue")
   "gromish" "natter" at last box                    #[6]
line from 7th last box.s to 5th last box.n
line from 7th last box.s to 3rd last box.n
line from 7th last box.s to last box.n
.PE

### 8< -------------------------------------------------

Note that the "top box", i.e. the skyblue one with the border
and the text, in shbox is the "last box", since it is drawn as
the second of the two. This makes it the natural position
reference and, as in my code above, the position can be referred
to in various ways.

Happy shadow-boxing!
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 14-Feb-10                                       Time: 18:28:26
------------------------------ XFMail ------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]