GraphicsContext.st
author ca
Thu, 13 Feb 1997 22:55:41 +0100
changeset 1346 619cd027ce68
parent 1319 4f21750c19bf
child 1431 d84f96e80223
permissions -rw-r--r--
commentary
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     1
"
6
7ee0cfde237d *** empty log message ***
claus
parents: 5
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
     3
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     4
48194c26a46c Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
"
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
48194c26a46c Initial revision
claus
parents:
diff changeset
    13
Object subclass:#GraphicsContext
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
    14
	instanceVariableNames:'device paint bgPaint function font lineStyle lineWidth joinStyle
716
b83fee8ff1b3 moved clipRect up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    15
		capStyle mask maskOrigin transformation clipRect'
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
    16
	classVariableNames:'White Black DefaultFont'
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
    17
	poolDictionaries:''
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
    18
	category:'Graphics-Support'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    19
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    20
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
    21
!GraphicsContext class methodsFor:'documentation'!
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    22
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    23
copyright
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    24
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    25
 COPYRIGHT (c) 1992 by Claus Gittinger
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    26
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    27
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    28
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    29
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    31
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    32
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    33
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    34
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    35
!
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    36
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    37
documentation
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    38
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    39
    this is an abstract superclass for all kinds of graphic drawables -
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    40
    both windows and printed pages (i.e. printers) are inheriting from
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    41
    this class (even drawables not at all associated with any device would do so).
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    42
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
    43
    Drawing is done in paint/bgPaint colors, which can be true colors (i.e.
db983d8d7e53 scaling
claus
parents: 71
diff changeset
    44
    directly supported by the underlying hardware) or simulated colors
db983d8d7e53 scaling
claus
parents: 71
diff changeset
    45
    (i.e. dithered colors or images).
db983d8d7e53 scaling
claus
parents: 71
diff changeset
    46
    The paint/bgPaint instance variables are set to the logical colors,
