GraphicsContext.st
author Claus Gittinger <cg@exept.de>
Wed, 09 Jun 1999 19:11:18 +0200
changeset 2763 75aed641b570
parent 2762 ea1b8d9c8f76
child 2764 c7d8d29c81ac
permissions -rw-r--r--
*** empty log message ***
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'
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
    16
	classVariableNames:'White Black DefaultFont DrawingOnClosedDrawableSignal'
519
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
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    63
	paint           <Color>         the paint used for drawing
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    64
	bgPaint         <Color>         the background used for drawing texts and bitmaps
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    65
	function        <Symbol>        the drawing function (i.e. #copy, #or, #xor ...)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    66
					- not all Drawables support every function
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    67
					(i.e. paper only allows #copy)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    68
	font            <Font>          the current font to be used for drawing
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    69
	lineStyle       <Symbol>        the lineStyle (i.e. #solid, #dashed, #doubleDashed)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    70
	lineWidth       <SmallInteger>  the lineWidth (device dependent, usually pixels)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    71
	joinStyle       <Symbol>        the style in which lines (in polygons)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    72
					are joined (i.e. #miter, #bevel, #round)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    73
	capStyle        <Symbol>        the style in which the last point of a line is drawn
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    74
					(i.e. #notLast, #butt, #round, #projecting)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    75
	mask            <Form>          a mask used for drawing
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    76
					- not all Drawables support it
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    77
	maskOrigin      <Point>         the origin of the mask relative to
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    80
			<WindowingTransformation>
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    81
					controls scale & translation of nonNil
716
b83fee8ff1b3 moved clipRect up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    82
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    83
	clipRect        <Rectangle>     a clip rectangle (device dep. usually pixels or inches)
716
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
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    88
	White           <Color>         cached white color - its needed so often
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    89
	Black           <Color>         cached black color - its needed so often
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    90
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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:]
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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:]
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    97
	Color Font Form Image
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    98
	Geometric
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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:
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   115
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   116
	|v|
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   117
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   118
	v := View new.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   119
	v openAndWait.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   120
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   121
	v paint:(Color red).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   122
	v displayString:'hello' x:10 y:50
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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:
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   126
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   127
	|v|
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   128
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   129
	v := View new.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   130
	v openAndWait.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   131
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   132
	v paint:(Color red) on:(Color yellow).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   133
	v displayOpaqueString:'hello' x:10 y:50
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   144
	   #dashed       - for dashed lines, where only the on-dashes are drawn
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   145
			   with the current paint color
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   146
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   147
	   #doubleDashed - dashed lines, draws on-dashes with paint color,
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   148
			   off-dashes with bgPaint
563
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:
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   151
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   152
	|v|
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   153
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   154
	v := View new.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   155
	v openAndWait.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   156
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   157
	v paint:(Color red) on:(Color blue).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   158
	v displayLineFrom:(10@10) to:(90@90).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   159
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   160
	v lineStyle:#dashed.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   161
	v displayLineFrom:(90@10) to:(10@90).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   162
        
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   163
	v lineStyle:#doubleDashed.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   164
	v displayRectangle:((5@5) corner:(95@95)).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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:
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   168
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   169
	|v|
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   170
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   171
	v := View new.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   172
	v openAndWait.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   173
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   174
	v paint:(Color red).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   175
	v displayLineFrom:(20@20) to:(80@80).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   176
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   177
	v lineWidth:5.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   178
	v displayLineFrom:(80@20) to:(20@80).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   179
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   180
	v lineWidth:8.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   181
	v displayRectangle:((5@5) corner:(95@95)).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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.
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   186
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   187
	|v|
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   188
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   189
	v := View new extent:200@200.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   190
	v openAndWait.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   191
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   192
	v lineWidth:15.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   193
	v paint:(Color red).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   194
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   195
	v displayRectangle:((65@65) corner:(135@135)).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   196
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   197
	v joinStyle:#bevel.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   198
	v displayRectangle:((45@45) corner:(155@155)).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   199
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   200
	v joinStyle:#round.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   201
	v displayRectangle:((25@25) corner:(175@175)).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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).
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   211
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   212
	|v|
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   213
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   214
	v := View new extent:200@200.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   215
	v openAndWait.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   216
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   217
	v lineWidth:15.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   218
	v paint:(Color red).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   219
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   220
	v displayLineFrom:(25@25) to:(175@25).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   221
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   222
	v capStyle:#round.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   223
	v displayLineFrom:(25@55) to:(175@55).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   224
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   225
	v capStyle:#projecting.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   226
	v displayLineFrom:(25@85) to:(175@85).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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)
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   232
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   233
	|v|
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   234
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   235
	v := View new extent:200@200.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   236
	v openAndWait.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   237
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   238
	v lineWidth:15.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   239
	v paint:(Image fromFile:'granite_small.tiff').
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   240
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   241
	v displayLineFrom:(25@25) to:(175@25).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   242
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   243
	v capStyle:#round.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   244
	v displayLineFrom:(25@55) to:(175@55).
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   245
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   246
	v capStyle:#projecting.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   247
	v displayLineFrom:(25@85) to:(175@85).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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:
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   252
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   253
	|v|
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   254
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   255
	v := View new extent:200@200.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   256
	v openAndWait.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   257
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   258
	v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   259
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   260
	v scale:(2@2); translation:50.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   261
	v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   262
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   263
	v scale:(0.5@0.5); translation:0.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   264
	v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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):
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   270
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   271
	|v|
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   272
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   273
	v := View new extent:200@200.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   274
	v openAndWait.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   275
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   276
	v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   277
	v displayString:'hello' x:50 y:40.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   278
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   279
	v scale:(2@4).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   280
	v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   281
	v displayUnscaledString:'hello' x:50 y:40.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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:
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   287
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   288
	|v|
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   289
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   290
	v := View new extent:200@200.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   291
	v openAndWait.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   292
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   293
	v displayArcIn:(20@20 corner:50@50) from:0 angle:180.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   294
	v paint:Color yellow.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   295
	v fillArcIn:(120@120 corner:150@150) from:0 angle:180.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   296
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   297
	v paint:Color red.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   298
	v displayCircle:150@50 radius:30.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   299
	v paint:Color blue.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   300
	v fillCircle:50@150 radius:30.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   301
									[exEnd]
