GraphicsAttributes.st
author claus
Tue, 06 Jun 1995 06:09:07 +0200
changeset 151 8123ec03c52f
child 154 871a750ba914
permissions -rw-r--r--
.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
151
claus
parents:
diff changeset
     1
"
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
     3
	      All Rights Reserved
claus
parents:
diff changeset
     4
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    10
 hereby transferred.
claus
parents:
diff changeset
    11
"
claus
parents:
diff changeset
    12
claus
parents:
diff changeset
    13
Object subclass:#GraphicsAttributes
claus
parents:
diff changeset
    14
       instanceVariableNames:'paint
claus
parents:
diff changeset
    15
			      font
claus
parents:
diff changeset
    16
			      lineStyle lineWidth
claus
parents:
diff changeset
    17
			      joinStyle capStyle
claus
parents:
diff changeset
    18
			      maskOrigin'
claus
parents:
diff changeset
    19
       classVariableNames:'' 
claus
parents:
diff changeset
    20
       poolDictionaries:''
claus
parents:
diff changeset
    21
       category:'Graphics-Support'
claus
parents:
diff changeset
    22
!
claus
parents:
diff changeset
    23
claus
parents:
diff changeset
    24
GraphicsAttributes comment:'
claus
parents:
diff changeset
    25
COPYRIGHT (c) 1992 by Claus Gittinger
claus
parents:
diff changeset
    26
	      All Rights Reserved
claus
parents:
diff changeset
    27
claus
parents:
diff changeset
    28
$Header: /cvs/stx/stx/libview/GraphicsAttributes.st,v 1.1 1995-06-06 04:07:14 claus Exp $
claus
parents:
diff changeset
    29
'!
claus
parents:
diff changeset
    30
claus
parents:
diff changeset
    31
!GraphicsAttributes class methodsFor:'documentation'!
claus
parents:
diff changeset
    32
claus
parents:
diff changeset
    33
copyright
claus
parents:
diff changeset
    34
"
claus
parents:
diff changeset
    35
 COPYRIGHT (c) 1992 by Claus Gittinger
claus
parents:
diff changeset
    36
	      All Rights Reserved
claus
parents:
diff changeset
    37
claus
parents:
diff changeset
    38
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    39
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    40
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    41
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    42
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    43
 hereby transferred.
claus
parents:
diff changeset
    44
"
claus
parents:
diff changeset
    45
!
claus
parents:
diff changeset
    46
claus
parents:
diff changeset
    47
version
claus
parents:
diff changeset
    48
"
claus
parents:
diff changeset
    49
$Header: /cvs/stx/stx/libview/GraphicsAttributes.st,v 1.1 1995-06-06 04:07:14 claus Exp $
claus
parents:
diff changeset
    50
"
claus
parents:
diff changeset
    51
!
claus
parents:
diff changeset
    52
claus
parents:
diff changeset
    53
documentation
claus
parents:
diff changeset
    54
"
claus
parents:
diff changeset
    55
    instances keep multiple graphics attributes as used in a graphicsContext.
claus
parents:
diff changeset
    56
    They can be used when multiple attributes are to be set.
claus
parents:
diff changeset
    57
claus
parents:
diff changeset
    58
    Instance variables:
claus
parents:
diff changeset
    59
claus
parents:
diff changeset
    60
	paint           <Color>         the paint to be used for drawing
claus
parents:
diff changeset
    61
	font            <Font>          the font to be used for drawing
