GraphicsContext.st
author Claus Gittinger <cg@exept.de>
Tue, 01 Apr 1997 23:12:40 +0200
changeset 1506 1b6c39325902
parent 1443 67acc199f123
child 1641 b7c128be3394
permissions -rw-r--r--
added lineDraw with a brush.
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
1431
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   451
setDevicePattern:aColorOrMask
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   452
    "ST/X can paint in any color or image"
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   453
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   454
    self paint:aColorOrMask
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   455
!
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   456
785
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   457
tilePhase
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   458
    "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
   459
     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
   460
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   461
    ^ self maskOrigin
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   462
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   463
    "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
   464
!
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
tilePhase:aPoint
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   467
    "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
   468
     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
   469
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   470
    ^ self maskOrigin:aPoint
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   471
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   472
    "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
   473
!
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   474
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   475
widthOfString:aString
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   476
    "given a string, return its width in pixels if
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   477
     drawn on the receivers device."
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   478
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   479
    ^ (font on:device) widthOf:aString
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   480
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   481
    "Modified: 28.5.1996 / 20:22:22 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   482
!
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   483
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   484
widthOfString:aString from:start to:stop
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   485
    "given a string, return the width in pixels if
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   486
     a substring is drawn on the receivers device."
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   487
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   488
    ^ (font on:device) widthOf:aString from:start to:stop
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   489
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   490
    "Modified: 28.5.1996 / 20:22:18 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   491
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   492
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   493
!GraphicsContext methodsFor:'ST-80 displaying'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   494
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   495
displayArc:origin radius:radius from:startAngle angle:angle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   496
    "draw an arc around a point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   497
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   498
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   499
        displayArcX:(origin x - radius)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   500
                  y:(origin y - radius)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   501
              width:(radius * 2) 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   502
             height:(radius * 2)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   503
               from:startAngle 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   504
              angle:angle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   505
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   506
    "Modified: 8.5.1996 / 08:34:43 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   507
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   508
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   509
displayArcBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle at:origin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   510
   "draw an arc/circle/ellipse - ST-80 compatibility"                                
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   511
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   512
   ^ self displayArcX:(boundingBox left + origin x)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   513
		    y:(boundingBox top + origin y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   514
		width:(boundingBox width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   515
	       height:(boundingBox height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   516
		 from:startAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   517
		angle:sweepAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   518
!
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
displayLineFrom:startPoint to:endPoint translateBy:anOffset
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   521
    "draw a line - ST-80 compatibility"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   522
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   523
    self displayLineFrom:(startPoint + anOffset)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   524
		      to:(endPoint + anOffset)
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
displayPolyline:aPolygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   528
    "draw a polygon - ST-80 compatibility"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   529
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   530
    ^ self displayPolygon:aPolygon 
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
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   533
displayRectangularBorder:aRectangle at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   534
    "draw a rectangle - ST-80 compatibility"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   535
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   536
    self displayRectangle:(aRectangle translateBy:aPoint)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   537
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   538
1280
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   539
displayWedgeBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   540
   "fill an arc/circle/ellipse - ST-80 compatibility"
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   541
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   542
   ^ self fillArcX:(boundingBox left)
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   543
                 y:(boundingBox top)
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   544
             width:(boundingBox width)
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   545
            height:(boundingBox height)
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   546
              from:startAngle
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   547
             angle:sweepAngle
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   548
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   549
    "Created: 27.1.1997 / 15:50:14 / cg"
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   550
!
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   551
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   552
displayWedgeBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle at:origin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   553
   "fill an arc/circle/ellipse - ST-80 compatibility"
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   554
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   555
   ^ self fillArcX:(boundingBox left + origin x)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   556
		 y:(boundingBox top + origin y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   557
	     width:(boundingBox width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   558
	    height:(boundingBox height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   559
	      from:startAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   560
	     angle:sweepAngle
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   561
! !
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   562
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   563
!GraphicsContext methodsFor:'accessing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   564
48194c26a46c Initial revision
claus
parents:
diff changeset
   565
backgroundPaint
48194c26a46c Initial revision
claus
parents:
diff changeset
   566
    "return the background paint color.
48194c26a46c Initial revision
claus
parents:
diff changeset
   567
     (used for opaqueForms and opaqueStrings)"
48194c26a46c Initial revision
claus
parents:
diff changeset
   568
48194c26a46c Initial revision
claus
parents:
diff changeset
   569
    ^ bgPaint
48194c26a46c Initial revision
claus
parents:
diff changeset
   570
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   571
48194c26a46c Initial revision
claus
parents:
diff changeset
   572
backgroundPaint:aColor
48194c26a46c Initial revision
claus
parents:
diff changeset
   573
    "set the background painting color (which is used for
48194c26a46c Initial revision
claus
parents:
diff changeset
   574
     opaqueForms and opaqueStrings). aColor can be a dithered one."
48194c26a46c Initial revision
claus
parents:
diff changeset
   575
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   576
    bgPaint := aColor
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   577
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   578
    "Modified: 12.5.1996 / 22:25:17 / cg"
0
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
48194c26a46c Initial revision
claus
parents:
diff changeset
   582
    "return the current cap-style for line-drawing"
48194c26a46c Initial revision
claus
parents:
diff changeset
   583
48194c26a46c Initial revision
claus
parents:
diff changeset
   584
    ^ capStyle
48194c26a46c Initial revision
claus
parents:
diff changeset
   585
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   586
48194c26a46c Initial revision
claus
parents:
diff changeset
   587
capStyle:aStyleSymbol
48194c26a46c Initial revision
claus
parents:
diff changeset
   588
    "set the cap-style for line-drawing;
48194c26a46c Initial revision
claus
parents:
diff changeset
   589
     possible styles are: #notLast, #butt, #round, #projecting"
48194c26a46c Initial revision
claus
parents:
diff changeset
   590
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   591
    aStyleSymbol isNil ifTrue:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   592
        capStyle := #butt
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   593
    ] ifFalse:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   594
        capStyle := aStyleSymbol
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   595
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   596
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   597
    "Modified: 12.5.1996 / 22:24:30 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   598
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   599
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   600
clipRect
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   601
    "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
   602
     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
   603
     displaySurfaces (i.e. views) bounds. Added for ST-80 compatibility."
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   604
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   605
    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
   606
    ^ self clippingBounds.
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   607
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   608
    "Modified: 28.5.1996 / 14:14:53 / cg"
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   609
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   610
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   611
clipRect:aRectangle
48194c26a46c Initial revision
claus
parents:
diff changeset
   612
    "set the drawing clip-rectangle"
48194c26a46c Initial revision
claus
parents:
diff changeset
   613
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   614
    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
   615
    ^ 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
   616
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   617
    "Modified: 28.5.1996 / 14:13:09 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   618
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   619
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   620
clippingBounds
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   621
    "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
   622
     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
   623
     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
   624
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   625
    |rect|
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   626
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   627
    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
   628
        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
   629
        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
   630
            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
   631
        ].
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   632
        ^ rect
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   633
    ].
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   634
    ^ clipRect
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   635
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   636
    "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
   637
!
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
clippingRectangle:aRectangleOrNil
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   640
    "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
   641
     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
   642
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   643
    clipRect := aRectangleOrNil
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   644
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   645
    "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
   646
    "Created: 28.5.1996 / 14:09:27 / cg"
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   647
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   648
561
3c1ec7798f77 added #clippingRectangleOrNil for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   649
clippingRectangleOrNil
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   650
    "return the clipping rectangle for drawing, nil if there is none."
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   651
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   652
    ^ clipRect
561
3c1ec7798f77 added #clippingRectangleOrNil for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   653
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   654
    "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
   655
    "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
   656
!
3c1ec7798f77 added #clippingRectangleOrNil for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   657
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   658
dashStyle:aDashList offset:dashOffset
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   659
    "define dashes. Each element of the dashList specifies the length
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   660
     of a corresponding dash. For example, setting it to [4 4]
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   661
     defines 4on-4off dashing; 
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   662
     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
   663
     The dashOffset specifies where in the dashList the dashing starts.
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   664
     Ignored here - this may not be supported by all graphics devices."
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   665
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   666
    ^ self
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   667
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   668
    "Created: 4.6.1996 / 18:59:34 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   669
    "Modified: 4.6.1996 / 19:03:38 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   670
!
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   671
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   672
font
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   673
    "return the current 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
    ^ font
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
font:aFont
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   679
    "set the drawing font"
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
    ^ self subclassResponsibility
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
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   685
    "return the current 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
    ^ function
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
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   690
function:aFunctionSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   691
    "set the drawing function"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   692
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   693
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   694
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   695
735
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   696
graphicsContext
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   697
    "for ST-80 compatibility"
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   698
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   699
    ^ self
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   700
!
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   701
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   702
graphicsDevice
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   703
    "same as #device, for ST-80 compatibility"
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   704
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   705
    ^ device
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   706
!
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   707
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   708
joinStyle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   709
    "return the current join-style for polygon-drawing"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   710
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   711
    ^ joinStyle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   712
!
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   713
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   714
joinStyle:aStyleSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   715
    "set the join-style of lines in polygon-drawing;
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   716
     possible styles are: #miter, #bevel, #round"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   717
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   718
    aStyleSymbol isNil ifTrue:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   719
        joinStyle := #miter
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   720
    ] ifFalse:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   721
        joinStyle := aStyleSymbol
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   722
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   723
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   724
    "Modified: 12.5.1996 / 22:24:14 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   725
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   726
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   727
lineStyle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   728
    "return the current line-drawing-style"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   729
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   730
    ^ lineStyle
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   731
!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   732
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   733
lineStyle:aStyleSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   734
    "set the line-drawing-style;
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   735
     possible styles are: #solid, #dashed, #doubleDashed"
151
claus
parents: 134
diff changeset
   736
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   737
    aStyleSymbol isNil ifTrue:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   738
        lineStyle := #solid
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   739
    ] ifFalse:[
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   740
        lineStyle := aStyleSymbol
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   741
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   742
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   743
    "Modified: 12.5.1996 / 22:19:25 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   744
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   745
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   746
lineWidth
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   747
    "return the current drawing linewidth"
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
151
claus
parents: 134
diff changeset
   750
!
claus
parents: 134
diff changeset
   751
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   752
lineWidth:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   753
    "set the line drawing width in pixels"
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
    lineWidth := aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   756
!
151
claus
parents: 134
diff changeset
   757
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   758
mask
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   759
    "return the current 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
    ^ mask
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   762
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   763
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   764
mask:aForm
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   765
    "set the drawing mask"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   766
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   767
    ^ self subclassResponsibility
151
claus
parents: 134
diff changeset
   768
!
claus
parents: 134
diff changeset
   769
claus
parents: 134
diff changeset
   770
maskOrigin
claus
parents: 134
diff changeset
   771
    "return the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   772
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   773
     This is an alias for ST-80's #phase"
claus
parents: 134
diff changeset
   774
claus
parents: 134
diff changeset
   775
    ^ maskOrigin
claus
parents: 134
diff changeset
   776
!
claus
parents: 134
diff changeset
   777
claus
parents: 134
diff changeset
   778
maskOrigin:aPoint
claus
parents: 134
diff changeset
   779
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   780
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   781
     This is an alias for ST-80's #phase:"
claus
parents: 134
diff changeset
   782
claus
parents: 134
diff changeset
   783
    ^ self maskOriginX:aPoint x y:aPoint y
claus
parents: 134
diff changeset
   784
!
claus
parents: 134
diff changeset
   785
claus
parents: 134
diff changeset
   786
maskOriginX:x y:y 
claus
parents: 134
diff changeset
   787
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   788
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   789
     This is an alias for ST-80's #phase:"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   790
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   791
    ^ self
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   792
!
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   793
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   794
medium
1346
619cd027ce68 commentary
ca
parents: 1319
diff changeset
   795
    "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
   796
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   797
    ^ device
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   798
720
a582a7af45f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   799
    "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
   800
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   801
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   802
paint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   803
    "return the current paint drawing color"
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
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:aColor
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   809
    "set the drawing painting color, aColor can be a dithered one"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   810
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   811
    paint := aColor
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   812
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   813
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   814
paint:fgColor on:bgColor
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   815
    "set the paint and backgroundPaint, used for text and bitmaps.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   816
     Both colors may be dithered colors"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   817
671
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   818
    fgColor ~~ paint ifTrue:[
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   819
        self paint:fgColor.
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   820
    ].
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   821
    bgPaint := bgColor
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   822
671
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   823
    "Modified: 12.5.1996 / 19:40:43 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   824
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   825
151
claus
parents: 134
diff changeset
   826
setMaskOrigin:aPoint
claus
parents: 134
diff changeset
   827
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   828
     OBSOLETE: use #maskOrigin: or #phase:"
claus
parents: 134
diff changeset
   829
claus
parents: 134
diff changeset
   830
    ^ self maskOrigin:aPoint
claus
parents: 134
diff changeset
   831
!
claus
parents: 134
diff changeset
   832
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   833
setMaskOriginX:x y:y
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   834
    "set the origin within the mask (used to draw with patterns).
151
claus
parents: 134
diff changeset
   835
     OBSOLETE: use #maskOriginX:y: or #phase:"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   836
151
claus
parents: 134
diff changeset
   837
    ^ self maskOriginX:x y:y 
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   838
!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   839
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   840
viewOrigin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   841
    "return the drawables visible origin (for scrolling)"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   842
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   843
    ^ 0@0
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   844
! !
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   845
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   846
!GraphicsContext methodsFor:'accessing-transformation'!
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   847
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   848
scale
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   849
    "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
   850
707
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   851
    transformation isNil ifTrue:[^ 1@1].
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   852
    ^ transformation scale
707
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   853
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   854
    "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
   855
!
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   856
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   857
scale:aPoint
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   858
    "set the scale factor of the transformation"
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   859
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   860
    transformation isNil ifTrue:[
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   861
        aPoint = 1 ifTrue:[^ self].
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   862
        transformation := WindowingTransformation scale:aPoint translation:0
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   863
    ] ifFalse:[
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   864
        transformation scale:aPoint.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   865
    ]
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   866
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   867
    "Modified: 27.4.1996 / 18:47:38 / cg"
76
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 
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   871
    "return the transformation"
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   872
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   873
    ^ transformation
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   874
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   875
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   876
transformation:aTransformation 
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   877
    "set the transformation"
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   878
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   879
    transformation := aTransformation
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   880
!
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   881
1319
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   882
translateBy:aPoint
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   883
    "add to the translation offset of the transformation"
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
    transformation isNil ifTrue:[
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   886
        aPoint = 0 ifTrue:[^ self].
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   887
        transformation := WindowingTransformation scale:1 translation:aPoint
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   888
    ] ifFalse:[
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   889
        transformation translateBy:aPoint
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   890
    ]
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   891
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   892
    "Created: 10.2.1997 / 13:50:22 / cg"
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   893
!
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   894
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   895
translation
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   896
    "return the translation factor (as point) of the transformation"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   897
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   898
    transformation isNil ifTrue:[^ 0@0].
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   899
    ^ transformation translation
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   900
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   901
    "Created: 27.4.1996 / 18:46:41 / cg"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   902
!
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   903
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   904
translation:aPoint
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   905
    "set the translation offset of the transformation"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   906
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   907
    transformation isNil ifTrue:[
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   908
        aPoint = 0 ifTrue:[^ self].
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   909
        transformation := WindowingTransformation scale:1 translation:aPoint
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   910
    ] ifFalse:[
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   911
        transformation translation:aPoint.
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   912
    ]
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   913
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   914
    "Created: 27.4.1996 / 18:47:28 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   915
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   916
755
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   917
!GraphicsContext methodsFor:'backward compatibility'!
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   918
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   919
withPattern:aPattern do:aBlock
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   920
    |old|
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   921
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   922
    aPattern isColor ifTrue:[
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   923
        old := paint.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   924
        self paint:aPattern.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   925
        aBlock value.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   926
        self paint:old
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   927
    ] ifFalse:[
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   928
        old := mask.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   929
        self mask:aPattern.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   930
        aBlock value.
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   931
        self mask:old
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   932
    ]
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   933
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   934
    "Modified: 28.5.1996 / 22:45:40 / cg"
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   935
! !
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
   936
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   937
!GraphicsContext methodsFor:'basic displaying'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   938
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   939
displayArcX:x y:y width:width height:height from:startAngle angle:angle
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   940
    "draw an arc in a box
48194c26a46c Initial revision
claus
parents:
diff changeset
   941
     - this could be recoded to draw using displayLine"
48194c26a46c Initial revision
claus
parents:
diff changeset
   942
48194c26a46c Initial revision
claus
parents:
diff changeset
   943
    ^ self subclassResponsibility
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   944
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   945
    "Created: 8.5.1996 / 08:47:06 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   946
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   947
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   948
displayLineFromX:x0 y:y0 toX:x1 y:y1
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   949
    "draw a line from x0/y0 to x1/y1"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   950
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   951
    ^ self subclassResponsibility
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   952
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   953
    "Created: 28.5.1996 / 17:12:37 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   954
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   955
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 24
diff changeset
   956
displayOpaqueForm:aForm x:x y:y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   957
    "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
   958
     drawn in current fg, 0's in current bg color.
48194c26a46c Initial revision
claus
parents:
diff changeset
   959
     If the form has depth ~~ 1, it is copied as is onto the receiver"
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
48194c26a46c Initial revision
claus
parents:
diff changeset
   964
displayOpaqueString:aString from:index1 to:index2 x:x y:y
48194c26a46c Initial revision
claus
parents:
diff changeset
   965
    "draw part of a string with both fg and bg at x/y in current font"
48194c26a46c Initial revision
claus
parents:
diff changeset
   966
48194c26a46c Initial revision
claus
parents:
diff changeset
   967
    ^ self subclassResponsibility
48194c26a46c Initial revision
claus
parents:
diff changeset
   968
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   969
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   970
displayPolygon:aPolygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   971
    "draw a polygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   972
     - this could be recoded to draw using displayLine"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   973
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   974
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   975
!
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
displayRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   978
    "draw a rectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   979
     - this could be recoded to draw using displayLine"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   980
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   981
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   982
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   983
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   984
displayString:aString from:index1 to:index2 x:x y:y
48194c26a46c Initial revision
claus
parents:
diff changeset
   985
    "draw part of a string with fg at x/y in current font"
48194c26a46c Initial revision
claus
parents:
diff changeset
   986
48194c26a46c Initial revision
claus
parents:
diff changeset
   987
    ^ self subclassResponsibility
48194c26a46c Initial revision
claus
parents:
diff changeset
   988
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   989
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   990
!GraphicsContext methodsFor:'basic filling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   991
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   992
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
   993
    "fill an arc with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   994
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   995
    ^ self subclassResponsibility
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   996
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   997
    "Created: 8.5.1996 / 08:47:44 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   998
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   999
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1000
fillPolygon:points
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1001
    "fill a polygon 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
157
claus
parents: 151
diff changeset
  1004
!
claus
parents: 151
diff changeset
  1005
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1006
fillRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1007
    "fill a rectangle with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1008
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1009
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1010
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1011
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1012
!GraphicsContext methodsFor:'bit blitting'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1013
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1014
copyFrom:aGC toX:dstX y:dstY
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 copyFrom:aGC x:0 y:0 toX:dstX y:dstY width:aGC width height:aGC height
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:srcX y:srcY toX: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 subclassResponsibility
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1024
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1025
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1026
copyFrom:aGC x:dstX y:dstY width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1027
    "copy from a drawable - maybe self"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1028
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1029
    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
  1030
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1031
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1032
!GraphicsContext methodsFor:'drawing'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1033
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1034
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
  1035
    "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
  1036
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1037
    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
  1038
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1039
    "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
  1040
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1041
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1042
displayArcIn:aRectangle from:startAngle angle:angle
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1043
    "draw an arc in a box"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1044
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1045
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1046
        displayArcX:(aRectangle left)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1047
                  y:(aRectangle top)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1048
              width:(aRectangle width)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1049
             height:(aRectangle height)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1050
               from:startAngle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1051
              angle:angle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1052
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1053
    "Modified: 8.5.1996 / 08:35:00 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1054
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1055
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1056
displayArcOrigin:origin corner:corner from:startAngle angle:angle
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1057
    "draw an arc in a box"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1058
48194c26a46c Initial revision
claus
parents:
diff changeset
  1059
    |left top right bot|
48194c26a46c Initial revision
claus
parents:
diff changeset
  1060
48194c26a46c Initial revision
claus
parents:
diff changeset
  1061
    left := origin x.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1062
    top := origin y.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1063
    right := corner x.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1064
    bot := corner y.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1065
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1066
        displayArcX:left 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1067
                  y:top
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1068
              width:(right - left + 1)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1069
             height:(bot - top + 1)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1070
               from:startAngle 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1071
              angle:angle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1072
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1073
    "Modified: 8.5.1996 / 08:35:25 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1074
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1075
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1076
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
  1077
    "draw an arc; apply transformation if nonNil"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1078
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1079
    self obsoleteMethodWarning:'use #displayArcX:y:width:height:from:angle:'.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1080
    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
  1081
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1082
    "Modified: 8.5.1996 / 08:46:56 / cg"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1083
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1084
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1085
displayCircle:aPoint radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1086
    "draw a circle around a center point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1087
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1088
    self displayCircleX:(aPoint x) y:(aPoint y) radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1089
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1090
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1091
displayCircleIn:aRectangle
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1092
    "draw a circle in a box"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1093
48194c26a46c Initial revision
claus
parents:
diff changeset
  1094
    self
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1095
        displayArcX:(aRectangle left)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1096
                  y:(aRectangle top)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1097
              width:(aRectangle width)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1098
             height:(aRectangle height)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1099
               from:0 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1100
              angle:360
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1101
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1102
    "Modified: 8.5.1996 / 08:35:40 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1103
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1104
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1105
displayCircleX:x y:y radius:r
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1106
    "draw a circle around a center point"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1107
48194c26a46c Initial revision
claus
parents:
diff changeset
  1108
    |d|
48194c26a46c Initial revision
claus
parents:
diff changeset
  1109
    d := 2 * r.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1110
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1111
        displayArcX:(x - r) 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1112
                  y:(y - r)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1113
              width:d
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1114
             height:d
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1115
               from:0 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1116
              angle:360
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1117
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1118
    "Modified: 8.5.1996 / 08:36:03 / cg"
519
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
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1121
displayForm:aForm at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1122
    "draw a form"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1123
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1124
    self displayForm:aForm x:(aPoint x) y:(aPoint y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1125
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1126
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1127
displayForm:aForm x:x y:y
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1128
    "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
  1129
     drawn in current paint color, 0's are ignored.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1130
     If the form has depth ~~ 1, the result is undefined"
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
    |fg bg f noColor|
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1133
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1134
    fg := paint.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1135
    bg := bgPaint.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1136
    f := function.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1137
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1138
    f ~~ #copy ifTrue:[
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1139
        self error:'function not supported'.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1140
        ^ self
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1141
    ].
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1142
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1143
    noColor := Color noColor.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1144
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1145
     stamp out fg-pixels
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1146
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1147
    self paint:noColor on:Color allColor function:#and.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1148
    self displayOpaqueForm:aForm x:x y:y.
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
     or-in fg-pixels
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
    self paint:fg on:Color noColor function:#or.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1153
    self displayOpaqueForm:aForm x:x y:y.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1154
    self paint:fg on:fg function:f.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1155
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1156
    "Modified: 28.5.1996 / 17:10:28 / cg"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1157
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1158
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1159
displayLineFrom:point1 to:point2
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1160
    "draw a line"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1161
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1162
    self displayLineFromX:(point1 x) y:(point1 y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1163
		      toX:(point2 x) y:(point2 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
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1166
displayLineFromX:xStart y:yStart toX:xEnd y:yEnd brush:aForm
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1167
    "draw a line using a brush.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1168
     Here, a slow fallback is used, drawing into a 
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1169
     temporary bitmap first, which is then displayed"
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1170
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1171
    |deltaX deltaY dx dy px py destX destY P tempForm x0 y0
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1172
     xMin xMax yMin yMax x1 x2 y1 y2|
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1173
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1174
    xStart < xEnd ifTrue:[
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1175
        xMin := xStart.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1176
        xMax := xEnd.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1177
    ] ifFalse:[
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1178
        xMin := xEnd.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1179
        xMax := xStart
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1180
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1181
    yStart < yEnd ifTrue:[
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1182
        yMin := yStart.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1183
        yMax := yEnd.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1184
    ] ifFalse:[
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1185
        yMin := yEnd.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1186
        yMax := yStart
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1187
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1188
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1189
    tempForm := Form width:(xMax-xMin+1+aForm width)
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1190
                     height:(yMax-yMin+1+aForm height) 
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1191
                     depth:aForm depth
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1192
                     on:device.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1193
    tempForm clear.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1194
    tempForm paint:(Color colorId:1) on:(Color colorId:0).
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1195
    tempForm function:#or.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1196
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1197
    ((yStart = yEnd and:[xStart < xEnd])
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1198
    or: [yStart < yEnd]) ifTrue:[
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1199
        x1 := xStart. y1 := yStart.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1200
        x2 := xEnd. y2 := yEnd.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1201
    ] ifFalse:[
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1202
        x1 := xEnd. y1 := yEnd.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1203
        x2 := xStart. y2 := yStart.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1204
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1205
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1206
    x1 := x1 - xMin.  x2 := x2 - xMin.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1207
    y1 := y1 - yMin.  y2 := y2 - yMin.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1208
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1209
    destX := x1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1210
    destY := y1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1211
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1212
    "/ bresenham ...
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1213
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1214
    deltaX := x2 - x1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1215
    deltaY := y2 - y1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1216
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1217
    dx := deltaX sign.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1218
    dy := deltaY sign.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1219
    px := deltaY abs.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1220
    py := deltaX abs.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1221
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1222
    tempForm displayForm:aForm x:destX y:destY.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1223
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1224
    py > px ifTrue:[
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1225
        "horizontal"
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1226
        P := py // 2.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1227
        py timesRepeat:[
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1228
            destX := destX + dx.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1229
            (P := P - px) < 0 ifTrue:[ 
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1230
                destY := destY + dy.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1231
                P := P + py
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1232
            ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1233
            tempForm displayForm:aForm x:destX y:destY.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1234
        ]
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1235
    ] ifFalse:[ 
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1236
        "vertical"
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1237
        P := px // 2.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1238
        px timesRepeat:[
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1239
            destY := destY + dy.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1240
            (P := P - py) < 0 ifTrue:[ 
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1241
                destX := destX + dx.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1242
                P := P + px
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1243
            ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1244
            tempForm displayForm:aForm x:destX y:destY
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1245
        ]
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1246
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1247
    self displayForm:tempForm 
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1248
                   x:xMin-aForm offset x 
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1249
                   y:yMin-aForm offset y.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1250
    tempForm close
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1251
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1252
    "Modified: 1.4.1997 / 21:29:06 / cg"
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1253
!
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1254
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1255
displayOpaqueString:aString at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1256
    "draw a string with both fg and bg"
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
    self displayOpaqueString:aString x:(aPoint x) y:(aPoint y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1259
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1260
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1261
displayOpaqueString:aString from:start to:stop at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1262
    "draw part of a string - drawing both fg and bg"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1263
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1264
    ^ 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
  1265
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1266
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1267
displayOpaqueString:aString x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1268
    "draw a string with both fg and bg"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1269
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1270
    self displayOpaqueString:aString from:1 to:(aString size) x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1271
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1272
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1273
displayPoint:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1274
    "draw a pixel"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1275
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1276
    self displayPointX:(aPoint x) y:(aPoint y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1277
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1278
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1279
displayPointX:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1280
    "draw a point at x/y"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1281
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1282
    self displayLineFromX:x y:y toX:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1283
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1284
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1285
displayRectangle:aRectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1286
    "draw a rectangle"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1287
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1288
    self displayRectangleX:(aRectangle left)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1289
			 y:(aRectangle top)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1290
		     width:(aRectangle width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1291
		    height:(aRectangle height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1292
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1293
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1294
displayRectangleOrigin:origin corner:corner
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1295
    "draw a rectangle"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1296
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1297
    |top left|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1298
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1299
    left := origin x.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1300
    top := origin y.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1301
    self displayRectangleX:left y:top 
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1302
                     width:(corner x - left)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1303
                    height:(corner y - top)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1304
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1305
    "Modified: 13.4.1996 / 20:58:31 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1306
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1307
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1308
displayString:aString at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1309
    "draw a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1310
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1311
    self displayString:aString x:aPoint x y:aPoint y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1312
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1313
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1314
displayString:aString from:start to:stop at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1315
    "draw part of a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1316
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1317
    ^ 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
  1318
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1319
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1320
displayString:aString x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1321
    "draw a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1322
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1323
    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
  1324
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1325
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1326
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
  1327
    "draw a filled arc; apply transformation if nonNil"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1328
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1329
    self obsoleteMethodWarning:'use #fillArcX:y:width:height:from:angle:'.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1330
    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
  1331
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1332
    "Modified: 8.5.1996 / 08:47:52 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1333
! !
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1334
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1335
!GraphicsContext methodsFor:'drawing in device coordinates'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1336
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1337
displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1338
    "draw a line in device coordinates"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1339
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1340
    |sav|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1341
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1342
    sav := transformation.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1343
    transformation := nil.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1344
    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1345
    transformation := sav
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1346
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1347
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1348
fillDeviceRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1349
    "fill a rectangle with current paint color (device coordinates)"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1350
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1351
    |sav|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1352
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1353
    sav := transformation.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1354
    transformation := nil.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1355
    self fillRectangleX:x y:y width:w height:h.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1356
    transformation := sav
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1357
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1358
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1359
!GraphicsContext methodsFor:'edge drawing'!
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1360
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1361
drawEdgesForX:x y:y width:w height:h level:l 
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1362
                shadow:shadowColor light:lightColor
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1363
                halfShadow:halfShadowColor halfLight:halfLightColor
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1364
                style:edgeStyle
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
    "draw 3D edges into a rectangle"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1367
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1368
    |topLeftFg botRightFg topLeftHalfFg botRightHalfFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1369
     count "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1370
     r     "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1371
     b     "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1372
     xi    "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1373
     yi    "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1374
     run paint|
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1375
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1376
    count := l.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1377
    (count < 0) ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1378
        topLeftFg := shadowColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1379
        botRightFg := lightColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1380
        topLeftHalfFg := halfShadowColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1381
        botRightHalfFg := halfLightColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1382
        count := count negated
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1383
    ] ifFalse:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1384
        topLeftFg := lightColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1385
        botRightFg := shadowColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1386
        topLeftHalfFg := halfLightColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1387
        botRightHalfFg := halfShadowColor.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1388
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1389
    topLeftHalfFg isNil ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1390
        topLeftHalfFg := topLeftFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1391
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1392
    botRightHalfFg isNil ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1393
        botRightHalfFg := botRightFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1394
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1395
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1396
    r := x + w - 1. "right"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1397
    b := y + h - 1. "bottom"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1398
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1399
    self lineWidth:0.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1400
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1401
    "top and left edges"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1402
    ((edgeStyle == #soft) and:["l" count > 0]) ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1403
        paint := topLeftHalfFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1404
    ] ifFalse:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1405
        paint := topLeftFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1406
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1407
    self paint:paint.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1408
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1409
    0 to:(count - 1) do:[:i |
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1410
        run := y + i.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1411
        self displayDeviceLineFromX:x y:run toX:r y:run. "top"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1412
        run := x + i.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1413
        self displayDeviceLineFromX:run y:y toX:run y:b  "left"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1414
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1415
    (edgeStyle == #soft) ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1416
"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1417
        self paint:topLeftFg.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1418
        self displayDeviceLineFromX:x y:y toX:r y:y. 
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1419
        self displayDeviceLineFromX:x y:y toX:x y:b        
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1420
"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1421
        (l > 2) ifTrue:[
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
  1422
            self paint:(device blackColor).
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1423
            self displayDeviceLineFromX:x y:y toX:r y:y. 
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1424
            self displayDeviceLineFromX:x y:y toX:x y:b. 
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1425
        ]
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1426
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1427
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1428
    xi := x + 1.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1429
    yi := y + 1.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1430
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1431
"/ does not look good
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1432
"/ style == #st80 iftrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1433
"/  yi := yi + 1
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1434
"/ ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1435
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1436
    "bottom and right edges"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1437
    (edgeStyle == #soft "new:" and:[count > 1]) ifTrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1438
        paint := botRightHalfFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1439
    ] ifFalse:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1440
        paint := botRightFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1441
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1442
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1443
    self paint:paint.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1444
    0 to:(count - 1) do:[:i |
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1445
        run := b - i.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1446
        self displayDeviceLineFromX:xi-1 y:run toX:r y:run. "bottom"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1447
        run := r - i.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1448
        self displayDeviceLineFromX:run y:yi-1 toX:run y:b.  "right"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1449
        xi := xi + 1.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1450
        yi := yi + 1
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1451
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1452
    ((edgeStyle == #soft) and:[l > 1]) ifTrue:[
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
  1453
        self paint:(device blackColor) "shadowColor".
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1454
        self displayDeviceLineFromX:(x + (1 - 1)) y:b toX:r y:b. 
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1455
        self displayDeviceLineFromX:r y:(y + (1 - 1)) toX:r y:b        
1443
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1456
    ].
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1457
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1458
    self edgeDrawn:#all
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1459
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1460
    "Modified: 7.3.1997 / 17:59:19 / cg"
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1461
!
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1462
1443
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1463
edgeDrawn:whichOne
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1464
    "a redefinable hook for views which like to draw
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1465
     over their edges (some checkToggles do).
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1466
     Nothing done here."
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1467
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1468
    "Created: 7.3.1997 / 17:59:07 / cg"
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1469
! !
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1470
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1471
!GraphicsContext methodsFor:'filling'!
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
fillArc:origin radius:r from:startAngle angle:angle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1474
    "draw a filled arc around a point"
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
    |d|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1477
    d := 2 * r.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1478
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1479
        fillArcX:(origin x - r) 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1480
               y:(origin y - r)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1481
           width:d
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1482
          height:d
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1483
            from:startAngle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1484
           angle:angle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1485
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1486
    "Modified: 8.5.1996 / 08:41:54 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1487
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1488
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1489
fillArcIn:aRectangle from:startAngle angle:angle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1490
    "draw a filled arc in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1491
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1492
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1493
        fillArcX:(aRectangle left)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1494
               y:(aRectangle top)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1495
           width:(aRectangle width)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1496
          height:(aRectangle height)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1497
            from:startAngle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1498
           angle:angle
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1499
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1500
    "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
  1501
    "Modified: 8.5.1996 / 08:42:13 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1502
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1503
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1504
fillArcOrigin:origin corner:corner from:startAngle angle:angle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1505
    "draw a filled arc in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1506
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1507
    |left top right bot|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1508
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1509
    left := origin x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1510
    top := origin y.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1511
    right := corner x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1512
    bot := corner y.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1513
    self 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1514
        fillArcX:left 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1515
        y:top
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1516
        width:(right - left + 1) 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1517
        height:(bot - top + 1)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1518
        from:startAngle 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1519
        angle:angle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1520
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1521
    "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
  1522
    "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
  1523
!
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1524
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1525
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
  1526
    "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
  1527
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1528
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1529
        fillArcX:x 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1530
               y:y
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1531
           width:w
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1532
          height:h
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1533
            from:startAngle
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1534
           angle:(endAngle - startAngle)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1535
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1536
    "Created: 8.5.1996 / 08:52:41 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1537
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1538
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1539
fillCircle:aPoint radius:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1540
    "draw a filled circle around aPoint"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1541
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1542
    self fillCircleX:(aPoint x) y:(aPoint y) radius:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1543
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1544
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1545
fillCircleIn:aRectangle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1546
    "draw a filled circle in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1547
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1548
    self
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1549
        fillArcX:(aRectangle left)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1550
               y:(aRectangle top)
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1551
           width:(aRectangle width)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1552
          height:(aRectangle height)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1553
            from:0 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1554
           angle:360
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1555
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1556
    "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
  1557
    "Modified: 8.5.1996 / 08:42:38 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1558
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1559
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1560
fillCircleX:x y:y radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1561
    "draw a filled circle around x@y"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1562
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1563
    |d|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1564
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1565
    d := 2 * r.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1566
    self 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1567
        fillArcX:(x - r)
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1568
        y:(y - r) 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1569
        width:d
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1570
        height:d 
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1571
        from:0
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1572
        angle:360
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1573
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1574
    "Modified: 8.5.1996 / 08:43:02 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1575
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1576
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1577
fillRectangle:aRectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1578
    "fill a rectangle with current paint color"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1579
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1580
    self fillRectangleX:(aRectangle left)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1581
		      y:(aRectangle top)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1582
		  width:(aRectangle width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1583
		 height:(aRectangle height)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1584
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1585
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1586
fillRectangleOrigin:origin corner:corner
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1587
    "draw a filled rectangle"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1588
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1589
    |top left|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1590
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1591
    left := origin x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1592
    top := origin y.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1593
    self fillRectangleX:left y:top 
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1594
                  width:(corner x - left)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1595
                 height:(corner y - top)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1596
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1597
    "Created: 13.4.1996 / 20:58:16 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1598
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1599
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1600
!GraphicsContext methodsFor:'initialization'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1601
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1602
initialize
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1603
    "set up some useful default values"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1604
952
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1605
    paint isNil ifTrue:[paint := Black].
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1606
    bgPaint isNil ifTrue:[bgPaint := White].
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1607
    function := #copy.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1608
    lineWidth := 1.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1609
    lineStyle := #solid.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1610
    joinStyle := #miter.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1611
    capStyle := #butt.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1612
    font := DefaultFont.
952
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1613
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1614
    "Modified: 17.7.1996 / 13:00:12 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1615
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1616
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1617
!GraphicsContext methodsFor:'misc'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1618
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1619
flush
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
  1620
    "send all buffered drawing to the device."
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1621
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
  1622
    device flush
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
  1623
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
  1624
    "Modified: 28.5.1996 / 20:22:26 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1625
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1626
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
  1627
!GraphicsContext class methodsFor:'documentation'!
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1628
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1629
version
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1630
    ^ '$Header: /cvs/stx/stx/libview/GraphicsContext.st,v 1.54 1997-04-01 21:12:40 cg Exp $'
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1631
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1632
GraphicsContext initialize!