Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
/box-image-broken-create {         % =>
2
  box-image-generic-create
3
  dup box-image-broken-setup-methods
4
  dup /box-image-broken add-type
5
} def
6
 
7
/box-image-broken-setup-methods {
8
  dup /Methods get
9
  dup /show {box-image-broken-show} put
10
  pop pop
11
} def
12
 
13
/box-image-broken-show {           % => Viewport This
14
  gsave
15
 
16
  0.1 setlinewidth
17
 
18
  dup get-left  1 index get-top    moveto
19
  dup get-right 1 index get-top    lineto
20
  dup get-right 1 index get-bottom lineto
21
  dup get-left  1 index get-bottom lineto
22
  closepath
23
  stroke
24
 
25
  dup get-left  1 index get-top    moveto
26
  dup get-right 1 index get-top    lineto
27
  dup get-right 1 index get-bottom lineto
28
  dup get-left  1 index get-bottom lineto
29
  closepath
30
  clip
31
 
32
  % TODO: output ALT attribute
33
 
34
  grestore
35
  pop pop
36
} def
37
 
38
/box-image-create {                % => Mask Image Init SY SX
39
  image-create
40
  box-image-generic-create
41
  dup box-image-setup-methods
42
  dup /box-image add-type          % => Image Box
43
 
44
  dup /Image 3 index put
45
  exch pop
46
} def
47
 
48
/box-image-setup-methods {         % =>
49
  dup /Methods get
50
  dup /show {box-image-show} put
51
  pop pop
52
} def
53
 
54
/box-image-show {                  % => Viewport Box
55
  2 copy box-generic-show
56
 
57
% Check if "designer" set the height or width of this image to zero; in this there will be no reason
58
% in drawing the image at all
59
  dup /get-width call-method 1 lt
60
  1 index get-height 1 lt or {
61
  } {
62
    dup /Image get                 % => Viewport Box Image
63
    1 index get-left
64
    2 index get-bottom moveto      % => Viewport Box Image
65
    1 index /get-width call-method
66
    2 index get-height             % => Viewport Box Image W H
67
    3 2 roll
68
    image-show                     % => Viewport Box
69
  } ifelse                         % => Viewport Box
70
  pop pop
71
} def
72
 
73
/box-image-generic-create {        % =>
74
  box-generic-inline-create
75
  dup box-image-generic-setup-methods
76
  dup /box-image-generic add-type
77
 
78
  dup /scale /none put
79
  dup /src-width  1 put
80
  dup /src-height 1 put
81
} def
82
 
83
/box-image-generic-get-max-width { % => Context This
84
  dup get-full-width
85
  exch pop
86
  exch pop
87
} def
88
 
89
/box-image-generic-get-min-width { % => Context This
90
  dup get-full-width
91
  exch pop
92
  exch pop
93
} def
94
 
95
/box-image-generic-get-scale {     % => This
96
  /scale get
97
} def
98
 
99
/box-image-generic-get-src-height {
100
  /src-height get
101
} def
102
 
103
/box-image-generic-get-src-width {
104
  /src-width get
105
} def
106
 
107
/box-image-generic-pre-reflow-images { % => This
108
  dup box-image-generic-get-scale  % => This Scale
109
 
110
  dup /width eq {                  % => This Scale
111
    1 index box-image-generic-get-src-width
112
    2 index box-image-generic-get-src-height div
113
    2 index /get-width
114
    call-method mul                % => This Scale Size
115
 
116
    dup 3 index put-height         % => This Scale Size
117
    2 index put-default-baseline   % => This Scale
118
  } if
119
 
120
  dup /height eq {                 % => This Scale
121
    1 index box-image-generic-get-src-height
122
    2 index box-image-generic-get-src-width div
123
    2 index get-height mul         % => This Scale Size
124
 
125
    dup 3 index put-width          % => This Scale Size
126
 
127
    dup wc-create-constant
128
    3 index put-width-constraint   % => This Scale Size
129
 
130
    2 index put-default-baseline   % => This Scale
131
  } if
132
 
133
  pop pop
134
} def
135
 
136
/box-image-generic-put-scale {     % => Scale This
137
  exch                             % => This Scale
138
  /scale exch                      % => This /scale Scale
139
  put
140
} def
141
 
142
/box-image-generic-put-src-height {% => Scale This
143
  exch                             % => This Scale
144
  /src-height exch                 % => This /src-height Scale
145
  put
146
} def
147
 
148
/box-image-generic-put-src-width { % => Scale This
149
  exch                             % => This Scale
150
  /src-width exch                  % => This /src-width Scale
151
  put
152
} def
153
 
154
/box-image-generic-reflow {        % => Context Parent This
155
  dup box-image-generic-pre-reflow-images
156
                                   % => Context Parent This
157
 
158
% Check if we need a line break here
159
  2 index
160
  2 index
161
  2 index
162
  /maybe-line-break call-method
163
  pop
164
 
165
% set default baseline
166
  dup get-default-baseline
167
  1 index put-baseline
168
 
169
% append to parent line box
170
  dup 2 index
171
  box-container-append-line
172
 
173
% Move box to the parent current point
174
  1 index
175
  1 index
176
  box-generic-guess-corner         % => Context Parent This
177
 
178
% Move parent's X coordinate
179
  1 index get-current-x
180
  1 index get-full-width
181
  add
182
  2 index put-current-x            % => Context Parent This
183
 
184
% Extend parent height
185
  dup get-bottom-margin
186
  2 index
187
  box-generic-extend-height        % => Context Parent This
188
 
189
  pop pop pop
190
} def
191
 
192
/box-image-generic-setup-methods {
193
  dup /Methods get
194
  dup /get-max-width     { box-image-generic-get-max-width } put
195
  dup /get-min-width     { box-image-generic-get-min-width } put
196
  dup /pre-reflow-images { box-image-generic-pre-reflow-images } put
197
  dup /reflow            { box-image-generic-reflow } put
198
  pop pop
199
} def