GraphicsContext.st
author matilk
Wed, 13 Sep 2017 09:40:34 +0200
changeset 8174 2704c965b97b
parent 8034 922a13554dae
child 8290 6614502a0390
permissions -rw-r--r--
#BUGFIX by Maren class: DeviceGraphicsContext changed: #displayDeviceOpaqueForm:x:y: nil check
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
"
3310
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
    12
"{ Package: 'stx:libview' }"
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
    13
7015
09828e08bc73 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
    14
"{ NameSpace: Smalltalk }"
09828e08bc73 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
    15
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    16
Object subclass:#GraphicsContext
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
    17
	instanceVariableNames:'device paint bgPaint function font lineStyle lineWidth joinStyle
4027
3be6ffd7713f characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
    18
		capStyle mask maskOrigin transformation clipRect
3be6ffd7713f characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
    19
		characterEncoding'
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
    20
	classVariableNames:'White Black DefaultFont DrawingOnClosedDrawableSignal'
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
    21
	poolDictionaries:''
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
    22
	category:'Graphics-Support'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    23
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    24
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
    25
!GraphicsContext class methodsFor:'documentation'!
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    26
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    27
copyright
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    28
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    29
 COPYRIGHT (c) 1992 by Claus Gittinger
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    30
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    31
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    32
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    33
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    35
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    36
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    37
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    38
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    39
!
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    40
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    41
documentation
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    42
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    43
    this is an abstract superclass for all kinds of graphic drawables -
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    44
    both windows and printed pages (i.e. printers) are inheriting from
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    45
    this class (even drawables not at all associated with any device would do so).
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    46
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
    47
    Drawing is done in paint/bgPaint colors, which can be true colors (i.e.
db983d8d7e53 scaling
claus
parents: 71
diff changeset
    48
    directly supported by the underlying hardware) or simulated colors
db983d8d7e53 scaling
claus
parents: 71
diff changeset
    49
    (i.e. dithered colors or images).
db983d8d7e53 scaling
claus
parents: 71
diff changeset
    50
    The paint/bgPaint instance variables are set to the logical colors,