db983d8d7e53 scaling
claus
parents: 71
diff changeset
    47
    device specific drawable may like to keep actual colors in addition.
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    48
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    49
    The transformation instance variable is typically nil, for a 1-to-1
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    50
    coordinate mapping (i.e. x/y coordinates are pixels in the drawable).
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    51
    If nonNil, the transformation must be an  instance of WindowingTransformation
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    52
    and offers both a scale-factor and a translation.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    53
    Also, drawing in metric- or inch-units can be done using transformations.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    54
    (see instance creation methods of WindowingTransformation, and examples
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    55
     in 'doc/coding').
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    56
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    57
    All drawing is defined upon a few basic drawing methods, which must be 
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    58
    implemented by subclasses (some subclasses also redefine the others for
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    59
    more performance)
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    60
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    61
    [Instance variables:]
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    62
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    63
        paint           <Color>         the paint used for drawing
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    64
        bgPaint         <Color>         the background used for drawing texts and bitmaps
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    65
        function        <Symbol>        the drawing function (i.e. #copy, #or, #xor ...)
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    66
                                        - not all Drawables support every function
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    67
                                        (i.e. paper only allows #copy)
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    68
        font            <Font>          the current font to be used for drawing
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    69
        lineStyle       <Symbol>        the lineStyle (i.e. #solid, #dashed, #doubleDashed)
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    70
        lineWidth       <SmallInteger>  the lineWidth (device dependent, usually pixels)
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    71
        joinStyle       <Symbol>        the style in which lines (in polygons)
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    72
                                        are joined (i.e. #miter, #bevel, #round)
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    73
        capStyle        <Symbol>        the style in which the last point of a line is drawn
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    74
                                        (i.e. #notLast, #butt, #round, #projecting)
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    75
        mask            <Form>          a mask used for drawing
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    76
                                        - not all Drawables support it
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    77
        maskOrigin      <Point>         the origin of the mask relative to
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    78
                                        the drawables origin
716
b83fee8ff1b3 moved clipRect up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    79
	transformation
b83fee8ff1b3 moved clipRect up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    80
		        <WindowingTransformation>
b83fee8ff1b3 moved clipRect up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    81
				        controls scale & translation of nonNil
b83fee8ff1b3 moved clipRect up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    82
b83fee8ff1b3 moved clipRect up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    83
	clipRect	<Rectangle>	a clip rectangle (device dep. usually pixels or inches)
b83fee8ff1b3 moved clipRect up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    84
					or nil.
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    85
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    86
    [Class variables:[
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    87
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    88
        White           <Color>         cached white color - its needed so often
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    89
        Black           <Color>         cached black color - its needed so often
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    90
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    91
        DefaultFont     <Font>          default font to use
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    92
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    93
    [author:]
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    94
        Claus Gittinger
657
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
    95
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
    96
    [see also:]
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
    97
        Color Font Form Image
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
    98
        Geometric
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
    99
        DeviceWorkstation
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   100
"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   101
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   102
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   103
examples
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   104
"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   105
    drawing uses a paint color (which may be a dithered one) which is
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   106
    used like a `pen'. 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   107
    A few drawing operations (opaqueForm and opaqueString drawing)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   108
    use two colors, the paint and a backgroundPaint. For example,
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   109
    normal string drawing (#displayString:...) only draws the fonts
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   110
    on-pixels in the current paint, leaving off-pixels unchanged.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   111
    In contrast, #drawOpaqueString:.. also changes these to the bgPaint color.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   112
    The bgPaint can be changed with #backgroundPaint: or #paint:on: (which modifies both).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   113
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   114
    lets try it in a view:
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   115
                                                                        [exBegin]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   116
        |v|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   117
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   118
        v := View new.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   119
        v openAndWait.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   120
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   121
        v paint:(Color red).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   122
        v displayString:'hello' x:10 y:50
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   123
                                                                        [exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   124
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   125
    the same using opaque drawing:
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   126
                                                                        [exBegin]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   127
        |v|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   128
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   129
        v := View new.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   130
        v openAndWait.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   131
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   132
        v paint:(Color red) on:(Color yellow).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   133
        v displayOpaqueString:'hello' x:10 y:50
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   134
                                                                        [exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   135
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   136
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   137
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   138
    Lines are drawn using the paint color (if solid) or both paint and bgPaint
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   139
    (dashed lines). The look of the line is controlled by joinStyle, capStyle,
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   140
    lineWidth and lineStyle.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   141
    `lineStyle' can be one of #solid, #dashed, #doubleDashed
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   142
    where: #solid        - is for solid lines, drawn with the current paint color 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   143
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   144
           #dashed       - for dashed lines, where only the on-dashes are drawn
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   145
                           with the current paint color
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   146
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   147
           #doubleDashed - dashed lines, draws on-dashes with paint color,
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   148
                           off-dashes with bgPaint
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   149
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   150
    for example:
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   151
                                                                        [exBegin]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   152
        |v|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   153
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   154
        v := View new.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   155
        v openAndWait.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   156
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   157
        v paint:(Color red) on:(Color blue).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   158
        v displayLineFrom:(10@10) to:(90@90).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   159
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   160
        v lineStyle:#dashed.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   161
        v displayLineFrom:(90@10) to:(10@90).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   162
        
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   163
        v lineStyle:#doubleDashed.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   164
        v displayRectangle:((5@5) corner:(95@95)).
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   165
                                                                        [exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   166
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   167
    changing the line-width:
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   168
                                                                        [exBegin]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   169
        |v|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   170
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   171
        v := View new.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   172
        v openAndWait.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   173
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   174
        v paint:(Color red).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   175
        v displayLineFrom:(20@20) to:(80@80).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   176
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   177
        v lineWidth:5.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   178
        v displayLineFrom:(80@20) to:(20@80).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   179
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   180
        v lineWidth:8.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   181
        v displayRectangle:((5@5) corner:(95@95)).
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   182
                                                                        [exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   183
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   184
    with wide lines, the corners (of polygons or rectangles) can be
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   185
    one of the joinStyles: #miter, #bevel, #round. The default is #miter.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   186
                                                                        [exBegin]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   187
        |v|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   188
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   189
        v := View new extent:200@200.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   190
        v openAndWait.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   191
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   192
        v lineWidth:15.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   193
        v paint:(Color red).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   194
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   195
        v displayRectangle:((65@65) corner:(135@135)).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   196
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   197
        v joinStyle:#bevel.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   198
        v displayRectangle:((45@45) corner:(155@155)).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   199
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   200
        v joinStyle:#round.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   201
        v displayRectangle:((25@25) corner:(175@175)).
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   202
                                                                        [exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   203
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   204
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   205
    the endPoints look is controlled with capStyle;
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   206
    possible values are: #notLast, #butt, #round, #projecting.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   207
    The default is #butt. 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   208
    #notLast is mostly useful when exoring (inverting): it will not draw the
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   209
    endPoint, to allow another line to join the previous line without inverting
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   210
    this point twice. (See the X manual for more info).
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   211
                                                                        [exBegin]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   212
        |v|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   213
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   214
        v := View new extent:200@200.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   215
        v openAndWait.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   216
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   217
        v lineWidth:15.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   218
        v paint:(Color red).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   219
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   220
        v displayLineFrom:(25@25) to:(175@25).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   221
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   222
        v capStyle:#round.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   223
        v displayLineFrom:(25@55) to:(175@55).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   224
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   225
        v capStyle:#projecting.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   226
        v displayLineFrom:(25@85) to:(175@85).
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   227
                                                                        [exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   228
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   229
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   230
    You can use a bitmap as a point color:
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   231
    (this may be slow on some graphics devices, though)
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   232
                                                                        [exBegin]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   233
        |v|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   234
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   235
        v := View new extent:200@200.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   236
        v openAndWait.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   237
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   238
        v lineWidth:15.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   239
        v paint:(Image fromFile:'granite_small.tiff').
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   240
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   241
        v displayLineFrom:(25@25) to:(175@25).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   242
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   243
        v capStyle:#round.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   244
        v displayLineFrom:(25@55) to:(175@55).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   245
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   246
        v capStyle:#projecting.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   247
        v displayLineFrom:(25@85) to:(175@85).
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   248
                                                                        [exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   249
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   250
    all views support a translation and scale, so you can draw in another
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   251
    coordinate system:
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   252
                                                                        [exBegin]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   253
        |v|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   254
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   255
        v := View new extent:200@200.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   256
        v openAndWait.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   257
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   258
        v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   259
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   260
        v scale:(2@2); translation:50.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   261
        v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   262
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   263
        v scale:(0.5@0.5); translation:0.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   264
        v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   265
                                                                        [exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   266
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   267
    if scaling is on, it is often useful to be able to draw individual
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   268
    things unscaled - this still translates the position, but
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   269
    uses the unscaled font (for example, to draw strings in a graphic):
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   270
                                                                        [exBegin]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   271
        |v|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   272
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   273
        v := View new extent:200@200.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   274
        v openAndWait.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   275
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   276
        v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   277
        v displayString:'hello' x:50 y:40.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   278
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   279
        v scale:(2@4).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   280
        v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   281
        v displayUnscaledString:'hello' x:50 y:40.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   282
                                                                        [exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   283
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   284
    Filled objects are drawin using the #fillXXX methods; for example,
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   285
    displayRectangleXXX draws the outline, while fillRectangleXXX draws a
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   286
    filled one:
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   287
                                                                        [exBegin]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   288
        |v|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   289
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   290
        v := View new extent:200@200.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   291
        v openAndWait.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   292
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   293
        v displayArcIn:(20@20 corner:50@50) from:0 angle:180.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   294
        v paint:Color yellow.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   295
        v fillArcIn:(120@120 corner:150@150) from:0 angle:180.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   296
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   297
        v paint:Color red.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   298
        v displayCircle:150@50 radius:30.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   299
        v paint:Color blue.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   300
        v fillCircle:50@150 radius:30.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   301
                                                                        [exEnd]
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   302
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   303
    polygons:
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   304
                                                                        [exBegin]
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   305
        |v poly1 poly2|
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   306
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   307
        poly1 := OrderedCollection new.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   308
        poly1 add:(10 @ 10).
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   309
        poly1 add:(100 @ 50).
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   310
        poly1 add:(50 @ 50).
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   311
        poly1 add:(20 @ 100).
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   312
        poly1 add:(10 @ 100).
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   313
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   314
        poly2 := poly1 copy.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   315
        poly2 add:(poly2 first).
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   316
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   317
        v := View new extent:200@200.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   318
        v openAndWait.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   319
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   320
        v scale:2.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   321
        v paint:Color red.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   322
        v fillPolygon:poly1.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   323
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   324
        v scale:1.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   325
        v paint:Color blue.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   326
        v displayPolygon:poly2.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   327
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   328
        v scale:0.5.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   329
        v paint:Color yellow.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   330
        v fillPolygon:poly1.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   331
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   332
                                                                        [exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   333
"
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   334
! !
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   335
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   336
!GraphicsContext class methodsFor:'initialization'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   337
48194c26a46c Initial revision
claus
parents:
diff changeset
   338
initialize
48194c26a46c Initial revision
claus
parents:
diff changeset
   339
    "setup some defaults - these are usually redefined
48194c26a46c Initial revision
claus
parents:
diff changeset
   340
     during startup."
48194c26a46c Initial revision
claus
parents:
diff changeset
   341
134
claus
parents: 109
diff changeset
   342
    White isNil ifTrue:[
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   343
	Color isNil ifTrue:[^ self].
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   344
	Display isNil ifTrue:[^ self].
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   345
134
claus
parents: 109
diff changeset
   346
	Color initialize.
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   347
134
claus
parents: 109
diff changeset
   348
	White := Color white on:Display.
claus
parents: 109
diff changeset
   349
	Black := Color black on:Display.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   350
134
claus
parents: 109
diff changeset
   351
	Font initialize.
claus
parents: 109
diff changeset
   352
	DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12
claus
parents: 109
diff changeset
   353
    ]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   354
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   355
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   356
!GraphicsContext class methodsFor:'instance creation'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   357
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   358
new
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   359
    "return a new instance of myself. Redefined to initialize
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   360
     the new thingy"
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   361
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   362
    ^ self basicNew initialize
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   363
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   364
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   365
!GraphicsContext class methodsFor:'accessing defaults'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   366
48194c26a46c Initial revision
claus
parents:
diff changeset
   367
defaultFont
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   368
    "get the default font used for drawing"
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   369
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   370
    DefaultFont isNil ifTrue:[
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   371
	DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   372
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   373
    ^ DefaultFont
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   374
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   375
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   376
defaultFont:aFont
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   377
    "set the default font used for drawing"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   378
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   379
    DefaultFont := aFont
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   380
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   381
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   382
!GraphicsContext class methodsFor:'constants'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   383
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   384
capButt
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   385
    "return a constant to specify butt cap"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   386
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   387
    ^ #butt
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   388
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   389
48194c26a46c Initial revision
claus
parents:
diff changeset
   390
capNotLast
48194c26a46c Initial revision
claus
parents:
diff changeset
   391
    "return a constant to specify not-last cap"
48194c26a46c Initial revision
claus
parents:
diff changeset
   392
48194c26a46c Initial revision
claus
parents:
diff changeset
   393
    ^ #notLast
48194c26a46c Initial revision
claus
parents:
diff changeset
   394
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   395
48194c26a46c Initial revision
claus
parents:
diff changeset
   396
capProjecting
48194c26a46c Initial revision
claus
parents:
diff changeset
   397
    "return a constant to specify projecting cap"
48194c26a46c Initial revision
claus
parents:
diff changeset
   398
48194c26a46c Initial revision
claus
parents:
diff changeset
   399
    ^ #projecting
48194c26a46c Initial revision
claus
parents:
diff changeset
   400
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   401
48194c26a46c Initial revision
claus
parents:
diff changeset
   402
capRound
48194c26a46c Initial revision
claus
parents:
diff changeset
   403
    "return a constant to specify round cap"
48194c26a46c Initial revision
claus
parents:
diff changeset
   404
48194c26a46c Initial revision
claus
parents:
diff changeset
   405
    ^ #round
48194c26a46c Initial revision
claus
parents:
diff changeset
   406
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   407
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   408
joinBevel
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   409
    "return a constant to specify bevel join"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   410
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   411
    ^ #bevel
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   412
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   413
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   414
joinMiter
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   415
    "return a constant to specify miter join"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   416
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   417
    ^ #miter
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   418
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   419
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   420
joinRound
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   421
    "return a constant to specify round join"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   422
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   423
    ^ #round
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   424
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   425
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   426
!GraphicsContext methodsFor:'ST-80 compatibility'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   427
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   428
findFont:aFontDescription
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   429
    "given a fontDescription, return a device font for it
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   430
     on my device."
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   431
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   432
    ^ aFontDescription on:device
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   433
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   434
    "Modified: 28.5.1996 / 20:22:29 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   435
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   436
785
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   437
phase
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   438
    "return the origin within the mask (used to draw with patterns).
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   439
     This is an alias for ST/X's #maskOrigin"
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   440
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   441
    ^ self maskOrigin
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   442
!
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   443
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   444
phase:aPoint
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   445
    "set the origin within the mask (used to draw with patterns).
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   446
     This is an alias for ST/X's #maskOrigin:"
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   447
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   448
    ^ self maskOrigin:aPoint
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   449
!
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   450
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   451
tilePhase
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   452
    "return the origin within the mask (used to draw with patterns).
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   453
     This is an alias for ST/X's #maskOrigin"
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   454
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   455
    ^ self maskOrigin
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   456
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   457
    "Created: 4.6.1996 / 15:26:39 / cg"
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   458
!
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   459
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   460
tilePhase:aPoint
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   461
    "set the origin within the mask (used to draw with patterns).
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   462
     This is an alias for ST/X's #maskOrigin"
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   463
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   464
    ^ self maskOrigin:aPoint
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   465
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   466
    "Created: 4.6.1996 / 15:26:49 / cg"
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   467
!
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   468
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   469
widthOfString:aString
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   470
    "given a string, return its width in pixels if
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   471
     drawn on the receivers device."
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   472
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   473
    ^ (font on:device) widthOf:aString
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   474
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   475
    "Modified: 28.5.1996 / 20:22:22 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   476
!
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   477
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   478
widthOfString:aString from:start to:stop
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   479
    "given a string, return the width in pixels if
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   480
     a substring is drawn on the receivers device."
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   481
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   482
    ^ (font on:device) widthOf:aString from:start to:stop
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   483
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   484
    "Modified: 28.5.1996 / 20:22:18 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   485
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   486
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   487
!GraphicsContext methodsFor:'ST-80 displaying'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   488
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   489
displayArc:origin radius:radius from:startAngle angle:angle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   490
    "draw an arc around a point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   491
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   492
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   493
        displayArcX:(origin x - radius)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   494
                  y:(origin y - radius)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   495
              width:(radius * 2) 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   496
             height:(radius * 2)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   497
               from:startAngle 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   498
              angle:angle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   499
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   500
    "Modified: 8.5.1996 / 08:34:43 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   501
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   502
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   503
displayArcBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle at:origin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   504
   "draw an arc/circle/ellipse - ST-80 compatibility"                                
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   505
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   506
   ^ self displayArcX:(boundingBox left + origin x)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   507
		    y:(boundingBox top + origin y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   508
		width:(boundingBox width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   509
	       height:(boundingBox height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   510
		 from:startAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   511
		angle:sweepAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   512
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   513
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   514
displayLineFrom:startPoint to:endPoint translateBy:anOffset
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   515
    "draw a line - ST-80 compatibility"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   516
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   517
    self displayLineFrom:(startPoint + anOffset)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   518
		      to:(endPoint + anOffset)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   519
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   520
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   521
displayPolyline:aPolygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   522
    "draw a polygon - ST-80 compatibility"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   523
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   524
    ^ self displayPolygon:aPolygon 
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   525
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   526
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   527
displayRectangularBorder:aRectangle at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   528
    "draw a rectangle - ST-80 compatibility"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   529
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   530
    self displayRectangle:(aRectangle translateBy:aPoint)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   531
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   532
1280
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   533
displayWedgeBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   534
   "fill an arc/circle/ellipse - ST-80 compatibility"
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   535
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   536
   ^ self fillArcX:(boundingBox left)
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   537
                 y:(boundingBox top)
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   538
             width:(boundingBox width)
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   539
            height:(boundingBox height)
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   540
              from:startAngle
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   541
             angle:sweepAngle
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   542
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   543
    "Created: 27.1.1997 / 15:50:14 / cg"
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   544
!
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   545
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   546
displayWedgeBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle at:origin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   547
   "fill an arc/circle/ellipse - ST-80 compatibility"
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   548
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   549
   ^ self fillArcX:(boundingBox left + origin x)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   550
		 y:(boundingBox top + origin y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   551
	     width:(boundingBox width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   552
	    height:(boundingBox height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   553
	      from:startAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   554
	     angle:sweepAngle
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   555
! !
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   556
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   557
!GraphicsContext methodsFor:'accessing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   558
48194c26a46c Initial revision
claus
parents:
diff changeset
   559
backgroundPaint
48194c26a46c Initial revision
claus
parents:
diff changeset
   560
    "return the background paint color.
48194c26a46c Initial revision
claus
parents:
diff changeset
   561
     (used for opaqueForms and opaqueStrings)"
48194c26a46c Initial revision
claus
parents:
diff changeset
   562
48194c26a46c Initial revision
claus
parents:
diff changeset
   563
    ^ bgPaint
48194c26a46c Initial revision
claus
parents:
diff changeset
   564
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   565
48194c26a46c Initial revision
claus
parents:
diff changeset
   566
backgroundPaint:aColor
48194c26a46c Initial revision
claus
parents:
diff changeset
   567
    "set the background painting color (which is used for
48194c26a46c Initial revision
claus
parents:
diff changeset
   568
     opaqueForms and opaqueStrings). aColor can be a dithered one."
48194c26a46c Initial revision
claus
parents:
diff changeset
   569
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   570
    bgPaint := aColor
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   571
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   572
    "Modified: 12.5.1996 / 22:25:17 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   573
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   574
48194c26a46c Initial revision
claus
parents:
diff changeset
   575
capStyle
48194c26a46c Initial revision
claus
parents:
diff changeset
   576
    "return the current cap-style for line-drawing"
48194c26a46c Initial revision
claus
parents:
diff changeset
   577
48194c26a46c Initial revision
claus
parents:
diff changeset
   578
    ^ capStyle
48194c26a46c Initial revision
claus
parents:
diff changeset
   579
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   580
48194c26a46c Initial revision
claus
parents:
diff changeset
   581
capStyle:aStyleSymbol
48194c26a46c Initial revision
claus
parents:
diff changeset
   582
    "set the cap-style for line-drawing;
48194c26a46c Initial revision
claus
parents:
diff changeset
   583
     possible styles are: #notLast, #butt, #round, #projecting"
48194c26a46c Initial revision
claus
parents:
diff changeset
   584
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   585
    aStyleSymbol isNil ifTrue:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   586
        capStyle := #butt
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   587
    ] ifFalse:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   588
        capStyle := aStyleSymbol
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   589
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   590
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   591
    "Modified: 12.5.1996 / 22:24:30 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   592
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   593
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   594
clipRect
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   595
    "return the clip-rectangle for drawing.
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   596
     If there is currently no active clip, return the underlying
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   597
     displaySurfaces (i.e. views) bounds. Added for ST-80 compatibility."
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   598
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   599
    self obsoleteMethodWarning:'use #clippingBounds'.
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   600
    ^ self clippingBounds.
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   601
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   602
    "Modified: 28.5.1996 / 14:14:53 / cg"
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   603
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   604
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   605
clipRect:aRectangle
48194c26a46c Initial revision
claus
parents:
diff changeset
   606
    "set the drawing clip-rectangle"
48194c26a46c Initial revision
claus
parents:
diff changeset
   607
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   608
    self obsoleteMethodWarning:'use #clippingRectangle:'.
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   609
    ^ self clippingRectangle:aRectangle
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   610
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   611
    "Modified: 28.5.1996 / 14:13:09 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   612
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   613
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   614
clippingBounds
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   615
    "return the clip-rectangle for drawing.
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   616
     If there is currently no active clip, return the underlying
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   617
     displaySurfaces (i.e. views) bounds. Added for ST-80 compatibility."
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   618
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   619
    |rect|
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   620
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   621
    clipRect isNil ifTrue:[
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   622
        rect := 0@0 extent:(self medium extent).
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   623
        transformation notNil ifTrue:[
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   624
            rect := transformation applyInverseTo:rect.
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   625
        ].
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   626
        ^ rect
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   627
    ].
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   628
    ^ clipRect
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   629
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   630
    "Modified: 28.5.1996 / 14:05:15 / cg"
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   631
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   632
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   633
clippingRectangle:aRectangleOrNil
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   634
    "set the clipping rectangle for drawing (in logical coordinates);
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   635
     a nil argument turn off clipping (i.e. whole view is drawable)"
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   636
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   637
    clipRect := aRectangleOrNil
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   638
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   639
    "Modified: 22.5.1996 / 13:12:07 / cg"
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   640
    "Created: 28.5.1996 / 14:09:27 / cg"
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   641
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   642
561
3c1ec7798f77 added #clippingRectangleOrNil for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   643
clippingRectangleOrNil
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   644
    "return the clipping rectangle for drawing, nil if there is none."
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   645
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   646
    ^ clipRect
561
3c1ec7798f77 added #clippingRectangleOrNil for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   647
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   648
    "Created: 10.4.1996 / 14:32:02 / cg"
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   649
    "Modified: 28.5.1996 / 14:08:19 / cg"
561
3c1ec7798f77 added #clippingRectangleOrNil for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   650
!
3c1ec7798f77 added #clippingRectangleOrNil for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   651
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   652
dashStyle:aDashList offset:dashOffset
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   653
    "define dashes. Each element of the dashList specifies the length
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   654
     of a corresponding dash. For example, setting it to [4 4]
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   655
     defines 4on-4off dashing; 
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   656
     Setting it to [1 2 4 2] defines 1on-2off-4on-2off dashes.
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   657
     The dashOffset specifies where in the dashList the dashing starts.
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   658
     Ignored here - this may not be supported by all graphics devices."
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   659
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   660
    ^ self
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   661
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   662
    "Created: 4.6.1996 / 18:59:34 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   663
    "Modified: 4.6.1996 / 19:03:38 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   664
!
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   665
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   666
font
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   667
    "return the current drawing font"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   668
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   669
    ^ font
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   670
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   671
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   672
font:aFont
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   673
    "set the drawing font"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   674
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   675
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   676
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   677
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   678
function
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   679
    "return the current drawing function"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   680
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   681
    ^ function
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   682
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   683
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   684
function:aFunctionSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   685
    "set the drawing function"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   686
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   687
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   688
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   689
735
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   690
graphicsContext
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   691
    "for ST-80 compatibility"
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   692
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   693
    ^ self
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   694
!
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   695
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   696
graphicsDevice
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   697
    "same as #device, for ST-80 compatibility"
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   698
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   699
    ^ device
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   700
!
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   701
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   702
joinStyle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   703
    "return the current join-style for polygon-drawing"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   704
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   705
    ^ joinStyle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   706
!
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   707
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   708
joinStyle:aStyleSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   709
    "set the join-style of lines in polygon-drawing;
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   710
     possible styles are: #miter, #bevel, #round"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   711
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   712
    aStyleSymbol isNil ifTrue:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   713
        joinStyle := #miter
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   714
    ] ifFalse:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   715
        joinStyle := aStyleSymbol
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   716
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   717
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   718
    "Modified: 12.5.1996 / 22:24:14 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   719
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   720
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   721
lineStyle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   722
    "return the current line-drawing-style"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   723
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   724
    ^ lineStyle
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   725
!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   726
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   727
lineStyle:aStyleSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   728
    "set the line-drawing-style;
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   729
     possible styles are: #solid, #dashed, #doubleDashed"
151
claus
parents: 134
diff changeset
   730
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   731
    aStyleSymbol isNil ifTrue:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   732
        lineStyle := #solid
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   733
    ] ifFalse:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   734
        lineStyle := aStyleSymbol
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   735
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   736
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   737
    "Modified: 12.5.1996 / 22:19:25 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   738
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   739
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   740
lineWidth
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   741
    "return the current drawing linewidth"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   742
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   743
    ^ lineWidth
151
claus
parents: 134
diff changeset
   744
!
claus
parents: 134
diff changeset
   745
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   746
lineWidth:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   747
    "set the line drawing width in pixels"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   748
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   749
    lineWidth := aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   750
!
151
claus
parents: 134
diff changeset
   751
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   752
mask
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   753
    "return the current drawing mask"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   754
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   755
    ^ mask
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   756
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   757
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   758
mask:aForm
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   759
    "set the drawing mask"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   760
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   761
    ^ self subclassResponsibility
151
claus
parents: 134
diff changeset
   762
!
claus
parents: 134
diff changeset
   763
claus
parents: 134
diff changeset
   764
maskOrigin
claus
parents: 134
diff changeset
   765
    "return the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   766
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   767
     This is an alias for ST-80's #phase"
claus
parents: 134
diff changeset
   768
claus
parents: 134
diff changeset
   769
    ^ maskOrigin
claus
parents: 134
diff changeset
   770
!
claus
parents: 134
diff changeset
   771
claus
parents: 134
diff changeset
   772
maskOrigin:aPoint
claus
parents: 134
diff changeset
   773
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   774
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   775
     This is an alias for ST-80's #phase:"
claus
parents: 134
diff changeset
   776
claus
parents: 134
diff changeset
   777
    ^ self maskOriginX:aPoint x y:aPoint y
claus
parents: 134
diff changeset
   778
!
claus
parents: 134
diff changeset
   779
claus
parents: 134
diff changeset
   780
maskOriginX:x y:y 
claus
parents: 134
diff changeset
   781
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   782
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   783
     This is an alias for ST-80's #phase:"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   784
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   785
    ^ self
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   786
!
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   787
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   788
medium
1346
619cd027ce68 commentary
ca
parents: 1319
diff changeset
   789
    "return the destination medium i.e. the underlying graphics device"
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   790
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   791
    ^ device
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   792
720
a582a7af45f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   793
    "Modified: 28.5.1996 / 14:26:03 / cg"
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   794
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   795
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   796
paint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   797
    "return the current paint drawing color"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   798
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   799
    ^ paint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   800
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   801
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   802
paint:aColor
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   803
    "set the drawing painting color, aColor can be a dithered one"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   804
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   805
    paint := aColor
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   806
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   807
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   808
paint:fgColor on:bgColor
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   809
    "set the paint and backgroundPaint, used for text and bitmaps.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   810
     Both colors may be dithered colors"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   811
671
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   812
    fgColor ~~ paint ifTrue:[
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   813
        self paint:fgColor.
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   814
    ].
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   815
    bgPaint := bgColor
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   816
671
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   817
    "Modified: 12.5.1996 / 19:40:43 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   818
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   819
151
claus
parents: 134
diff changeset
   820
setMaskOrigin:aPoint
claus
parents: 134
diff changeset
   821
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   822
     OBSOLETE: use #maskOrigin: or #phase:"
claus
parents: 134
diff changeset
   823
claus
parents: 134
diff changeset
   824
    ^ self maskOrigin:aPoint
claus
parents: 134
diff changeset
   825
!
claus
parents: 134
diff changeset
   826
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   827
setMaskOriginX:x y:y
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   828
    "set the origin within the mask (used to draw with patterns).
151
claus
parents: 134
diff changeset
   829
     OBSOLETE: use #maskOriginX:y: or #phase:"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   830
151
claus
parents: 134
diff changeset
   831
    ^ self maskOriginX:x y:y 
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   832
!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   833
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   834
viewOrigin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   835
    "return the drawables visible origin (for scrolling)"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   836
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   837
    ^ 0@0
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   838
! !
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   839
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   840
!GraphicsContext methodsFor:'accessing-transformation'!
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   841
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   842
scale
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   843
    "return the scale factor (as point) of the transformation"
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   844
707
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   845
    transformation isNil ifTrue:[^ 1@1].
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   846
    ^ transformation scale
707
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   847
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   848
    "Modified: 21.5.1996 / 21:16:47 / cg"
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   849
!
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   850
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   851
scale:aPoint
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   852
    "set the scale factor of the transformation"
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   853
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   854
    transformation isNil ifTrue:[
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   855
        aPoint = 1 ifTrue:[^ self].
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   856
        transformation := WindowingTransformation scale:aPoint translation:0
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   857
    ] ifFalse:[
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   858
        transformation scale:aPoint.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   859
    ]
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   860
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   861
    "Modified: 27.4.1996 / 18:47:38 / cg"
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   862
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   863
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   864
transformation 
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   865
    "return the transformation"
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   866
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   867
    ^ transformation
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   868
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   869
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   870
transformation:aTransformation 
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   871
    "set the transformation"
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   872
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   873
    transformation := aTransformation
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   874
!
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   875
1319
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   876
translateBy:aPoint
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   877
    "add to the translation offset of the transformation"
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   878
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   879
    transformation isNil ifTrue:[
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   880
        aPoint = 0 ifTrue:[^ self].
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   881
        transformation := WindowingTransformation scale:1 translation:aPoint
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   882
    ] ifFalse:[
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   883
        transformation translateBy:aPoint
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   884
    ]
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   885
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   886
    "Created: 10.2.1997 / 13:50:22 / cg"
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   887
!
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   888
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   889
translation
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   890
    "return the translation factor (as point) of the transformation"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   891
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   892
    transformation isNil ifTrue:[^ 0@0].
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   893
    ^ transformation translation
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   894
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   895
    "Created: 27.4.1996 / 18:46:41 / cg"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   896
!
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   897
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   898
translation:aPoint
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   899
    "set the translation offset of the transformation"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   900
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   901
    transformation isNil ifTrue:[
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   902
        aPoint = 0 ifTrue:[^ self].
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   903
        transformation := WindowingTransformation scale:1 translation:aPoint
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   904
    ] ifFalse:[
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   905
        transformation translation:aPoint.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   906
    ]
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   907
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   908
    "Created: 27.4.1996 / 18:47:28 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   909
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   910
755
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   911
!GraphicsContext methodsFor:'backward compatibility'!
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   912
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   913
withPattern:aPattern do:aBlock
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   914
    |old|
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   915
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   916
    aPattern isColor ifTrue:[
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   917
        old := paint.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   918
        self paint:aPattern.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   919
        aBlock value.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   920
        self paint:old
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   921
    ] ifFalse:[
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   922
        old := mask.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   923
        self mask:aPattern.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   924
        aBlock value.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   925
        self mask:old
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   926
    ]
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   927
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   928
    "Modified: 28.5.1996 / 22:45:40 / cg"
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   929
! !
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   930
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   931
!GraphicsContext methodsFor:'basic displaying'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   932
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   933
displayArcX:x y:y width:width height:height from:startAngle angle:angle
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   934
    "draw an arc in a box
48194c26a46c Initial revision
claus
parents:
diff changeset
   935
     - this could be recoded to draw using displayLine"
48194c26a46c Initial revision
claus
parents:
diff changeset
   936
48194c26a46c Initial revision
claus
parents:
diff changeset
   937
    ^ self subclassResponsibility
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   938
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   939
    "Created: 8.5.1996 / 08:47:06 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   940
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   941
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   942
displayLineFromX:x0 y:y0 toX:x1 y:y1
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   943
    "draw a line from x0/y0 to x1/y1"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   944
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   945
    ^ self subclassResponsibility
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   946
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   947
    "Created: 28.5.1996 / 17:12:37 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   948
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   949
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 24
diff changeset
   950
displayOpaqueForm:aForm x:x y:y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   951
    "draw a form at x/y; if the form has depth 1, 1's in the form are
48194c26a46c Initial revision
claus
parents:
diff changeset
   952
     drawn in current fg, 0's in current bg color.
48194c26a46c Initial revision
claus
parents:
diff changeset
   953
     If the form has depth ~~ 1, it is copied as is onto the receiver"
48194c26a46c Initial revision
claus
parents:
diff changeset
   954
48194c26a46c Initial revision
claus
parents:
diff changeset
   955
    ^ self subclassResponsibility
48194c26a46c Initial revision
claus
parents:
diff changeset
   956
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   957
48194c26a46c Initial revision
claus
parents:
diff changeset
   958
displayOpaqueString:aString from:index1 to:index2 x:x y:y
48194c26a46c Initial revision
claus
parents:
diff changeset
   959
    "draw part of a string with both fg and bg at x/y in current font"
48194c26a46c Initial revision
claus
parents:
diff changeset
   960
48194c26a46c Initial revision
claus
parents:
diff changeset
   961
    ^ self subclassResponsibility
48194c26a46c Initial revision
claus
parents:
diff changeset
   962
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   963
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   964
displayPolygon:aPolygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   965
    "draw a polygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   966
     - this could be recoded to draw using displayLine"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   967
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   968
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   969
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   970
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   971
displayRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   972
    "draw a rectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   973
     - this could be recoded to draw using displayLine"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   974
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   975
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   976
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   977
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   978
displayString:aString from:index1 to:index2 x:x y:y
48194c26a46c Initial revision
claus
parents:
diff changeset
   979
    "draw part of a string with fg at x/y in current font"
48194c26a46c Initial revision
claus
parents:
diff changeset
   980
48194c26a46c Initial revision
claus
parents:
diff changeset
   981
    ^ self subclassResponsibility
48194c26a46c Initial revision
claus
parents:
diff changeset
   982
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   983
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   984
!GraphicsContext methodsFor:'basic filling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   985
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   986
fillArcX:x y:y width:w height:h from:start angle:angle
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   987
    "fill an arc with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   988
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   989
    ^ self subclassResponsibility
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   990
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   991
    "Created: 8.5.1996 / 08:47:44 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   992
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   993
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   994
fillPolygon:points
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   995
    "fill a polygon with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   996
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   997
    ^ self subclassResponsibility
157
claus
parents: 151
diff changeset
   998
!
claus
parents: 151
diff changeset
   999
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1000
fillRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1001
    "fill a rectangle with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1002
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1003
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1004
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1005
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1006
!GraphicsContext methodsFor:'bit blitting'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1007
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1008
copyFrom:aGC toX:dstX y:dstY
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1009
    "copy from a drawable - maybe self"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1010
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1011
    self copyFrom:aGC x:0 y:0 toX:dstX y:dstY width:aGC width height:aGC height
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1012
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1013
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1014
copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1015
    "copy from a drawable - maybe self"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1016
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1017
    ^ self subclassResponsibility
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1018
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1019
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1020
copyFrom:aGC x:dstX y:dstY width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1021
    "copy from a drawable - maybe self"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1022
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1023
    self copyFrom:aGC x:0 y:0 toX:dstX y:dstY width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1024
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1025
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1026
!GraphicsContext methodsFor:'drawing'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1027
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1028
display:someObject at:aPoint
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1029
    "draw someObject - this must understand the #displayOn:at: message"
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1030
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1031
    someObject displayOn:self at:aPoint
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1032
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1033
    "Created: 28.5.1996 / 14:22:57 / cg"
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1034
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1035
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1036
displayArcIn:aRectangle from:startAngle angle:angle
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1037
    "draw an arc in a box"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1038
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1039
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1040
        displayArcX:(aRectangle left)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1041
                  y:(aRectangle top)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1042
              width:(aRectangle width)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1043
             height:(aRectangle height)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1044
               from:startAngle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1045
              angle:angle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1046
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1047
    "Modified: 8.5.1996 / 08:35:00 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1048
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1049
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1050
displayArcOrigin:origin corner:corner from:startAngle angle:angle
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1051
    "draw an arc in a box"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1052
48194c26a46c Initial revision
claus
parents:
diff changeset
  1053
    |left top right bot|
48194c26a46c Initial revision
claus
parents:
diff changeset
  1054
48194c26a46c Initial revision
claus
parents:
diff changeset
  1055
    left := origin x.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1056
    top := origin y.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1057
    right := corner x.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1058
    bot := corner y.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1059
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1060
        displayArcX:left 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1061
                  y:top
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1062
              width:(right - left + 1)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1063
             height:(bot - top + 1)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1064
               from:startAngle 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1065
              angle:angle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1066
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1067
    "Modified: 8.5.1996 / 08:35:25 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1068
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1069
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1070
displayArcX:x y:y w:w h:h from:startAngle angle:angle
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1071
    "draw an arc; apply transformation if nonNil"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1072
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1073
    self obsoleteMethodWarning:'use #displayArcX:y:width:height:from:angle:'.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1074
    self displayArcX:x y:y width:w height:h from:startAngle angle:angle
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1075
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1076
    "Modified: 8.5.1996 / 08:46:56 / cg"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1077
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1078
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1079
displayCircle:aPoint radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1080
    "draw a circle around a center point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1081
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1082
    self displayCircleX:(aPoint x) y:(aPoint y) radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1083
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1084
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1085
displayCircleIn:aRectangle
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1086
    "draw a circle in a box"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1087
48194c26a46c Initial revision
claus
parents:
diff changeset
  1088
    self
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1089
        displayArcX:(aRectangle left)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1090
                  y:(aRectangle top)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1091
              width:(aRectangle width)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1092
             height:(aRectangle height)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1093
               from:0 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1094
              angle:360
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1095
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1096
    "Modified: 8.5.1996 / 08:35:40 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1097
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1098
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1099
displayCircleX:x y:y radius:r
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1100
    "draw a circle around a center point"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1101
48194c26a46c Initial revision
claus
parents:
diff changeset
  1102
    |d|
48194c26a46c Initial revision
claus
parents:
diff changeset
  1103
    d := 2 * r.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1104
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1105
        displayArcX:(x - r) 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1106
                  y:(y - r)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1107
              width:d
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1108
             height:d
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1109
               from:0 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1110
              angle:360
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1111
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1112
    "Modified: 8.5.1996 / 08:36:03 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1113
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1114
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1115
displayForm:aForm at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1116
    "draw a form"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1117
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1118
    self displayForm:aForm x:(aPoint x) y:(aPoint y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1119
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1120
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1121
displayForm:aForm x:x y:y
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1122
    "draw a form at x/y; if the form has depth 1, 1's in the form are
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1123
     drawn in current paint color, 0's are ignored.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1124
     If the form has depth ~~ 1, the result is undefined"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1125
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1126
    |fg bg f noColor|
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1127
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1128
    fg := paint.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1129
    bg := bgPaint.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1130
    f := function.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1131
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1132
    f ~~ #copy ifTrue:[
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1133
        self error:'function not supported'.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1134
        ^ self
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1135
    ].
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1136
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1137
    noColor := Color noColor.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1138
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1139
     stamp out fg-pixels
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1140
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1141
    self paint:noColor on:Color allColor function:#and.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1142
    self displayOpaqueForm:aForm x:x y:y.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1143
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1144
     or-in fg-pixels
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1145
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1146
    self paint:fg on:Color noColor function:#or.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1147
    self displayOpaqueForm:aForm x:x y:y.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1148
    self paint:fg on:fg function:f.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1149
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1150
    "Modified: 28.5.1996 / 17:10:28 / cg"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1151
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1152
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1153
displayLineFrom:point1 to:point2
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1154
    "draw a line"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1155
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1156
    self displayLineFromX:(point1 x) y:(point1 y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1157
		      toX:(point2 x) y:(point2 y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1158
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1159
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1160
displayOpaqueString:aString at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1161
    "draw a string with both fg and bg"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1162
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1163
    self displayOpaqueString:aString x:(aPoint x) y:(aPoint y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1164
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1165
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1166
displayOpaqueString:aString from:start to:stop at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1167
    "draw part of a string - drawing both fg and bg"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1168
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1169
    ^ self displayOpaqueString:aString from:start to:stop x:aPoint x y:aPoint y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1170
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1171
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1172
displayOpaqueString:aString x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1173
    "draw a string with both fg and bg"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1174
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1175
    self displayOpaqueString:aString from:1 to:(aString size) x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1176
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1177
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1178
displayPoint:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1179
    "draw a pixel"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1180
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1181
    self displayPointX:(aPoint x) y:(aPoint y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1182
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1183
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1184
displayPointX:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1185
    "draw a point at x/y"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1186
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1187
    self displayLineFromX:x y:y toX:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1188
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1189
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1190
displayRectangle:aRectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1191
    "draw a rectangle"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1192
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1193
    self displayRectangleX:(aRectangle left)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1194
			 y:(aRectangle top)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1195
		     width:(aRectangle width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1196
		    height:(aRectangle height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1197
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1198
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1199
displayRectangleOrigin:origin corner:corner
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1200
    "draw a rectangle"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1201
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1202
    |top left|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1203
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1204
    left := origin x.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1205
    top := origin y.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1206
    self displayRectangleX:left y:top 
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1207
                     width:(corner x - left)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1208
                    height:(corner y - top)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1209
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1210
    "Modified: 13.4.1996 / 20:58:31 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1211
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1212
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1213
displayString:aString at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1214
    "draw a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1215
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1216
    self displayString:aString x:aPoint x y:aPoint y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1217
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1218
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1219
displayString:aString from:start to:stop at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1220
    "draw part of a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1221
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1222
    ^ self displayString:aString from:start to:stop x:aPoint x y:aPoint y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1223
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1224
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1225
displayString:aString x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1226
    "draw a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1227
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1228
    self displayString:aString from:1 to:(aString size) x:x y:y
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1229
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1230
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1231
fillArcX:x y:y w:w h:h from:startAngle angle:angle
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1232
    "draw a filled arc; apply transformation if nonNil"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1233
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1234
    self obsoleteMethodWarning:'use #fillArcX:y:width:height:from:angle:'.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1235
    self fillArcX:x y:y width:w height:h from:startAngle angle:angle
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1236
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1237
    "Modified: 8.5.1996 / 08:47:52 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1238
! !
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1239
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1240
!GraphicsContext methodsFor:'drawing in device coordinates'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1241
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1242
displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1243
    "draw a line in device coordinates"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1244
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1245
    |sav|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1246
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1247
    sav := transformation.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1248
    transformation := nil.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1249
    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1250
    transformation := sav
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1251
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1252
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1253
fillDeviceRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1254
    "fill a rectangle with current paint color (device coordinates)"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1255
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1256
    |sav|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1257
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1258
    sav := transformation.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1259
    transformation := nil.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1260
    self fillRectangleX:x y:y width:w height:h.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1261
    transformation := sav
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1262
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1263
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1264
!GraphicsContext methodsFor:'edge drawing'!
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1265
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1266
drawEdgesForX:x y:y width:w height:h level:l 
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1267
                shadow:shadowColor light:lightColor
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1268
                halfShadow:halfShadowColor halfLight:halfLightColor
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1269
                style:edgeStyle
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1270
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1271
    "draw 3D edges into a rectangle"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1272
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1273
    |topLeftFg botRightFg topLeftHalfFg botRightHalfFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1274
     count "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1275
     r     "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1276
     b     "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1277
     xi    "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1278
     yi    "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1279
     run paint|
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1280
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1281
    count := l.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1282
    (count < 0) ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1283
        topLeftFg := shadowColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1284
        botRightFg := lightColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1285
        topLeftHalfFg := halfShadowColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1286
        botRightHalfFg := halfLightColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1287
        count := count negated
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1288
    ] ifFalse:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1289
        topLeftFg := lightColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1290
        botRightFg := shadowColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1291
        topLeftHalfFg := halfLightColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1292
        botRightHalfFg := halfShadowColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1293
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1294
    topLeftHalfFg isNil ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1295
        topLeftHalfFg := topLeftFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1296
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1297
    botRightHalfFg isNil ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1298
        botRightHalfFg := botRightFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1299
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1300
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1301
    r := x + w - 1. "right"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1302
    b := y + h - 1. "bottom"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1303
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1304
    self lineWidth:0.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1305
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1306
    "top and left edges"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1307
    ((edgeStyle == #soft) and:["l" count > 0]) ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1308
        paint := topLeftHalfFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1309
    ] ifFalse:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1310
        paint := topLeftFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1311
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1312
    self paint:paint.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1313
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1314
    0 to:(count - 1) do:[:i |
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1315
        run := y + i.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1316
        self displayDeviceLineFromX:x y:run toX:r y:run. "top"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1317
        run := x + i.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1318
        self displayDeviceLineFromX:run y:y toX:run y:b  "left"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1319
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1320
    (edgeStyle == #soft) ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1321
"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1322
        self paint:topLeftFg.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1323
        self displayDeviceLineFromX:x y:y toX:r y:y. 
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1324
        self displayDeviceLineFromX:x y:y toX:x y:b        
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1325
"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1326
        (l > 2) ifTrue:[
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
  1327
            self paint:(device blackColor).
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1328
            self displayDeviceLineFromX:x y:y toX:r y:y. 
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1329
            self displayDeviceLineFromX:x y:y toX:x y:b. 
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1330
        ]
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1331
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1332
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1333
    xi := x + 1.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1334
    yi := y + 1.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1335
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1336
"/ does not look good
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1337
"/ style == #st80 iftrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1338
"/  yi := yi + 1
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1339
"/ ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1340
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1341
    "bottom and right edges"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1342
    (edgeStyle == #soft "new:" and:[count > 1]) ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1343
        paint := botRightHalfFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1344
    ] ifFalse:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1345
        paint := botRightFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1346
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1347
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1348
    self paint:paint.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1349
    0 to:(count - 1) do:[:i |
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1350
        run := b - i.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1351
        self displayDeviceLineFromX:xi-1 y:run toX:r y:run. "bottom"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1352
        run := r - i.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1353
        self displayDeviceLineFromX:run y:yi-1 toX:run y:b.  "right"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1354
        xi := xi + 1.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1355
        yi := yi + 1
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1356
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1357
    ((edgeStyle == #soft) and:[l > 1]) ifTrue:[
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
  1358
        self paint:(device blackColor) "shadowColor".
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1359
        self displayDeviceLineFromX:(x + (1 - 1)) y:b toX:r y:b. 
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1360
        self displayDeviceLineFromX:r y:(y + (1 - 1)) toX:r y:b        
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1361
    ]
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1362
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1363
    "Created: 24.5.1996 / 19:28:38 / cg"
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
  1364
    "Modified: 13.1.1997 / 23:09:33 / cg"
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1365
! !
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1366
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1367
!GraphicsContext methodsFor:'filling'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1368
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1369
fillArc:origin radius:r from:startAngle angle:angle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1370
    "draw a filled arc around a point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1371
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1372
    |d|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1373
    d := 2 * r.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1374
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1375
        fillArcX:(origin x - r) 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1376
               y:(origin y - r)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1377
           width:d
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1378
          height:d
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1379
            from:startAngle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1380
           angle:angle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1381
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1382
    "Modified: 8.5.1996 / 08:41:54 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1383
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1384
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1385
fillArcIn:aRectangle from:startAngle angle:angle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1386
    "draw a filled arc in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1387
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1388
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1389
        fillArcX:(aRectangle left)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1390
               y:(aRectangle top)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1391
           width:(aRectangle width)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1392
          height:(aRectangle height)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1393
            from:startAngle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1394
           angle:angle
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1395
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1396
    "Created: 13.4.1996 / 20:56:03 / cg"
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1397
    "Modified: 8.5.1996 / 08:42:13 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1398
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1399
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1400
fillArcOrigin:origin corner:corner from:startAngle angle:angle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1401
    "draw a filled arc in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1402
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1403
    |left top right bot|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1404
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1405
    left := origin x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1406
    top := origin y.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1407
    right := corner x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1408
    bot := corner y.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1409
    self 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1410
        fillArcX:left 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1411
        y:top
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1412
        width:(right - left + 1) 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1413
        height:(bot - top + 1)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1414
        from:startAngle 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1415
        angle:angle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1416
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1417
    "Created: 13.4.1996 / 20:56:56 / cg"
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1418
    "Modified: 8.5.1996 / 08:42:23 / cg"
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1419
!
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1420
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1421
fillArcX:x y:y width:w height:h from:startAngle to:endAngle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1422
    "draw a filled arc in a box, given startAngle and endAngle."
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1423
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1424
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1425
        fillArcX:x 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1426
               y:y
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1427
           width:w
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1428
          height:h
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1429
            from:startAngle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1430
           angle:(endAngle - startAngle)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1431
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1432
    "Created: 8.5.1996 / 08:52:41 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1433
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1434
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1435
fillCircle:aPoint radius:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1436
    "draw a filled circle around aPoint"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1437
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1438
    self fillCircleX:(aPoint x) y:(aPoint y) radius:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1439
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1440
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1441
fillCircleIn:aRectangle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1442
    "draw a filled circle in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1443
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1444
    self
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1445
        fillArcX:(aRectangle left)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1446
               y:(aRectangle top)
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1447
           width:(aRectangle width)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1448
          height:(aRectangle height)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1449
            from:0 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1450
           angle:360
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1451
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1452
    "Created: 13.4.1996 / 20:57:41 / cg"
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1453
    "Modified: 8.5.1996 / 08:42:38 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1454
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1455
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1456
fillCircleX:x y:y radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1457
    "draw a filled circle around x@y"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1458
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1459
    |d|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1460
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1461
    d := 2 * r.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1462
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1463
        fillArcX:(x - r)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1464
        y:(y - r) 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1465
        width:d
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1466
        height:d 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1467
        from:0
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1468
        angle:360
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1469
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1470
    "Modified: 8.5.1996 / 08:43:02 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1471
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1472
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1473
fillRectangle:aRectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1474
    "fill a rectangle with current paint color"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1475
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1476
    self fillRectangleX:(aRectangle left)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1477
		      y:(aRectangle top)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1478
		  width:(aRectangle width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1479
		 height:(aRectangle height)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1480
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1481
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1482
fillRectangleOrigin:origin corner:corner
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1483
    "draw a filled rectangle"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1484
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1485
    |top left|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1486
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1487
    left := origin x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1488
    top := origin y.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1489
    self fillRectangleX:left y:top 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1490
                  width:(corner x - left)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1491
                 height:(corner y - top)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1492
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1493
    "Created: 13.4.1996 / 20:58:16 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1494
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1495
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1496
!GraphicsContext methodsFor:'initialization'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1497
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1498
initialize
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1499
    "set up some useful default values"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1500
952
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1501
    paint isNil ifTrue:[paint := Black].
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1502
    bgPaint isNil ifTrue:[bgPaint := White].
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1503
    function := #copy.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1504
    lineWidth := 1.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1505
    lineStyle := #solid.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1506
    joinStyle := #miter.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1507
    capStyle := #butt.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1508
    font := DefaultFont.
952
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1509
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1510
    "Modified: 17.7.1996 / 13:00:12 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1511
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1512
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1513
!GraphicsContext methodsFor:'misc'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1514
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1515
flush
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
  1516
    "send all buffered drawing to the device."
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1517
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
  1518
    device flush
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
  1519
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
  1520
    "Modified: 28.5.1996 / 20:22:26 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1521
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1522
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
  1523
!GraphicsContext class methodsFor:'documentation'!
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1524
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1525
version
1346
619cd027ce68 commentary
ca
parents: 1319
diff changeset
  1526
    ^ '$Header: /cvs/stx/stx/libview/GraphicsContext.st,v 1.51 1997-02-13 21:55:41 ca Exp $'
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1527
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1528
GraphicsContext initialize!