Spaces:
Sleeping
Sleeping
File size: 4,961 Bytes
07c3cdd | 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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | /box-image-broken-create { % =>
box-image-generic-create
dup box-image-broken-setup-methods
dup /box-image-broken add-type
} def
/box-image-broken-setup-methods {
dup /Methods get
dup /show {box-image-broken-show} put
pop pop
} def
/box-image-broken-show { % => Viewport This
gsave
0.1 setlinewidth
dup get-left 1 index get-top moveto
dup get-right 1 index get-top lineto
dup get-right 1 index get-bottom lineto
dup get-left 1 index get-bottom lineto
closepath
stroke
dup get-left 1 index get-top moveto
dup get-right 1 index get-top lineto
dup get-right 1 index get-bottom lineto
dup get-left 1 index get-bottom lineto
closepath
clip
% TODO: output ALT attribute
grestore
pop pop
} def
/box-image-create { % => Mask Image Init SY SX
image-create
box-image-generic-create
dup box-image-setup-methods
dup /box-image add-type % => Image Box
dup /Image 3 index put
exch pop
} def
/box-image-setup-methods { % =>
dup /Methods get
dup /show {box-image-show} put
pop pop
} def
/box-image-show { % => Viewport Box
2 copy box-generic-show
% Check if "designer" set the height or width of this image to zero; in this there will be no reason
% in drawing the image at all
dup /get-width call-method 1 lt
1 index get-height 1 lt or {
} {
dup /Image get % => Viewport Box Image
1 index get-left
2 index get-bottom moveto % => Viewport Box Image
1 index /get-width call-method
2 index get-height % => Viewport Box Image W H
3 2 roll
image-show % => Viewport Box
} ifelse % => Viewport Box
pop pop
} def
/box-image-generic-create { % =>
box-generic-inline-create
dup box-image-generic-setup-methods
dup /box-image-generic add-type
dup /scale /none put
dup /src-width 1 put
dup /src-height 1 put
} def
/box-image-generic-get-max-width { % => Context This
dup get-full-width
exch pop
exch pop
} def
/box-image-generic-get-min-width { % => Context This
dup get-full-width
exch pop
exch pop
} def
/box-image-generic-get-scale { % => This
/scale get
} def
/box-image-generic-get-src-height {
/src-height get
} def
/box-image-generic-get-src-width {
/src-width get
} def
/box-image-generic-pre-reflow-images { % => This
dup box-image-generic-get-scale % => This Scale
dup /width eq { % => This Scale
1 index box-image-generic-get-src-width
2 index box-image-generic-get-src-height div
2 index /get-width
call-method mul % => This Scale Size
dup 3 index put-height % => This Scale Size
2 index put-default-baseline % => This Scale
} if
dup /height eq { % => This Scale
1 index box-image-generic-get-src-height
2 index box-image-generic-get-src-width div
2 index get-height mul % => This Scale Size
dup 3 index put-width % => This Scale Size
dup wc-create-constant
3 index put-width-constraint % => This Scale Size
2 index put-default-baseline % => This Scale
} if
pop pop
} def
/box-image-generic-put-scale { % => Scale This
exch % => This Scale
/scale exch % => This /scale Scale
put
} def
/box-image-generic-put-src-height {% => Scale This
exch % => This Scale
/src-height exch % => This /src-height Scale
put
} def
/box-image-generic-put-src-width { % => Scale This
exch % => This Scale
/src-width exch % => This /src-width Scale
put
} def
/box-image-generic-reflow { % => Context Parent This
dup box-image-generic-pre-reflow-images
% => Context Parent This
% Check if we need a line break here
2 index
2 index
2 index
/maybe-line-break call-method
pop
% set default baseline
dup get-default-baseline
1 index put-baseline
% append to parent line box
dup 2 index
box-container-append-line
% Move box to the parent current point
1 index
1 index
box-generic-guess-corner % => Context Parent This
% Move parent's X coordinate
1 index get-current-x
1 index get-full-width
add
2 index put-current-x % => Context Parent This
% Extend parent height
dup get-bottom-margin
2 index
box-generic-extend-height % => Context Parent This
pop pop pop
} def
/box-image-generic-setup-methods {
dup /Methods get
dup /get-max-width { box-image-generic-get-max-width } put
dup /get-min-width { box-image-generic-get-min-width } put
dup /pre-reflow-images { box-image-generic-pre-reflow-images } put
dup /reflow { box-image-generic-reflow } put
pop pop
} def |