db983d8d7e53 scaling
claus
parents: 71
diff changeset
    51
    device specific drawable may like to keep actual colors in addition.
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    52
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    53
    The transformation instance variable is typically nil, for a 1-to-1
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    54
    coordinate mapping (i.e. x/y coordinates are pixels in the drawable).
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    55
    If nonNil, the transformation must be an  instance of WindowingTransformation
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    56
    and offers both a scale-factor and a translation.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    57
    Also, drawing in metric- or inch-units can be done using transformations.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    58
    (see instance creation methods of WindowingTransformation, and examples
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    59
     in 'doc/coding').
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    60
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
    61
    All drawing is defined upon a few basic drawing methods, which must be
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    62
    implemented by subclasses (some subclasses also redefine the others for
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    63
    more performance)
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    64
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    65
    [Instance variables:]
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    66
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    67
	paint           <Color>         the paint used for drawing
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    68
	bgPaint         <Color>         the background used for drawing texts and bitmaps
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    69
	function        <Symbol>        the drawing function (i.e. #copy, #or, #xor ...)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    70
					- not all Drawables support every function
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    71
					(i.e. paper only allows #copy)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    72
	font            <Font>          the current font to be used for drawing
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    73
	lineStyle       <Symbol>        the lineStyle (i.e. #solid, #dashed, #doubleDashed)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    74
	lineWidth       <SmallInteger>  the lineWidth (device dependent, usually pixels)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    75
	joinStyle       <Symbol>        the style in which lines (in polygons)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    76
					are joined (i.e. #miter, #bevel, #round)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    77
	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
    78
					(i.e. #notLast, #butt, #round, #projecting)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    79
	mask            <Form>          a mask used for drawing
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    80
					- not all Drawables support it
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    81
	maskOrigin      <Point>         the origin of the mask relative to
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    82
					the drawables origin
716
b83fee8ff1b3 moved clipRect up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    83
	transformation
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    84
			<WindowingTransformation>
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    85
					controls scale & translation of nonNil
716
b83fee8ff1b3 moved clipRect up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    86
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    87
	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
    88
					or nil.
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    89
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    90
    [Class variables:[
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    91
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    92
	White           <Color>         cached white color - its needed so often
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    93
	Black           <Color>         cached black color - its needed so often
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    94
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    95
	DefaultFont     <Font>          default font to use
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    96
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    97
    [author:]
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
    98
	Claus Gittinger
657
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
    99
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   100
    [see also:]
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   101
	Color Font Form Image
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   102
	Geometric
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   103
	DeviceWorkstation
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   104
"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   105
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   106
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   107
examples
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   108
"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   109
    drawing uses a paint color (which may be a dithered one) which is
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   110
    used like a `pen'.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   111
    A few drawing operations (opaqueForm and opaqueString drawing)
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   112
    use two colors, the paint and a backgroundPaint. For example,
7344
627026dac7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7289
diff changeset
   113
    normal string drawing (#displayString:...) only draws the font's
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   114
    on-pixels in the current paint, leaving off-pixels unchanged.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   115
    In contrast, #drawOpaqueString:.. also changes these to the bgPaint color.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   116
    The bgPaint can be changed with #backgroundPaint: or #paint:on: (which modifies both).
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   117
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   118
    lets try it in a view:
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   119
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   120
	|v|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   121
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   122
	v := View new.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   123
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   124
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   125
	v paint:(Color red).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   126
	v displayString:'hello' x:10 y:50
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   127
									[exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   128
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   129
    the same using opaque drawing:
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   130
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   131
	|v|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   132
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   133
	v := View new.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   134
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   135
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   136
	v paint:(Color red) on:(Color yellow).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   137
	v displayOpaqueString:'hello' x:10 y:50
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   138
									[exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   139
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   140
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   141
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   142
    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
   143
    (dashed lines). The look of the line is controlled by joinStyle, capStyle,
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   144
    lineWidth and lineStyle.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   145
    `lineStyle' can be one of #solid, #dashed, #doubleDashed
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   146
    where: #solid        - is for solid lines, drawn with the current paint color
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   147
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   148
	   #dashed       - for dashed lines, where only the on-dashes are drawn
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   149
			   with the current paint color
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   150
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   151
	   #doubleDashed - dashed lines, draws on-dashes with paint color,
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   152
			   off-dashes with bgPaint
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   153
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   154
    for example:
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   155
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   156
	|v|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   157
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   158
	v := View new.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   159
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   160
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   161
	v paint:(Color red) on:(Color blue).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   162
	v displayLineFrom:(10@10) to:(90@90).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   163
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   164
	v lineStyle:#dashed.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   165
	v displayLineFrom:(90@10) to:(10@90).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   166
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   167
	v lineStyle:#doubleDashed.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   168
	v displayRectangle:((5@5) corner:(95@95)).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   169
									[exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   170
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   171
    changing the line-width:
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   172
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   173
	|v|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   174
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   175
	v := View new.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   176
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   177
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   178
	v paint:(Color red).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   179
	v displayLineFrom:(20@20) to:(80@80).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   180
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   181
	v lineWidth:5.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   182
	v displayLineFrom:(80@20) to:(20@80).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   183
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   184
	v lineWidth:8.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   185
	v displayRectangle:((5@5) corner:(95@95)).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   186
									[exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   187
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   188
    with wide lines, the corners (of polygons or rectangles) can be
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   189
    one of the joinStyles: #miter, #bevel, #round. The default is #miter.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   190
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   191
	|v|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   192
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   193
	v := View new extent:200@200.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   194
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   195
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   196
	v lineWidth:15.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   197
	v paint:(Color red).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   198
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   199
	v displayRectangle:((65@65) corner:(135@135)).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   200
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   201
	v joinStyle:#bevel.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   202
	v displayRectangle:((45@45) corner:(155@155)).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   203
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   204
	v joinStyle:#round.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   205
	v displayRectangle:((25@25) corner:(175@175)).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   206
									[exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   207
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   208
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   209
    the endPoints look is controlled with capStyle;
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   210
    possible values are: #notLast, #butt, #round, #projecting.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   211
    The default is #butt.
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   212
    #notLast is mostly useful when exoring (inverting): it will not draw the
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   213
    endPoint, to allow another line to join the previous line without inverting
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   214
    this point twice. (See the X manual for more info).
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   215
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   216
	|v|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   217
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   218
	v := View new extent:200@200.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   219
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   220
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   221
	v lineWidth:15.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   222
	v paint:(Color red).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   223
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   224
	v displayLineFrom:(25@25) to:(175@25).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   225
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   226
	v capStyle:#round.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   227
	v displayLineFrom:(25@55) to:(175@55).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   228
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   229
	v capStyle:#projecting.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   230
	v displayLineFrom:(25@85) to:(175@85).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   231
									[exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   232
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   233
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   234
    You can use a bitmap as a point color:
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   235
    (this may be slow on some graphics devices, though)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   236
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   237
	|v|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   238
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   239
	v := View new extent:200@200.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   240
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   241
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   242
	v lineWidth:15.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   243
	v paint:(Image fromFile:'granite_small.tiff').
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   244
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   245
	v displayLineFrom:(25@25) to:(175@25).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   246
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   247
	v capStyle:#round.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   248
	v displayLineFrom:(25@55) to:(175@55).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   249
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   250
	v capStyle:#projecting.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   251
	v displayLineFrom:(25@85) to:(175@85).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   252
									[exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   253
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   254
    all views support a translation and scale, so you can draw in another
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   255
    coordinate system:
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   256
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   257
	|v|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   258
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   259
	v := View new extent:200@200.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   260
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   261
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   262
	v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   263
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   264
	v scale:(2@2); translation:50.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   265
	v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   266
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   267
	v scale:(0.5@0.5); translation:0.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   268
	v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   269
									[exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   270
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   271
    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
   272
    things unscaled - this still translates the position, but
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   273
    uses the unscaled font (for example, to draw strings in a graphic):
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   274
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   275
	|v|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   276
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   277
	v := View new extent:200@200.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   278
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   279
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   280
	v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   281
	v displayString:'hello' x:50 y:40.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   282
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   283
	v scale:(2@4).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   284
	v displayForm:(Image fromFile:'SBrowser.xbm') x:10 y:10.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   285
	v displayUnscaledString:'hello' x:50 y:40.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   286
									[exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   287
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   288
    Filled objects are drawin using the #fillXXX methods; for example,
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   289
    displayRectangleXXX draws the outline, while fillRectangleXXX draws a
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   290
    filled one:
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   291
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   292
	|v|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   293
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   294
	v := View new extent:200@200.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   295
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   296
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   297
	v displayArcIn:(20@20 corner:50@50) from:0 angle:180.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   298
	v paint:Color yellow.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   299
	v fillArcIn:(120@120 corner:150@150) from:0 angle:180.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   300
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   301
	v paint:Color red.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   302
	v displayCircle:150@50 radius:30.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   303
	v paint:Color blue.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   304
	v fillCircle:50@150 radius:30.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   305
									[exEnd]
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   306
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   307
    polygons:
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   308
									[exBegin]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   309
	|v poly1 poly2|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   310
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   311
	poly1 := OrderedCollection new.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   312
	poly1 add:(10 @ 10).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   313
	poly1 add:(100 @ 50).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   314
	poly1 add:(50 @ 50).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   315
	poly1 add:(20 @ 100).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   316
	poly1 add:(10 @ 100).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   317
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   318
	poly2 := poly1 copy.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   319
	poly2 add:(poly2 first).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   320
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   321
	v := View new extent:200@200.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   322
	v openAndWait.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   323
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   324
	v scale:2.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   325
	v paint:Color red.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   326
	v fillPolygon:poly1.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   327
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   328
	v scale:1.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   329
	v paint:Color blue.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   330
	v displayPolygon:poly2.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   331
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   332
	v scale:0.5.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   333
	v paint:Color yellow.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   334
	v fillPolygon:poly1.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   335
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   336
									[exEnd]
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   337
"
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   338
! !
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   339
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   340
!GraphicsContext class methodsFor:'initialization'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   341
48194c26a46c Initial revision
claus
parents:
diff changeset
   342
initialize
48194c26a46c Initial revision
claus
parents:
diff changeset
   343
    "setup some defaults - these are usually redefined
48194c26a46c Initial revision
claus
parents:
diff changeset
   344
     during startup."
48194c26a46c Initial revision
claus
parents:
diff changeset
   345
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   346
    DrawingOnClosedDrawableSignal isNil ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   347
	DrawingOnClosedDrawableSignal := Signal new mayProceed:true.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   348
	DrawingOnClosedDrawableSignal nameClass:self message:#drawingOnClosedDrawableSignal.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   349
	DrawingOnClosedDrawableSignal notifierString:'drawing attempt on closed drawable'.
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   350
    ].
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   351
134
claus
parents: 109
diff changeset
   352
    White isNil ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   353
	Color initialize.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   354
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   355
	Display notNil ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   356
	    White := Display whiteColor.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   357
	    Black := Display blackColor.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   358
	] ifFalse:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   359
	    White := Color white.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   360
	    Black := Color black.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   361
	].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   362
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   363
	Font initialize.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   364
	DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   365
	Display notNil ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   366
	    DefaultFont := DefaultFont onDevice:Display
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   367
	]
134
claus
parents: 109
diff changeset
   368
    ]
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   369
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   370
    "Modified: / 29.1.1998 / 12:56:18 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   371
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   372
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   373
!GraphicsContext class methodsFor:'instance creation'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   374
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   375
new
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   376
    "return a new instance of myself. Redefined to initialize
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   377
     the new thingy"
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   378
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   379
    ^ self basicNew initialize
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   380
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   381
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   382
!GraphicsContext class methodsFor:'Signal constants'!
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   383
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   384
drawingOnClosedDrawableSignal
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   385
    "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
   386
     on a closed drawable.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   387
     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
   388
     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
   389
     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
   390
     and the background process continues to draw.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   391
     In this case, the background thread should handle this signal
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   392
     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
   393
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   394
    ^ DrawingOnClosedDrawableSignal
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
    "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
   397
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   398
     |v|
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
     v := StandardSystemView new openAndWait.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   401
     [
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   402
	[true] whileTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   403
	    |x y|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   404
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   405
	    x := Random nextIntegerBetween:0 and:(v width).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   406
	    y := Random nextIntegerBetween:0 and:(v height).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   407
	    v displayString:'hello' x:x y:y.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   408
	    Delay waitForSeconds:0.5.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   409
	]
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   410
     ] fork.
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
    "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
   413
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   414
     |v|
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 := StandardSystemView new openAndWait.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   417
     [
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   418
	v class drawingOnClosedDrawableSignal handle:[:ex |
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   419
	    ex return
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   420
	] do:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   421
	    [true] whileTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   422
		|x y|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   423
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   424
		x := Random nextIntegerBetween:0 and:(v width).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   425
		y := Random nextIntegerBetween:0 and:(v height).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   426
		v displayString:'hello' x:x y:y.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   427
		Delay waitForSeconds:0.5.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   428
	    ]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   429
	]
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   430
     ] fork.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   431
    "
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   432
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   433
    "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
   434
    "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
   435
! !
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2017
diff changeset
   436
5032
93bc49567a43 category change
Claus Gittinger <cg@exept.de>
parents: 4984
diff changeset
   437
!GraphicsContext class methodsFor:'accessing-defaults'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   438
48194c26a46c Initial revision
claus
parents:
diff changeset
   439
defaultFont
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   440
    "get the default font used for drawing"
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   441
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   442
    DefaultFont isNil ifTrue:[
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   443
	DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   444
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   445
    ^ DefaultFont
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   446
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   447
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   448
defaultFont:aFont
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   449
    "set the default font used for drawing"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   450
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   451
    DefaultFont := aFont
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   452
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   453
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   454
!GraphicsContext class methodsFor:'constants'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   455
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   456
capButt
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   457
    "return a constant to specify butt cap"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   458
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   459
    ^ #butt
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   460
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   461
48194c26a46c Initial revision
claus
parents:
diff changeset
   462
capNotLast
48194c26a46c Initial revision
claus
parents:
diff changeset
   463
    "return a constant to specify not-last cap"
48194c26a46c Initial revision
claus
parents:
diff changeset
   464
48194c26a46c Initial revision
claus
parents:
diff changeset
   465
    ^ #notLast
48194c26a46c Initial revision
claus
parents:
diff changeset
   466
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   467
48194c26a46c Initial revision
claus
parents:
diff changeset
   468
capProjecting
48194c26a46c Initial revision
claus
parents:
diff changeset
   469
    "return a constant to specify projecting cap"
48194c26a46c Initial revision
claus
parents:
diff changeset
   470
48194c26a46c Initial revision
claus
parents:
diff changeset
   471
    ^ #projecting
48194c26a46c Initial revision
claus
parents:
diff changeset
   472
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   473
48194c26a46c Initial revision
claus
parents:
diff changeset
   474
capRound
48194c26a46c Initial revision
claus
parents:
diff changeset
   475
    "return a constant to specify round cap"
48194c26a46c Initial revision
claus
parents:
diff changeset
   476
48194c26a46c Initial revision
claus
parents:
diff changeset
   477
    ^ #round
48194c26a46c Initial revision
claus
parents:
diff changeset
   478
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   479
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   480
joinBevel
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   481
    "return a constant to specify bevel join"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   482
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   483
    ^ #bevel
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   484
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   485
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   486
joinMiter
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   487
    "return a constant to specify miter join"
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
    ^ #miter
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   490
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   491
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   492
joinRound
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   493
    "return a constant to specify round join"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   494
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   495
    ^ #round
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   496
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   497
7860
46360e9dcdb7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7801
diff changeset
   498
!GraphicsContext class methodsFor:'queries'!
46360e9dcdb7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7801
diff changeset
   499
46360e9dcdb7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7801
diff changeset
   500
isAbstract
46360e9dcdb7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7801
diff changeset
   501
    "Return if this class is an abstract class.
46360e9dcdb7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7801
diff changeset
   502
     True is returned here for myself only; false for subclasses.
46360e9dcdb7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7801
diff changeset
   503
     Abstract subclasses must redefine this again."
46360e9dcdb7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7801
diff changeset
   504
46360e9dcdb7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7801
diff changeset
   505
    ^ self == GraphicsContext.
46360e9dcdb7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7801
diff changeset
   506
! !
46360e9dcdb7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7801
diff changeset
   507
3880
c4c8268a2d9f method category rename
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
   508
!GraphicsContext methodsFor:'Compatibility-ST80'!
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   509
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   510
displayArc:origin radius:radius from:startAngle angle:angle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   511
    "draw an arc around a point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   512
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   513
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   514
	displayArcX:(origin x - radius)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   515
		  y:(origin y - radius)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   516
	      width:(radius * 2)
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   517
	     height:(radius * 2)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   518
	       from:startAngle
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   519
	      angle:angle
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   520
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   521
    "Modified: 8.5.1996 / 08:34:43 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   522
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   523
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   524
displayArcBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   525
   "draw an arc/circle/ellipse - ST-80 compatibility"
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   526
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   527
   ^ self displayArcX:(boundingBox left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   528
		    y:(boundingBox top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   529
		width:(boundingBox width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   530
	       height:(boundingBox height)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   531
		 from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   532
		angle:sweepAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   533
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   534
    "Created: / 14.11.1997 / 21:04:19 / cg"
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   535
!
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   536
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   537
displayArcBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle at:origin
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   538
   "draw an arc/circle/ellipse - ST-80 compatibility"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   539
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   540
   ^ self displayArcX:(boundingBox left + origin x)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   541
		    y:(boundingBox top + origin y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   542
		width:(boundingBox width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   543
	       height:(boundingBox height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   544
		 from:startAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   545
		angle:sweepAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   546
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   547
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   548
displayLineFrom:startPoint to:endPoint translateBy:anOffset
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   549
    "draw a line - ST-80 compatibility"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   550
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   551
    self displayLineFrom:(startPoint + anOffset)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   552
		      to:(endPoint + anOffset)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   553
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   554
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   555
displayPolyline:aPolygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   556
    "draw a polygon - ST-80 compatibility"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   557
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   558
    ^ self displayPolygon:aPolygon
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   559
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   560
4379
02ac555f6b0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4377
diff changeset
   561
displayRectangularBorder:aRectangle
02ac555f6b0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4377
diff changeset
   562
    "draw a rectangle - ST-80 compatibility"
02ac555f6b0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4377
diff changeset
   563
02ac555f6b0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4377
diff changeset
   564
    self displayRectangle:aRectangle
02ac555f6b0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4377
diff changeset
   565
!
02ac555f6b0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4377
diff changeset
   566
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   567
displayRectangularBorder:aRectangle at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   568
    "draw a rectangle - ST-80 compatibility"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   569
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   570
    self displayRectangle:(aRectangle translateBy:aPoint)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   571
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   572
1280
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   573
displayWedgeBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   574
   "fill an arc/circle/ellipse - ST-80 compatibility"
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   575
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   576
   ^ self fillArcX:(boundingBox left)
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   577
		 y:(boundingBox top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   578
	     width:(boundingBox width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   579
	    height:(boundingBox height)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   580
	      from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   581
	     angle:sweepAngle
1280
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   582
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   583
    "Created: 27.1.1997 / 15:50:14 / cg"
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   584
!
a2a81377d894 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   585
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   586
displayWedgeBoundedBy:boundingBox startAngle:startAngle sweepAngle:sweepAngle at:origin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   587
   "fill an arc/circle/ellipse - ST-80 compatibility"
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   588
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   589
   ^ self fillArcX:(boundingBox left + origin x)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   590
		 y:(boundingBox top + origin y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   591
	     width:(boundingBox width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   592
	    height:(boundingBox height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   593
	      from:startAngle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   594
	     angle:sweepAngle
2807
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   595
!
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   596
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   597
findFont:aFontDescription
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   598
    "given a fontDescription, return a device font for it
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   599
     on my device."
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   600
2827
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2807
diff changeset
   601
    ^ aFontDescription onDevice:device
2807
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   602
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   603
    "Modified: 28.5.1996 / 20:22:29 / cg"
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   604
!
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   605
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   606
phase
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   607
    "return the origin within the mask (used to draw with patterns).
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   608
     This is an alias for ST/X's #maskOrigin"
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   609
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   610
    ^ self maskOrigin
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   611
!
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   612
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   613
phase:aPoint
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   614
    "set the origin within the mask (used to draw with patterns).
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   615
     This is an alias for ST/X's #maskOrigin:"
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   616
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   617
    ^ self maskOrigin:aPoint
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   618
!
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   619
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   620
setDevicePattern:aColorOrMask
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   621
    "ST/X can paint in any color or image"
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   622
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   623
    self paint:aColorOrMask
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   624
!
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   625
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   626
tilePhase
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   627
    "return the origin within the mask (used to draw with patterns).
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   628
     This is an alias for ST/X's #maskOrigin"
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   629
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   630
    ^ self maskOrigin
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   631
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   632
    "Created: 4.6.1996 / 15:26:39 / cg"
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   633
!
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   634
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   635
tilePhase:aPoint
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   636
    "set the origin within the mask (used to draw with patterns).
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   637
     This is an alias for ST/X's #maskOrigin"
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   638
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   639
    ^ self maskOrigin:aPoint
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   640
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   641
    "Created: 4.6.1996 / 15:26:49 / cg"
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   642
!
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   643
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   644
widthOfString:aString
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   645
    "given a string, return its width in pixels if
7240
a89267cf99b4 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7015
diff changeset
   646
     drawn on the receiver's device."
2807
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   647
2827
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2807
diff changeset
   648
    ^ (font onDevice:device) widthOf:aString
2807
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   649
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   650
    "Modified: 28.5.1996 / 20:22:22 / cg"
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   651
!
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   652
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   653
widthOfString:aString from:start to:stop
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   654
    "given a string, return the width in pixels if
7240
a89267cf99b4 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7015
diff changeset
   655
     a substring is drawn on the receiver's device."
2807
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   656
2827
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2807
diff changeset
   657
    ^ (font onDevice:device) widthOf:aString from:start to:stop
2807
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   658
d65200e6a0d6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2806
diff changeset
   659
    "Modified: 28.5.1996 / 20:22:18 / cg"
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   660
! !
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   661
3880
c4c8268a2d9f method category rename
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
   662
!GraphicsContext methodsFor:'Compatibility-Squeak'!
2806
3dcf15761c17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
   663
2938
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   664
fill:aRectangle fillColor:aColor
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   665
    "fill a rectangle with the given color color"
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   666
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   667
    |savedPaint|
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   668
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   669
    savedPaint := paint.
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   670
    self paint:aColor.
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   671
    self fillRectangle:aRectangle.
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   672
    self paint:savedPaint
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   673
!
898d40365e5f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
   674
3310
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
   675
fillRectangle:aRectangle color:aColor
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
   676
    "fill a rectangle with the given paint color"
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
   677
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
   678
    |oldPaint|
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
   679
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
   680
    oldPaint := paint.
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
   681
    self paint:aColor.
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
   682
    self fillRectangle:aRectangle.
5593d19c3d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3162
diff changeset
   683
    self paint:oldPaint.
2806
3dcf15761c17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
   684
! !
3dcf15761c17 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
   685
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   686
!GraphicsContext methodsFor:'accessing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   687
48194c26a46c Initial revision
claus
parents:
diff changeset
   688
backgroundPaint
48194c26a46c Initial revision
claus
parents:
diff changeset
   689
    "return the background paint color.
48194c26a46c Initial revision
claus
parents:
diff changeset
   690
     (used for opaqueForms and opaqueStrings)"
48194c26a46c Initial revision
claus
parents:
diff changeset
   691
48194c26a46c Initial revision
claus
parents:
diff changeset
   692
    ^ bgPaint
48194c26a46c Initial revision
claus
parents:
diff changeset
   693
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   694
48194c26a46c Initial revision
claus
parents:
diff changeset
   695
backgroundPaint:aColor
48194c26a46c Initial revision
claus
parents:
diff changeset
   696
    "set the background painting color (which is used for
48194c26a46c Initial revision
claus
parents:
diff changeset
   697
     opaqueForms and opaqueStrings). aColor can be a dithered one."
48194c26a46c Initial revision
claus
parents:
diff changeset
   698
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   699
    bgPaint := aColor
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   700
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   701
    "Modified: 12.5.1996 / 22:25:17 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   702
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   703
7503
bdb0ef0d889a #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7477
diff changeset
   704
basicFont
bdb0ef0d889a #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7477
diff changeset
   705
    "return the font for drawing"
bdb0ef0d889a #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7477
diff changeset
   706
bdb0ef0d889a #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7477
diff changeset
   707
    ^ font
bdb0ef0d889a #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7477
diff changeset
   708
bdb0ef0d889a #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7477
diff changeset
   709
    "Created: 12.5.1996 / 11:17:59 / cg"
bdb0ef0d889a #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7477
diff changeset
   710
!
bdb0ef0d889a #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7477
diff changeset
   711
6272
406862df2374 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6268
diff changeset
   712
blackColor
7463
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
   713
    "return the black color on this device.
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
   714
     This is the same as 'Color black onDevice:self device', but much faster."
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
   715
6272
406862df2374 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6268
diff changeset
   716
    ^ device blackColor
406862df2374 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6268
diff changeset
   717
!
406862df2374 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6268
diff changeset
   718
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   719
capStyle
4377
d71b81b9797f comments
Claus Gittinger <cg@exept.de>
parents: 4215
diff changeset
   720
    "return the current cap-style for line-drawing.
d71b81b9797f comments
Claus Gittinger <cg@exept.de>
parents: 4215
diff changeset
   721
     possible styles are: #notLast, #butt, #round, #projecting"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   722
48194c26a46c Initial revision
claus
parents:
diff changeset
   723
    ^ capStyle
48194c26a46c Initial revision
claus
parents:
diff changeset
   724
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   725
48194c26a46c Initial revision
claus
parents:
diff changeset
   726
capStyle:aStyleSymbol
48194c26a46c Initial revision
claus
parents:
diff changeset
   727
    "set the cap-style for line-drawing;
48194c26a46c Initial revision
claus
parents:
diff changeset
   728
     possible styles are: #notLast, #butt, #round, #projecting"
48194c26a46c Initial revision
claus
parents:
diff changeset
   729
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   730
    aStyleSymbol isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   731
	capStyle := #butt
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   732
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   733
	capStyle := aStyleSymbol
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   734
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   735
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   736
    "Modified: 12.5.1996 / 22:24:30 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   737
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   738
4071
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   739
characterEncoding
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   740
    "returns a symbol describing how the contents is encoded internally.
7289
0d69fc01daba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7240
diff changeset
   741
     This is now obsolete, as we are always using unicode internally.
4071
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   742
     (encoding is something like #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc)"
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   743
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   744
    ^ characterEncoding
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   745
!
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   746
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   747
characterEncoding:encodingArg
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   748
    "define how the contents is encoded internally.
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   749
     This should normally never be required, as ST/X now assumes
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   750
     unicode (of which iso8859-1 is a subset) encoding.
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   751
     The possibility to change the characterEncoding is provided as
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   752
     a backward compatibility hook for programs which want to use
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   753
     another encoding internally.
7289
0d69fc01daba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7240
diff changeset
   754
     One such view is the CharacterSetView,
4071
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   755
     which wants to show character as they are actually present in a font."
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   756
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   757
    |encodingSymOrNil|
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   758
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   759
    encodingSymOrNil := encodingArg isNil
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   760
			    ifTrue:[#'iso10646-1' "unicode"]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   761
			    ifFalse:[encodingArg asSymbol].
4071
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   762
    characterEncoding ~~ encodingSymOrNil ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   763
	characterEncoding := encodingSymOrNil.
4071
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   764
    ].
5841
fdcb897dbcc5 comment: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents: 5780
diff changeset
   765
fdcb897dbcc5 comment: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents: 5780
diff changeset
   766
    "Modified (comment): / 25-01-2012 / 00:29:37 / cg"
4071
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   767
!
73f2f46b75d4 characterEncoding stuff moved
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   768
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   769
clippingBounds
7015
09828e08bc73 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
   770
    "return the clip-rectangle for drawing (in logical coordinates).
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   771
     If there is currently no active clip, return the underlying
6216
3807505561bf class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6173
diff changeset
   772
     medium (i.e. device) bounds. Added for ST-80 compatibility."
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   773
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   774
    |rect|
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   775
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   776
    clipRect isNil ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   777
	rect := 0@0 extent:(self medium extent).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   778
	transformation notNil ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   779
	    rect := transformation applyInverseTo:rect.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   780
	].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   781
	^ rect
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   782
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   783
    transformation notNil ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   784
	^ transformation applyInverseTo:clipRect.
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   785
    ].
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   786
    ^ clipRect
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   787
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   788
    "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
   789
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   790
6216
3807505561bf class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6173
diff changeset
   791
clippingBounds:aRectangleOrNil
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   792
    "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
   793
     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
   794
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   795
    (aRectangleOrNil notNil and:[transformation notNil]) ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   796
	clipRect := transformation applyTo:aRectangleOrNil.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   797
    ] ifFalse:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   798
	clipRect := aRectangleOrNil
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   799
    ].
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   800
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   801
    "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
   802
    "Created: 28.5.1996 / 14:09:27 / cg"
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   803
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
   804
6216
3807505561bf class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6173
diff changeset
   805
clippingBoundsOrNil
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   806
    "return the clipping bounds (a Rectangle) for drawing in logical coordinates, nil if there is none."
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   807
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   808
    clipRect isNil ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   809
	^ nil
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   810
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   811
    transformation notNil ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   812
	^ transformation applyInverseTo:clipRect.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   813
    ].
6216
3807505561bf class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6173
diff changeset
   814
    ^ clipRect
3807505561bf class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6173
diff changeset
   815
3807505561bf class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6173
diff changeset
   816
    "Created: 10.4.1996 / 14:32:02 / cg"
3807505561bf class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6173
diff changeset
   817
    "Modified: 28.5.1996 / 14:08:19 / cg"
3807505561bf class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6173
diff changeset
   818
!
3807505561bf class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6173
diff changeset
   819
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   820
dashStyle:aDashList offset:dashOffset
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   821
    "define dashes. Each element of the dashList specifies the length
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   822
     of a corresponding dash. For example, setting it to [4 4]
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   823
     defines 4on-4off dashing;
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   824
     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
   825
     The dashOffset specifies where in the dashList the dashing starts.
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   826
     Ignored here - this may not be supported by all graphics devices."
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   827
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   828
    ^ self
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   829
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   830
    "Created: 4.6.1996 / 18:59:34 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   831
    "Modified: 4.6.1996 / 19:03:38 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   832
!
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   833
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   834
font
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   835
    "return the current drawing font"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   836
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   837
    ^ font
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
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   840
font:aFont
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   841
    "set the drawing font"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   842
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   843
    ^ self subclassResponsibility
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
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   846
function
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   847
    "return the current drawing function"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   848
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   849
    ^ function
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
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   852
function:aFunctionSymbol
7912
3bd30e57a8b0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7860
diff changeset
   853
    "set the (bitblt) drawing function.
3bd30e57a8b0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7860
diff changeset
   854
     The argument is one of:
3bd30e57a8b0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7860
diff changeset
   855
        #and, #or, #copy
3bd30e57a8b0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7860
diff changeset
   856
    "
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   857
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   858
    ^ self subclassResponsibility
7912
3bd30e57a8b0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7860
diff changeset
   859
3bd30e57a8b0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7860
diff changeset
   860
    "Modified (comment): / 17-02-2017 / 16:44:24 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   861
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   862
735
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   863
graphicsContext
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   864
    "for ST-80 compatibility"
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   865
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   866
    ^ self
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   867
!
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   868
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   869
graphicsDevice
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   870
    "same as #device, for ST-80 compatibility"
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   871
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   872
    ^ device
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   873
!
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   874
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   875
joinStyle
4377
d71b81b9797f comments
Claus Gittinger <cg@exept.de>
parents: 4215
diff changeset
   876
    "return the current join-style for polygon-drawing.
d71b81b9797f comments
Claus Gittinger <cg@exept.de>
parents: 4215
diff changeset
   877
     possible styles are: #miter, #bevel, #round"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   878
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   879
    ^ joinStyle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   880
!
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   881
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   882
joinStyle:aStyleSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   883
    "set the join-style of lines in polygon-drawing;
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   884
     possible styles are: #miter, #bevel, #round"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   885
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   886
    aStyleSymbol isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   887
	joinStyle := #miter
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   888
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   889
	joinStyle := aStyleSymbol
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   890
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   891
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   892
    "Modified: 12.5.1996 / 22:24:14 / cg"
519
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
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   895
lineStyle
4377
d71b81b9797f comments
Claus Gittinger <cg@exept.de>
parents: 4215
diff changeset
   896
    "return the current line-drawing-style.
d71b81b9797f comments
Claus Gittinger <cg@exept.de>
parents: 4215
diff changeset
   897
     possible styles are: #solid, #dashed, #doubleDashed,
d71b81b9797f comments
Claus Gittinger <cg@exept.de>
parents: 4215
diff changeset
   898
     #dotted, #dashDot or #dashDotDot."
519
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
    ^ lineStyle
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   901
!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   902
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   903
lineStyle:aStyleSymbol
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   904
    "set the line-drawing-style;
2360
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
   905
     possible styles are: #solid, #dashed, #doubleDashed,
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
   906
     #dotted, #dashDot or #dashDotDot."
151
claus
parents: 134
diff changeset
   907
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   908
    aStyleSymbol isNil ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   909
	lineStyle := #solid
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   910
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   911
	lineStyle := aStyleSymbol
678
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   912
    ]
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   913
a0e9b66778d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   914
    "Modified: 12.5.1996 / 22:19:25 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   915
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   916
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   917
lineWidth
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   918
    "return the current drawing linewidth"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   919
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   920
    ^ lineWidth
151
claus
parents: 134
diff changeset
   921
!
claus
parents: 134
diff changeset
   922
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   923
lineWidth:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   924
    "set the line drawing width in pixels"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   925
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   926
    lineWidth := aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   927
!
151
claus
parents: 134
diff changeset
   928
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   929
mask
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   930
    "return the current drawing mask"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   931
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   932
    ^ mask
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
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   935
mask:aForm
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   936
    "set the drawing mask"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   937
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   938
    ^ self subclassResponsibility
151
claus
parents: 134
diff changeset
   939
!
claus
parents: 134
diff changeset
   940
claus
parents: 134
diff changeset
   941
maskOrigin
claus
parents: 134
diff changeset
   942
    "return the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   943
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   944
     This is an alias for ST-80's #phase"
claus
parents: 134
diff changeset
   945
claus
parents: 134
diff changeset
   946
    ^ maskOrigin
claus
parents: 134
diff changeset
   947
!
claus
parents: 134
diff changeset
   948
claus
parents: 134
diff changeset
   949
maskOrigin:aPoint
claus
parents: 134
diff changeset
   950
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   951
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   952
     This is an alias for ST-80's #phase:"
claus
parents: 134
diff changeset
   953
2017
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   954
    maskOrigin := aPoint.
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   955
    ^ self
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   956
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   957
    "Modified: / 26.1.1998 / 18:59:18 / cg"
151
claus
parents: 134
diff changeset
   958
!
claus
parents: 134
diff changeset
   959
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
   960
maskOriginX:x y:y
151
claus
parents: 134
diff changeset
   961
    "set the origin within the mask (used to draw with patterns).
claus
parents: 134
diff changeset
   962
     Should be redefined in classes which support it.
claus
parents: 134
diff changeset
   963
     This is an alias for ST-80's #phase:"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 81
diff changeset
   964
2017
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   965
    ^ self maskOrigin:(x @ y)
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   966
2cd9aaa851a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
   967
    "Modified: / 26.1.1998 / 18:59:56 / cg"
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   968
!
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   969
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   970
medium
1346
619cd027ce68 commentary
ca
parents: 1319
diff changeset
   971
    "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
   972
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   973
    ^ device
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   974
720
a582a7af45f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   975
    "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
   976
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   977
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   978
paint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   979
    "return the current paint drawing color"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   980
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   981
    ^ paint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   982
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   983
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   984
paint:aColor
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   985
    "set the drawing painting color, aColor can be a dithered one"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   986
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   987
    paint := aColor
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   988
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   989
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   990
paint:fgColor on:bgColor
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   991
    "set the paint and backgroundPaint, used for text and bitmaps.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   992
     Both colors may be dithered colors"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   993
671
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   994
    fgColor ~~ paint ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   995
	self paint:fgColor.
671
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   996
    ].
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
   997
    bgPaint := bgColor
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
   998
671
1bca26786912 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
   999
    "Modified: 12.5.1996 / 19:40:43 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1000
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1001
7703
ed5256740f66 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
  1002
setDevice:aDevice
ed5256740f66 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
  1003
    device := aDevice
ed5256740f66 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
  1004
!
ed5256740f66 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7503
diff changeset
  1005
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1006
viewOrigin
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1007
    "return the drawables visible origin (for scrolling)"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1008
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1009
    ^ 0@0
6272
406862df2374 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6268
diff changeset
  1010
!
406862df2374 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6268
diff changeset
  1011
406862df2374 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6268
diff changeset
  1012
whiteColor
6535
163c6d470624 class: GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1013
    "return the white color on this device.
7463
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1014
     This is the same as 'Color white onDevice:self device', but much faster."
6535
163c6d470624 class: GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1015
6272
406862df2374 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6268
diff changeset
  1016
    ^ device whiteColor
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1017
! !
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1018
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1019
!GraphicsContext methodsFor:'accessing-transformation'!
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1020
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1021
scale
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1022
    "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
  1023
707
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  1024
    transformation isNil ifTrue:[^ 1@1].
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1025
    ^ transformation scale
707
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  1026
d166ed985c61 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  1027
    "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
  1028
!
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1029
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1030
scale:aPoint
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1031
    "set the scale factor of the transformation"
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1032
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1033
    transformation isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1034
	aPoint = 1 ifTrue:[^ self].
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1035
	transformation := WindowingTransformation scale:aPoint translation:0
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1036
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1037
	transformation scale:aPoint.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1038
    ]
418
0e10e256d5b2 scale access methods moved from SimpleView
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1039
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1040
    "Modified: 27.4.1996 / 18:47:38 / cg"
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
  1041
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
  1042
7474
ff35cd980d70 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7463
diff changeset
  1043
scale:scale translation:aPoint
ff35cd980d70 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7463
diff changeset
  1044
    transformation isNil ifTrue:[
ff35cd980d70 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7463
diff changeset
  1045
        (aPoint = 0 and:[scale = 1]) ifTrue:[^ self].
ff35cd980d70 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7463
diff changeset
  1046
        transformation := WindowingTransformation scale:scale translation:aPoint
ff35cd980d70 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7463
diff changeset
  1047
    ] ifFalse:[
ff35cd980d70 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7463
diff changeset
  1048
        transformation scale:scale translation:aPoint.
ff35cd980d70 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7463
diff changeset
  1049
    ]
ff35cd980d70 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7463
diff changeset
  1050
!
ff35cd980d70 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7463
diff changeset
  1051
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1052
transformation
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
  1053
    "return the transformation"
db983d8d7e53 scaling
claus
parents: 71
diff changeset
  1054
db983d8d7e53 scaling
claus
parents: 71
diff changeset
  1055
    ^ transformation
db983d8d7e53 scaling
claus
parents: 71
diff changeset
  1056
!
db983d8d7e53 scaling
claus
parents: 71
diff changeset
  1057
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1058
transformation:aTransformation
76
db983d8d7e53 scaling
claus
parents: 71
diff changeset
  1059
    "set the transformation"
db983d8d7e53 scaling
claus
parents: 71
diff changeset
  1060
db983d8d7e53 scaling
claus
parents: 71
diff changeset
  1061
    transformation := aTransformation
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1062
!
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1063
1319
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1064
translateBy:aPoint
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1065
    "add to the translation offset of the transformation"
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1066
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1067
    transformation isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1068
	aPoint = 0 ifTrue:[^ self].
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1069
	transformation := WindowingTransformation scale:1 translation:aPoint
1319
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1070
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1071
	transformation translateBy:aPoint
1319
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1072
    ]
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1073
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1074
    "Created: 10.2.1997 / 13:50:22 / cg"
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1075
!
4f21750c19bf added #translateBy:
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1076
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1077
translation
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1078
    "return the translation factor (as point) of the transformation"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1079
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1080
    transformation isNil ifTrue:[^ 0@0].
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1081
    ^ transformation translation
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1082
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1083
    "Created: 27.4.1996 / 18:46:41 / cg"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1084
!
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1085
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1086
translation:aPoint
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1087
    "set the translation offset of the transformation"
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1088
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1089
    transformation isNil ifTrue:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1090
	aPoint = 0 ifTrue:[^ self].
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1091
	transformation := WindowingTransformation scale:1 translation:aPoint
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1092
    ] ifFalse:[
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1093
	transformation translation:aPoint.
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1094
    ]
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1095
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
  1096
    "Created: 27.4.1996 / 18:47:28 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1097
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1098
4396
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1099
!GraphicsContext methodsFor:'basic drawing'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1100
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1101
displayArcX:x y:y width:width height:height from:startAngle angle:angle
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1102
    "draw an arc in a box
48194c26a46c Initial revision
claus
parents:
diff changeset
  1103
     - this could be recoded to draw using displayLine"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1104
48194c26a46c Initial revision
claus
parents:
diff changeset
  1105
    ^ self subclassResponsibility
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1106
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1107
    "Created: 8.5.1996 / 08:47:06 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1108
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1109
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1110
displayDottedRectangleX:x y:y width:w height:h
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1111
    "draw a dotted-line rectangle
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1112
     A general implementation is found here; deviceGC's
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1113
     may reimplement this if directly supported by the device"
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1114
2747
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1115
    |lastX lastY x0 y0 oldStyle|
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1116
3535
d9e6b1086029 dotted line
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1117
    (false "(device platformName ~= 'WIN32')"
2747
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1118
    or:[OperatingSystem isMSWINDOWSNTlike]) ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1119
	oldStyle := lineStyle.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1120
	self lineStyle:#dotted.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1121
	self displayRectangleX:x y:y width:w height:h.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1122
	self lineStyle:oldStyle.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1123
	^ self.
2747
04c41d416186 draw dotted line faster if display supports it.
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  1124
    ].
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1125
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1126
    1 to:w-1 by:2 do:[:o |
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1127
	lastX := x + o.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1128
	self displayPointX:lastX y:y.
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1129
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1130
    y0 := 1.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1131
    lastX == (x+w-1) ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1132
	y0 := 0
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1133
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1134
    y0 to:h-1 by:2 do:[:o |
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1135
	lastY := y+o.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1136
	self displayPointX:x+w-1 y:lastY.
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1137
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1138
    x0 := w-2.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1139
    lastY == (y+h-1) ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1140
	x0:= w-1
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1141
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1142
    x0 to:0 by:-2 do:[:o |
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1143
	lastX := x+o.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1144
	self displayPointX:lastX y:y+h-1.
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1145
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1146
    y0 := h-1.
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1147
    lastX == 0 ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1148
	y0 := h-1
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1149
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1150
    y0 to:0 by:-2 do:[:o |
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1151
	self displayPointX:x y:y+o.
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1152
    ].
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1153
3535
d9e6b1086029 dotted line
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1154
    "Modified: / 6.11.2001 / 08:48:18 / cg"
2354
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1155
!
2755d3d1addd added #displayDottedRectangle... (for win95)
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  1156
2392
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1157
displayHorizontalWavelineFromX:x0 y:y0 toX:x1
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1158
    "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
  1159
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1160
    |w h pattern form x oldClip|
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1161
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1162
"/    pattern := #[
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1163
"/                 2r00000000 2r00111100
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1164
"/                 2r00000000 2r11000011
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1165
"/                 2r11000011 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1166
"/                 2r00111100 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1167
"/                ].
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1168
"/    h := 4.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1169
"/    w := 16.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1170
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1171
"/    pattern := #[
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1172
"/                 2r00000000 2r01111000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1173
"/                 2r00000000 2r10000100
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1174
"/                 2r10000001 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1175
"/                 2r01000010 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1176
"/                 2r00111100 2r00000000
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1177
"/                ].
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1178
"/    h := 5.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1179
"/    w := 14.
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1180
2782
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1181
"/    pattern := #[
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1182
"/                 2r00000001 2r11100000
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1183
"/                 2r00000010 2r00010000
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1184
"/                 2r10000100 2r00000000
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1185
"/                 2r01111000 2r00000000
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1186
"/                ].
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1187
"/    h := 4.
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1188
"/    w := 12.
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1189
"/
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1190
"/    pattern := #[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1191
"/                 2r00000011
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1192
"/                 2r11001100
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1193
"/                 2r00110000
2782
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1194
"/                ].
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1195
"/    h := 3.
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1196
"/    w := 8.
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1197
2392
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1198
    pattern := #[
7463
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1199
                 2r11001100 2r11001100 2r11001100 2r11001100
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1200
                 2r00110011 2r00110011 2r00110011 2r00110011
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1201
                ].
2782
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1202
    h := 2.
5777
8a5b6ccd5476 changed: #displayHorizontalWavelineFromX:y:toX:
Claus Gittinger <cg@exept.de>
parents: 5355
diff changeset
  1203
    w := 32.
2782
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1204
5780
7acd722f9cf9 comment/format in: #displayHorizontalWavelineFromX:y:toX:
Claus Gittinger <cg@exept.de>
parents: 5777
diff changeset
  1205
"/    pattern := #[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1206
"/                 2r11000000
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1207
"/                 2r00110000
5780
7acd722f9cf9 comment/format in: #displayHorizontalWavelineFromX:y:toX:
Claus Gittinger <cg@exept.de>
parents: 5777
diff changeset
  1208
"/                ].
7acd722f9cf9 comment/format in: #displayHorizontalWavelineFromX:y:toX:
Claus Gittinger <cg@exept.de>
parents: 5777
diff changeset
  1209
"/    h := 2.
7acd722f9cf9 comment/format in: #displayHorizontalWavelineFromX:y:toX:
Claus Gittinger <cg@exept.de>
parents: 5777
diff changeset
  1210
"/    w := 4.
7acd722f9cf9 comment/format in: #displayHorizontalWavelineFromX:y:toX:
Claus Gittinger <cg@exept.de>
parents: 5777
diff changeset
  1211
2782
00a7ee0a230d smaller underwave pattern
Claus Gittinger <cg@exept.de>
parents: 2765
diff changeset
  1212
    form := Form width:w height:h fromArray:pattern.
2392
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1213
7463
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1214
    oldClip := self clippingBoundsOrNil.
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1215
    self clippingBounds:((x0 @ y0) corner:(x1 @ (y0+h))).
2392
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1216
2783
665caca8506e care to use the same waveline origin
Claus Gittinger <cg@exept.de>
parents: 2782
diff changeset
  1217
    x := x0 truncateTo:w.
2392
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1218
    [x <= x1] whileTrue:[
7463
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1219
        self displayForm:form x:x y:y0.
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1220
        x := x + w.
2392
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1221
    ].
7463
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1222
    self clippingBounds:oldClip
2392
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1223
5777
8a5b6ccd5476 changed: #displayHorizontalWavelineFromX:y:toX:
Claus Gittinger <cg@exept.de>
parents: 5355
diff changeset
  1224
    "Created: / 28-10-1998 / 15:31:41 / cg"
5780
7acd722f9cf9 comment/format in: #displayHorizontalWavelineFromX:y:toX:
Claus Gittinger <cg@exept.de>
parents: 5777
diff changeset
  1225
    "Modified: / 24-07-2011 / 21:12:24 / cg"
2392
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1226
!
5664d81a3ea4 added support for wave-line underlining
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  1227
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1228
displayLineFromX:x0 y:y0 toX:x1 y:y1
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1229
    "draw a line from x0/y0 to x1/y1"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1230
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1231
    ^ self subclassResponsibility
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
  1232
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1233
    "Created: 28.5.1996 / 17:12:37 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1234
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1235
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 24
diff changeset
  1236
displayOpaqueForm:aForm x:x y:y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1237
    "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
  1238
     drawn in current fg, 0's in current bg color.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1239
     If the form has depth ~~ 1, it is copied as is onto the receiver"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1240
48194c26a46c Initial revision
claus
parents:
diff changeset
  1241
    ^ self subclassResponsibility
48194c26a46c Initial revision
claus
parents:
diff changeset
  1242
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1243
48194c26a46c Initial revision
claus
parents:
diff changeset
  1244
displayOpaqueString:aString from:index1 to:index2 x:x y:y
48194c26a46c Initial revision
claus
parents:
diff changeset
  1245
    "draw part of a string with both fg and bg at x/y in current font"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1246
48194c26a46c Initial revision
claus
parents:
diff changeset
  1247
    ^ self subclassResponsibility
48194c26a46c Initial revision
claus
parents:
diff changeset
  1248
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1249
8034
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1250
displayOpaqueString:aString from:index1 to:index2 x:x y:y maxWidth:maxWidth
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1251
    "draw part of a string with both fg and bg at x/y in current font"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1252
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1253
    ^ self subclassResponsibility
8034
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1254
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1255
    "Created: / 24-05-2017 / 22:07:48 / mawalch"
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1256
!
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1257
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1258
displayOpaqueString:aString from:index1 to:index2 x:x y:y maxWitdh:maxWidth
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1259
    <resource: #obsolete>
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1260
    self obsoleteMethodWarning:'Bad spelling. Use #displayOpaqueString:from:to:x:y:maxWidth: instead.'.
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1261
    ^ self displayOpaqueString:aString from:index1 to:index2 x:x y:y maxWidth:maxWidth
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1262
922a13554dae #OTHER by mawalch
mawalch
parents: 7912
diff changeset
  1263
    "Modified: / 24-05-2017 / 22:11:46 / mawalch"
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1264
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1265
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1266
displayPolygon:aPolygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1267
    "draw a polygon
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1268
     - this could be recoded to draw using displayLine"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1269
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1270
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1271
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1272
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1273
displayRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1274
    "draw a rectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1275
     - this could be recoded to draw using displayLine"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1276
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1277
    ^ self subclassResponsibility
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1278
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1279
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1280
displayString:aString from:index1 to:index2 x:x y:y
48194c26a46c Initial revision
claus
parents:
diff changeset
  1281
    "draw part of a string with fg at x/y in current font"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1282
48194c26a46c Initial revision
claus
parents:
diff changeset
  1283
    ^ self subclassResponsibility
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1284
!
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1285
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1286
displayString:aString from:index1 to:index2 x:x y:y opaque:opaque
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1287
    "draw part of a string with both fg and bg at x/y in current font"
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1288
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1289
    opaque ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1290
	self displayOpaqueString:aString from:index1 to:index2 x:x y:y
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1291
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1292
	self displayString:aString from:index1 to:index2 x:x y:y
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1293
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1294
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1295
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1296
!GraphicsContext methodsFor:'basic filling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1297
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1298
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
  1299
    "fill an arc with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1300
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1301
    ^ self subclassResponsibility
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1302
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1303
    "Created: 8.5.1996 / 08:47:44 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1304
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1305
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1306
fillPolygon:points
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1307
    "fill a polygon with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1308
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1309
    ^ self subclassResponsibility
157
claus
parents: 151
diff changeset
  1310
!
claus
parents: 151
diff changeset
  1311
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1312
fillRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1313
    "fill a rectangle with current paint color"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1314
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1315
    ^ self subclassResponsibility
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1316
!
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1317
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1318
fillRectangleX:x y:y width:w height:h color:aColor
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1319
    "fill a rectangle with given color"
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1320
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1321
    |oldPaint|
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1322
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1323
    oldPaint := paint.
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1324
    self paint:aColor.
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1325
    self fillRectangleX:x y:y width:w height:h.
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1326
    self paint:oldPaint.
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1327
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1328
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1329
!GraphicsContext methodsFor:'drawing'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1330
719
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1331
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
  1332
    "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
  1333
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1334
    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
  1335
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1336
    "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
  1337
!
62f1217f0084 prepare for separation of the view hierarchy; moved clipStuff up into here
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1338
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1339
displayArcIn:aRectangle from:startAngle angle:angle
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1340
    "draw an arc in a box"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1341
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1342
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1343
	displayArcX:(aRectangle left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1344
		  y:(aRectangle top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1345
	      width:(aRectangle width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1346
	     height:(aRectangle height)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1347
	       from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1348
	      angle:angle
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1349
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1350
    "Modified: 8.5.1996 / 08:35:00 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1351
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1352
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1353
displayArcOrigin:origin corner:corner from:startAngle angle:angle
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1354
    "draw an arc in a box"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1355
48194c26a46c Initial revision
claus
parents:
diff changeset
  1356
    |left top right bot|
48194c26a46c Initial revision
claus
parents:
diff changeset
  1357
48194c26a46c Initial revision
claus
parents:
diff changeset
  1358
    left := origin x.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1359
    top := origin y.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1360
    right := corner x.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1361
    bot := corner y.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1362
    self
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1363
	displayArcX:left
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1364
		  y:top
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1365
	      width:(right - left + 1)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1366
	     height:(bot - top + 1)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1367
	       from:startAngle
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1368
	      angle:angle
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1369
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1370
    "Modified: 8.5.1996 / 08:35:25 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1371
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1372
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1373
displayCircle:aPoint radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1374
    "draw a circle around a center point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1375
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1376
    self displayCircleX:(aPoint x) y:(aPoint y) radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1377
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1378
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1379
displayCircleIn:aRectangle
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1380
    "draw a circle in a box"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1381
48194c26a46c Initial revision
claus
parents:
diff changeset
  1382
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1383
	displayArcX:(aRectangle left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1384
		  y:(aRectangle top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1385
	      width:(aRectangle width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1386
	     height:(aRectangle height)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1387
	       from:0
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1388
	      angle:360
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1389
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1390
    "Modified: 8.5.1996 / 08:35:40 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1391
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1392
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1393
displayCircleX:x y:y radius:r
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
  1394
    "draw a circle around a center point"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1395
48194c26a46c Initial revision
claus
parents:
diff changeset
  1396
    |d|
48194c26a46c Initial revision
claus
parents:
diff changeset
  1397
    d := 2 * r.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1398
    self
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1399
	displayArcX:(x - r)
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1400
		  y:(y - r)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1401
	      width:d
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1402
	     height:d
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1403
	       from:0
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1404
	      angle:360
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1405
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  1406
    "Modified: 8.5.1996 / 08:36:03 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1407
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1408
1953
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1409
displayForm:aFormOrImage
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1410
    "draw a form (or image) at the origin"
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1411
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1412
    self displayForm:aFormOrImage x:0 y:0
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1413
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1414
    "Modified: / 24.4.1997 / 16:00:11 / cg"
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1415
    "Created: / 9.11.1997 / 00:50:52 / cg"
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1416
!
b3c4d6e5fa4a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  1417
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1418
displayForm:aFormOrImage at:aPoint
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1419
    "draw a form (or image)"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1420
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1421
    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
  1422
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1423
    "Modified: 24.4.1997 / 16:00:11 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1424
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1425
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1426
displayForm:aFormOrImage x:x y:y
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1427
    "draw a form (or image) at x/y;
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1428
     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
  1429
     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
  1430
     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
  1431
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1432
    |fg bg f noColor|
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1433
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1434
    aFormOrImage depth > 1 ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1435
	self displayOpaqueForm:aFormOrImage x:x y:y.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1436
	^ self.
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1437
    ].
6387
0ee8729af4e6 class: GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 6371
diff changeset
  1438
"/    aFormOrImage mask notNil ifTrue:[
0ee8729af4e6 class: GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 6371
diff changeset
  1439
"/self halt.
0ee8729af4e6 class: GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 6371
diff changeset
  1440
"/    ].
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1441
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1442
    fg := paint.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1443
    bg := bgPaint.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1444
    f := function.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1445
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1446
    f ~~ #copy ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1447
	self error:'function not supported'.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1448
	^ self
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1449
    ].
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1450
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1451
    noColor := Color noColor.
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1452
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1453
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1454
     stamp out fg-pixels
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1455
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1456
    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
  1457
    self displayOpaqueForm:aFormOrImage x:x y:y.
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1458
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1459
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1460
     or-in fg-pixels
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1461
    "
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1462
    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
  1463
    self displayOpaqueForm:aFormOrImage x:x y:y.
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1464
    self paint:fg on:fg function:f.
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1465
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1466
    "Modified: 24.4.1997 / 16:01:43 / cg"
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1467
!
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1468
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1469
displayForm:aFormOrImage x:x y:y opaque:opaque
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1470
    "draw a form (or image) at x/y;
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1471
     if the form has depth 1, 1's in the form are
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1472
     drawn in current paint color, 0's are ignored.
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1473
     If the form has depth ~~ 1, the current fg color setting is ignored."
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1474
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1475
    opaque ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1476
	self displayOpaqueForm:aFormOrImage x:x y:y
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1477
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1478
	self displayForm:aFormOrImage x:x y:y
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1479
    ].
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1480
!
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3535
diff changeset
  1481
4171
bf0193e5a898 #displayImage for compatibility
Stefan Vogel <sv@exept.de>
parents: 4129
diff changeset
  1482
displayImage:aFormOrImage
bf0193e5a898 #displayImage for compatibility
Stefan Vogel <sv@exept.de>
parents: 4129
diff changeset
  1483
    "draw an image (or form).
bf0193e5a898 #displayImage for compatibility
Stefan Vogel <sv@exept.de>
parents: 4129
diff changeset
  1484
     Provided for ST-80 compatibilty;
bf0193e5a898 #displayImage for compatibility
Stefan Vogel <sv@exept.de>
parents: 4129
diff changeset
  1485
     in ST/X, images are also handled by #displayForm:"
bf0193e5a898 #displayImage for compatibility
Stefan Vogel <sv@exept.de>
parents: 4129
diff changeset
  1486
bf0193e5a898 #displayImage for compatibility
Stefan Vogel <sv@exept.de>
parents: 4129
diff changeset
  1487
    self displayForm:aFormOrImage x:0 y:0
bf0193e5a898 #displayImage for compatibility
Stefan Vogel <sv@exept.de>
parents: 4129
diff changeset
  1488
!
bf0193e5a898 #displayImage for compatibility
Stefan Vogel <sv@exept.de>
parents: 4129
diff changeset
  1489
1654
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1490
displayImage:aFormOrImage at:aPoint
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1491
    "draw an image (or form).
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1492
     Provided for ST-80 compatibilty;
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1493
     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
  1494
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1495
    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
  1496
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1497
    "Modified: 24.4.1997 / 16:02:43 / cg"
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1498
!
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1499
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1500
displayImage:aFormOrImage x:x y:y
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1501
    "draw an image (or form).
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1502
     Provided for ST-80 compatibilty;
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1503
     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
  1504
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1505
    self displayForm:aFormOrImage x:x y:y
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1506
93c6430368d7 added #displayImage for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1507
    "Created: 24.4.1997 / 16:03:03 / cg"
726
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1508
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1509
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1510
displayLineFrom:point1 to:point2
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1511
    "draw a line"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1512
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1513
    self displayLineFromX:(point1 x) y:(point1 y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1514
		      toX:(point2 x) y:(point2 y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1515
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1516
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1517
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
  1518
    "draw a line using a brush.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1519
     Here, a slow fallback is used, drawing into a
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1520
     temporary bitmap first, which is then displayed"
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1521
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
  1522
    |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
  1523
     xMin xMax yMin yMax x1 x2 y1 y2|
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1524
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1525
    xStart < xEnd ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1526
	xMin := xStart.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1527
	xMax := xEnd.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1528
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1529
	xMin := xEnd.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1530
	xMax := xStart
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1531
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1532
    yStart < yEnd ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1533
	yMin := yStart.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1534
	yMax := yEnd.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1535
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1536
	yMin := yEnd.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1537
	yMax := yStart
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1538
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1539
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1540
    tempForm := Form width:(xMax-xMin+1+aForm width)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1541
		     height:(yMax-yMin+1+aForm height)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1542
		     depth:aForm depth
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1543
		     onDevice:device.
7358
f13be4e055c6 #QUALITY by sr
sr
parents: 7344
diff changeset
  1544
    tempForm isNil ifTrue:[^nil].
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1545
    tempForm clear.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1546
    tempForm paint:(Color colorId:1) on:(Color colorId:0).
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1547
    tempForm function:#or.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1548
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1549
    ((yStart = yEnd and:[xStart < xEnd])
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1550
    or: [yStart < yEnd]) ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1551
	x1 := xStart. y1 := yStart.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1552
	x2 := xEnd. y2 := yEnd.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1553
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1554
	x1 := xEnd. y1 := yEnd.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1555
	x2 := xStart. y2 := yStart.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1556
    ].
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1557
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1558
    x1 := x1 - xMin.  x2 := x2 - xMin.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1559
    y1 := y1 - yMin.  y2 := y2 - yMin.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1560
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1561
    destX := x1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1562
    destY := y1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1563
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1564
    "/ bresenham ...
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1565
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1566
    deltaX := x2 - x1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1567
    deltaY := y2 - y1.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1568
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1569
    dx := deltaX sign.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1570
    dy := deltaY sign.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1571
    px := deltaY abs.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1572
    py := deltaX abs.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1573
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1574
    tempForm displayForm:aForm x:destX y:destY.
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1575
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1576
    py > px ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1577
	"horizontal"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1578
	p := py // 2.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1579
	py timesRepeat:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1580
	    destX := destX + dx.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1581
	    (p := p - px) < 0 ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1582
		destY := destY + dy.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1583
		p := p + py
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1584
	    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1585
	    tempForm displayForm:aForm x:destX y:destY.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1586
	]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1587
    ] ifFalse:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1588
	"vertical"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1589
	p := px // 2.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1590
	px timesRepeat:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1591
	    destY := destY + dy.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1592
	    (p := p - py) < 0 ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1593
		destX := destX + dx.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1594
		p := p + px
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1595
	    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1596
	    tempForm displayForm:aForm x:destX y:destY
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1597
	]
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1598
    ].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1599
    self displayForm:tempForm
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1600
		   x:xMin-aForm offset x
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1601
		   y:yMin-aForm offset y.
1506
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1602
    tempForm close
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1603
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1604
    "Modified: 1.4.1997 / 21:29:06 / cg"
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1605
!
1b6c39325902 added lineDraw with a brush.
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1606
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1607
displayOpaqueString:aString from:start to:stop at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1608
    "draw part of a string - drawing both fg and bg"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1609
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1610
    ^ 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
  1611
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1612
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1613
displayOpaqueString:aString x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1614
    "draw a string with both fg and bg"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1615
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1616
    self displayOpaqueString:aString from:1 to:(aString size) x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1617
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1618
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1619
displayOpaqueString:aString x:x y:y angle:drawAngle
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1620
    "draw a string along a (possibly non-horizontal) line,
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1621
     drawing both fg and bg pixels.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1622
     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
  1623
     a horizontal draw.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1624
     Drawing is done by first drawing the string into a temporary bitmap,
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1625
     which is rotated and finally drawn as usual.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1626
     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
  1627
	     operation - not to be used with cillions of strings ..."
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1628
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1629
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1630
	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
  1631
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
     |v|
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 := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1636
     v extent:300@200.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1637
     v openAndWait.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1638
     0 to:360 by:45 do:[:a |
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1639
	 v paint:Color black on:Color red.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1640
	 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
  1641
     ].
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1642
    "
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
    "in contrast to non-opaque draw:
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1645
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1646
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1647
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1648
     v extent:300@200.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1649
     v openAndWait.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1650
     0 to:360 by:45 do:[:a |
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1651
	 v paint:Color black on:Color red.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1652
	 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
  1653
     ].
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1654
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1655
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1656
    "Modified: 23.4.1997 / 17:50:23 / cg"
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
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1659
displayPoint:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1660
    "draw a pixel"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1661
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1662
    self displayPointX:(aPoint x) y:(aPoint y)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1663
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1664
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1665
displayPointX:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1666
    "draw a point at x/y"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1667
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1668
    self displayLineFromX:x y:y toX:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1669
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1670
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1671
displayRectangle:aRectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1672
    "draw a rectangle"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1673
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1674
    self displayRectangleX:(aRectangle left)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1675
			 y:(aRectangle top)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1676
		     width:(aRectangle width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1677
		    height:(aRectangle height)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1678
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1679
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1680
displayRectangleOrigin:origin corner:corner
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1681
    "draw a rectangle"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1682
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1683
    |top left|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1684
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1685
    left := origin x.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1686
    top := origin y.
7801
204ddab3ac42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7703
diff changeset
  1687
    self displayRectangleX:left y:top width:(corner x - left) height:(corner y - top)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1688
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  1689
    "Modified: 13.4.1996 / 20:58:31 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1690
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1691
2069
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1692
displayRectangleOrigin:origin extent:extent
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1693
    "draw a rectangle"
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1694
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1695
    self displayRectangleX:(origin x) y:(origin y)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1696
		     width:(extent x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1697
		    height:(extent y)
2069
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1698
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1699
    "Modified: 13.4.1996 / 20:58:31 / cg"
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1700
!
cf25dd15f04d added #displayRectangleOrigin:extent:
ca
parents: 2032
diff changeset
  1701
4396
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1702
displayRoundRectangleX:left y:top width:width height:height wCorner:wCorn hCorner:hCorn
4930
d464ba6aea9b #displayRoundRectangle:... - fix for X11
Stefan Vogel <sv@exept.de>
parents: 4911
diff changeset
  1703
    |right bottom wC hC wHalf hHalf isWin32|
4396
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1704
4911
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1705
    "/ BIG KLUDGE WARNING HERE: the code below looks "good" on windows displays;
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1706
    "/ (if you change anything under Unix, make it X-platform specific.
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1707
    "/ (there seem to be drawing incompatibilities between Win- and XWorkstation)
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1708
6371
a5f8a5dd647f class: GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 6272
diff changeset
  1709
    isWin32 := device isWindowsPlatform.
4930
d464ba6aea9b #displayRoundRectangle:... - fix for X11
Stefan Vogel <sv@exept.de>
parents: 4911
diff changeset
  1710
4900
32c51c74c3a4 round rectangle drawing
Claus Gittinger <cg@exept.de>
parents: 4777
diff changeset
  1711
    right := left + width-1.
32c51c74c3a4 round rectangle drawing
Claus Gittinger <cg@exept.de>
parents: 4777
diff changeset
  1712
    bottom := top + height-1.
4396
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1713
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1714
    wC := wCorn.
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1715
    hC := hCorn.
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1716
4911
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1717
    self scale = 1 ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1718
	wHalf := wC // 2.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1719
	hHalf := hC // 2.
4911
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1720
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1721
	wHalf := wC / 2.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1722
	hHalf := hC / 2.
4911
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1723
    ].
4396
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1724
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1725
    "top left arc"
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1726
    self displayArcX:left y:top width:wC height:hC from:90 angle:90.
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1727
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1728
    "top right arc"
4902
d1511e0c9adb win32 fixes ???
Claus Gittinger <cg@exept.de>
parents: 4901
diff changeset
  1729
    self displayArcX:(right - wC) y:top width:wC height:hC from:0 angle:90.
4396
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1730
4911
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1731
    "bottom right arc"
4930
d464ba6aea9b #displayRoundRectangle:... - fix for X11
Stefan Vogel <sv@exept.de>
parents: 4911
diff changeset
  1732
    (isWin32 and:[self scale = 1]) ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1733
	self displayArcX:(right - wC+1) y:(bottom - hC+1) width:wC height:hC from:270 angle:90.
4911
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1734
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1735
	self displayArcX:(right - wC) y:(bottom - hC) width:wC height:hC from:270 angle:90.
4911
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1736
    ].
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1737
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1738
    "bottom left arc"
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1739
    self displayArcX:left y:(bottom - hC) width:wC height:hC from:180 angle:90.
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1740
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1741
    "top line"
4940
cbac16cbe259 dont draw round-rectangle points twice (in case of xoring)
Claus Gittinger <cg@exept.de>
parents: 4930
diff changeset
  1742
    self displayLineFromX:(left + wHalf) y:top toX:(right - wHalf-1) y:top.
4911
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1743
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1744
    "left line"
4940
cbac16cbe259 dont draw round-rectangle points twice (in case of xoring)
Claus Gittinger <cg@exept.de>
parents: 4930
diff changeset
  1745
    self displayLineFromX:left y:(top + hHalf - 1) toX:left y:(bottom - hHalf - 2).
4911
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1746
4396
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1747
    "bottom line"
4911
aa37e3fa329e round rectangles
Claus Gittinger <cg@exept.de>
parents: 4903
diff changeset
  1748
    self displayLineFromX:(left + wHalf-1) y:bottom
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1749
		      toX:(right - wHalf ) y:bottom.
4396
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1750
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1751
    "right line"
4902
d1511e0c9adb win32 fixes ???
Claus Gittinger <cg@exept.de>
parents: 4901
diff changeset
  1752
    self displayLineFromX:right y:(top + hHalf) toX:right y:(bottom - hHalf).
4396
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1753
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1754
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1755
    "
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1756
     |v|
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1757
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1758
     (v := View new) extent:200@200; openAndWait.
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1759
     v displayRoundRectangleX:10 y:10 width:100 height:100 wCorner:20 hCorner:20
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1760
    "
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1761
!
bd626d040e1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  1762
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1763
displayString:aString at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1764
    "draw a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1765
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1766
    self displayString:aString x:aPoint x y:aPoint y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1767
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1768
2460
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1769
displayString:aString centeredAtX:x y:y
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1770
    "draw a string - drawing fg only"
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1771
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1772
    |w h|
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1773
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1774
    w := aString widthOn:self.
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1775
    h := aString heightOn:self.
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1776
    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
  1777
!
a1c5c2053f42 added #displayString:centeredAtX:y:
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1778
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1779
displayString:aString from:start to:stop at:aPoint
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1780
    "draw part of a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1781
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1782
    ^ 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
  1783
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1784
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1785
displayString:aString x:x y:y
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1786
    "draw a string - drawing fg only"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1787
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  1788
    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
  1789
!
5400de25657e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
  1790
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1791
displayString:aString x:x y:y angle:drawAngle
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1792
    "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
  1793
     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
  1794
     a horizontal draw.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1795
     Drawing is done by first drawing the string into a temporary bitmap,
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1796
     which is rotated and finally drawn as usual.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1797
     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
  1798
	     operation - not to be used with cillions of strings ..."
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1799
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1800
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1801
	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
  1802
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1803
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1804
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1805
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1806
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1807
     v extent:300@200.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1808
     v openAndWait.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1809
     0 to:360 by:90 do:[:a |
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1810
	 v paint:Color black.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1811
	 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
  1812
     ].
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1813
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1814
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1815
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1816
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1817
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1818
     v extent:400@400.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1819
     v openAndWait.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1820
     0 to:360 by:5 do:[:a |
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1821
	 v paint:Color black.
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1822
	 v displayString:'.........hello' x:200 y:200 angle:a.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1823
     ].
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1824
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1825
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1826
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1827
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1828
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1829
     v extent:200@100.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1830
     v openAndWait.
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1831
     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
  1832
     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
  1833
     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
  1834
     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
  1835
     v displayString:' hello' x:90 y:50 angle:270.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1836
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1837
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1838
     |v|
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1839
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1840
     v := View new.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1841
     v extent:200@100.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1842
     v openAndWait.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1843
     v displayString:'hello' x:50 y:50 angle:0.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1844
     v displayString:'hello' x:50 y:50 angle:45.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1845
     v displayString:'hello' x:50 y:50 angle:90.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1846
     v displayString:'hello' x:50 y:50 angle:135.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1847
     v displayString:'hello' x:50 y:50 angle:180.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1848
     v displayString:'hello' x:50 y:50 angle:225.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1849
     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
  1850
     v displayString:'hello' x:50 y:50 angle:315.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1851
    "
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1852
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1853
    "Modified: 24.4.1997 / 12:51:25 / cg"
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1854
!
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1855
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1856
displayString:aString x:x y:y angle:drawAngle opaque:opaque
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1857
    "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
  1858
     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
  1859
     a horizontal draw.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1860
     Drawing is done by first drawing the string into a temporary bitmap,
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1861
     which is rotated and finally drawn as usual.
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1862
     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
  1863
             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
  1864
     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
  1865
             this can (currently) only be done opaque"
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1866
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1867
    |angle tempForm tempImage w h ascent descent a xN yN p r
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1868
     dX dY sin cos m|
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1869
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1870
    angle := drawAngle.
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1871
    angle >= 360 ifTrue:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1872
        angle := angle - (((angle // 360)) * 360)
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1873
    ] ifFalse:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1874
        angle < 0 ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1875
            angle := angle - (((angle // 360)) * 360).
4129
20e9c7b506df angular drawing
Claus Gittinger <cg@exept.de>
parents: 4107
diff changeset
  1876
            angle := angle + 360.
20e9c7b506df angular drawing
Claus Gittinger <cg@exept.de>
parents: 4107
diff changeset
  1877
            angle >= 360 ifTrue:[
20e9c7b506df angular drawing
Claus Gittinger <cg@exept.de>
parents: 4107
diff changeset
  1878
                angle := angle - (((angle // 360)) * 360)
20e9c7b506df angular drawing
Claus Gittinger <cg@exept.de>
parents: 4107
diff changeset
  1879
            ]
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1880
        ].
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1881
    ].
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1882
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1883
    angle = 0 ifTrue:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1884
        opaque ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1885
            ^ 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
  1886
        ].
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1887
        ^ self displayString:aString x:x y:y
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1888
    ].
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1889
3717
8ab117634269 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3668
diff changeset
  1890
    font := font onDevice:device.
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1891
    ascent := font ascent.
3717
8ab117634269 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3668
diff changeset
  1892
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1893
    aString isString ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1894
        "/ a real string;
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1895
        "/ 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
  1896
4954
e54b6bc479bf angular string drawing fixed (sigh: sin wants radians)
Claus Gittinger <cg@exept.de>
parents: 4940
diff changeset
  1897
        w := font widthOf:aString.
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1898
        h := font height.
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1899
        descent := h - ascent.
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1900
7358
f13be4e055c6 #QUALITY by sr
sr
parents: 7344
diff changeset
  1901
        tempForm := Form width:w height:h depth:1 onDevice:device.
f13be4e055c6 #QUALITY by sr
sr
parents: 7344
diff changeset
  1902
        tempForm isNil ifTrue:[^ self].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1903
        tempForm paint:(Color colorId:1) on:(Color colorId:0).
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1904
        tempForm clear.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1905
        tempForm font:font.
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1906
        tempForm displayString:aString x:0 y:ascent.
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1907
    ] ifFalse:[
4954
e54b6bc479bf angular string drawing fixed (sigh: sin wants radians)
Claus Gittinger <cg@exept.de>
parents: 4940
diff changeset
  1908
        "/ something weird (labelAndIcon ..)
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1909
        "/ 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
  1910
        "/ 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
  1911
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1912
        w := aString widthOn:self.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1913
        h := aString heightOn:self.
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1914
        descent := 0.
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1915
"/        ascent := font ascent max:(h // 2).
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1916
"/        descent := (h - font ascent) max:(h // 2).
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1917
7358
f13be4e055c6 #QUALITY by sr
sr
parents: 7344
diff changeset
  1918
        tempForm := Form width:w height:h depth:(device depth) onDevice:device.
f13be4e055c6 #QUALITY by sr
sr
parents: 7344
diff changeset
  1919
        tempForm isNil ifTrue:[^ self].
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1920
        tempForm paint:bgPaint.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1921
        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
  1922
        tempForm paint:paint on:bgPaint.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1923
        tempForm font:font.
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1924
        aString displayOn:tempForm x:0 y:ascent opaque:true.
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1925
    ].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1926
    tempImage := tempForm asImage rotated:angle.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1927
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1928
    opaque ifTrue:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1929
        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
  1930
        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
  1931
        m := m rotated:angle
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1932
    ].
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1933
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1934
    "/ compute final position of rotated form
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1935
    "/ adjust position for baseline.
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1936
    angle = 90 ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1937
        xN := x - descent.
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1938
        yN := y.
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1939
    ] ifFalse:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1940
        angle = 180 ifTrue:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1941
            xN := x - w.
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1942
            yN := y - descent "+ h - ascent".
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1943
        ] ifFalse:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1944
            angle = 270 ifTrue:[
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1945
                xN := x - ascent.
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1946
                yN := y - w.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1947
            ] ifFalse:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1948
                "/ 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
  1949
                "/ 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
  1950
                "/ 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
  1951
                "/ then shifted towards the top-left origin.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1952
                p := (w@h) / 2.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1953
                r := p r.
4107
6ff7c076616b Use #theta inseat of obsolete #angle.
Stefan Vogel <sv@exept.de>
parents: 4071
diff changeset
  1954
                a := p theta.
4954
e54b6bc479bf angular string drawing fixed (sigh: sin wants radians)
Claus Gittinger <cg@exept.de>
parents: 4940
diff changeset
  1955
                sin := angle degreesToRadians sin.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  1956
                cos := angle degreesToRadians cos.
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1957
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1958
                angle < 90 ifTrue:[
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1959
                    dX := descent * sin.
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1960
                    dY := ascent * cos.
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1961
                    xN := x - dX.
4954
e54b6bc479bf angular string drawing fixed (sigh: sin wants radians)
Claus Gittinger <cg@exept.de>
parents: 4940
diff changeset
  1962
                    yN := y - dY.
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1963
                ] ifFalse:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1964
                    angle < 180 ifTrue:[
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1965
                        dX := ascent * sin.
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1966
                        dY := descent * cos.
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1967
                        xN := x + dX - (tempImage width).
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1968
                        yN := y + dY.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1969
                    ] ifFalse:[
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1970
                        angle < 270 ifTrue:[
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1971
                            dX := descent * sin.
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1972
                            dY := ascent * cos.
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1973
                            xN := x - dX - (tempImage width).
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1974
                            yN := y - dY - (tempImage height)
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1975
                        ] ifFalse:[
3668
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1976
                            dX := ascent * sin.
1de1036132ce fillRectangleX with color arg.
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1977
                            dY := descent * cos.
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1978
                            xN := x + dX.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1979
                            yN := y + dY - (tempImage height).
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1980
                        ]
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1981
                    ]
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1982
                ].
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1983
                tempImage mask:nil.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1984
            ]
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1985
        ].
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1986
    ].
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1987
1647
2be7ad21d324 displayString - with angle finished
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1988
    opaque ifTrue:[
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1989
        p := paint.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1990
        self paint:bgPaint.
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1991
        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
  1992
        self paint:p.
1651
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1993
    ].
85f2b72134f1 can now also draw opaqueStrings with arbitrary angle
Claus Gittinger <cg@exept.de>
parents: 1647
diff changeset
  1994
    self displayForm:tempImage x:xN y:yN.
1641
b7c128be3394 added #displayString:x:y:angle:
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  1995
2032
cc11a2c3918d partial fix for angleDrawing of non-strings (with labelAndIcons)
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1996
    "Modified: / 29.1.1998 / 13:23:23 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1997
! !
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
!GraphicsContext methodsFor:'drawing in device coordinates'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2000
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2001
displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2002
    "draw a line in device coordinates"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2003
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2004
    |sav|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2005
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2006
    sav := transformation.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2007
    transformation := nil.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2008
    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2009
    transformation := sav
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2010
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2011
4393
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2012
displayDeviceRectangleX:x y:y width:w height:h
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2013
    "draw a rectangle in device coordinates"
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2014
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2015
    |sav|
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2016
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2017
    sav := transformation.
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2018
    transformation := nil.
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2019
    self displayRectangleX:x y:y width:w height:h.
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2020
    transformation := sav
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2021
!
797ab4781c01 code cleanup
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2022
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2023
fillDeviceRectangleX:x y:y width:w height:h
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2024
    "fill a rectangle with current paint color (device coordinates)"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2025
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2026
    |sav|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2027
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2028
    sav := transformation.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2029
    transformation := nil.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2030
    self fillRectangleX:x y:y width:w height:h.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2031
    transformation := sav
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2032
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2033
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2034
!GraphicsContext methodsFor:'edge drawing'!
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2035
4215
8842241e489d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4171
diff changeset
  2036
drawEdgesForX:x y:y width:w height:h level:l
8842241e489d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4171
diff changeset
  2037
    "draw 3D edges into a rectangle"
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2038
    self
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2039
	drawEdgesForX:x y:y width:w height:h level:l
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2040
	shadow:self blackColor light:self whiteColor
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2041
	halfShadow:nil halfLight:nil
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2042
	style:nil
4215
8842241e489d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4171
diff changeset
  2043
!
8842241e489d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4171
diff changeset
  2044
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2045
drawEdgesForX:x y:y width:w height:h level:lvl
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2046
		shadow:shadowColor light:lightColor
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2047
		halfShadow:halfShadowColor halfLight:halfLightColor
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2048
		style:edgeStyle
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2049
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2050
    "draw 3D edges into a rectangle"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2051
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2052
    |topLeftFg botRightFg topLeftHalfFg botRightHalfFg
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2053
     count "{ Class: SmallInteger }"
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2054
     r
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2055
     b
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2056
     xi    "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2057
     yi    "{ Class: SmallInteger }"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2058
     run paint|
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2059
6535
163c6d470624 class: GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2060
    count := lvl.
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2061
    (count < 0) ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2062
	topLeftFg := shadowColor.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2063
	botRightFg := lightColor.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2064
	topLeftHalfFg := halfShadowColor.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2065
	botRightHalfFg := halfLightColor.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2066
	count := count negated
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2067
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2068
	topLeftFg := lightColor.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2069
	botRightFg := shadowColor.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2070
	topLeftHalfFg := halfLightColor.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2071
	botRightHalfFg := halfShadowColor.
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2072
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2073
    topLeftHalfFg isNil ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2074
	topLeftHalfFg := topLeftFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2075
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2076
    botRightHalfFg isNil ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2077
	botRightHalfFg := botRightFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2078
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2079
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2080
    r := x + w - 1. "right"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2081
    b := y + h - 1. "bottom"
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2082
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2083
    self lineWidth:0.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2084
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2085
    "top and left edges"
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  2086
    ((edgeStyle == #soft or:[edgeStyle == #softWin95]) and:["l" count > 0]) ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2087
	paint := topLeftHalfFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2088
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2089
	paint := topLeftFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2090
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2091
    self paint:paint.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2092
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2093
    0 to:(count - 1) do:[:i |
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2094
	run := y + i.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2095
	run < b ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2096
	    self displayDeviceLineFromX:x y:run toX:r y:run. "top"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2097
	].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2098
	run := x + i.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2099
	self displayDeviceLineFromX:run y:y toX:run y:b  "left"
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2100
    ].
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  2101
    (edgeStyle == #soft or:[edgeStyle == #softWin95]) ifTrue:[
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2102
"
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2103
	self paint:topLeftFg.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2104
	self displayDeviceLineFromX:x y:y toX:r y:y.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2105
	self displayDeviceLineFromX:x y:y toX:x y:b
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2106
"
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2107
	(lvl > 1) ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2108
	    edgeStyle == #softWin95 ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2109
		self paint:(Color veryLightGray).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2110
	    ] ifFalse:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2111
		(lvl > 2 and:[edgeStyle == #soft]) ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2112
		    self paint:(device blackColor).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2113
		] ifFalse:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2114
		    self paint:halfLightColor.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2115
		]
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2116
	    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2117
	    self displayDeviceLineFromX:x y:y toX:r y:y.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2118
	    self displayDeviceLineFromX:x y:y toX:x y:b.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2119
	]
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2120
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2121
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2122
    xi := x + 1.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2123
    yi := y + 1.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2124
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2125
"/ does not look good
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2126
"/ style == #st80 iftrue:[
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2127
"/  yi := yi + 1
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2128
"/ ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2129
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2130
    "bottom and right edges"
2255
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  2131
    ((edgeStyle == #soft or:[edgeStyle == #softWin95])
d53b5e22b82b added edgeStyle: #softWin95 (draws grey)
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  2132
    "new:" and:[count > 1]) ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2133
	paint := botRightHalfFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2134
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2135
	paint := botRightFg
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2136
    ].
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2137
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2138
    self paint:paint.
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2139
    0 to:(count - 1) do:[:i |
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2140
	run := b - i.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2141
	run > y ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2142
	    self displayDeviceLineFromX:xi-1 y:run toX:r y:run. "bottom"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2143
	].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2144
	run := r - i.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2145
	self displayDeviceLineFromX:run y:yi-1 toX:run y:b.  "right"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2146
	xi := xi + 1.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2147
	yi := yi + 1
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2148
    ].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2149
    ((edgeStyle == #soft or:[edgeStyle == #softWin95])
6535
163c6d470624 class: GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2150
    and:[lvl > 1]) ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2151
	self paint:(device blackColor) "shadowColor".
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2152
	self displayDeviceLineFromX:x y:b toX:r y:b.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2153
	self displayDeviceLineFromX:r y:y toX:r y:b
1443
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2154
    ].
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2155
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2156
    self edgeDrawn:#all
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2157
2273
bf00fcc5a526 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  2158
    "Modified: / 24.8.1998 / 18:23:02 / cg"
1443
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2159
!
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2160
1443
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2161
edgeDrawn:whichOne
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2162
    "a redefinable hook for views which like to draw
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2163
     over their edges (some checkToggles do).
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2164
     Nothing done here."
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2165
67acc199f123 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2166
    "Created: 7.3.1997 / 17:59:07 / cg"
713
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2167
! !
c23f1d15b4cb lifted edgeDrawing method
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2168
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2169
!GraphicsContext methodsFor:'filling'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2170
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2171
fillArc:origin radius:r from:startAngle angle:angle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2172
    "draw a filled arc around a point"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2173
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2174
    |d|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2175
    d := 2 * r.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2176
    self
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2177
	fillArcX:(origin x - r)
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2178
	       y:(origin y - r)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2179
	   width:d
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2180
	  height:d
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2181
	    from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2182
	   angle:angle
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2183
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2184
    "Modified: 8.5.1996 / 08:41:54 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2185
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2186
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2187
fillArcIn:aRectangle from:startAngle angle:angle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2188
    "draw a filled arc in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2189
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2190
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2191
	fillArcX:(aRectangle left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2192
	       y:(aRectangle top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2193
	   width:(aRectangle width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2194
	  height:(aRectangle height)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2195
	    from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2196
	   angle:angle
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2197
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2198
    "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
  2199
    "Modified: 8.5.1996 / 08:42:13 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2200
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2201
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2202
fillArcOrigin:origin corner:corner from:startAngle angle:angle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2203
    "draw a filled arc in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2204
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2205
    |left top right bot|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2206
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2207
    left := origin x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2208
    top := origin y.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2209
    right := corner x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2210
    bot := corner y.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2211
    self
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2212
	fillArcX:left
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2213
	y:top
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2214
	width:(right - left + 1)
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2215
	height:(bot - top + 1)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2216
	from:startAngle
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2217
	angle:angle
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2218
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2219
    "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
  2220
    "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
  2221
!
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2222
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2223
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
  2224
    "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
  2225
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2226
    self
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2227
	fillArcX:x
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2228
	       y:y
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2229
	   width:w
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2230
	  height:h
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2231
	    from:startAngle
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2232
	   angle:(endAngle - startAngle)
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2233
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2234
    "Created: 8.5.1996 / 08:52:41 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2235
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2236
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2237
fillCircle:aPoint radius:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2238
    "draw a filled circle around aPoint"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2239
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2240
    self fillCircleX:(aPoint x) y:(aPoint y) radius:aNumber
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2241
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2242
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2243
fillCircleIn:aRectangle
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2244
    "draw a filled circle in a box"
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2245
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2246
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2247
	fillArcX:(aRectangle left)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2248
	       y:(aRectangle top)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2249
	   width:(aRectangle width)
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2250
	  height:(aRectangle height)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2251
	    from:0
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2252
	   angle:360
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2253
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2254
    "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
  2255
    "Modified: 8.5.1996 / 08:42:38 / cg"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2256
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2257
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2258
fillCircleX:x y:y radius:r
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2259
    "draw a filled circle around x@y"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2260
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2261
    |d|
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2262
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2263
    d := 2 * r.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2264
    self
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2265
	fillArcX:(x - r)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2266
	y:(y - r)
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2267
	width:d
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2268
	height:d
1956
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2269
	from:0
d15780bd1b47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2270
	angle:360
653
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2271
0ad3de022f8b fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
  2272
    "Modified: 8.5.1996 / 08:43:02 / cg"
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2273
!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2274
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2275
fillRectangle:aRectangle
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2276
    "fill a rectangle with current paint color"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2277
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2278
    self fillRectangleX:(aRectangle left)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2279
		      y:(aRectangle top)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2280
		  width:(aRectangle width)
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2281
		 height:(aRectangle height)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2282
!
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2283
3733
bc056060b833 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
  2284
fillRectangleLeft:left top:top right:cornerX bottom:cornerY
bc056060b833 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
  2285
    "draw a filled rectangle.
bc056060b833 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
  2286
     Notice: the cornerPoint itself is NOT included"
bc056060b833 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
  2287
bc056060b833 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
  2288
    self fillRectangleX:left y:top width:(cornerX - left) height:(cornerY - top)
bc056060b833 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
  2289
!
bc056060b833 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
  2290
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2291
fillRectangleOrigin:origin corner:corner
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2292
    "draw a filled rectangle.
3733
bc056060b833 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
  2293
     Notice: the cornerPoint itself is NOT included"
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2294
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2295
    |top left|
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2296
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2297
    left := origin x.
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2298
    top := origin y.
3733
bc056060b833 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
  2299
    self fillRectangleX:left y:top width:(corner x - left) height:(corner y - top)
563
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2300
d6c07537b4a4 commentary
Claus Gittinger <cg@exept.de>
parents: 561
diff changeset
  2301
    "Created: 13.4.1996 / 20:58:16 / cg"
3954
192ecfed736f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2302
!
192ecfed736f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2303
192ecfed736f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2304
fillRectangleOrigin:origin extent:extent
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2305
    "draw a filled rectangle.
3954
192ecfed736f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2306
     Notice: the cornerPoint itself is NOT included"
192ecfed736f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2307
192ecfed736f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2308
    self fillRectangleX:(origin x) y:(origin y) width:(extent x) height:(extent y)
4901
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2309
!
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2310
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2311
fillRoundRectangleX:left y:top width:width height:height wCorner:wCorn hCorner:hCorn
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2312
    |right bottom wC hC wHalf hHalf|
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2313
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2314
    right := left + width.
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2315
    bottom := top + height.
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2316
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2317
    wC := wCorn.
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2318
    hC := hCorn.
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2319
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2320
    wHalf := wC / 2.
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2321
    hHalf := hC / 2.
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2322
6371
a5f8a5dd647f class: GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 6272
diff changeset
  2323
    device isWindowsPlatform ifTrue:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2324
	"/ bug workaround
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2325
	"top left arc"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2326
	self fillArcX:left y:top width:wC height:hC from:90 angle:90.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2327
	"top right arc"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2328
	self fillArcX:(right - wC - 1) y:top width:wC height:hC from:0 angle:90.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2329
	"bottom right arc"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2330
	self fillArcX:(right - wC - 1) y:(bottom - hC - 1) width:wC height:hC from:270 angle:90.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2331
	"bottom left arc"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2332
	self fillArcX:left y:(bottom - hC) width:wC height:hC-1 from:180 angle:90.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2333
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2334
	"center rectangle"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2335
	self fillRectangleX:(left + wHalf) y:top width:(width - wHalf - wHalf+1) height:height-1.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2336
	"left partial rectangle"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2337
	self fillRectangleX:left y:top+hHalf width:wHalf height:(height-hHalf-hHalf).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2338
	"right partial rectangle"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2339
	self fillRectangleX:right-wHalf y:top+hHalf width:wHalf-1 height:(height-hHalf-hHalf).
4901
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2340
    ] ifFalse:[
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2341
	"top left arc"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2342
	self fillArcX:left y:top width:wC height:hC from:90 angle:90.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2343
	"top right arc"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2344
	self fillArcX:(right - wC) y:top width:wC height:hC from:0 angle:90.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2345
	"bottom right arc"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2346
	self fillArcX:(right - wC - 1) y:(bottom - hC) width:wC height:hC from:270 angle:90.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2347
	"bottom left arc"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2348
	self fillArcX:left y:(bottom - hC) width:wC height:hC from:180 angle:90.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2349
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2350
	"center rectangle"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2351
	self fillRectangleX:(left + wHalf) y:top width:(width - wHalf - wHalf+1) height:height.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2352
	"left partial rectangle"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2353
	self fillRectangleX:left y:top+hHalf width:wHalf height:(height-hHalf-hHalf).
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2354
	"right partial rectangle"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2355
	self fillRectangleX:right-wHalf y:top+hHalf width:wHalf height:(height-hHalf-hHalf).
4901
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2356
    ].
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2357
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2358
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2359
    "
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2360
     |v|
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2361
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2362
     (v := View new) extent:200@200; openAndWait.
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2363
     v fillRoundRectangleX:10 y:10 width:100 height:100 wCorner:20 hCorner:20
b96f1e51b7ec round rectangle drawing.
Claus Gittinger <cg@exept.de>
parents: 4900
diff changeset
  2364
    "
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2365
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2366
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2367
!GraphicsContext methodsFor:'initialization'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2368
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2369
initialize
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2370
    "set up some useful default values"
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2371
952
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2372
    paint isNil ifTrue:[paint := Black].
91619d21efd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2373
    bgPaint isNil ifTrue:[bgPaint := White].
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2374
    function := #copy.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2375
    lineWidth := 1.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2376
    lineStyle := #solid.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2377
    joinStyle := #miter.
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2378
    capStyle := #butt.
6144
beebe1c57358 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6081
diff changeset
  2379
    font := self class defaultFont.
7289
0d69fc01daba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7240
diff changeset
  2380
0d69fc01daba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7240
diff changeset
  2381
    "/ this is rubbish. we are now always using unicode internaly
4056
67c4686afbc6 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 4027
diff changeset
  2382
    characterEncoding := #'iso10646-1'. "/ aka unicode
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2383
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2384
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2385
!GraphicsContext methodsFor:'misc'!
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2386
3033
2d910a68668f checkin from browser
ps
parents: 2938
diff changeset
  2387
clippedTo:aRectangle do:aBlock
2d910a68668f checkin from browser
ps
parents: 2938
diff changeset
  2388
    |oldClip|
2d910a68668f checkin from browser
ps
parents: 2938
diff changeset
  2389
2d910a68668f checkin from browser
ps
parents: 2938
diff changeset
  2390
    oldClip := clipRect.
7463
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  2391
    self clippingBounds:aRectangle.
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  2392
    aBlock ensure:[
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  2393
        self clippingBounds:oldClip
48202ec4ce92 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  2394
    ].
3033
2d910a68668f checkin from browser
ps
parents: 2938
diff changeset
  2395
!
2d910a68668f checkin from browser
ps
parents: 2938
diff changeset
  2396
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2397
flush
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
  2398
    "send all buffered drawing to the device."
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2399
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
  2400
    device flush
585
426d2018cdc8 commentary
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
  2401
742
655abd0c228d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
  2402
    "Modified: 28.5.1996 / 20:22:26 / cg"
6268
b999f70fffb6 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6258
diff changeset
  2403
!
b999f70fffb6 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6258
diff changeset
  2404
b999f70fffb6 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6258
diff changeset
  2405
sync
b999f70fffb6 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6258
diff changeset
  2406
    "send all buffered drawing to the device and wait until the device responds"
b999f70fffb6 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6258
diff changeset
  2407
b999f70fffb6 class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6258
diff changeset
  2408
    device sync
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2409
! !
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2410
6081
9f752a3d8ea0 class: GraphicsContext
Michael Beyl <mb@exept.de>
parents: 5841
diff changeset
  2411
!GraphicsContext methodsFor:'printing & storing'!
9f752a3d8ea0 class: GraphicsContext
Michael Beyl <mb@exept.de>
parents: 5841
diff changeset
  2412
6173
124dbde3be9e class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6144
diff changeset
  2413
storeOn:aStream
6081
9f752a3d8ea0 class: GraphicsContext
Michael Beyl <mb@exept.de>
parents: 5841
diff changeset
  2414
    "blocked: ascii storeString not possible (recursive - view - subviews - container)"
9f752a3d8ea0 class: GraphicsContext
Michael Beyl <mb@exept.de>
parents: 5841
diff changeset
  2415
6173
124dbde3be9e class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6144
diff changeset
  2416
    self shouldNotImplement.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2417
    "if proceeded from exception..."
6173
124dbde3be9e class: GraphicsContext
Stefan Vogel <sv@exept.de>
parents: 6144
diff changeset
  2418
    self printOn:aStream.
6081
9f752a3d8ea0 class: GraphicsContext
Michael Beyl <mb@exept.de>
parents: 5841
diff changeset
  2419
! !
9f752a3d8ea0 class: GraphicsContext
Michael Beyl <mb@exept.de>
parents: 5841
diff changeset
  2420
4984
af923a212424 New: #fontAscent
Stefan Vogel <sv@exept.de>
parents: 4954
diff changeset
  2421
!GraphicsContext methodsFor:'queries'!
af923a212424 New: #fontAscent
Stefan Vogel <sv@exept.de>
parents: 4954
diff changeset
  2422
af923a212424 New: #fontAscent
Stefan Vogel <sv@exept.de>
parents: 4954
diff changeset
  2423
fontAscent
af923a212424 New: #fontAscent
Stefan Vogel <sv@exept.de>
parents: 4954
diff changeset
  2424
    "answer the ascent of the current font on the current device"
af923a212424 New: #fontAscent
Stefan Vogel <sv@exept.de>
parents: 4954
diff changeset
  2425
af923a212424 New: #fontAscent
Stefan Vogel <sv@exept.de>
parents: 4954
diff changeset
  2426
    ^ font ascentOn:device
af923a212424 New: #fontAscent
Stefan Vogel <sv@exept.de>
parents: 4954
diff changeset
  2427
! !
af923a212424 New: #fontAscent
Stefan Vogel <sv@exept.de>
parents: 4954
diff changeset
  2428
1203
49dd13574c7d dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
  2429
!GraphicsContext class methodsFor:'documentation'!
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2430
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2431
version
7015
09828e08bc73 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  2432
    ^ '$Header$'
5355
6fdcaea511a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5032
diff changeset
  2433
!
6fdcaea511a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5032
diff changeset
  2434
6fdcaea511a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5032
diff changeset
  2435
version_CVS
7015
09828e08bc73 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  2436
    ^ '$Header$'
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2437
! !
3733
bc056060b833 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
  2438
6081
9f752a3d8ea0 class: GraphicsContext
Michael Beyl <mb@exept.de>
parents: 5841
diff changeset
  2439
519
ea7d88d346fe nicer message
Claus Gittinger <cg@exept.de>
parents: 418
diff changeset
  2440
GraphicsContext initialize!