summaryrefslogtreecommitdiff
path: root/examples/ridt91.eps
blob: adea4cd66c2d3ea70706ee8d6379ad347d1a5738 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 380 200
%%Creator: karl@cs.umb.edu from code by Roger Hersch
%%CreationDate: 8 March 1991
%%Title: RIDT logo

% Forget everything we do.
save

% Make definitions in our own dictionary.
20 dict begin

% However, this isn't quite a true EPS file, because we use the
% setscreen operator, which has device- and document-dependent effects.
% In particular, if the document is being printed in landscape mode, we
% have to rotate the cell by 90 degrees.  The dvips translator sets the
% variable `isls' to be true in landscape mode, so we test for that.
% 
/screen_angle
    /isls where
    { /isls get { 90 } { 0 } ifelse }
    { 0 }
  ifelse
def


% Increasing this number makes the screen finer (it isn't the actual
% frequency).
% 
/screen_frequency 10 def


% If you change these numbers, change the bounding box comment above.
% This default size is approximately 134mm by 71mm.
/logo_width 380 def
/logo_height 200 def

% Besides changing the size from the outside, you can also change the
% scale factor defined here.  Of course then the bounding box won't be
% accurate.
/scalefactor 1 def

% We need a string to hold the gray values.
/fountainstring 256 string def

% Put values varying from 0 to 255 into the string; these will be values
% for the image operator.
0 1 255
  {
    fountainstring exch dup
    255 div 180 mul cos neg 2 div
    .5 add 255 mul cvi
    put
  }
bind for


% This procedure takes the bounding box of a rectangle, and images
% /fountainstring into it.
/fountain
  { 
    /ury exch def
    /urx exch def
    /lly exch def
    /llx exch def
    gsave
      llx lly translate
      
      % Scale to the size of the rectangle.
      urx llx sub ury lly sub scale

      % The source image has one row of 256 8-bit values.
      1 256 8
      
      % Map unit square to source.
      [1 0 0 -256 0 256]
      
      % Image the string.
      { fountainstring } image
   grestore
  }
bind def


% Draw a line across the bottom for visual anchoring.
% 
0 0 moveto
logo_width 0 lineto stroke

  screen_frequency scalefactor div
  screen_angle
  { exch pop abs 1 exch sub } bind
setscreen

scalefactor scalefactor scale

/Palatino-Roman findfont 100 scalefont setfont

% Determine the dimensions of our string.
/logo_words (RIDT 91) def

0 0 moveto
logo_words true charpath flattenpath pathbbox
/word_height exch def
/word_width exch def
pop pop % llx and lly are zero.
newpath

/x_offset logo_width word_width sub 2 div def
/y_offset 15 def

% Draw the background pattern, which is dark at the top and light at the
% bottom.
% 
0 0 logo_width logo_height fountain

% Make the clipping path be `RIDT 91', twice.
x_offset y_offset moveto
logo_words true charpath
x_offset logo_height y_offset word_height add sub moveto
logo_words true charpath
clip
newpath

% Paint the pattern again, this time with light at the top and dark at
% the bottom.
% 
logo_width logo_height translate
180 rotate
0 0 logo_width logo_height fountain

end 
restore

% showpage