claus
parents:
diff changeset
    62
	lineStyle       <Symbol>        the lineStyle (i.e. #solid, #dashed, #doubleDashed)
claus
parents:
diff changeset
    63
	lineWidth       <SmallInteger>  the lineWidth (device dependent, usually pixels)
claus
parents:
diff changeset
    64
	joinStyle       <Symbol>        the style in which lines (in polygons)
claus
parents:
diff changeset
    65
					are joined (i.e. #miter, #bevel, #round)
claus
parents:
diff changeset
    66
	capStyle        <Symbol>        the style in which the last point of a line is drawn
claus
parents:
diff changeset
    67
					(i.e. #notLast, #butt, #round, #projecting)
claus
parents:
diff changeset
    68
	maskOrigin      <Point>         the origin of the mask relative to
claus
parents:
diff changeset
    69
					the drawables origin
claus
parents:
diff changeset
    70
claus
parents:
diff changeset
    71
    CAVEAT: the maskOrigin is called phase in ST-80
claus
parents:
diff changeset
    72
"
claus
parents:
diff changeset
    73
! !
claus
parents:
diff changeset
    74
claus
parents:
diff changeset
    75
!GraphicsAttributes methodsFor:'installing'!
claus
parents:
diff changeset
    76
claus
parents:
diff changeset
    77
installOn:aGC
claus
parents:
diff changeset
    78
    paint notNil ifTrue:[aGC paint:paint].
claus
parents:
diff changeset
    79
    font notNil ifTrue:[aGC font:font].
claus
parents:
diff changeset
    80
    lineWIdth notNil ifTrue:[aGC lineWidth:lineWidth].
claus
parents:
diff changeset
    81
    lineStyle notNil ifTrue:[aGC lineStyle:lineStyle].
claus
parents:
diff changeset
    82
    joinStyle notNil ifTrue:[aGC joinStyle:joinStyle].
claus
parents:
diff changeset
    83
    capStyle notNil ifTrue:[aGC capStyle:capStyle].
claus
parents:
diff changeset
    84
    maskOrigin notNil ifTrue:[aGC maskOrigin:capStyle].
claus
parents:
diff changeset
    85
! !
claus
parents:
diff changeset
    86
claus
parents:
diff changeset
    87
!GraphicsAttributes methodsFor:'accessing'!
claus
parents:
diff changeset
    88
claus
parents:
diff changeset
    89
paint
claus
parents:
diff changeset
    90
    "return the current paint drawing color"
claus
parents:
diff changeset
    91
claus
parents:
diff changeset
    92
    ^ paint
claus
parents:
diff changeset
    93
!
claus
parents:
diff changeset
    94
claus
parents:
diff changeset
    95
paint:aColor
claus
parents:
diff changeset
    96
    "set the drawing painting color"
claus
parents:
diff changeset
    97
claus
parents:
diff changeset
    98
    paint := aColor
claus
parents:
diff changeset
    99
!
claus
parents:
diff changeset
   100
claus
parents:
diff changeset
   101
lineWidth
claus
parents:
diff changeset
   102
    "return the drawing linewidth"
claus
parents:
diff changeset
   103
claus
parents:
diff changeset
   104
    ^ lineWidth
claus
parents:
diff changeset
   105
!
claus
parents:
diff changeset
   106
claus
parents:
diff changeset
   107
lineWidth:aNumber
claus
parents:
diff changeset
   108
    "set the line drawing width in pixels"
claus
parents:
diff changeset
   109
claus
parents:
diff changeset
   110
    lineWidth := aNumber
claus
parents:
diff changeset
   111
!
claus
parents:
diff changeset
   112
claus
parents:
diff changeset
   113
lineStyle
claus
parents:
diff changeset
   114
    "return the line-drawing-style"
claus
parents:
diff changeset
   115
claus
parents:
diff changeset
   116
    ^ lineStyle
claus
parents:
diff changeset
   117
!
claus
parents:
diff changeset
   118
claus
parents:
diff changeset
   119
lineStyle:aStyleSymbol
claus
parents:
diff changeset
   120
    "set the line-drawing-style;
claus
parents:
diff changeset
   121
     possible styles are: #solid, #dashed, #doubleDashed"
claus
parents:
diff changeset
   122
claus
parents:
diff changeset
   123
    lineStyle := aStyleSymbol
claus
parents:
diff changeset
   124
!
claus
parents:
diff changeset
   125
claus
parents:
diff changeset
   126
capStyle
claus
parents:
diff changeset
   127
    "return the cap-style for line-drawing"
claus
parents:
diff changeset
   128
claus
parents:
diff changeset
   129
    ^ capStyle
claus
parents:
diff changeset
   130
!
claus
parents:
diff changeset
   131
claus
parents:
diff changeset
   132
capStyle:aStyleSymbol
claus
parents:
diff changeset
   133
    "set the cap-style for line-drawing;
claus
parents:
diff changeset
   134
     possible styles are: #notLast, #butt, #round, #projecting"
claus
parents:
diff changeset
   135
claus
parents:
diff changeset
   136
    capStyle := aStyleSymbol
claus
parents:
diff changeset
   137
!
claus
parents:
diff changeset
   138
claus
parents:
diff changeset
   139
joinStyle
claus
parents:
diff changeset
   140
    "return the join-style for polygon-drawing"
claus
parents:
diff changeset
   141
claus
parents:
diff changeset
   142
    ^ joinStyle
claus
parents:
diff changeset
   143
!
claus
parents:
diff changeset
   144
claus
parents:
diff changeset
   145
joinStyle:aStyleSymbol
claus
parents:
diff changeset
   146
    "set the join-style of lines in polygon-drawing;
claus
parents:
diff changeset
   147
     possible styles are: #miter, #bevel, #round"
claus
parents:
diff changeset
   148
claus
parents:
diff changeset
   149
    joinStyle := aStyleSymbol
claus
parents:
diff changeset
   150
!
claus
parents:
diff changeset
   151
claus
parents:
diff changeset
   152
font
claus
parents:
diff changeset
   153
    "return the drawing font"
claus
parents:
diff changeset
   154
claus
parents:
diff changeset
   155
    ^ font
claus
parents:
diff changeset
   156
!
claus
parents:
diff changeset
   157
claus
parents:
diff changeset
   158
font:aFont
claus
parents:
diff changeset
   159
    "set the drawing font"
claus
parents:
diff changeset
   160
claus
parents:
diff changeset
   161
    font := aFont
claus
parents:
diff changeset
   162
!
claus
parents:
diff changeset
   163
claus
parents:
diff changeset
   164
maskOrigin:aPoint
claus
parents:
diff changeset
   165
    "set the origin within the mask (used to draw with patterns).
claus
parents:
diff changeset
   166
     This is an alias for ST-80's #phase"
claus
parents:
diff changeset
   167
claus
parents:
diff changeset
   168
    maskOrigin := aPoint
claus
parents:
diff changeset
   169
!
claus
parents:
diff changeset
   170
claus
parents:
diff changeset
   171
maskOriginX:x y:y
claus
parents:
diff changeset
   172
    "set the origin within the mask (used to draw with patterns)."
claus
parents:
diff changeset
   173
claus
parents:
diff changeset
   174
    ^ maskOrigin
claus
parents:
diff changeset
   175
!
claus
parents:
diff changeset
   176
claus
parents:
diff changeset
   177
phase:aPoint
claus
parents:
diff changeset
   178
    "set the origin within the mask (used to draw with patterns).
claus
parents:
diff changeset
   179
     This is an alias for ST/X's #maskOrigin:"
claus
parents:
diff changeset
   180
claus
parents:
diff changeset
   181
    maskOrigin := aPoint
claus
parents:
diff changeset
   182
!
claus
parents:
diff changeset
   183
claus
parents:
diff changeset
   184
phase
claus
parents:
diff changeset
   185
    "return the origin within the mask (used to draw with patterns).
claus
parents:
diff changeset
   186
     This is an alias for ST/X's #maskOrigin"
claus
parents:
diff changeset
   187
claus
parents:
diff changeset
   188
    ^ maskOrigin
claus
parents:
diff changeset
   189
! !
claus
parents:
diff changeset
   190
claus
parents:
diff changeset
   191