GraphicsAttributes.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 06 Sep 2017 10:04:18 +0200
branchjv
changeset 8180 25149dfd68e0
parent 6528 62c1dbef0b84
permissions -rw-r--r--
Build files: removed a bunch of make rules for long-dead unsupported systems ...in order to unify and simplify the build. If a need to support this ancient systems arose, these hacks may ni longer be needed (due to new versions of tools) or the hacks would have to be written again (better) or retrieved from SCM (worse). Time will show.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
151
claus
parents:
diff changeset
     1
"
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
151
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
"
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    12
"{ Package: 'stx:libview' }"
151
claus
parents:
diff changeset
    13
claus
parents:
diff changeset
    14
Object subclass:#GraphicsAttributes
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    15
	instanceVariableNames:'paint font lineStyle lineWidth joinStyle capStyle maskOrigin'
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    16
	classVariableNames:''
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    17
	poolDictionaries:''
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    18
	category:'Graphics-Support'
151
claus
parents:
diff changeset
    19
!
claus
parents:
diff changeset
    20
claus
parents:
diff changeset
    21
!GraphicsAttributes class methodsFor:'documentation'!
claus
parents:
diff changeset
    22
claus
parents:
diff changeset
    23
copyright
claus
parents:
diff changeset
    24
"
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
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    33
 hereby transferred.
claus
parents:
diff changeset
    34
"
claus
parents:
diff changeset
    35
!
claus
parents:
diff changeset
    36
claus
parents:
diff changeset
    37
documentation
claus
parents:
diff changeset
    38
"
claus
parents:
diff changeset
    39
    instances keep multiple graphics attributes as used in a graphicsContext.
claus
parents:
diff changeset
    40
    They can be used when multiple attributes are to be set.
157
claus
parents: 154
diff changeset
    41
    This class is (currently) not used by the system, but has been added
claus
parents: 154
diff changeset
    42
    to make porting of existing ST-80 applications easier.
151
claus
parents:
diff changeset
    43
claus
parents:
diff changeset
    44
    Instance variables:
claus
parents:
diff changeset
    45
claus
parents:
diff changeset
    46
	paint           <Color>         the paint to be used for drawing
claus
parents:
diff changeset
    47
	font            <Font>          the font to be used for drawing
