home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-12 | 24.3 KB | 1,080 lines |
- head 1.8;
- branch ;
- access ;
- symbols beta10:1.7;
- locks death:1.8;
- comment @# @;
-
-
- 1.8
- date 93.04.04.23.30.41; author death; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 93.01.09.21.07.28; author death; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 93.01.01.11.51.35; author death; state Exp;
- branches ;
- next 1.5;
-
- 1.5
- date 92.12.31.15.34.16; author death; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 92.12.05.23.07.27; author death; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 92.12.03.18.02.00; author death; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 92.11.27.19.38.04; author death; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 92.11.08.09.28.57; author death; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.8
- log
- @Sun Apr 4 23:30:41 PDT 1993
- @
- text
- @%BEGIN Common
- %
- % Pen size
- %
- /penWidth 1 def
- /penHeight 1 def
-
- %
- % The coordinates of the last rectangle used
- %
- /lastTop 0 def
- /lastLeft 0 def
- /lastBottom 0 def
- /lastRight 0 def
- %
- % Define color values
- %
- /foregroundColor [0 0 0] def
- /backgroundColor [1 1 1] def
- %
- % Define the three patterns used
- %
- /backPattern 20 dict def
- backPattern begin
- /QDPatType 0 def
- /QDPatData <FFFFFFFFFFFFFFFF> def % white
- /QDPatGrey 1 def
- end
- /penPattern 20 dict def
- penPattern begin
- /QDPatType 0 def
- /QDPatData <0000000000000000> def
- /QDPatGrey 0 def
- end
- /fillPattern 20 dict def
- fillPattern begin
- /QDPatType 0 def
- /QDPatData <0000000000000000> def % black
- /QDPatGrey 1 def
- end
- %
- % set the drawing mode
- %
- /patternMode /patCopy def
- %
- % Calculate the PostScript level currently in use.
- %
- /PSlevel
- systemdict /languagelevel known
- {languagelevel}
- {1}
- ifelse
- def
-
-
-
- %%%%%%%%%%%%%
- % Name: usePattern
- % Syntax: pattern usePattern -
- % About: Set the current drawing patten to the one passed.
- % Note: We do some weird double-use of dictionary in PS 2 code
- %%%%%%%%%%%%%
- /usePattern
- {
- /QDPatternDict exch def
- /patternType QDPatternDict /QDPatType get def
-
- patternType 2 eq
- { QDPatternDict /QDColorValue get useColor }
- {
- PSlevel 1 eq
- {
- %
- % Can't do true patterns, so compute percent gray, and weight by
- % appropriate ammounts of fore and back colors.
- %
- /patGrey QDPatternDict /QDPatGrey get def
- /invGrey 1 patGrey sub def
- 0 1 2
- {
- /index exch def
- foregroundColor index get invGrey mul
- backgroundColor index get patGrey mul add
- }
- for
- setrgbcolor
- }
- {
- % PS level 2
- patternType 0 eq
- {
- /PSPatDict 15 dict def
- PSPatDict begin
- /PaintType 1 def
- /PatternType 1 def
- /TilingType 1 def
- /BBox [0 0 8 8] def
- /XStep 8 def
- /YStep 8 def
- /myData QDPatternDict /QDPatData get def
- /PaintProc {
- %
- % Draw foreground bits, and then draw background
- % bits, using different colors depending on mode.
- %
- begin
- patternMode /patBic eq
- patternMode /notPatCopy eq
- or
- { 0 1 2 { backgroundColor exch get } for }
- %patOr, patCopy, and default
- { 0 1 2 { foregroundColor exch get } for }
- ifelse
- setrgbcolor
- 8 8 false
- [1 0 0 1 0 0]
- myData
- imagemask
-
- patternMode /notPatOr eq
- patternMode /notPatCopy eq
- or
- { 0 1 2 { foregroundColor exch get } for }
- % patCopy, notBic and default
- { 0 1 2 { backgroundColor exch get } for }
- ifelse
- setrgbcolor
- 8 8 true
- [1 0 0 1 0 0]
- myData
- imagemask
- end
- } def
- end
- PSPatDict matrix makepattern setpattern
- }
- {
- % Pat type 2
- /PSPatDict 20 dict def
- PSPatDict begin
- /PaintType 1 def
- /PatternType 1 def
- /TilingType 1 def
- /BBox [0 0 QDPatternDict /QDDestWidth get
- QDPatternDict /QDDestHeight get] def
- /XStep QDPatternDict /QDDestWidth get def
- /YStep QDPatternDict /QDDestHeight get def
-
- /ImageType 1 def
- /Width QDPatternDict /Width get def
- /Height QDPatternDict /Height get def
- /BitsPerComponent
- QDPatternDict /BitsPerComponent get def
- /Decode [ 0 2 BitsPerComponent exp 1 sub ] def
- /ImageMatrix [1 0 0 1 0 0] def
- /DataSource QDPatternDict /QDPatBitmap get def
- /PaintProc {
- /ourDict exch def
- [/Indexed /DeviceRGB
- QDPatternDict /QDNumColors get
- QDPatternDict /QDColorTable get]
- setcolorspace
- ourDict image
- } def
- end
- PSPatDict matrix makepattern setpattern
- }
- ifelse
- }
- ifelse
- }
- ifelse
- }
- def
-
-
-
- %%%%%%%%%%%%%
- % Name: useColor
- % Syntax: [red green blue] useColor -
- % About: Given array with R G B values, set the current color to it.
- %%%%%%%%%%%%%
- /useColor
- {
- /colorArray exch def
- colorArray 0 get
- colorArray 1 get
- colorArray 2 get
- setrgbcolor
- }
- def
-
- %%%%%%%%%%%%%
- % Name: setupForArcPath
- % Syntax: width height bottom left setupForArcPath xcoord ycoord radius
- % About: Given bounds of an oval defined by a rectangle, return its
- % center in undistored space & it's radius (good for use with arc)
- % Also, distort coord system so oval can be drawn (not as circle).
- % If width is > height (computations merely mirrored if reversed)
- % scale coord system, push x coord center, push y coord center as:
- % (ovalBottom-(ovalHeight/2)) * (ovalWidth/ovalHeight)
- % (Get center then unscale it)
- %%%%%%%%%%%%%
- /setupForArcPath
- {
- /ovalLeft exch def
- /ovalBottom exch def
- /ovalHeight exch def
- /ovalWidth exch def
-
- ovalHeight 0 le
- ovalWidth 0 le
- or
- { 0 0 0 } % if height or with <= 0, return center 0,0 radius 0
- {
- ovalWidth ovalHeight gt
- {
- 1 ovalHeight ovalWidth div scale
- ovalLeft ovalWidth 2 div add % X coordinate center
- ovalBottom ovalHeight 2 div sub ovalWidth ovalHeight div mul
- ovalWidth 2 div % radius
- }
- {
- ovalWidth ovalHeight div 1 scale
- ovalLeft ovalWidth 2 div add ovalHeight ovalWidth div mul
- ovalBottom ovalHeight 2 div sub % Y coord center
- ovalHeight 2 div % radius
- }
- ifelse
- }
- ifelse
- }
- def
-
- %%%%%%%%%%%%%
- % Name: regionBounds
- % Syntax: top left bottom right regionBounds -
- % About: Build a closed path given the coordinates on the stack.
- %%%%%%%%%%%%%
- /regionBounds
- {
- /right exch def
- /bottom exch def
- /left exch def
- /top exch def
-
- newpath
- left top moveto
- right top lineto
- right bottom lineto
- left bottom lineto
- closepath
- }
- def
-
- %%%%%%%%%%%%%
- % Name: regionPath
- % Syntax: x y ... x y n regionPath -
- % About: Given N, and N pairs of x,y coords which define a region's edge,
- % build a path through these coordinates.
- %%%%%%%%%%%%%
- /regionPath
- {
- /numShapes exch def
- newpath
- numShapes
- {
- /numPoints exch def
- /y exch def
- /x exch def
- x y moveto
- numPoints 1 sub
- {
- /y exch def
- /x exch def
- x y lineto
- }
- repeat
- closepath
- }
- repeat
- }
- def
-
- %%%%%%%%%%%%%
- % Name: startPict
- % Syntax: num startPict -
- % About: Called before any converted pict data. Do any setup here.
- %%%%%%%%%%%%%
- /startPict
- {pop}
- def
-
- %%%%%%%%%%%%%
- % Name: QDClip [0001]
- % Syntax: regionInfo QDclip -
- % About: Sets the clipping path for the drawing. If shapes in region
- % other than bounding rect, build their path and clip to them too.
- %%%%%%%%%%%%%
- /QDclip
- {
- initclip
- regionBounds
- clip
- /numShapes exch def
- numShapes 0 gt
- {
- numShapes
- regionPath
- clip
- }
- if
- }
- def
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Name: endPict [00FF]
- % Syntax: - endPict -
- % About: Marks the end of a picture. Do any cleanup here.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /endPict
- {}
- def
-
- %%%%%%%%%%%%%
- % Name: headerOp [0C00]
- % Syntax: num num num num num num headerOp -
- % About: This appears to do nothing for PICT 1 or 2, so we ignore it.
- %%%%%%%%%%%%%
- /headerOp
- {pop pop pop pop pop pop}
- def
-
-
- %END Common
-
- @
-
-
- 1.7
- log
- @Sat Jan 9 21:07:28 PST 1993
- @
- text
- @d38 1
- a38 1
- /QDPatData <FFFFFFFFFFFFFFFF> def % white
- @
-
-
- 1.6
- log
- @Fri Jan 1 11:51:35 PST 1993
- @
- text
- @d3 1
- a3 1
- % Define the default pen size
- d9 1
- a9 1
- % Store the last rectangle coordinates that were used by the various routines
- a14 1
-
- d16 1
- a16 1
- % Define color values (black foreground, white background)
- a19 1
-
- d21 1
- a21 4
- % Define the patterns tha will be used
- % The background pattern
- % The pen pattern
- % The fill pattern
- d32 1
- a32 1
- /QDPatData <0000000000000000> def % black
- a40 1
-
- d42 1
- a42 1
- % Mode
- d45 3
- a47 12
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Utility value: PSlevel
- % Syntax: - PSlevel num
- % Description:
- % This will return the current PS language level as an integer.
- % Because the languagelevel operator is undefined for level 1
- % PS, this checks whether the operator is known currently.
- % If so, it returns the number it returns. If it isn't known, we
- % return 1.
- % Bugs:
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d57 6
- a62 10
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Utility routine: usePattern
- % Syntax: pattern usePattern -
- % Description:
- % This changes the current drawing 'pattern'.
- % While QuickDraw has 3 patterns in use at once, we keep only one here,
- % switching between them as needed.
- % Notes:
- % PATTERN DATA HAS BEEN INVERTED FOR B&W!! REVERSE MODES!
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d67 1
- d69 1
- a70 7
- /colorpat QDPatternDict /QDColorValue get def
- 0 1 2
- {colorpat exch get}
- for
- setrgbcolor
- }
- {
- d74 2
- a75 3
- % No way to do true patterns, so compute an approximate RGB value
- % that vaguely represents the pattern. Get the % grey of the B&W pattern
- % and then use appropriate percentages of fore and background color.
- a78 1
- /patGrey 0 invGrey sub 1 add def
- d83 1
- a83 1
- backgroundColor index get patGrey mul add 2 div
- d89 1
- a89 1
- % Ps level 2
- d92 1
- a92 1
- /PSPatDict 10 dict def
- d102 17
- a118 21
- begin
- patternMode /patBic eq
- patternMode /notPatCopy eq
- or
- {
- backgroundColor 0 get
- backgroundColor 1 get
- backgroundColor 2 get
- }
- {
- %patOr, patCopy, and default
- foregroundColor 0 get
- foregroundColor 1 get
- foregroundColor 2 get
- }
- ifelse
- setrgbcolor
- 8 8 true
- [1 0 0 1 0 0]
- myData
- imagemask
- d120 13
- a132 21
- patternMode /notPatOr eq
- patternMode /notPatCopy eq
- or
- {
- foregroundColor 0 get
- foregroundColor 1 get
- foregroundColor 2 get
- }
- {
- % patCopy, notBic and default
- backgroundColor 0 get
- backgroundColor 1 get
- backgroundColor 2 get
- }
- ifelse
- setrgbcolor
- 8 8 false
- [1 0 0 1 0 0]
- myData
- imagemask
- end
- d138 1
- d144 2
- a145 1
- /BBox [0 0 QDPatternDict /QDDestWidth get QDPatternDict /QDDestHeight get] def
- d152 3
- a154 2
- /BitsPerComponent QDPatternDict /BitsPerComponent get def
- /Decode [ 0 2 BitsPerComponent exp 1 sub ] def
- d161 2
- a162 1
- QDPatternDict /QDColorTable get] setcolorspace
- d176 7
- a182 14
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Utility routine: useColor
- % Syntax: [red green blue] useColor -
- % Description:
- % This is called with a three element array on the stack,
- % where the elements of that array represent an RGB color
- % value that was specified, perhaps, with the pict foreground or
- % background operators. We take this array, extract its contents
- % and set the current pen color to this rgb value. note that we
- % use setrgbcolor, since this is Level 1 compatible, and so we don't
- % need to worry about the level of PS here.
- % Bugs:
- % Like many other things here, this does no argument checking.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d193 2
- a194 123
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Utility routine: PICTline
- % Syntax: num num num num PICTline -
- % Description:
- % This draws a line from the start x and y coordinates, to
- % the destination x and y coordinates. It uses the current
- % pen pattern and pen width and height to do this.
- % Note taht it special cases the instance when the penheight and width
- % are both 1, and just draws a simple line in PS (this provides more
- % accurate results). Otherwise, it draws a line that is like one
- % in a PICT file, which can have different heights and widths, and
- % so on. See inside mac V. 1
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /PICTline
- {
- /endY exch def
- /endX exch def
- /startY exch def
- /startX exch def
-
- %
- % If the pen width or height is ever 0 or less, we don't draw anything.
- % This is following the lead of MacDraw I and II (of course, those don't even display
- % pens with non equal width ends. So, maybe this is a wrong assumption to be
- % making here
- %
- penHeight 0 gt
- penWidth 0 gt
- and
- {
- gsave
- penPattern usePattern
- newpath
- %
- % If the pen size is 1 on each side, do a normal lineto.
- %
- penHeight 1 eq
- penWidth 1 eq
- and
- {
- startX startY moveto
- endX endY lineto
- stroke
- }
- {
- %
- % Draw a thicker line. Figure out where to draw from and
- % to (there are 6 vertices on the line that gets drawn), depending
- % on how the start and end coordiantes relate.
- %
- endY startY lt
- {
- endX startX gt
- {
- startX startY moveto
- endX endY lineto
- endX penWidth add endY lineto
- endX penWidth add endY penHeight add lineto
- startX penWidth add startY penHeight add lineto
- startX startY penHeight add lineto
- }
- {
- startX penWidth add startY moveto
- endX penWidth add endY lineto
- endX endY lineto
- endX endY penHeight add lineto
- startX startY penHeight add lineto
- startX penWidth add startY penHeight add lineto
- }
- ifelse
- }
- {
- endX startX gt
- {
- startX startY moveto
- startX penWidth add startY lineto
- endX penWidth add endY lineto
- endX penWidth add endY penHeight add lineto
- endX endY penHeight add lineto
- startX startY penHeight add lineto
- }
- {
- startX startY moveto
- endX endY lineto
- endX endY penHeight add lineto
- endX penWidth add endY penHeight add lineto
- startX penWidth add startY penHeight add lineto
- startX penWidth add startY lineto
- }
- ifelse
- }
- ifelse
- closepath
- fill
- } % end of whether we have sides of length 1 or greater.
- ifelse
- grestore
- } % End of test for >0 length sides
- if
- } def
-
-
-
- % About: Use coords of a rectangle, plus the starting and finishing
- % angle, and frames the outline of a portion of an oval's outline
- % (an arc), using the values of penWidth and penHeight.
- % This is accomplished in one of 2 cases:
- % 1) The penwidth and height are both 1,
- % 2) The width of the oval (that the arc is a part of) is greater
- % than its height.
- % 3) The Oval's height is greater than its width.
- % The first is special cased because it looks slightly better this
- % way, and will doubtlessly be the most common case. In 2 & 3, user
- % space is necessarily distorted so we can achieve oval shapes.
- % Note: to get the penwidth and heigh effect, we frame an oval inside
- % an oval, and then fill the space between them.
- % Note that the last* values are modified and used here
-
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % utility: setupForArcPath
- d196 8
- a203 25
- % Description:
- % Given the width and height of an oval, plus the coords of it's bottom and left,
- % this computes the oval's center in non-distorted user space, and the proper
- % 'radius' to use to draw the oval. It also scales user space appropriately.
- % With all this messy math done, it returns the x and y coord of the center, plus
- % the radius value on the stack to the caller.
- % The intention is that the user call this with the width, etc, of the oval, and
- % get back numbers ready to be plugged into arc or arcn or whatever.
- % The code is a little dense on math. But, the basic ideas are 'simple'.
- % First, we scale user space appropriatley. Then, we compute the xcoord, then
- % the ycoord and finally the radius (pushing all on the stack as we go).
- % If our width is larger than our height, we compute these one way, otherwise
- % we compute them another. The raidus is always half the length of the longer.
- % Ine each scenario, one of the coords is simply half way along the width or
- % height in an obvious way. In the case of getting the Y coordinate when the
- % width is greater, we compute:
- % ((ovalHeight/2)+ovalBottom) * (ovalWidth/ovalHeight)
- % That is, gets center, then unscales it so it will be in the right position in
- % the unscaled userspace. Similar computation in the other case.
- % Bugs:
- % This header comment is much longer than the code itself... =)
- % Remove the trapping for oval sizes that are too big, and you can get
- % some cute results! =)
- % removed a 1 add from the bottom height and width
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d211 2
- a212 2
- 0 ovalHeight eq % don't try to draw if our width or height is 0
- 0 ovalWidth eq
- d214 1
- a214 1
- { 0 0 0 } % return a center of 0,0 with a radius of 0
- d220 2
- a221 2
- ovalBottom ovalHeight 2 div sub ovalWidth ovalHeight div mul % Y coord center
- ovalWidth 2 div % radius
- d225 2
- a226 2
- ovalLeft ovalWidth 2 div add ovalHeight ovalWidth div mul % X coordinate center
- ovalBottom ovalHeight 2 div sub% Y coord center
- d235 2
- a236 4
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % utility: regionBounds
- d238 2
- a239 11
- % Description:
- % The top four coordinates on the stck when a region opcode is encountered
- % is the top left borrom and right coordinates of the rectangle that bounds/clips
- % the whole of the region shape. This returns the path formed by this rectangle
- % to the caller.
- % Notes:
- % Ideally, this would be integrated with whatever routine creates the path
- % for the rest of the region. This might, however, require that two paths
- % be returned to the user. As this is difficult, I have opted to deal with doing
- % the processing of region data in two passes.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d246 1
- a246 3
- %
- % Build a rectangular path...
- %
- d249 3
- a251 3
- right 1 add top lineto
- right 1 add bottom 1 add lineto
- left bottom 1 add lineto
- d256 6
- a261 16
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % utility: regionPath
- % Syntax: [x y x] ... [x y x] n top left bottom right regionPath -
- % Description:
- % Takes a region from the stack, and theoretically builds a path from it.
- % Realistically we mostly just discard it, because building a region, in general, is going
- % to be more work than it seems to warrant.
- % So, instead, we discard the many region lines, if they exist, and build a simple
- % path around the bounding rect of the region.
- % Data on the stack consists of: a bounding rectangle, a number of region segments
- % and then that number of region segment. Each segment is a 3 element array:
- % [x1 y1, x2] which defines a line with y coordinates y1 and x ones from x1 to x2.
- % (that is, it describes the line from x1,y1 to x2,y1
- % Notes:
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d285 2
- a286 2
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % uniltiy routine: startPict
- d288 2
- a289 7
- % Description:
- % This routine balances the endPict routine that is called at the end of
- % the data that came from a pict file. It kinda corresponds to
- % the ininitial version opcode in the pict file, in that it is passed the
- % version number of the source pict file. Mainly, though, it allows
- % one to do any setup one needs to do before starting displyaing the pict.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d294 6
- a299 13
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0001
- % Name: QDClip
- % Syntax: macRegion QDclip -
- % Description:
- % Sets the PS clipping path to the path described by the mac region
- % Note that we check the number of shapes following the main bounding
- % box for the region. If it is 0, then we do nothing. Otherwise, we build a path
- % representing them, and intersect it with the current clip path. Doing
- % this prevents us from calling regionPath then clip with no shapes, whichs
- % causes an empty clip path (nothing gets drawn)
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d313 2
- a314 1
- } def
- a315 1
-
- d317 1
- a317 2
- % Opcode: 00FF
- % Name: endPict
- d319 1
- a319 3
- % Description:
- % This should mark the end of the picture. So. If any cleaning
- % needs to be done, it should be done here
- d325 2
- a326 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 00C0
- % Name: headerOp
- d328 2
- a329 6
- % Description:
- % Another of those fine opcodes that isn't very well defined.
- % It's a pict2 opcode. It takes -1, followed by 4 32bit numbers, follwoed by -1 (I think)
- % At the moment is appears to do nothing crucial. So, we ignore it.
- % Bugs:
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- @
-
-
- 1.5
- log
- @Thu Dec 31 15:34:16 PST 1992
- @
- text
- @@
-
-
- 1.4
- log
- @Sat Dec 5 23:07:27 PST 1992
- @
- text
- @d28 1
- a28 1
- /backPattern 10 dict def
- d31 1
- a31 1
- /QDPatData <FFFFFFFF> def % white
- d34 1
- a34 1
- /penPattern 10 dict def
- d37 1
- a37 1
- /QDPatData <00000000> def % black
- d40 1
- a40 1
- /fillPattern 10 dict def
- d43 1
- a43 1
- /QDPatData <FFFFFFFF> def % white
- d47 4
- d80 1
- d86 1
- a86 3
- patternType 0 eq
- patternType 1 eq
- or
- d88 7
- d116 87
- a202 1
-
- a205 7
- {
- /colorpat QDPatternDict /QDColorValue get def
- 0 1 2
- {colorpat exch get}
- for
- setrgbcolor
- }
- a209 1
-
- d338 17
- d381 1
- d386 3
- a388 3
- /ovalBottom exch 1 add def
- /ovalHeight exch 1 add def
- /ovalWidth exch 1 add def
- d498 2
- a499 3
- {
- pop
- } def
- d542 14
- @
-
-
- 1.3
- log
- @Thu Dec 3 18:01:59 PST 1992
- @
- text
- @d1 1
- d22 24
- d47 1
- d49 1
- a49 1
- % Utility routine: PSlevel
- a59 1
- {
- d64 54
- d439 1
- a439 35
-
-
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
- %
- % Define the patterns tha will be used (in this context, 1 is black, 0 is white)
- % The background pattern
- % The pen pattern
- % The fill pattern
- %
- /backPattern 0 def
- /penPattern 1 def
- /fillPattern 0 def
-
-
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Utility routine: usePattern
- % Syntax: pattern usePattern -
- % Description:
- % This changes the current drawing 'pattern'.
- % While QuickDraw has 3 patterns in use at once, we keep only one here,
- % switching between them as needed.
- % Notes:
- % At the moment, a 'pattern' is simply represented as a shade of grey, so,
- % we just change the grey level when called
- % @@@@ PS 2
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- /usePattern
- { 0 exch sub 1 add setgray }
- def
-
- @
-
-
- 1.2
- log
- @Fri Nov 27 19:38:03 PST 1992
- @
- text
- @d28 3
- a30 3
- % PS, this briefly patches the error dictionary so that if we try to
- % call languagelevel in a level 1 environment, we will recover
- % effortlessly, and return the proper number anyway (1).
- d35 4
- a38 8
- errordict begin
- /oldundef {undefined} def
- /undefined {pop 1} def
-
- languagelevel
-
- /undefined {oldundef} def
- end
- d256 3
- a258 3
- right top lineto
- right bottom lineto
- left bottom lineto
- d289 1
- a289 1
- numPoints 2 mul 1 sub
- a314 4
- %
- % Invert the coord system to match PICT view of the world.
- %
- [1 0 0 -1 0 255] concat
- d317 1
- d324 5
- d335 8
- a342 3
- %%% if there are no shapes, when what happens with this?
- regionPath
- %%%%%%%%%%%%%%%%%%%%%% clip
- @
-
-
- 1.1
- log
- @Sun Nov 8 09:28:57 PST 1992
- @
- text
- @d15 5
- d21 1
- d23 50
- d236 33
- a281 6
- % If we ever process this stuff for real, we should store values as a 'last region'
- % for reuse later (?).
- % It would probably be nicer, actually, to do the region-data processing in the
- % converter program, and not here. So, if this is ever enabled, this routine will
- % probably need significant changes (but, the final code will probably be pretty
- % simple... basically this could be described as just a polygon).
- d285 1
- a285 14
- /right exch def
- /bottom exch def
- /left exch def
- /top exch def
- /segments exch def
- %
- % read in the segments making up the region.
- %
- segments
- { pop }
- repeat % for the number of segments
- %
- % Build a rectangular path...
- %
- d287 16
- a302 5
- left top moveto
- right top lineto
- right bottom lineto
- left bottom lineto
- closepath
- d306 18
- d327 1
- a327 1
- % Name: endPict
- d335 3
- d339 1
- a339 1
- clip
- a363 8
- % Define our B&W patterns
- %
- /penPattern 0 def
- /fillPattern 0 def
- /backPattern 0 def
-
-
- %
- a373 18
- %
- % Define color values
- %
- /fgColor 0 def
- /bkColor 1 def
-
- %
- % These are constants used to set the fgColor and bkColor, above. They should have
- % real values to match their names, rather than B&W colors...
- %
- /blackColor 1 def
- /whiteColor 1 def
- /redColor 1 def
- /greenColor 1 def
- /blueColor 1 def
- /cyanColor 1 def
- /magentaColor 1 def
- /yellowColor 1 def
- @
-