GraphAttr.st
changeset 151 8123ec03c52f
child 154 871a750ba914
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GraphAttr.st	Tue Jun 06 06:09:07 1995 +0200
@@ -0,0 +1,191 @@
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+Object subclass:#GraphicsAttributes
+       instanceVariableNames:'paint
+			      font
+			      lineStyle lineWidth
+			      joinStyle capStyle
+			      maskOrigin'
+       classVariableNames:'' 
+       poolDictionaries:''
+       category:'Graphics-Support'
+!
+
+GraphicsAttributes comment:'
+COPYRIGHT (c) 1992 by Claus Gittinger
+	      All Rights Reserved
+
+$Header: /cvs/stx/stx/libview/Attic/GraphAttr.st,v 1.1 1995-06-06 04:07:14 claus Exp $
+'!
+
+!GraphicsAttributes class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1992 by Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libview/Attic/GraphAttr.st,v 1.1 1995-06-06 04:07:14 claus Exp $
+"
+!
+
+documentation
+"
+    instances keep multiple graphics attributes as used in a graphicsContext.
+    They can be used when multiple attributes are to be set.
+
+    Instance variables:
+
+	paint           <Color>         the paint to be used for drawing
+	font            <Font>          the font to be used for drawing
+	lineStyle       <Symbol>        the lineStyle (i.e. #solid, #dashed, #doubleDashed)
+	lineWidth       <SmallInteger>  the lineWidth (device dependent, usually pixels)
+	joinStyle       <Symbol>        the style in which lines (in polygons)
+					are joined (i.e. #miter, #bevel, #round)
+	capStyle        <Symbol>        the style in which the last point of a line is drawn
+					(i.e. #notLast, #butt, #round, #projecting)
+	maskOrigin      <Point>         the origin of the mask relative to
+					the drawables origin
+
+    CAVEAT: the maskOrigin is called phase in ST-80
+"
+! !
+
+!GraphicsAttributes methodsFor:'installing'!
+
+installOn:aGC
+    paint notNil ifTrue:[aGC paint:paint].
+    font notNil ifTrue:[aGC font:font].
+    lineWIdth notNil ifTrue:[aGC lineWidth:lineWidth].
+    lineStyle notNil ifTrue:[aGC lineStyle:lineStyle].
+    joinStyle notNil ifTrue:[aGC joinStyle:joinStyle].
+    capStyle notNil ifTrue:[aGC capStyle:capStyle].
+    maskOrigin notNil ifTrue:[aGC maskOrigin:capStyle].
+! !
+
+!GraphicsAttributes methodsFor:'accessing'!
+
+paint
+    "return the current paint drawing color"
+
+    ^ paint
+!
+
+paint:aColor
+    "set the drawing painting color"
+
+    paint := aColor
+!
+
+lineWidth
+    "return the drawing linewidth"
+
+    ^ lineWidth
+!
+
+lineWidth:aNumber
+    "set the line drawing width in pixels"
+
+    lineWidth := aNumber
+!
+
+lineStyle
+    "return the line-drawing-style"
+
+    ^ lineStyle
+!
+
+lineStyle:aStyleSymbol
+    "set the line-drawing-style;
+     possible styles are: #solid, #dashed, #doubleDashed"
+
+    lineStyle := aStyleSymbol
+!
+
+capStyle
+    "return the cap-style for line-drawing"
+
+    ^ capStyle
+!
+
+capStyle:aStyleSymbol
+    "set the cap-style for line-drawing;
+     possible styles are: #notLast, #butt, #round, #projecting"
+
+    capStyle := aStyleSymbol
+!
+
+joinStyle
+    "return the join-style for polygon-drawing"
+
+    ^ joinStyle
+!
+
+joinStyle:aStyleSymbol
+    "set the join-style of lines in polygon-drawing;
+     possible styles are: #miter, #bevel, #round"
+
+    joinStyle := aStyleSymbol
+!
+
+font
+    "return the drawing font"
+
+    ^ font
+!
+
+font:aFont
+    "set the drawing font"
+
+    font := aFont
+!
+
+maskOrigin:aPoint
+    "set the origin within the mask (used to draw with patterns).
+     This is an alias for ST-80's #phase"
+
+    maskOrigin := aPoint
+!
+
+maskOriginX:x y:y
+    "set the origin within the mask (used to draw with patterns)."
+
+    ^ maskOrigin
+!
+
+phase:aPoint
+    "set the origin within the mask (used to draw with patterns).
+     This is an alias for ST/X's #maskOrigin:"
+
+    maskOrigin := aPoint
+!
+
+phase
+    "return the origin within the mask (used to draw with patterns).
+     This is an alias for ST/X's #maskOrigin"
+
+    ^ maskOrigin
+! !
+
+