claus
parents:
diff changeset
    48
	lineStyle       <Symbol>        the lineStyle (i.e. #solid, #dashed, #doubleDashed)
claus
parents:
diff changeset
    49
	lineWidth       <SmallInteger>  the lineWidth (device dependent, usually pixels)
claus
parents:
diff changeset
    50
	joinStyle       <Symbol>        the style in which lines (in polygons)
claus
parents:
diff changeset
    51
					are joined (i.e. #miter, #bevel, #round)
claus
parents:
diff changeset
    52
	capStyle        <Symbol>        the style in which the last point of a line is drawn
claus
parents:
diff changeset
    53
					(i.e. #notLast, #butt, #round, #projecting)
claus
parents:
diff changeset
    54
	maskOrigin      <Point>         the origin of the mask relative to
claus
parents:
diff changeset
    55
					the drawables origin
claus
parents:
diff changeset
    56
claus
parents:
diff changeset
    57
    CAVEAT: the maskOrigin is called phase in ST-80
claus
parents:
diff changeset
    58
"
claus
parents:
diff changeset
    59
! !
claus
parents:
diff changeset
    60
claus
parents:
diff changeset
    61
!GraphicsAttributes methodsFor:'accessing'!
claus
parents:
diff changeset
    62
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    63
capStyle
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    64
    "return the cap-style for line-drawing"
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    65
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    66
    ^ capStyle
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    67
!
151
claus
parents:
diff changeset
    68
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    69
capStyle:aStyleSymbol
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    70
    "set the cap-style for line-drawing;
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    71
     possible styles are: #notLast, #butt, #round, #projecting"
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    72
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    73
    capStyle := aStyleSymbol
151
claus
parents:
diff changeset
    74
!
claus
parents:
diff changeset
    75
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    76
font
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    77
    "return the drawing font"
151
claus
parents:
diff changeset
    78
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    79
    ^ font
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    80
!
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    81
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    82
font:aFont
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    83
    "set the drawing font"
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    84
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    85
    font := aFont
151
claus
parents:
diff changeset
    86
!
claus
parents:
diff changeset
    87
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    88
joinStyle
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    89
    "return the join-style for polygon-drawing"
151
claus
parents:
diff changeset
    90
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    91
    ^ joinStyle
151
claus
parents:
diff changeset
    92
!
claus
parents:
diff changeset
    93
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    94
joinStyle:aStyleSymbol
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    95
    "set the join-style of lines in polygon-drawing;
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    96
     possible styles are: #miter, #bevel, #round"
151
claus
parents:
diff changeset
    97
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
    98
    joinStyle := aStyleSymbol
151
claus
parents:
diff changeset
    99
!
claus
parents:
diff changeset
   100
claus
parents:
diff changeset
   101
lineStyle
claus
parents:
diff changeset
   102
    "return the line-drawing-style"
claus
parents:
diff changeset
   103
claus
parents:
diff changeset
   104
    ^ lineStyle
claus
parents:
diff changeset
   105
!
claus
parents:
diff changeset
   106
claus
parents:
diff changeset
   107
lineStyle:aStyleSymbol
claus
parents:
diff changeset
   108
    "set the line-drawing-style;
claus
parents:
diff changeset
   109
     possible styles are: #solid, #dashed, #doubleDashed"
claus
parents:
diff changeset
   110
claus
parents:
diff changeset
   111
    lineStyle := aStyleSymbol
claus
parents:
diff changeset
   112
!
claus
parents:
diff changeset
   113
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   114
lineWidth
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   115
    "return the drawing linewidth"
151
claus
parents:
diff changeset
   116
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   117
    ^ lineWidth
151
claus
parents:
diff changeset
   118
!
claus
parents:
diff changeset
   119
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   120
lineWidth:aNumber
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   121
    "set the line drawing width in pixels"
151
claus
parents:
diff changeset
   122
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   123
    lineWidth := aNumber
151
claus
parents:
diff changeset
   124
!
claus
parents:
diff changeset
   125
claus
parents:
diff changeset
   126
maskOrigin:aPoint
claus
parents:
diff changeset
   127
    "set the origin within the mask (used to draw with patterns).
claus
parents:
diff changeset
   128
     This is an alias for ST-80's #phase"
claus
parents:
diff changeset
   129
claus
parents:
diff changeset
   130
    maskOrigin := aPoint
claus
parents:
diff changeset
   131
!
claus
parents:
diff changeset
   132
claus
parents:
diff changeset
   133
maskOriginX:x y:y
claus
parents:
diff changeset
   134
    "set the origin within the mask (used to draw with patterns)."
claus
parents:
diff changeset
   135
claus
parents:
diff changeset
   136
    ^ maskOrigin
claus
parents:
diff changeset
   137
!
claus
parents:
diff changeset
   138
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   139
paint
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   140
    "return the current paint drawing color"
151
claus
parents:
diff changeset
   141
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   142
    ^ paint
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   143
!
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   144
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   145
paint:aColor
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   146
    "set the drawing painting color"
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   147
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   148
    paint := aColor
151
claus
parents:
diff changeset
   149
!
claus
parents:
diff changeset
   150
claus
parents:
diff changeset
   151
phase
claus
parents:
diff changeset
   152
    "return the origin within the mask (used to draw with patterns).
claus
parents:
diff changeset
   153
     This is an alias for ST/X's #maskOrigin"
claus
parents:
diff changeset
   154
claus
parents:
diff changeset
   155
    ^ maskOrigin
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   156
!
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   157
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   158
phase:aPoint
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   159
    "set the origin within the mask (used to draw with patterns).
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   160
     This is an alias for ST/X's #maskOrigin:"
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   161
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   162
    maskOrigin := aPoint
151
claus
parents:
diff changeset
   163
! !
claus
parents:
diff changeset
   164
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   165
!GraphicsAttributes methodsFor:'installing'!
151
claus
parents:
diff changeset
   166
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   167
installOn:aGC
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   168
    paint notNil ifTrue:[aGC paint:paint].
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   169
    font notNil ifTrue:[aGC font:font].
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   170
    lineWidth notNil ifTrue:[aGC lineWidth:lineWidth].
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   171
    lineStyle notNil ifTrue:[aGC lineStyle:lineStyle].
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   172
    joinStyle notNil ifTrue:[aGC joinStyle:joinStyle].
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   173
    capStyle notNil ifTrue:[aGC capStyle:capStyle].
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   174
    maskOrigin notNil ifTrue:[aGC maskOrigin:capStyle].
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   175
! !
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   176
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   177
!GraphicsAttributes class methodsFor:'documentation'!
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   178
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   179
version
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   180
    ^ '$Header: /cvs/stx/stx/libview/GraphicsAttributes.st,v 1.4 1995-11-11 15:51:01 cg Exp $'
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   181
! !
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 219
diff changeset
   182