619
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:
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   304
									[exBegin]
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   305
	|v poly1 poly2|
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   306
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   307
	poly1 := OrderedCollection new.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   308
	poly1 add:(10 @ 10).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   309
	poly1 add:(100 @ 50).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   310
	poly1 add:(50 @ 50).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   311
	poly1 add:(20 @ 100).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   312
	poly1 add:(10 @ 100).
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   313
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   314
	poly2 := poly1 copy.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   315
	poly2 add:(poly2 first).
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   316
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   317
	v := View new extent:200@200.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   318
	v openAndWait.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   319
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   320
	v scale:2.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   321
	v paint:Color red.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   322
	v fillPolygon:poly1.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   323
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   324
	v scale:1.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   325
	v paint:Color blue.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   326
	v displayPolygon:poly2.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   327
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   328
	v scale:0.5.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   329
	v paint:Color yellow.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   330
	v fillPolygon:poly1.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   331
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
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
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   342
    DrawingOnClosedDrawableSignal isNil ifTrue:[
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   343
        DrawingOnClosedDrawableSignal := Signal new mayProceed:true.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   344
        DrawingOnClosedDrawableSignal nameClass:self message:#drawingOnClosedDrawableSignal.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   345
        DrawingOnClosedDrawableSignal notifierString:'drawing attempt on closed drawable'.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   346
    ].
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   347
134
claus
parents: 109
diff changeset
   348
    White isNil ifTrue:[
2763
75aed641b570 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2762
diff changeset
   349
        "/ mhmh - the next two checks are historic leftOvers;
75aed641b570 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2762
diff changeset
   350
        "/ they should never be nil.
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   351
        Color isNil ifTrue:[^ self].
2763
75aed641b570 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2762
diff changeset
   352
        Font isNil ifTrue:[^ self].
2762
ea1b8d9c8f76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2747
diff changeset
   353
ea1b8d9c8f76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2747
diff changeset
   354
        White := Color white.
ea1b8d9c8f76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2747
diff changeset
   355
        Black := Color black.
ea1b8d9c8f76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2747
diff changeset
   356
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   357
        Color initialize.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   358
2763
75aed641b570 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2762
diff changeset
   359
        Display notNil ifTrue:[
75aed641b570 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2762
diff changeset
   360
            White := White on:Display.
75aed641b570 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2762
diff changeset
   361
            Black := Black on:Display.
75aed641b570 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2762
diff changeset
   362
        ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   363
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   364
        Font initialize.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   365
        DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12
134
claus
parents: 109
diff changeset
   366
    ]
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   367
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   368
    "Modified: / 29.1.1998 / 12:56:18 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   369
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   370
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   371
!GraphicsContext class methodsFor:'instance creation'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   372
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   373
new
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   374
    "return a new instance of myself. Redefined to initialize
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   375
     the new thingy"
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   376
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   377
    ^ self basicNew initialize
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
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   380
!GraphicsContext class methodsFor:'Signal constants'!
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   381
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   382
drawingOnClosedDrawableSignal
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   383
    "return the signal which is raised, if drawing is attempted
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   384
     on a closed drawable.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   385
     This is especially useful, if a forked thread animates
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   386
     a view in the background, and is not properly synchronized
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   387
     with the window thread - i.e. the window gets closed by the user,
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   388
     and the background process continues to draw.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   389
     In this case, the background thread should handle this signal 
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   390
     and terminate itself in the handler."
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   391
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   392
    ^ DrawingOnClosedDrawableSignal
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   393
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   394
    "demonstration1: (error if closed by the windowManager):
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   395
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   396
     |v|
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   397
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   398
     v := StandardSystemView new openAndWait.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   399
     [
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   400
        [true] whileTrue:[
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   401
            |x y|
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   402
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   403
            x := Random nextIntegerBetween:0 and:(v width).
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   404
            y := Random nextIntegerBetween:0 and:(v height).
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   405
            v displayString:'hello' x:x y:y.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   406
            Delay waitForSeconds:0.5.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   407
        ]
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   408
     ] fork.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   409
    "
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   410
    "demonstration2: (no error if closed by the windowManager):
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   411
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   412
     |v|
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   413
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   414
     v := StandardSystemView new openAndWait.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   415
     [
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   416
        v class drawingOnClosedDrawableSignal handle:[:ex |
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   417
            ex return
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   418
        ] do:[
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   419
            [true] whileTrue:[
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   420
                |x y|
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   421
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   422
                x := Random nextIntegerBetween:0 and:(v width).
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   423
                y := Random nextIntegerBetween:0 and:(v height).
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   424
                v displayString:'hello' x:x y:y.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   425
                Delay waitForSeconds:0.5.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   426
            ]
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   427
        ]
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   428
     ] fork.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   429
    "
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   430
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   431
    "Created: / 29.1.1998 / 13:10:41 / cg"
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   432
    "Modified: / 29.1.1998 / 13:11:14 / cg"
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   433
! !
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   434
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   435
!GraphicsContext class methodsFor:'accessing defaults'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   436
48194c26a46c Initial revision
claus
parents:
diff changeset
   437
defaultFont
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   438
    "get the default font used for drawing"
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   439
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   440
    DefaultFont isNil ifTrue:[
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   441
	DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   442
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   443
    ^ DefaultFont
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   444
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   445
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   446
defaultFont:aFont
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   447
    "set the default font used for drawing"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   448
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   449
    DefaultFont := aFont
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   450
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   451
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   452
!GraphicsContext class methodsFor:'constants'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   453
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   454
capButt
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   455
    "return a constant to specify butt cap"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   456
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   457
    ^ #butt
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   458
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   459
48194c26a46c Initial revision
claus
parents:
diff changeset
   460
capNotLast
48194c26a46c Initial revision
claus
parents:
diff changeset
   461
    "return a constant to specify not-last cap"
48194c26a46c Initial revision
claus
parents:
diff changeset
   462
48194c26a46c Initial revision
claus
parents:
diff changeset
   463
    ^ #notLast
48194c26a46c Initial revision
claus
parents:
diff changeset
   464
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   465
48194c26a46c Initial revision
claus
parents:
diff changeset
   466
capProjecting
48194c26a46c Initial revision
claus
parents:
diff changeset
   467
    "return a constant to specify projecting cap"
48194c26a46c Initial revision
claus
parents:
diff changeset
   468
48194c26a46c Initial revision
claus
parents:
diff changeset
   469
    ^ #projecting
48194c26a46c Initial revision
claus
parents:
diff changeset
   470
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   471
48194c26a46c Initial revision
claus
parents:
diff changeset
   472
capRound
48194c26a46c Initial revision
claus
parents:
diff changeset
   473
    "return a constant to specify round cap"
48194c26a46c Initial revision
claus
parents:
diff changeset
   474
48194c26a46c Initial revision
claus
parents:
diff changeset
   475
    ^ #round
48194c26a46c Initial revision
claus
parents:
diff changeset
   476
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   477
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   478
joinBevel
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   479
    "return a constant to specify bevel join"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   480
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   481
    ^ #bevel
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   482
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   483
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   484
joinMiter
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   485
    "return a constant to specify miter join"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   486
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   487
    ^ #miter
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   488
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   489
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   490
joinRound
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   491
    "return a constant to specify round join"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   492
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   493
    ^ #round
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   494
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   495
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   496
!GraphicsContext methodsFor:'ST-80 compatibility'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   497
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   498
findFont:aFontDescription
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   499
    "given a fontDescription, return a device font for it
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   500
     on my device."
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   501
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   502
    ^ aFontDescription on:device
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   503
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   504
    "Modified: 28.5.1996 / 20:22:29 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   505
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   506
785
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   507
phase
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   508
    "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
   509
     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
   510
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   511
    ^ self maskOrigin
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   512
!
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   513
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   514
phase:aPoint
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   515
    "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
   516
     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
   517
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   518
    ^ self maskOrigin:aPoint
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   519
!
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   520
1431
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   521
setDevicePattern:aColorOrMask
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   522
    "ST/X can paint in any color or image"
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   523
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   524
    self paint:aColorOrMask
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   525
!
d84f96e80223 checkin from browser
ca
parents: 1346
diff changeset
   526
785
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   527
tilePhase
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   528
    "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
   529
     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
   530
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   531
    ^ self maskOrigin
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   532
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   533
    "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
   534
!
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   535
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   536
tilePhase:aPoint
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   537
    "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
   538
     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
   539
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   540
    ^ self maskOrigin:aPoint
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   541
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   542
    "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
   543
!
6112ccde457f added #tilePhase / #tilePhase: for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 755
diff changeset
   544
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   545
widthOfString:aString
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   546
    "given a string, return its width in pixels if
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   547
     drawn on the receivers device."
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   548
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   549
    ^ (font on:device) widthOf:aString
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   550
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   551
    "Modified: 28.5.1996 / 20:22:22 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   552
!
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   553
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   554
widthOfString:aString from:start to:stop
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   555
    "given a string, return the width in pixels if
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   556
     a substring is drawn on the receivers device."
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   557
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   558
    ^ (font on:device) widthOf:aString from:start to:stop
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   559
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   560
    "Modified: 28.5.1996 / 20:22:18 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   561
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   562
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   563
!GraphicsContext methodsFor:'ST-80 displaying'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   564
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   565
displayArc:origin radius:radius from:startAngle angle:angle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   566
    "draw an arc around a point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   567
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   568
    self 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   569
	displayArcX:(origin x - radius)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   570
		  y:(origin y - radius)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   571
	      width:(radius * 2) 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   572
	     height:(radius * 2)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   573
	       from:startAngle 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   574
	      angle:angle
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   575
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   576
    "Modified: 8.5.1996 / 08:34:43 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   577
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   578
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   579
displayArcBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   580
   "draw an arc/circle/ellipse - ST-80 compatibility"                                
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   581
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   582
   ^ self displayArcX:(boundingBox left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   583
		    y:(boundingBox top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   584
		width:(boundingBox width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   585
	       height:(boundingBox height)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   586
		 from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   587
		angle:sweepAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   588
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   589
    "Created: / 14.11.1997 / 21:04:19 / cg"
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   590
!
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   591
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   592
displayArcBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle at:origin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   593
   "draw an arc/circle/ellipse - ST-80 compatibility"                                
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   594
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   595
   ^ self displayArcX:(boundingBox left + origin x)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   596
		    y:(boundingBox top + origin y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   597
		width:(boundingBox width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   598
	       height:(boundingBox height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   599
		 from:startAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   600
		angle:sweepAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   601
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   602
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   603
displayLineFrom:startPoint to:endPoint translateBy:anOffset
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   604
    "draw a line - ST-80 compatibility"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   605
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   606
    self displayLineFrom:(startPoint + anOffset)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   607
		      to:(endPoint + anOffset)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   608
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   609
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   610
displayPolyline:aPolygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   611
    "draw a polygon - ST-80 compatibility"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   612
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   613
    ^ self displayPolygon:aPolygon 
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   614
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   615
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   616
displayRectangularBorder:aRectangle at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   617
    "draw a rectangle - ST-80 compatibility"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   618
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   619
    self displayRectangle:(aRectangle translateBy:aPoint)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   620
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   621
1280
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   622
displayWedgeBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   623
   "fill an arc/circle/ellipse - ST-80 compatibility"
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   624
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   625
   ^ self fillArcX:(boundingBox left)
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   626
		 y:(boundingBox top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   627
	     width:(boundingBox width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   628
	    height:(boundingBox height)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   629
	      from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   630
	     angle:sweepAngle
1280
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   631
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   632
    "Created: 27.1.1997 / 15:50:14 / cg"
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   633
!
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   634
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   635
displayWedgeBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle at:origin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   636
   "fill an arc/circle/ellipse - ST-80 compatibility"
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   637
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   638
   ^ self fillArcX:(boundingBox left + origin x)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   639
		 y:(boundingBox top + origin y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   640
	     width:(boundingBox width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   641
	    height:(boundingBox height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   642
	      from:startAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   643
	     angle:sweepAngle
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   644
! !
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   645
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   646
!GraphicsContext methodsFor:'accessing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   647
48194c26a46c Initial revision
claus
parents:
diff changeset
   648
backgroundPaint
48194c26a46c Initial revision
claus
parents:
diff changeset
   649
    "return the background paint color.
48194c26a46c Initial revision
claus
parents:
diff changeset
   650
     (used for opaqueForms and opaqueStrings)"
48194c26a46c Initial revision
claus
parents:
diff changeset
   651
48194c26a46c Initial revision
claus
parents:
diff changeset
   652
    ^ bgPaint
48194c26a46c Initial revision
claus
parents:
diff changeset
   653
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   654
48194c26a46c Initial revision
claus
parents:
diff changeset
   655
backgroundPaint:aColor
48194c26a46c Initial revision
claus
parents:
diff changeset
   656
    "set the background painting color (which is used for
48194c26a46c Initial revision
claus
parents:
diff changeset
   657
     opaqueForms and opaqueStrings). aColor can be a dithered one."
48194c26a46c Initial revision
claus
parents:
diff changeset
   658
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   659
    bgPaint := aColor
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   660
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   661
    "Modified: 12.5.1996 / 22:25:17 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   662
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   663
48194c26a46c Initial revision
claus
parents:
diff changeset
   664
capStyle
48194c26a46c Initial revision
claus
parents:
diff changeset
   665
    "return the current cap-style for line-drawing"
48194c26a46c Initial revision
claus
parents:
diff changeset
   666
48194c26a46c Initial revision
claus
parents:
diff changeset
   667
    ^ capStyle
48194c26a46c Initial revision
claus
parents:
diff changeset
   668
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   669
48194c26a46c Initial revision
claus
parents:
diff changeset
   670
capStyle:aStyleSymbol
48194c26a46c Initial revision
claus
parents:
diff changeset
   671
    "set the cap-style for line-drawing;
48194c26a46c Initial revision
claus
parents:
diff changeset
   672
     possible styles are: #notLast, #butt, #round, #projecting"
48194c26a46c Initial revision
claus
parents:
diff changeset
   673
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   674
    aStyleSymbol isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   675
	capStyle := #butt
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   676
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   677
	capStyle := aStyleSymbol
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   678
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   679
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   680
    "Modified: 12.5.1996 / 22:24:30 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   681
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   682
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   683
clipRect
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   684
    "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
   685
     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
   686
     displaySurfaces (i.e. views) bounds. Added for ST-80 compatibility."
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   687
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   688
    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
   689
    ^ self clippingBounds.
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   690
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   691
    "Modified: 28.5.1996 / 14:14:53 / cg"
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   692
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   693
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   694
clipRect:aRectangle
48194c26a46c Initial revision
claus
parents:
diff changeset
   695
    "set the drawing clip-rectangle"
48194c26a46c Initial revision
claus
parents:
diff changeset
   696
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   697
    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
   698
    ^ 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
   699
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   700
    "Modified: 28.5.1996 / 14:13:09 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   701
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   702
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   703
clippingBounds
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   704
    "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
   705
     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
   706
     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
   707
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   708
    |rect|
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   709
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   710
    clipRect isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   711
	rect := 0@0 extent:(self medium extent).
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   712
	transformation notNil ifTrue:[
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   713
	    rect := transformation applyInverseTo:rect.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   714
	].
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   715
	^ rect
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   716
    ].
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   717
    ^ clipRect
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   718
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   719
    "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
   720
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   721
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   722
clippingRectangle:aRectangleOrNil
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   723
    "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
   724
     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
   725
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   726
    clipRect := aRectangleOrNil
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   727
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   728
    "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
   729
    "Created: 28.5.1996 / 14:09:27 / cg"
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   730
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   731
561
3c1ec7798f77 added #clippingRectangleOrNil for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   732
clippingRectangleOrNil
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   733
    "return the clipping rectangle for drawing, nil if there is none."
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   734
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   735
    ^ clipRect
561
3c1ec7798f77 added #clippingRectangleOrNil for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   736
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   737
    "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
   738
    "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
   739
!
3c1ec7798f77 added #clippingRectangleOrNil for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   740
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   741
dashStyle:aDashList offset:dashOffset
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   742
    "define dashes. Each element of the dashList specifies the length
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   743
     of a corresponding dash. For example, setting it to [4 4]
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   744
     defines 4on-4off dashing; 
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   745
     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
   746
     The dashOffset specifies where in the dashList the dashing starts.
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   747
     Ignored here - this may not be supported by all graphics devices."
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   748
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   749
    ^ self
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   750
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   751
    "Created: 4.6.1996 / 18:59:34 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   752
    "Modified: 4.6.1996 / 19:03:38 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   753
!
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   754
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   755
font
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   756
    "return the current drawing font"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   757
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   758
    ^ font
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   759
!
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
font:aFont
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   762
    "set the drawing font"
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
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   765
!
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
function
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   768
    "return the current drawing function"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   769
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   770
    ^ function
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   771
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   772
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   773
function:aFunctionSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   774
    "set the drawing function"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   775
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   776
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   777
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   778
735
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   779
graphicsContext
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   780
    "for ST-80 compatibility"
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   781
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   782
    ^ self
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   783
!
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   784
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   785
graphicsDevice
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   786
    "same as #device, for ST-80 compatibility"
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   787
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   788
    ^ device
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   789
!
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   790
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   791
joinStyle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   792
    "return the current join-style for polygon-drawing"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   793
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   794
    ^ joinStyle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   795
!
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   796
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   797
joinStyle:aStyleSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   798
    "set the join-style of lines in polygon-drawing;
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   799
     possible styles are: #miter, #bevel, #round"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   800
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   801
    aStyleSymbol isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   802
	joinStyle := #miter
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   803
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   804
	joinStyle := aStyleSymbol
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   805
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   806
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   807
    "Modified: 12.5.1996 / 22:24:14 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   808
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   809
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   810
lineStyle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   811
    "return the current line-drawing-style"
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
    ^ lineStyle
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   814
!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   815
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   816
lineStyle:aStyleSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   817
    "set the line-drawing-style;
2360
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
   818
     possible styles are: #solid, #dashed, #doubleDashed,
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
   819
     #dotted, #dashDot or #dashDotDot."
151
claus
parents: 134
diff changeset
   820
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   821
    aStyleSymbol isNil ifTrue:[
2360
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
   822
        lineStyle := #solid
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   823
    ] ifFalse:[
2360
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
   824
        lineStyle := aStyleSymbol
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   825
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   826
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   827
    "Modified: 12.5.1996 / 22:19:25 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   828
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   829
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   830
lineWidth
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   831
    "return the current drawing linewidth"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   832
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   833
    ^ lineWidth
151
claus
parents: 134
diff changeset
   834
!
claus
parents: 134
diff changeset
   835
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   836
lineWidth:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   837
    "set the line drawing width in pixels"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   838
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   839
    lineWidth := aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   840
!
151
claus
parents: 134
diff changeset
   841
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   842
mask
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   843
    "return the current drawing mask"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   844
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   845
    ^ mask
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   846
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   847
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   848
mask:aForm
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   849
    "set the drawing mask"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   850
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   851
    ^ self subclassResponsibility
151
claus
parents: 134
diff changeset
   852
!
claus
parents: 134
diff changeset
   853
claus
parents: 134
diff changeset
   854
maskOrigin
claus
parents: 134
diff changeset
   855
    "return the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   856
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   857
     This is an alias for ST-80's #phase"
claus
parents: 134
diff changeset
   858
claus
parents: 134
diff changeset
   859
    ^ maskOrigin
claus
parents: 134
diff changeset
   860
!
claus
parents: 134
diff changeset
   861
claus
parents: 134
diff changeset
   862
maskOrigin:aPoint
claus
parents: 134
diff changeset
   863
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   864
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   865
     This is an alias for ST-80's #phase:"
claus
parents: 134
diff changeset
   866
2017
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   867
    maskOrigin := aPoint.
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   868
    ^ self
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   869
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   870
    "Modified: / 26.1.1998 / 18:59:18 / cg"
151
claus
parents: 134
diff changeset
   871
!
claus
parents: 134
diff changeset
   872
claus
parents: 134
diff changeset
   873
maskOriginX:x y:y 
claus
parents: 134
diff changeset
   874
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   875
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   876
     This is an alias for ST-80's #phase:"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   877
2017
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   878
    ^ self maskOrigin:(x @ y)
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   879
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   880
    "Modified: / 26.1.1998 / 18:59:56 / cg"
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   881
!
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   882
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   883
medium
1346
619cd027ce68 commentary
ca
parents: 1319
diff changeset
   884
    "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
   885
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   886
    ^ device
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   887
720
a582a7af45f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   888
    "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
   889
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   890
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   891
paint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   892
    "return the current paint drawing color"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   893
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   894
    ^ paint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   895
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   896
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   897
paint:aColor
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   898
    "set the drawing painting color, aColor can be a dithered one"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   899
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   900
    paint := aColor
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   901
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   902
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   903
paint:fgColor on:bgColor
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   904
    "set the paint and backgroundPaint, used for text and bitmaps.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   905
     Both colors may be dithered colors"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   906
671
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   907
    fgColor ~~ paint ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   908
	self paint:fgColor.
671
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   909
    ].
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   910
    bgPaint := bgColor
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   911
671
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   912
    "Modified: 12.5.1996 / 19:40:43 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   913
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   914
151
claus
parents: 134
diff changeset
   915
setMaskOrigin:aPoint
claus
parents: 134
diff changeset
   916
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   917
     OBSOLETE: use #maskOrigin: or #phase:"
claus
parents: 134
diff changeset
   918
2017
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   919
    ^ self maskOriginX:aPoint x y:aPoint y
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   920
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   921
    "Modified: / 26.1.1998 / 18:54:14 / cg"
151
claus
parents: 134
diff changeset
   922
!
claus
parents: 134
diff changeset
   923
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   924
setMaskOriginX:x y:y
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   925
    "set the origin within the mask (used to draw with patterns).
151
claus
parents: 134
diff changeset
   926
     OBSOLETE: use #maskOriginX:y: or #phase:"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   927
151
claus
parents: 134
diff changeset
   928
    ^ self maskOriginX:x y:y 
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   929
!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   930
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   931
viewOrigin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   932
    "return the drawables visible origin (for scrolling)"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   933
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   934
    ^ 0@0
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   935
! !
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   936
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   937
!GraphicsContext methodsFor:'accessing-transformation'!
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   938
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   939
scale
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   940
    "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
   941
707
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   942
    transformation isNil ifTrue:[^ 1@1].
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   943
    ^ transformation scale
707
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   944
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   945
    "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
   946
!
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   947
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   948
scale:aPoint
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   949
    "set the scale factor of the transformation"
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   950
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   951
    transformation isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   952
	aPoint = 1 ifTrue:[^ self].
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   953
	transformation := WindowingTransformation scale:aPoint translation:0
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   954
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   955
	transformation scale:aPoint.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   956
    ]
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   957
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   958
    "Modified: 27.4.1996 / 18:47:38 / cg"
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   959
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   960
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   961
transformation 
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   962
    "return the transformation"
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   963
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   964
    ^ transformation
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   965
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   966
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   967
transformation:aTransformation 
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   968
    "set the transformation"
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   969
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   970
    transformation := aTransformation
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   971
!
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   972
1319
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   973
translateBy:aPoint
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   974
    "add to the translation offset of the transformation"
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   975
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   976
    transformation isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   977
	aPoint = 0 ifTrue:[^ self].
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   978
	transformation := WindowingTransformation scale:1 translation:aPoint
1319
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   979
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   980
	transformation translateBy:aPoint
1319
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   981
    ]
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   982
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   983
    "Created: 10.2.1997 / 13:50:22 / cg"
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   984
!
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
   985
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   986
translation
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   987
    "return the translation factor (as point) of the transformation"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   988
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   989
    transformation isNil ifTrue:[^ 0@0].
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   990
    ^ transformation translation
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   991
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   992
    "Created: 27.4.1996 / 18:46:41 / cg"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   993
!
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   994
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   995
translation:aPoint
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   996
    "set the translation offset of the transformation"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   997
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   998
    transformation isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   999
	aPoint = 0 ifTrue:[^ self].
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1000
	transformation := WindowingTransformation scale:1 translation:aPoint
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1001
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1002
	transformation translation:aPoint.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1003
    ]
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1004
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1005
    "Created: 27.4.1996 / 18:47:28 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1006
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1007
755
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1008
!GraphicsContext methodsFor:'backward compatibility'!
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1009
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1010
withPattern:aPattern do:aBlock
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1011
    |old|
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1012
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1013
    aPattern isColor ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1014
	old := paint.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1015
	self paint:aPattern.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1016
	aBlock value.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1017
	self paint:old
755
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1018
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1019
	old := mask.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1020
	self mask:aPattern.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1021
	aBlock value.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1022
	self mask:old
755
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1023
    ]
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1024
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1025
    "Modified: 28.5.1996 / 22:45:40 / cg"
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1026
! !
2b91421bd8d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 742
diff changeset
  1027
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
  1028
!GraphicsContext methodsFor:'basic displaying'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1029
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1030
displayArcX:x y:y width:width height:height from:startAngle angle:angle
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1031
    "draw an arc in a box
48194c26a46c Initial revision
claus
parents:
diff changeset
  1032
     - this could be recoded to draw using displayLine"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1033
48194c26a46c Initial revision
claus
parents:
diff changeset
  1034
    ^ self subclassResponsibility
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1035
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1036
    "Created: 8.5.1996 / 08:47:06 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1037
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1038
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1039
displayDottedRectangleX:x y:y width:w height:h
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1040
    "draw a dotted-line rectangle
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1041
     A general implementation is found here; deviceGC's
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1042
     may reimplement this if directly supported by the device"
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1043
2747
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1044
    |lastX lastY x0 y0 oldStyle|
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1045
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1046
    ((device platformName ~= 'WIN32')
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1047
    or:[OperatingSystem isMSWINDOWSNTlike]) ifTrue:[
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1048
        oldStyle := lineStyle.
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1049
        self lineStyle:#dotted.
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1050
        self displayRectangleX:x y:y width:w height:h.
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1051
        self lineStyle:oldStyle.
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1052
        ^ self.
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1053
    ].
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1054
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1055
    1 to:w-1 by:2 do:[:o |
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1056
        lastX := x + o.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1057
        self displayPointX:lastX y:y.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1058
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1059
    y0 := 1.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1060
    lastX == (x+w-1) ifTrue:[
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1061
        y0 := 0
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1062
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1063
    y0 to:h-1 by:2 do:[:o |
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1064
        lastY := y+o.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1065
        self displayPointX:x+w-1 y:lastY.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1066
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1067
    x0 := w-2.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1068
    lastY == (y+h-1) ifTrue:[
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1069
        x0:= w-1
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1070
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1071
    x0 to:0 by:-2 do:[:o |
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1072
        lastX := x+o.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1073
        self displayPointX:lastX y:y+h-1.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1074
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1075
    y0 := h-1.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1076
    lastX == 0 ifTrue:[
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1077
        y0 := h-1
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1078
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1079
    y0 to:0 by:-2 do:[:o |
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1080
        self displayPointX:x y:y+o.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1081
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1082
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1083
    "Modified: / 18.9.1998 / 16:31:09 / cg"
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1084
!
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1085
2392
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1086
displayHorizontalWavelineFromX:x0 y:y0 toX:x1
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1087
    "draw a horizontal wave-line from x0/y0 to x1/y0"
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1088
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1089
    |w h pattern form x oldClip|
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1090
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1091
"/    pattern := #[
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1092
"/                 2r00000000 2r00111100
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1093
"/                 2r00000000 2r11000011
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1094
"/                 2r11000011 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1095
"/                 2r00111100 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1096
"/                ].
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1097
"/    h := 4.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1098
"/    w := 16.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1099
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1100
"/    pattern := #[
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1101
"/                 2r00000000 2r01111000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1102
"/                 2r00000000 2r10000100
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1103
"/                 2r10000001 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1104
"/                 2r01000010 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1105
"/                 2r00111100 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1106
"/                ].
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1107
"/    h := 5.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1108
"/    w := 14.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1109
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1110
    pattern := #[
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1111
                 2r00000001 2r11100000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1112
                 2r00000010 2r00010000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1113
                 2r10000100 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1114
                 2r01111000 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1115
                ].
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1116
    h := 4.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1117
    w := 12.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1118
    form := Form width:16 height:h fromArray:pattern.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1119
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1120
    oldClip := self clippingRectangleOrNil.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1121
    self clippingRectangle:((x0 @ y0) corner:(x1 @ (y0+h))).
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1122
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1123
    x := x0.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1124
    [x <= x1] whileTrue:[
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1125
        self displayForm:form x:x y:y0.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1126
        x := x + w.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1127
    ].
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1128
    self clippingRectangle:oldClip
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1129
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1130
    "Created: / 28.10.1998 / 15:31:41 / cg"
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1131
    "Modified: / 28.10.1998 / 15:41:55 / cg"
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1132
!
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1133
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1134
displayLineFromX:x0 y:y0 toX:x1 y:y1
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1135
    "draw a line from x0/y0 to x1/y1"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1136
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1137
    ^ self subclassResponsibility
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
  1138
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1139
    "Created: 28.5.1996 / 17:12:37 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1140
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1141
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 24
diff changeset
  1142
displayOpaqueForm:aForm x:x y:y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1143
    "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
  1144
     drawn in current fg, 0's in current bg color.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1145
     If the form has depth ~~ 1, it is copied as is onto the receiver"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1146
48194c26a46c Initial revision
claus
parents:
diff changeset
  1147
    ^ self subclassResponsibility
48194c26a46c Initial revision
claus
parents:
diff changeset
  1148
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1149
48194c26a46c Initial revision
claus
parents:
diff changeset
  1150
displayOpaqueString:aString from:index1 to:index2 x:x y:y
48194c26a46c Initial revision
claus
parents:
diff changeset
  1151
    "draw part of a string with both fg and bg at x/y in current font"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1152
48194c26a46c Initial revision
claus
parents:
diff changeset
  1153
    ^ self subclassResponsibility
48194c26a46c Initial revision
claus
parents:
diff changeset
  1154
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1155
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1156
displayPolygon:aPolygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1157
    "draw a polygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1158
     - this could be recoded to draw using displayLine"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1159
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1160
    ^ self subclassResponsibility
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
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1163
displayRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1164
    "draw a rectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1165
     - this could be recoded to draw using displayLine"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1166
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1167
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1168
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1169
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1170
displayString:aString from:index1 to:index2 x:x y:y
48194c26a46c Initial revision
claus
parents:
diff changeset
  1171
    "draw part of a string with fg at x/y in current font"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1172
48194c26a46c Initial revision
claus
parents:
diff changeset
  1173
    ^ self subclassResponsibility
48194c26a46c Initial revision
claus
parents:
diff changeset
  1174
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1175
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1176
!GraphicsContext methodsFor:'basic filling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1177
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1178
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
  1179
    "fill an arc with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1180
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1181
    ^ self subclassResponsibility
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1182
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1183
    "Created: 8.5.1996 / 08:47:44 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1184
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1185
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1186
fillPolygon:points
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1187
    "fill a polygon with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1188
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1189
    ^ self subclassResponsibility
157
claus
parents: 151
diff changeset
  1190
!
claus
parents: 151
diff changeset
  1191
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1192
fillRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1193
    "fill a rectangle with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1194
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1195
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1196
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1197
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1198
!GraphicsContext methodsFor:'bit blitting'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1199
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1200
copyFrom:aGC toX:dstX y:dstY
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1201
    "copy from a drawable - maybe self"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1202
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1203
    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
  1204
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1205
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1206
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
  1207
    "copy from a drawable - maybe self"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1208
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1209
    ^ self subclassResponsibility
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1210
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1211
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1212
copyFrom:aGC x:dstX y:dstY width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1213
    "copy from a drawable - maybe self"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1214
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1215
    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
  1216
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1217
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1218
!GraphicsContext methodsFor:'drawing'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1219
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1220
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
  1221
    "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
  1222
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1223
    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
  1224
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1225
    "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
  1226
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1227
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1228
displayArcIn:aRectangle from:startAngle angle:angle
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1229
    "draw an arc in a box"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1230
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1231
    self 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1232
	displayArcX:(aRectangle left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1233
		  y:(aRectangle top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1234
	      width:(aRectangle width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1235
	     height:(aRectangle height)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1236
	       from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1237
	      angle:angle
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1238
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1239
    "Modified: 8.5.1996 / 08:35:00 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1240
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1241
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1242
displayArcOrigin:origin corner:corner from:startAngle angle:angle
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1243
    "draw an arc in a box"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1244
48194c26a46c Initial revision
claus
parents:
diff changeset
  1245
    |left top right bot|
48194c26a46c Initial revision
claus
parents:
diff changeset
  1246
48194c26a46c Initial revision
claus
parents:
diff changeset
  1247
    left := origin x.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1248
    top := origin y.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1249
    right := corner x.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1250
    bot := corner y.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1251
    self 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1252
	displayArcX:left 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1253
		  y:top
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1254
	      width:(right - left + 1)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1255
	     height:(bot - top + 1)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1256
	       from:startAngle 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1257
	      angle:angle
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1258
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1259
    "Modified: 8.5.1996 / 08:35:25 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1260
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1261
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1262
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
  1263
    "draw an arc; apply transformation if nonNil"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1264
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1265
    self obsoleteMethodWarning:'use #displayArcX:y:width:height:from:angle:'.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1266
    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
  1267
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1268
    "Modified: 8.5.1996 / 08:46:56 / cg"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1269
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1270
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1271
displayCircle:aPoint radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1272
    "draw a circle around a center point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1273
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1274
    self displayCircleX:(aPoint x) y:(aPoint y) radius:r
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
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1277
displayCircleIn:aRectangle
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1278
    "draw a circle in a box"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1279
48194c26a46c Initial revision
claus
parents:
diff changeset
  1280
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1281
	displayArcX:(aRectangle left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1282
		  y:(aRectangle top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1283
	      width:(aRectangle width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1284
	     height:(aRectangle height)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1285
	       from:0 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1286
	      angle:360
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1287
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1288
    "Modified: 8.5.1996 / 08:35:40 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1289
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1290
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1291
displayCircleX:x y:y radius:r
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1292
    "draw a circle around a center point"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1293
48194c26a46c Initial revision
claus
parents:
diff changeset
  1294
    |d|
48194c26a46c Initial revision
claus
parents:
diff changeset
  1295
    d := 2 * r.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1296
    self 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1297
	displayArcX:(x - r) 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1298
		  y:(y - r)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1299
	      width:d
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1300
	     height:d
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1301
	       from:0 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1302
	      angle:360
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1303
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1304
    "Modified: 8.5.1996 / 08:36:03 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1305
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1306
1953
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1307
displayForm:aFormOrImage
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1308
    "draw a form (or image) at the origin"
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1309
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1310
    self displayForm:aFormOrImage x:0 y:0
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1311
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1312
    "Modified: / 24.4.1997 / 16:00:11 / cg"
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1313
    "Created: / 9.11.1997 / 00:50:52 / cg"
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1314
!
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1315
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1316
displayForm:aFormOrImage at:aPoint
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1317
    "draw a form (or image)"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1318
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1319
    self displayForm:aFormOrImage x:(aPoint x) y:(aPoint y)
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1320
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1321
    "Modified: 24.4.1997 / 16:00:11 / cg"
519
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
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1324
displayForm:aFormOrImage x:x y:y
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1325
    "draw a form (or image) at x/y; 
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1326
     if the form has depth 1, 1's in the form are
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1327
     drawn in current paint color, 0's are ignored.
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1328
     If the form has depth ~~ 1, the current fg color setting is ignored."
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1329
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1330
    |fg bg f noColor|
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1331
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1332
    aFormOrImage depth > 1 ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1333
	self displayOpaqueForm:aFormOrImage x:x y:y.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1334
	^ self.
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1335
    ].
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1336
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1337
    fg := paint.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1338
    bg := bgPaint.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1339
    f := function.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1340
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1341
    f ~~ #copy ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1342
	self error:'function not supported'.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1343
	^ self
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1344
    ].
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1345
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1346
    noColor := Color noColor.
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1347
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1348
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1349
     stamp out fg-pixels
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1350
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1351
    self paint:noColor on:Color allColor function:#and.
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1352
    self displayOpaqueForm:aFormOrImage x:x y:y.
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1353
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1354
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1355
     or-in fg-pixels
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1356
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1357
    self paint:fg on:Color noColor function:#or.
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1358
    self displayOpaqueForm:aFormOrImage x:x y:y.
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1359
    self paint:fg on:fg function:f.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1360
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1361
    "Modified: 24.4.1997 / 16:01:43 / cg"
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1362
!
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1363
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1364
displayImage:aFormOrImage at:aPoint
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1365
    "draw an image (or form).
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1366
     Provided for ST-80 compatibilty;
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1367
     in ST/X, images are also handled by #displayForm:"
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1368
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1369
    self displayForm:aFormOrImage x:(aPoint x) y:(aPoint y)
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1370
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1371
    "Modified: 24.4.1997 / 16:02:43 / cg"
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1372
!
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1373
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1374
displayImage:aFormOrImage x:x y:y
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1375
    "draw an image (or form).
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1376
     Provided for ST-80 compatibilty;
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1377
     in ST/X, images are also handled by #displayForm:"
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1378
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1379
    self displayForm:aFormOrImage x:x y:y
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1380
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1381
    "Created: 24.4.1997 / 16:03:03 / cg"
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1382
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1383
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1384
displayLineFrom:point1 to:point2
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1385
    "draw a line"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1386
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1387
    self displayLineFromX:(point1 x) y:(point1 y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1388
		      toX:(point2 x) y:(point2 y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1389
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1390
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1391
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
  1392
    "draw a line using a brush.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1393
     Here, a slow fallback is used, drawing into a 
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1394
     temporary bitmap first, which is then displayed"
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1395
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
  1396
    |deltaX deltaY dx dy px py destX destY p tempForm
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1397
     xMin xMax yMin yMax x1 x2 y1 y2|
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1398
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1399
    xStart < xEnd ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1400
	xMin := xStart.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1401
	xMax := xEnd.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1402
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1403
	xMin := xEnd.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1404
	xMax := xStart
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1405
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1406
    yStart < yEnd ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1407
	yMin := yStart.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1408
	yMax := yEnd.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1409
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1410
	yMin := yEnd.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1411
	yMax := yStart
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1412
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1413
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1414
    tempForm := Form width:(xMax-xMin+1+aForm width)
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1415
		     height:(yMax-yMin+1+aForm height) 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1416
		     depth:aForm depth
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1417
		     on:device.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1418
    tempForm clear.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1419
    tempForm paint:(Color colorId:1) on:(Color colorId:0).
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1420
    tempForm function:#or.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1421
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1422
    ((yStart = yEnd and:[xStart < xEnd])
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1423
    or: [yStart < yEnd]) ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1424
	x1 := xStart. y1 := yStart.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1425
	x2 := xEnd. y2 := yEnd.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1426
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1427
	x1 := xEnd. y1 := yEnd.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1428
	x2 := xStart. y2 := yStart.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1429
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1430
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1431
    x1 := x1 - xMin.  x2 := x2 - xMin.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1432
    y1 := y1 - yMin.  y2 := y2 - yMin.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1433
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1434
    destX := x1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1435
    destY := y1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1436
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1437
    "/ bresenham ...
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1438
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1439
    deltaX := x2 - x1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1440
    deltaY := y2 - y1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1441
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1442
    dx := deltaX sign.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1443
    dy := deltaY sign.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1444
    px := deltaY abs.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1445
    py := deltaX abs.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1446
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1447
    tempForm displayForm:aForm x:destX y:destY.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1448
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1449
    py > px ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1450
	"horizontal"
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
  1451
	p := py // 2.
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1452
	py timesRepeat:[
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1453
	    destX := destX + dx.
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
  1454
	    (p := p - px) < 0 ifTrue:[ 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1455
		destY := destY + dy.
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
  1456
		p := p + py
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1457
	    ].
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1458
	    tempForm displayForm:aForm x:destX y:destY.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1459
	]
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1460
    ] ifFalse:[ 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1461
	"vertical"
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
  1462
	p := px // 2.
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1463
	px timesRepeat:[
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1464
	    destY := destY + dy.
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
  1465
	    (p := p - py) < 0 ifTrue:[ 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1466
		destX := destX + dx.
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
  1467
		p := p + px
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1468
	    ].
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1469
	    tempForm displayForm:aForm x:destX y:destY
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1470
	]
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1471
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1472
    self displayForm:tempForm 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1473
		   x:xMin-aForm offset x 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1474
		   y:yMin-aForm offset y.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1475
    tempForm close
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1476
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1477
    "Modified: 1.4.1997 / 21:29:06 / cg"
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1478
!
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1479
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1480
displayOpaqueString:aString at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1481
    "draw a string with both fg and bg"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1482
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1483
    self displayOpaqueString:aString x:(aPoint x) y:(aPoint y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1484
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1485
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1486
displayOpaqueString:aString from:start to:stop at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1487
    "draw part of a string - drawing both fg and bg"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1488
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1489
    ^ 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
  1490
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1491
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1492
displayOpaqueString:aString x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1493
    "draw a string with both fg and bg"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1494
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1495
    self displayOpaqueString:aString from:1 to:(aString size) x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1496
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1497
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1498
displayOpaqueString:aString x:x y:y angle:drawAngle
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1499
    "draw a string along a (possibly non-horizontal) line,
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1500
     drawing both fg and bg pixels.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1501
     The angle is in degrees, clock-wise, starting with 0 for
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1502
     a horizontal draw.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1503
     Drawing is done by first drawing the string into a temporary bitmap, 
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1504
     which is rotated and finally drawn as usual.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1505
     NOTICE: due to the rotation of the temporary bitmap, this is a slow
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1506
	     operation - not to be used with cillions of strings ..."
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1507
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1508
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1509
	displayString:aString x:x y:y angle:drawAngle opaque:true
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1510
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1511
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1512
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1513
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1514
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1515
     v extent:300@200.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1516
     v openAndWait.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1517
     0 to:360 by:45 do:[:a |
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1518
	 v paint:Color black on:Color red.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1519
	 v displayOpaqueString:'hello world' x:100 y:100 angle:a.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1520
     ].
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1521
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1522
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1523
    "in contrast to non-opaque draw:
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1524
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1525
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1526
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1527
     v extent:300@200.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1528
     v openAndWait.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1529
     0 to:360 by:45 do:[:a |
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1530
	 v paint:Color black on:Color red.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1531
	 v displayString:'hello world' x:100 y:100 angle:a.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1532
     ].
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1533
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1534
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1535
    "Modified: 23.4.1997 / 17:50:23 / cg"
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1536
!
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1537
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1538
displayPoint:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1539
    "draw a pixel"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1540
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1541
    self displayPointX:(aPoint x) y:(aPoint y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1542
!
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
displayPointX:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1545
    "draw a point at x/y"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1546
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1547
    self displayLineFromX:x y:y toX:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1548
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1549
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1550
displayRectangle:aRectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1551
    "draw a rectangle"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1552
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1553
    self displayRectangleX:(aRectangle left)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1554
			 y:(aRectangle top)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1555
		     width:(aRectangle width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1556
		    height:(aRectangle height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1557
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1558
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1559
displayRectangleOrigin:origin corner:corner
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1560
    "draw a rectangle"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1561
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1562
    |top left|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1563
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1564
    left := origin x.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1565
    top := origin y.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1566
    self displayRectangleX:left y:top 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1567
		     width:(corner x - left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1568
		    height:(corner y - top)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1569
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1570
    "Modified: 13.4.1996 / 20:58:31 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1571
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1572
2069
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1573
displayRectangleOrigin:origin extent:extent
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1574
    "draw a rectangle"
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1575
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1576
    self displayRectangleX:(origin x) y:(origin y)
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1577
                     width:(extent x)
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1578
                    height:(extent y)
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1579
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1580
    "Modified: 13.4.1996 / 20:58:31 / cg"
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1581
!
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1582
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1583
displayString:aString at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1584
    "draw a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1585
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1586
    self displayString:aString x:aPoint x y:aPoint y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1587
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1588
2460
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1589
displayString:aString centeredAtX:x y:y
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1590
    "draw a string - drawing fg only"
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1591
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1592
    |w h|
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1593
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1594
    w := aString widthOn:self.
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1595
    h := aString heightOn:self.
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1596
    self displayString:aString x:x-(w/2) y:y-(h/2)
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1597
!
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1598
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1599
displayString:aString from:start to:stop at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1600
    "draw part of a string - drawing fg only"
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
    ^ 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
  1603
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1604
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1605
displayString:aString x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1606
    "draw a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1607
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1608
    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
  1609
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1610
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1611
displayString:aString x:x y:y angle:drawAngle
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1612
    "draw a string along a (possibly non-horizontal) line - drawing fg only.
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1613
     The angle is in degrees, clock-wise, starting with 0 for
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1614
     a horizontal draw.
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1615
     Drawing is done by first drawing the string into a temporary bitmap, 
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1616
     which is rotated and finally drawn as usual.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1617
     NOTICE: due to the rotation of the temporary bitmap, this is a slow
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1618
	     operation - not to be used with cillions of strings ..."
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1619
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1620
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1621
	displayString:aString x:x y:y angle:drawAngle opaque:false
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1622
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1623
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1624
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1625
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1626
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1627
     v extent:300@200.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1628
     v openAndWait.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1629
     0 to:360 by:90 do:[:a |
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1630
	 v paint:Color black.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1631
	 v displayString:'hello world' x:100 y:100 angle:a.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1632
     ].
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1633
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1634
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1635
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1636
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1637
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1638
     v extent:400@400.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1639
     v openAndWait.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1640
     0 to:360 by:5 do:[:a |
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1641
	 v paint:Color black.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1642
	 v displayString:'.........hello' x:200 y:200 angle:a.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1643
     ].
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1644
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1645
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1646
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1648
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1649
     v extent:200@100.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1650
     v openAndWait.
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1651
     v displayString:' hello' x:90 y:50 angle:0.
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1652
     v displayString:' hello' x:90 y:50 angle:45.
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1653
     v displayString:' hello' x:90 y:50 angle:90.
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1654
     v displayString:' hello' x:90 y:50 angle:180.
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1655
     v displayString:' hello' x:90 y:50 angle:270.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1656
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1657
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1658
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1659
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1660
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1661
     v extent:200@100.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1662
     v openAndWait.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1663
     v displayString:'hello' x:50 y:50 angle:0.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1664
     v displayString:'hello' x:50 y:50 angle:45.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1665
     v displayString:'hello' x:50 y:50 angle:90.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1666
     v displayString:'hello' x:50 y:50 angle:135.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1667
     v displayString:'hello' x:50 y:50 angle:180.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1668
     v displayString:'hello' x:50 y:50 angle:225.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1669
     v displayString:'hello' x:50 y:50 angle:270.
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1670
     v displayString:'hello' x:50 y:50 angle:315.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1671
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1672
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1673
    "Modified: 24.4.1997 / 12:51:25 / cg"
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1674
!
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1675
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1676
displayString:aString x:x y:y angle:drawAngle opaque:opaque
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1677
    "common code to draw a string along a (possibly non-horizontal) line.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1678
     The angle is in degrees, clock-wise, starting with 0 for
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1679
     a horizontal draw.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1680
     Drawing is done by first drawing the string into a temporary bitmap, 
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1681
     which is rotated and finally drawn as usual.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1682
     NOTICE: due to the rotation of the temporary bitmap, this is a slow
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1683
             operation - not to be used with cillions of strings ...
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1684
     CAVEAT: if the string is not a real string (i.e. a LabelAndIcon),
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1685
             this can (currently) only be done opaque"
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1686
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
  1687
    |angle tempForm tempImage w h asc desc a xN yN p r
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1688
     dX dY sin cos m|
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1689
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1690
    angle := drawAngle.
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1691
    angle >= 360 ifTrue:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1692
        angle := angle - (((angle // 360)) * 360)
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1693
    ] ifFalse:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1694
        angle < 0 ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1695
            angle := angle - (((angle // 360)) * 360).
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1696
            angle := angle + 360
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1697
        ].
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1698
    ].
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1699
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1700
    angle = 0 ifTrue:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1701
        opaque ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1702
            ^ self displayOpaqueString:aString x:x y:y
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1703
        ].
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1704
        ^ self displayString:aString x:x y:y
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1705
    ].
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1706
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1707
    aString isString ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1708
        "/ a real string;
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1709
        "/ do it in a monochrome form (for speed)
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1710
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1711
        w := font widthOf:aString.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1712
        h := font height.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1713
        asc := font ascent.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1714
        desc := h - asc.
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1715
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1716
        tempForm := Form 
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1717
                    width:w 
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1718
                    height:h
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1719
                    on:device.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1720
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1721
        tempForm clear.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1722
        tempForm font:font.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1723
        tempForm displayString:aString x:0 y:asc.
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1724
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1725
        tempImage := (Depth1Image fromForm:tempForm) rotated:angle.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1726
    ] ifFalse:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1727
        "/ something wierd (labelAndIcon ..)
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1728
        "/ do it in a deep form.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1729
        "/ CAVEAT: this can only be done opaque ...
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1730
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1731
        w := aString widthOn:self.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1732
        h := aString heightOn:self.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1733
        asc := font ascent.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1734
        desc := h - asc.
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1735
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1736
        tempForm := Form 
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1737
                    width:w 
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1738
                    height:h
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1739
                    depth:(device depth)
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1740
                    on:device.
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1741
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1742
        tempForm paint:bgPaint.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1743
        tempForm fillRectangleX:0 y:0 width:w height:h.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1744
        tempForm paint:paint on:bgPaint.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1745
        tempForm font:font.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1746
        aString displayOn:tempForm x:0 y:asc opaque:true.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1747
        tempImage := ((Image implementorForDepth:(device depth)) fromForm:tempForm) rotated:angle.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1748
    ].
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1749
    opaque ifTrue:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1750
        m := ImageMask width:w height:h.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1751
        m bits:(ByteArray new:(h * m bytesPerRow) withAll:16rFF).
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1752
        m := m rotated:angle
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1753
    ].
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1754
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1755
    "/ compute final position of rotated form
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1756
    "/ adjust position for baseline.
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1757
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1758
    angle = 90 ifTrue:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1759
        xN := x - desc. 
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1760
        yN := y.
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1761
    ] ifFalse:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1762
        angle = 180 ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1763
            xN := x - w.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1764
            yN := y - desc "+ h - asc".
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1765
        ] ifFalse:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1766
            angle = 270 ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1767
                xN := x - asc.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1768
                yN := y - w.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1769
            ] ifFalse:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1770
                "/ sigh: since the new image has different dimensions,
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1771
                "/ the computation is somewhat more difficult here.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1772
                "/ remember: the image has been rotated around its center,
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1773
                "/ then shifted towards the top-left origin.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1774
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1775
                p := (w@h) / 2.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1776
                r := p r.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1777
                a := p angle.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1778
                sin := angle degreesToRadians sin.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1779
                cos := angle degreesToRadians cos.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1780
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1781
                angle < 90 ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1782
                    dX := desc * sin.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1783
                    dY := asc * cos.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1784
                    xN := x - dX.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1785
                    yN := y - dY
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1786
                ] ifFalse:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1787
                    angle < 180 ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1788
                        dX := asc * sin.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1789
                        dY := desc * cos.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1790
                        xN := x + dX - (tempImage width).
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1791
                        yN := y + dY.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1792
                    ] ifFalse:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1793
                        angle < 270 ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1794
                            dX := desc * sin.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1795
                            dY := asc * cos.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1796
                            xN := x - dX - (tempImage width).
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1797
                            yN := y - dY - (tempImage height)
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1798
                        ] ifFalse:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1799
                            dX := asc * sin.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1800
                            dY := desc * cos.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1801
                            xN := x + dX.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1802
                            yN := y + dY - (tempImage height).
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1803
                        ]
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1804
                    ]
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1805
                ].
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1806
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1807
                tempImage mask:nil.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1808
            ]
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1809
        ].
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1810
    ].
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1811
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1812
    opaque ifTrue:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1813
        p := paint.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1814
        self paint:bgPaint.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1815
        self displayForm:m x:xN y:yN.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1816
        self paint:p.
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1817
    ].
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1818
    self displayForm:tempImage x:xN y:yN.
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1819
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1820
    "Modified: / 29.1.1998 / 13:23:23 / cg"
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1821
!
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1822
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1823
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
  1824
    "draw a filled arc; apply transformation if nonNil"
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1825
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1826
    self obsoleteMethodWarning:'use #fillArcX:y:width:height:from:angle:'.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1827
    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
  1828
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1829
    "Modified: 8.5.1996 / 08:47:52 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1830
! !
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1831
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1832
!GraphicsContext methodsFor:'drawing in device coordinates'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1833
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1834
displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1835
    "draw a line in device coordinates"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1836
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1837
    |sav|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1838
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1839
    sav := transformation.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1840
    transformation := nil.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1841
    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1842
    transformation := sav
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1843
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1844
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1845
fillDeviceRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1846
    "fill a rectangle with current paint color (device coordinates)"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1847
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1848
    |sav|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1849
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1850
    sav := transformation.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1851
    transformation := nil.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1852
    self fillRectangleX:x y:y width:w height:h.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1853
    transformation := sav
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1854
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1855
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1856
!GraphicsContext methodsFor:'edge drawing'!
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1857
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1858
drawEdgesForX:x y:y width:w height:h level:l 
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1859
                shadow:shadowColor light:lightColor
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1860
                halfShadow:halfShadowColor halfLight:halfLightColor
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1861
                style:edgeStyle
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1862
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1863
    "draw 3D edges into a rectangle"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1864
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1865
    |topLeftFg botRightFg topLeftHalfFg botRightHalfFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1866
     count "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1867
     r     "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1868
     b     "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1869
     xi    "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1870
     yi    "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1871
     run paint|
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1872
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1873
    count := l.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1874
    (count < 0) ifTrue:[
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1875
        topLeftFg := shadowColor.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1876
        botRightFg := lightColor.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1877
        topLeftHalfFg := halfShadowColor.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1878
        botRightHalfFg := halfLightColor.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1879
        count := count negated
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1880
    ] ifFalse:[
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1881
        topLeftFg := lightColor.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1882
        botRightFg := shadowColor.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1883
        topLeftHalfFg := halfLightColor.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1884
        botRightHalfFg := halfShadowColor.
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1885
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1886
    topLeftHalfFg isNil ifTrue:[
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1887
        topLeftHalfFg := topLeftFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1888
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1889
    botRightHalfFg isNil ifTrue:[
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1890
        botRightHalfFg := botRightFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1891
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1892
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1893
    r := x + w - 1. "right"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1894
    b := y + h - 1. "bottom"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1895
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1896
    self lineWidth:0.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1897
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1898
    "top and left edges"
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1899
    ((edgeStyle == #soft or:[edgeStyle == #softWin95]) and:["l" count > 0]) ifTrue:[
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1900
        paint := topLeftHalfFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1901
    ] ifFalse:[
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1902
        paint := topLeftFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1903
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1904
    self paint:paint.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1905
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1906
    0 to:(count - 1) do:[:i |
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1907
        run := y + i.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1908
        run < b ifTrue:[
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1909
            self displayDeviceLineFromX:x y:run toX:r y:run. "top"
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1910
        ].
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1911
        run := x + i.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1912
        self displayDeviceLineFromX:run y:y toX:run y:b  "left"
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1913
    ].
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1914
    (edgeStyle == #soft or:[edgeStyle == #softWin95]) ifTrue:[
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1915
"
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1916
        self paint:topLeftFg.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1917
        self displayDeviceLineFromX:x y:y toX:r y:y. 
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1918
        self displayDeviceLineFromX:x y:y toX:x y:b        
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1919
"
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1920
        (l > 1) ifTrue:[
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1921
            edgeStyle == #softWin95 ifTrue:[
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1922
                self paint:(Color veryLightGrey).
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1923
            ] ifFalse:[
2273
bf00fcc5a526 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1924
                (l > 2 and:[edgeStyle == #soft]) ifTrue:[
bf00fcc5a526 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1925
                    self paint:(device blackColor).
bf00fcc5a526 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1926
                ] ifFalse:[
bf00fcc5a526 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1927
                    self paint:halfLightColor.
bf00fcc5a526 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1928
                ]
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1929
            ].
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1930
            self displayDeviceLineFromX:x y:y toX:r y:y. 
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1931
            self displayDeviceLineFromX:x y:y toX:x y:b. 
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1932
        ]
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1933
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1934
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1935
    xi := x + 1.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1936
    yi := y + 1.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1937
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1938
"/ does not look good
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1939
"/ style == #st80 iftrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1940
"/  yi := yi + 1
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1941
"/ ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1942
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1943
    "bottom and right edges"
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1944
    ((edgeStyle == #soft or:[edgeStyle == #softWin95])
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1945
    "new:" and:[count > 1]) ifTrue:[
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1946
        paint := botRightHalfFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1947
    ] ifFalse:[
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1948
        paint := botRightFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1949
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1950
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1951
    self paint:paint.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1952
    0 to:(count - 1) do:[:i |
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1953
        run := b - i.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1954
        run > y ifTrue:[
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1955
            self displayDeviceLineFromX:xi-1 y:run toX:r y:run. "bottom"
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1956
        ].
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1957
        run := r - i.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1958
        self displayDeviceLineFromX:run y:yi-1 toX:run y:b.  "right"
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1959
        xi := xi + 1.
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1960
        yi := yi + 1
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1961
    ].
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1962
    ((edgeStyle == #soft or:[edgeStyle == #softWin95]) 
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1963
    and:[l > 1]) ifTrue:[
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1964
        self paint:(device blackColor) "shadowColor".
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1965
        self displayDeviceLineFromX:x y:b toX:r y:b. 
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  1966
        self displayDeviceLineFromX:r y:y toX:r y:b        
1443
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1967
    ].
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1968
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1969
    self edgeDrawn:#all
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1970
2273
bf00fcc5a526 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1971
    "Modified: / 24.8.1998 / 18:23:02 / cg"
1443
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1972
!
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1973
1443
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1974
edgeDrawn:whichOne
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1975
    "a redefinable hook for views which like to draw
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1976
     over their edges (some checkToggles do).
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1977
     Nothing done here."
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1978
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  1979
    "Created: 7.3.1997 / 17:59:07 / cg"
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1980
! !
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1981
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1982
!GraphicsContext methodsFor:'filling'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1983
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1984
fillArc:origin radius:r from:startAngle angle:angle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1985
    "draw a filled arc around a point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1986
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1987
    |d|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1988
    d := 2 * r.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1989
    self 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1990
	fillArcX:(origin x - r) 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1991
	       y:(origin y - r)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1992
	   width:d
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1993
	  height:d
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1994
	    from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1995
	   angle:angle
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1996
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1997
    "Modified: 8.5.1996 / 08:41:54 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1998
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1999
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2000
fillArcIn:aRectangle from:startAngle angle:angle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2001
    "draw a filled arc in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2002
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2003
    self 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2004
	fillArcX:(aRectangle left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2005
	       y:(aRectangle top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2006
	   width:(aRectangle width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2007
	  height:(aRectangle height)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2008
	    from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2009
	   angle:angle
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2010
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2011
    "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
  2012
    "Modified: 8.5.1996 / 08:42:13 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2013
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2014
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2015
fillArcOrigin:origin corner:corner from:startAngle angle:angle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2016
    "draw a filled arc in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2017
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2018
    |left top right bot|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2019
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2020
    left := origin x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2021
    top := origin y.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2022
    right := corner x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2023
    bot := corner y.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2024
    self 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2025
	fillArcX:left 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2026
	y:top
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2027
	width:(right - left + 1) 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2028
	height:(bot - top + 1)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2029
	from:startAngle 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2030
	angle:angle
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2031
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2032
    "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
  2033
    "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
  2034
!
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2035
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2036
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
  2037
    "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
  2038
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2039
    self 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2040
	fillArcX:x 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2041
	       y:y
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2042
	   width:w
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2043
	  height:h
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2044
	    from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2045
	   angle:(endAngle - startAngle)
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2046
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2047
    "Created: 8.5.1996 / 08:52:41 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2048
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2049
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2050
fillCircle:aPoint radius:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2051
    "draw a filled circle around aPoint"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2052
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2053
    self fillCircleX:(aPoint x) y:(aPoint y) radius:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2054
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2055
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2056
fillCircleIn:aRectangle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2057
    "draw a filled circle in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2058
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2059
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2060
	fillArcX:(aRectangle left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2061
	       y:(aRectangle top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2062
	   width:(aRectangle width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2063
	  height:(aRectangle height)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2064
	    from:0 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2065
	   angle:360
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2066
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2067
    "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
  2068
    "Modified: 8.5.1996 / 08:42:38 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2069
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2070
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2071
fillCircleX:x y:y radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2072
    "draw a filled circle around x@y"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2073
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2074
    |d|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2075
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2076
    d := 2 * r.
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2077
    self 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2078
	fillArcX:(x - r)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2079
	y:(y - r) 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2080
	width:d
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2081
	height:d 
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2082
	from:0
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2083
	angle:360
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2084
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2085
    "Modified: 8.5.1996 / 08:43:02 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2086
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2087
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2088
fillRectangle:aRectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2089
    "fill a rectangle with current paint color"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2090
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2091
    self fillRectangleX:(aRectangle left)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2092
		      y:(aRectangle top)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2093
		  width:(aRectangle width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2094
		 height:(aRectangle height)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2095
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2096
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2097
fillRectangleOrigin:origin corner:corner
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2098
    "draw a filled rectangle"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2099
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2100
    |top left|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2101
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2102
    left := origin x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2103
    top := origin y.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2104
    self fillRectangleX:left y:top 
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2105
		  width:(corner x - left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2106
		 height:(corner y - top)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2107
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2108
    "Created: 13.4.1996 / 20:58:16 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2109
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2110
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2111
!GraphicsContext methodsFor:'initialization'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2112
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2113
initialize
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2114
    "set up some useful default values"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2115
952
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2116
    paint isNil ifTrue:[paint := Black].
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2117
    bgPaint isNil ifTrue:[bgPaint := White].
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2118
    function := #copy.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2119
    lineWidth := 1.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2120
    lineStyle := #solid.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2121
    joinStyle := #miter.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2122
    capStyle := #butt.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2123
    font := DefaultFont.
952
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2124
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2125
    "Modified: 17.7.1996 / 13:00:12 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2126
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2127
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2128
!GraphicsContext methodsFor:'misc'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2129
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2130
flush
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
  2131
    "send all buffered drawing to the device."
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2132
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
  2133
    device flush
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
  2134
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
  2135
    "Modified: 28.5.1996 / 20:22:26 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2136
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2137
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
  2138
!GraphicsContext class methodsFor:'documentation'!
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2139
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2140
version
2763
75aed641b570 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2762
diff changeset
  2141
    ^ '$Header: /cvs/stx/stx/libview/GraphicsContext.st,v 1.76 1999-06-09 17:11:18 cg Exp $'
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2142
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2143
GraphicsContext initialize!