DeviceGraphicsContext.st
author Claus Gittinger <cg@exept.de>
Tue, 06 May 1997 16:34:47 +0200
changeset 1715 c70e31496f91
parent 1714 66143e4f3fcf
child 1722 4ceaeda95cc3
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
GraphicsContext subclass:#DeviceGraphicsContext
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
	instanceVariableNames:'drawableId gcId deviceFont foreground background'
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	classVariableNames:'CachedScaledForms CachedScales Lobby'
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	poolDictionaries:''
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	category:'Graphics-Support'
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
    20
!DeviceGraphicsContext class methodsFor:'documentation'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
copyright
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
 COPYRIGHT (c) 1992 by Claus Gittinger
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
	      All Rights Reserved
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 This software is furnished under a license and may be used
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 only in accordance with the terms of that license and with the
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 be provided or otherwise made available to, or used by, any
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 other person.  No title to or ownership of the software is
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 hereby transferred.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
documentation
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
    I provide the common protocol for a graphicsContext which is associated with a particular
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
    device (i.e. Bitmaps, Pixmaps, RootWindow and Windows in Xs world, but also postscript 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    printer pages or fax pages).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    My instance variables are mainly caching device-related stuff (such as font- and color-Ids)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    to avoid needless message traffic. This class is abstract, no direct instances of it
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    exist in the system.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    All real work is done by my device, which is accessed via the device instance variable.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    Most drawing requests are simply forwarded to it, others are simulated by using more basic 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    drawing functions (see GraphicsContext drawing vs. basic drawing category).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    The added variables foreground/background are the drawing colors actually 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    used; these are the real (i.e. non dithered) colors supported by the device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    Direct access to fg/bg is discouraged, since in the future, these may be 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    totally replaced by paint/bgPaint 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    (there are some operations and special cases, for which a direct access to 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
     fg/bg makes sense)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    [Instance variables:]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    58
	drawableId      <SmallInteger>  my drawableId on the device (a device handle)
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    59
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    60
	gcId            <SmallInteger>  my gc's ID on the device (a device handle)
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    61
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    62
	deviceFont      <Font>          the actual font, currently set in the device
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    63
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    64
	foreground      <Color>         the device foreground color used for drawing
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    65
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    66
	background      <Color>         the device background color used for drawing
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    [see also:]
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    69
	DeviceWorkstation
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    70
	Color Font Cursor
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    [author:]
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    73
	Claus Gittinger
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
    78
!DeviceGraphicsContext class methodsFor:'initialization'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
initialize
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    Lobby isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
	Lobby := Registry new.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
    86
!DeviceGraphicsContext class methodsFor:'instance creation'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
new
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    "create a new drawable - take the current display as
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
     its device (for now, this may be changed until the view is
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
     physically created)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    'Warning: DeviceGraphicsContext (' print. self name print. ') should not be created with new' printNL.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    ^ self onDevice:Screen current "Display"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
on:aDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    "create a new drawable on aDevice"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
1255
bdf4cbcae668 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   102
    self obsoleteMethodWarning:'use #onDevice:'.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    ^ self onDevice:aDevice
1255
bdf4cbcae668 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   104
bdf4cbcae668 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   105
    "Modified: 18.1.1997 / 18:25:00 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
onDevice:aDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    "create a new drawable on aDevice"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    |newDrawable|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    newDrawable := self basicNew.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
     set display before its initialized 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
     - so it can do something useful (i.e. get font sizes etc.) in its
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
     intitialize method(s)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
    newDrawable device:aDevice.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
    newDrawable initialize.
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   122
"/    Lobby register:newDrawable.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    ^ newDrawable
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   124
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   125
    "Modified: 2.4.1997 / 19:19:35 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
   128
!DeviceGraphicsContext class methodsFor:'cleanup'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
lowSpaceCleanup
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    CachedScaledForms := CachedScales := nil
1224
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   132
!
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   133
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   134
releaseResourcesOnDevice:aDevice
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   135
    "this is sent when a display connection is closed,
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   136
     to release all cached bitmap/window objects from that device"
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   137
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   138
    Lobby unregisterAllForWhich:[:aDrawable | aDrawable graphicsDevice == aDevice]
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   139
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   140
    "Created: 16.1.1997 / 16:43:52 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
!DeviceGraphicsContext methodsFor:'accessing'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
at:aPoint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    "return the pixel at the coordinate given by aPoint"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    ^ device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
	getPixelX:(aPoint x)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
		y:(aPoint y)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
	     from:drawableId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
at:aPoint put:aPixel
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    "set a pixel"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    |oldFg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
    self foreground:aPixel.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    self displayPointX:(aPoint x) y:(aPoint y).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
    self foreground:oldFg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
atX:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    "return the pixel at the coordinate given by x/y"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    ^ device getPixelX:x y:y from:drawableId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
atX:x y:y put:aPixel
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
    "set a pixel"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
    |oldFg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    self foreground:aPixel.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
    self displayPointX:x y:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    self foreground:oldFg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
backgroundPaint:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    "set the background-paint color; this is used in opaque-draw
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
     operations"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    (aColor ~~ bgPaint) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
	aColor notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
	    bgPaint := aColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
	    gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
		bgPaint isColor ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
		    bgPaint := aColor on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
		    bgPaint colorId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
			background := bgPaint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
			device setBackground:(bgPaint colorId) in:drawableId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
			^ self
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
		    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
		].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
		self paint:paint on:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
	    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
	]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
basicFont
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
    "return set the font for drawing"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
    ^ font
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
    "Created: 12.5.1996 / 11:17:59 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
basicFont:aFont
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
    "set the font for drawing if it has changed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
     This is a low level entry, which is not to be redefined
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
     (i.e. it must not imply a redraw operation)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    |id|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
    (aFont ~~ font) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   220
	aFont notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   221
	    font := aFont.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   222
	    gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   223
		font := font on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   224
		id := font fontId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   225
		id notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   226
		    device setFont:id in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   227
		]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   228
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   229
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
    "Modified: 23.2.1996 / 17:01:06 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
    "Created: 23.2.1996 / 17:16:51 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
capStyle:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
    "set the style in which the endpoints of lines
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
     are drawn - aSymbol may be #notLast, #butt, #round, #projecting"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    |s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    (s := aSymbol) isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   243
	s := #butt.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
    (s ~~ capStyle) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   247
	capStyle := s.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   248
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   249
	    device setLineWidth:lineWidth 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   250
			  style:lineStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   251
			    cap:s
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   252
			   join:joinStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   253
			     in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   254
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
    "Modified: 12.5.1996 / 22:23:03 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   260
clipByChildren
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   261
    "drawing shall be done into my view only (default)"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   262
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   263
    ^ self clippedByChildren:true
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   264
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   265
    "Created: 17.7.1996 / 13:25:55 / cg"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   266
!
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   267
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
clipRect
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
    "return the clipping rectangle for drawing. If there is currently no clipRect,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
     a dummy is created."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
    |rect|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
    clipRect isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   275
	rect := 0@0 extent:(self extent).
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   276
	transformation notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   277
	    rect := transformation applyInverseTo:rect.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   278
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   279
	^ rect
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
    ^ clipRect
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
    "Modified: 10.4.1996 / 14:32:22 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   286
clippedByChildren:aBoolean
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   287
    "turn on/off drawing over children.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   288
     If on, a superview may draw 'over' its children.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   289
     If off (the default), drawing is 'under' its children.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   290
     Only useful for the rootView, to draw over any visible views.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   291
     (for example, when dragging a rubber-line)"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   292
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   293
    gcId isNil ifTrue:[
1680
f47862c358fb pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
   294
        self initGC
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   295
    ].
1715
c70e31496f91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   296
    device noClipIn:drawableId gc:gcId.
c70e31496f91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   297
    device setClipByChildren:aBoolean in:drawableId gc:gcId.
c70e31496f91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   298
    device noClipIn:drawableId gc:gcId.
1714
66143e4f3fcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   299
"/
66143e4f3fcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   300
"/    device setClipX:0 y:0 width:(self width) height:(self height) in:drawableId gc:gcId.
66143e4f3fcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   301
"/
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   302
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   303
    "Created: 17.7.1996 / 13:25:16 / cg"
1680
f47862c358fb pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
   304
    "Modified: 29.4.1997 / 15:33:55 / dq"
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   305
!
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   306
735
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
   307
clippingRectangle:aRectangleOrNil
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
    "set the clipping rectangle for drawing (in logical coordinates);
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
     a nil argument turn off clipping (i.e. whole view is drawable)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
    |x y w h|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
    aRectangleOrNil isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   314
	clipRect isNil ifTrue:[^ self].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   315
	gcId notNil ifTrue:[
1712
647c6019cec4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1680
diff changeset
   316
	    device noClipIn:drawableId gc:gcId
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   317
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   319
	clipRect notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   320
	    (clipRect = aRectangleOrNil) ifTrue:[^ self]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   321
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   322
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   323
	    x := aRectangleOrNil left.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   324
	    y := aRectangleOrNil top.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   325
	    w := aRectangleOrNil width.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   326
	    h := aRectangleOrNil height.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   327
	    transformation notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   328
		x := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   329
		y := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   330
		w := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   331
		h := transformation applyScaleY:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   332
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   333
	    (x class == SmallInteger) ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   334
		w := w + (x - x truncated).
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   335
		x := x truncated
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   336
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   337
	    (y class == SmallInteger) ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   338
		h := h + (y - y truncated).
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   339
		y := y truncated
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   340
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   341
	    (w class == SmallInteger) ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   342
		w := w truncated + 1
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   343
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   344
	    (h class == SmallInteger) ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   345
		h := h truncated + 1
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   346
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   347
1712
647c6019cec4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1680
diff changeset
   348
	    device setClipX:x y:y width:w height:h in:drawableId gc:gcId
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   349
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
    clipRect := aRectangleOrNil
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
    "Modified: 22.5.1996 / 13:12:07 / cg"
735
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
   354
    "Created: 28.5.1996 / 19:40:20 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
clippingRectangleOrNil
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
    "return the clipping rectangle for drawing, nil if there is none."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
    ^ clipRect
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
    "Created: 10.4.1996 / 14:32:02 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   365
dashStyle:aDashList offset:dashOffset
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   366
    "define dashes. Each element of the dashList specifies the length
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   367
     of a corresponding dash. For example, setting it to [4 4]
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   368
     defines 4on-4off dashing; 
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   369
     Setting it to [1 2 4 2] defines 1on-2off-4on-2off dashes.
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   370
     The dashOffset specifies where in the dashList the dashing starts.
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   371
     This may not be supported by all graphics devices."
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   372
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   373
    gcId notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   374
	device setDashes:(ByteArray withAll:aDashList)
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   375
	      dashOffset:dashOffset
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   376
		      in:gcId
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   377
    ]
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   378
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   379
    "Modified: 4.6.1996 / 19:03:06 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   380
!
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   381
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
    "return the device, the receiver is associated with"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
    ^ device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
device:aDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
    "set the device"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
    device := aDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
font:aFont
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
    "set the font for drawing if it has changed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
     This should be redefined in some widget to perform an automatic
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
     redraw. See also: #basicFont:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
    (aFont ~~ font) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   400
	self basicFont:aFont
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
    "Modified: 6.3.1996 / 18:17:40 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
function:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
    "set the drawing function if it has changed"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
    (aSymbol ~~ function) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
	function := aSymbol.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
	    device setFunction:aSymbol in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
	]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
    "return the receivers graphic context id on the device"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
    ^ gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
graphicsDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
    "return the device, the receiver is associated with.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
     Same as #device, for ST-80 compatibility."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
    ^ device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
    "Created: 9.5.1996 / 01:37:58 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
id
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
    "return the id of the dravable on the device"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
    ^ drawableId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
joinStyle:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
    "set the style in which 2 lines are connected in polygons -
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
     aSymbol may be #miter, #bevel, #round"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
    |s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
    (s := aSymbol) isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   445
	s := #miter
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
    (s ~~ joinStyle) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   448
	joinStyle := s.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
        
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   450
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   451
	    device setLineWidth:lineWidth 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   452
			  style:lineStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   453
			    cap:capStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   454
			   join:s
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   455
			     in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   456
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
    "Modified: 12.5.1996 / 22:20:43 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
lineStyle:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
    "set the style in which lines are drawn -
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
     aSymbol may be #solid, #dashed, #doubleDashed"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
    |s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
    (s := aSymbol) isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   469
	s := #solid
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
    (s ~~ lineStyle) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   472
	lineStyle := s.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   473
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   474
	    device setLineWidth:lineWidth 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   475
			  style:s
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   476
			    cap:capStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   477
			   join:joinStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   478
			     in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   479
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
    "Modified: 12.5.1996 / 22:21:25 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
lineWidth:aNumber
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
    "set the line width for drawing if it has changed"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
    |n|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
    (aNumber ~~ lineWidth) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
	lineWidth := aNumber.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
	transformation isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
	    n := aNumber.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
	] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
	    n := transformation applyScaleX:aNumber.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
	    n := n rounded
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
	].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
	    device setLineWidth:n 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
			  style:lineStyle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
			    cap:capStyle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
			   join:joinStyle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
			     in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
	]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
mask:aForm
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
    "set the mask form for drawing"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
    |id|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
    (aForm ~~ mask) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
	mask := aForm.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
	    (mask == nil) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
		device setBitmapMask:nil in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
	    ] ifFalse:[
1033
b5cd84ed805f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   519
		mask := mask asFormOn:device.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
		id := mask id.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
		(mask depth == 1) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
		    device setBitmapMask:id in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
		] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
		    device setPixmapMask:id in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
		]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
	    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
	]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   531
noClipByChildren
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   532
    "drawing shall also be done into subviews"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   533
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   534
    ^ self clippedByChildren:false
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   535
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   536
    "Created: 17.7.1996 / 14:15:54 / cg"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   537
!
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   538
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
paint:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
    "set the drawing color, which may be a real color, a dithered one
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
     or even an image."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
    (aColor ~~ paint) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   544
	aColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   545
	    paint := aColor.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   546
	    self setGCForPaint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   547
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
    "Modified: 16.5.1996 / 15:35:57 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
paint:fgColor on:bgColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
    "set the paint and background-paint color. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
     The bg-paint is used in opaque-draw operations"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
    |fgId bgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
    ((fgColor ~~ paint) or:[bgColor ~~ bgPaint]) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   560
	fgColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   561
	    paint := fgColor
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   562
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   563
	bgColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   564
	    bgPaint := bgColor
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   565
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   566
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   567
	    paint := paint on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   568
	    paint isColor ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   569
		fgId := paint colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   570
		fgId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   571
		    mask notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   572
			mask := nil.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   573
			device setBitmapMask:nil in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   574
		    ]. 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   575
		    bgPaint := bgPaint on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   576
		    bgPaint isColor ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   577
			bgId := bgPaint colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   578
			bgId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   579
			    "the common case, both are real colors"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   580
			    (paint ~~ foreground) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   581
				foreground := paint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   582
				(bgPaint ~~ background) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   583
				    background := bgPaint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   584
				    device setForeground:fgId background:bgId in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   585
				    ^ self
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   586
				].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   587
				device setForeground:fgId in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   588
				^ self
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   589
			    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   590
			    (bgPaint ~~ background) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   591
				background := bgPaint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   592
				device setBackground:bgId in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   593
			    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   594
			    ^ self
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   595
			].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   596
			"bgPaint is dithered, setup paint here, leave bgPaint
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   597
			 till next opaque draw comes around."
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   598
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   599
			(paint ~~ foreground) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   600
			    foreground := paint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   601
			    device setForeground:fgId in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   602
			].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   603
			^ self
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   604
		    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   605
		]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   606
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   607
	    "either paint or bgPaint (or both) are dithered colors,
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   608
	     setup for paint, leave bg-problem till next opaque draw
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   609
	     comes around.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   610
	    "
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   611
	    self setGCForPaint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   612
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
    "Modified: 16.5.1996 / 15:37:05 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
paint:fgColor on:bgColor function:f
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
    "set paint, background-paint and function"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
    self paint:fgColor on:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
    self function:f
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
    "Modified: 16.5.1996 / 15:36:35 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
setGraphicsExposures:aBoolean
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
    "want to if aBoolean is true - or dont want to be notified
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
     of graphics exposures"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
    gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
	device setGraphicsExposures:aBoolean in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
setMaskOrigin:aPoint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
    "set the origin of the fill pattern"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
    (maskOrigin isNil or:[maskOrigin ~= aPoint]) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
	transformation isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
	    maskOrigin := aPoint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
	] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
	    maskOrigin := transformation applyTo:aPoint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
	].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
	    device setMaskOriginX:maskOrigin x rounded 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
				y:maskOrigin y rounded 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
			       in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
	]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
setMaskOriginX:orgX y:orgY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
    "set the origin of the pattern"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
    |x y|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
	x := transformation applyToX:orgX.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
	y := transformation applyToY:orgY.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
	x := orgX.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
	y := orgY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
    x := x rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
    y := y rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
    (maskOrigin isNil or:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
     ((x ~~ maskOrigin x) or:[y ~~ maskOrigin y]) ]) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
	maskOrigin := x @ y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
	    device setMaskOriginX:x y:y in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
	]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
1092
1b6391f333de category rename
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
   678
!DeviceGraphicsContext methodsFor:'accessing-internals'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
    "return the current background drawing color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
     OBSOLETE: use #paint: / #backgroundPaint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
    ^ background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
    "Modified: 12.5.1996 / 22:28:09 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
background:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
    "set the internal background color for drawing - aColor must be a real color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
     OBSOLETE: this method will vanish; use #paint: / #backgroundPaint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   692
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   693
    |bgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   694
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   695
    (aColor ~~ background) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   696
	aColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   697
	    background := aColor.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   698
	    gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   699
		background := background on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   700
		bgId := background colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   701
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   702
		"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   703
		 mhmh the following is a kludge ....
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   704
		"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   705
		bgId isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   706
		    (background grayIntensity >= 50) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   707
			bgId := device whitepixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   708
		    ] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   709
			bgId := device blackpixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   710
		    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   711
		].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   712
		device setBackground:bgId in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   713
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   714
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   715
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   717
    "Modified: 28.5.1996 / 20:44:55 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   718
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   719
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
    "return the current foreground drawing color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   722
     OBSOLETE: use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   723
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   724
    ^ foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   725
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   726
    "Modified: 12.5.1996 / 22:28:03 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   727
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   728
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   729
foreground:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   730
    "set the internal foreground color for drawing - aColor must be a real color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
    |fgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   734
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   735
    (aColor ~~ foreground) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   736
	aColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   737
	    foreground := aColor.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   738
	    gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   739
		(foreground class == SmallInteger) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   740
		    fgId := foreground
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   741
		] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   742
		    foreground := foreground on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   743
		    fgId := foreground colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   744
		].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   745
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   746
		"mhmh the following is a kludge ...."
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   747
		fgId isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   748
		    (foreground grayIntensity >= 50) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   749
			fgId := device whitepixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   750
		    ] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   751
			fgId := device blackpixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   752
		    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   753
		].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   754
		device setForeground:fgId in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   755
		paint := foreground
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   756
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   757
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   760
    "Modified: 28.5.1996 / 20:45:02 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
foreground:fgColor background:bgColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
    "set both internal foreground and internal background colors 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
     - these must be real colors.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   767
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
    |fgPixel bgPixel|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   769
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   770
    ((fgColor ~~ foreground) or:[bgColor ~~ background]) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   771
	fgColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   772
	    foreground := fgColor
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   773
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   774
	bgColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   775
	    background := bgColor
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   776
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   777
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   778
	    foreground := foreground on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   779
	    background := background on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   780
	    fgPixel := foreground colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   781
	    bgPixel := background colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   782
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   783
	    "mhmh the following is a kludge ...."
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   784
	    fgPixel isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   785
		(foreground grayIntensity >= 50) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   786
		    fgPixel := device whitepixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   787
		] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   788
		    fgPixel := device blackpixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   789
		]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   790
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   791
	    bgPixel isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   792
		(background grayIntensity >= 50) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   793
		    bgPixel := device whitepixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   794
		] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   795
		    bgPixel := device blackpixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   796
		]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   797
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   798
	    device setForeground:fgPixel background:bgPixel in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   799
	    paint := foreground
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   800
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   803
    "Modified: 28.5.1996 / 20:45:27 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
foreground:fgColor background:bgColor function:fun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
    "set foreground, background colors and function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
    self foreground:fgColor background:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
    self function:fun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
    "Modified: 12.5.1996 / 22:28:34 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
foreground:aColor function:fun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
    "set the foreground color and function for drawing.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   819
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   820
    |fgPixel|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
    ((aColor ~~ foreground) or:[fun ~~ function]) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   823
	foreground := aColor.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   824
	function := fun.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   825
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   826
	    foreground := foreground on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   827
	    fgPixel := foreground colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   828
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   829
	    "mhmh the following is a kludge ...."
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   830
	    fgPixel isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   831
		(foreground grayIntensity >= 50) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   832
		    fgPixel := device whitepixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   833
		] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   834
		    fgPixel := device blackpixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   835
		]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   836
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   837
	    device setForeground:fgPixel in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   838
	    device setFunction:fun in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   839
	    paint := foreground
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   840
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   843
    "Modified: 28.5.1996 / 20:45:09 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   844
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   845
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   846
!DeviceGraphicsContext methodsFor:'bit blitting'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   847
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   848
copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
    "copy bits from a smalltalk byteArray.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
     The bits found there are supposed to be in the devices native format (i.e.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
     translated to allocated color indices on pseudoColor devices and padded as required.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
     The byteOrder is MSB and will be converted as appropriate by the underlying devices 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
     method to whatever the device needs."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   855
    device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
	drawBits:aByteArray bitsPerPixel:bpp depth:depth  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
	   width:srcW height:srcH
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
	       x:srcX y:srcY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
	    into:drawableId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
	       x:dstX y:dstY 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   861
	   width:(self width) height:(self height)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
	    with:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
    "Created: 21.10.1995 / 00:04:22 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
    "copy from aDrawable into the receiver;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
     the source may be the receiver as well - in this case its a scroll.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
     All coordinates are in device coordinates."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   871
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   872
    ^ self
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   873
        copyFrom:aDrawable 
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   874
        x:srcX y:srcY 
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   875
        toX:dstX y:dstY 
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   876
        width:w height:h
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   877
        async:false
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   878
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   879
    "Modified: 29.1.1997 / 13:12:36 / cg"
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   880
!
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   881
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   882
copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   883
    "copy from aDrawable into the receiver;
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   884
     the source may be the receiver as well - in this case its a scroll.
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   885
     All coordinates are in device coordinates.
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   886
     If the receiver is a view AND async is true, the call returns immediately 
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   887
     - otherwise, it returns when the scroll operation is finished.
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   888
     (not all devices care for this).
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   889
     If the receiver is a pixmap, the call always returns immediately."
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   890
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   891
    |deviceDrawable id srcGCId asy|
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   892
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   893
    aDrawable graphicsDevice ~~ device ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   894
        deviceDrawable := aDrawable asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   895
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   896
        deviceDrawable := aDrawable
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   897
    ].
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   898
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   899
    id := deviceDrawable id.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
    "temporary ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
     this fixes a problem after restart on another display,
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   903
     when a file-bitmap was not found. 
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   904
     In this case, the id of the bitmap will be nil. 
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   905
     This will be fixed soon (no longer use device>>bitmapFromFile:).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
    "
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   907
    id isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   908
        'DeviceGraphicsContext [warning]: invalid bitmap copy - ignored' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   909
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   910
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   912
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   913
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   914
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   915
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   916
    srcGCId := deviceDrawable gcId.
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   917
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   918
    ((deviceDrawable depth == 1) and:[device depth ~~ 1]) ifTrue:[
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   919
        deviceDrawable isForm ifTrue:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   920
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   921
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   922
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   923
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   924
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   925
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   926
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   927
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   928
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   929
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   930
                height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   931
        ] ifFalse:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   932
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   933
                copyPlaneFromId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   934
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   935
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   936
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   937
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   938
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   939
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   940
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   941
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   942
                height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   943
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   944
    ] ifFalse:[
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   945
        deviceDrawable isForm ifTrue:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   946
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   947
                copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   948
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   949
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   950
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   951
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   952
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   953
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   954
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   955
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   956
                height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   957
        ] ifFalse:[
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   958
            asy := async or:[self isView not].
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   959
            asy ifFalse:[
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   960
                self catchExpose
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   961
            ].
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   962
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   963
                copyFromId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   964
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   965
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   966
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   967
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   968
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   969
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   970
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   971
                width:w 
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   972
                height:h.
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   973
            asy ifFalse:[
1294
a5abff742fd8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
   974
                device flush.
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   975
                self waitForExpose
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   976
            ]
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   977
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   978
    ]
868
65c93e5f6f8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
   979
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   980
    "Created: 29.1.1997 / 13:02:10 / cg"
1294
a5abff742fd8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
   981
    "Modified: 29.1.1997 / 13:34:33 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   983
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   984
copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   985
    "copy one plane from aDrawable into the receiver. 0's are drawn in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   986
     background, while 1's are drawn with foreground color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   987
     The depth of aDrawable must (should) be 1.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   988
     The drawable must have been allocated on the same device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   989
     All coordinates are in device coordinates."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   990
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
   991
    |deviceDrawable id|
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   992
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   993
    aDrawable graphicsDevice ~~ device ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   994
        deviceDrawable := aDrawable asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   995
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   996
        deviceDrawable := aDrawable
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   997
    ].
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   998
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   999
    id := deviceDrawable id.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1000
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1001
    "temporary ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1002
     this fixes a problem after restart on another display,
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1003
     when a file-bitmap was not found. 
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1004
     In this case, the id of the bitmap will be nil.
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1005
     This will be fixed soon (no longer use device>>bitmapFromFile:).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1006
    "
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1007
    id isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1008
        'DeviceGraphicsContext [warning]: invalid copyPlane - ignored' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1009
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1010
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1011
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1012
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1013
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1014
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1015
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1016
    deviceDrawable isForm ifTrue:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1017
        device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1018
            copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1019
            x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1020
            y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1021
            gc:(deviceDrawable gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1022
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1023
            x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1024
            y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1025
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1026
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1027
            height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1028
    ] ifFalse:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1029
        device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1030
            copyPlaneFromId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1031
            x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1032
            y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1033
            gc:(deviceDrawable gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1034
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1035
            x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1036
            y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1037
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1038
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1039
            height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1040
    ]
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1041
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1042
    "Modified: 18.1.1997 / 17:17:53 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1043
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1044
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1045
!DeviceGraphicsContext methodsFor:'copying'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1046
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1047
postCopy
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1048
    "this may not be enough to allow copying of views ..."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1049
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1050
    super postCopy.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1051
    device := drawableId := gcId := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1052
    self recreate
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1053
!
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1054
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1055
shallowCopyForFinalization
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1056
    "I am abstract"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1057
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1058
    self shouldNotImplement.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1059
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1060
    "Created: 2.4.1997 / 19:22:11 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1061
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1062
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1063
!DeviceGraphicsContext methodsFor:'drawing'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1064
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1065
displayArcX:x y:y width:w height:h from:startAngle angle:angle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1066
    "draw an arc; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1067
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  1068
    |pX pY nW nH|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1069
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1070
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1071
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1072
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1073
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1074
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1075
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1076
	nW := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1077
	nH := transformation applyScaleY:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1078
	nW < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1079
	      nW := nW abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1080
	      pX := pX - nW.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1081
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1082
	nH < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1083
	      nH := nH abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1084
	      pY := pY - nH.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1085
	].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1086
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1087
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1088
	pY := y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1089
	nW := w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1090
	nH := h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1091
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1092
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1093
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1094
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1095
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1096
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1097
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1098
    device
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1099
	  displayArcX:pX 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1100
		    y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1101
		width:nW 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1102
	       height:nH 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1103
		 from:startAngle 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1104
		angle:angle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1105
		   in:drawableId 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1106
		 with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1107
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1108
    "Created: 8.5.1996 / 08:31:30 / cg"
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  1109
    "Modified: 4.6.1996 / 17:59:28 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1110
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1111
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1112
displayForm:formToDraw x:x y:y
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1113
    "draw a form or image non opaque; 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1114
     if its a 1-plane bitmap, 1-bits are drawn in the
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1115
     current paint-color, leaving pixels with 0-bits unchanged
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1116
     (i.e. only 1-bits are drawn from the form).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1117
     If its a deep form (i.e. a pixmap) the current paint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1118
     settings are ignored and the form is drawn as-is. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1119
     Care must be taken, that the paint color is correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1120
     (by sending #on: to the color) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1121
     Using functions other than #copy only makes sense if you are
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1122
     certain, that the colors are real colors (actually, only for
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1123
     noColor or allColor)."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1124
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1125
    |realForm pX pY w h nW nH|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1126
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1127
    realForm := formToDraw.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1128
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1129
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1130
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1131
        pY := transformation applyToY:y.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1132
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1133
        transformation noScale ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1134
            w := formToDraw width.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1135
            h := formToDraw height.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1136
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1137
            nW := (transformation applyScaleX:w) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1138
            nH := (transformation applyScaleY:h) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1139
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1140
            ((nW ~= w) or:[nH ~= h]) ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1141
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1142
                "/ hard case - someone is drawing forms with scaling in effect
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1143
                "/ look if we have a scaled version in our pocket ...
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1144
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1145
                realForm := nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1146
                CachedScaledForms notNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1147
                    (CachedScales at:formToDraw ifAbsent:nil) = transformation scale ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1148
                        realForm := CachedScaledForms at:formToDraw ifAbsent:nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1149
                    ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1150
                ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1151
                realForm isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1152
                    "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1153
                    "/ nope - must do the work ...
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1154
                    "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1155
                    realForm := formToDraw magnifiedBy:(nW / w) @ (nH / h).
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1156
                    CachedScaledForms isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1157
                        CachedScaledForms := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1158
                        CachedScales := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1159
                    ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1160
                    CachedScaledForms at:formToDraw put:realForm.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1161
                    CachedScales at:formToDraw put:transformation scale.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1162
                ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1163
            ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1164
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1165
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1166
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1167
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1168
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1169
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1170
    self displayDeviceForm:realForm x:pX y:pY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1171
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1172
    "Modified: 12.4.1997 / 12:47:29 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1173
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1174
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1175
displayLineFromX:x0 y:y0 toX:x1 y:y1
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1176
    "draw a line (with current paint-color); apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1177
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1178
    |pX0 pY0 pX1 pY1 easy fgId bgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1179
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1180
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1181
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1182
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1183
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1184
    lineStyle == #doubleDashed ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1185
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1186
         if bgPaint or paint is not a real color, we have to do it the hard way ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1187
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1188
        easy := true.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1189
        paint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1190
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1191
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1192
            fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1193
            fgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1194
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1195
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1196
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1197
        bgPaint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1198
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1199
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1200
            bgId := bgPaint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1201
            bgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1202
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1203
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1204
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1205
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1206
        easy ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1207
            ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1208
                device setForeground:fgId background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1209
                foreground := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1210
                background := bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1211
            ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1212
        ] ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1213
            'DeviceGraphicsContext [warning]: cannot draw dashes with dithered colors' errorPrintCR
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1214
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1215
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1216
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1217
    transformation notNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1218
        pX0 := transformation applyToX:x0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1219
        pY0 := transformation applyToY:y0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1220
        pX1 := transformation applyToX:x1.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1221
        pY1 := transformation applyToY:y1.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1222
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1223
        pX0 := x0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1224
        pY0 := y0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1225
        pX1 := x1.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1226
        pY1 := y1
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1227
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1228
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1229
    pX0 := pX0 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1230
    pY0 := pY0 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1231
    pX1 := pX1 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1232
    pY1 := pY1 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1233
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1234
    device displayLineFromX:pX0 y:pY0 toX:pX1 y:pY1 in:drawableId with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1235
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1236
    "Modified: 10.1.1997 / 17:46:32 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1237
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1238
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1239
displayOpaqueForm:formToDraw x:x y:y
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1240
    "draw a form or image opaque; 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1241
     if its a 1-plane bitmap, 1-bits are drawn in the
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1242
     current paint-color and 0-bits in the bgPaint color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1243
     If its a deep form (i.e. a pixmap) the current paint/bgPaint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1244
     settings are ignored and the form drawn as-is. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1245
     In the 1-plane case, special care must be taken if paint and/or bgPaint 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1246
     dithered colors or patterns, since are that the colors are correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1247
     (by sending #on: to the colors) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1248
     If there is a transformation, the image is scaled as appropiate."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1249
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1250
    |w h realForm pX pY nW nH|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1251
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1252
    bgPaint isNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1253
        "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1254
        "/ actually not an opaque draw
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1255
        "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1256
        self displayForm:formToDraw x:x y:y.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1257
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1258
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1259
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1260
    realForm := formToDraw.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1262
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1263
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1264
        pY := transformation applyToY:y.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1265
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1266
        transformation noScale ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1267
            w := formToDraw width.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1268
            h := formToDraw height.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1269
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1270
            nW := (transformation applyScaleX:w) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1271
            nH := (transformation applyScaleY:h) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1272
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1273
            ((nW ~= w) or:[nH ~= h]) ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1274
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1275
                "/ hard case - someone is drawing forms with scaling in effect
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1276
                "/ look if we have a scaled version in our pocket ...
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1277
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1278
                realForm := nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1279
                CachedScaledForms notNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1280
                    (CachedScales at:formToDraw ifAbsent:nil) = transformation scale ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1281
                        realForm := CachedScaledForms at:formToDraw ifAbsent:nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1282
                    ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1283
                ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1284
                realForm isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1285
                    "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1286
                    "/ nope - must do the work ...
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1287
                    "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1288
                    realForm := formToDraw magnifiedBy:(nW / w) @ (nH / h).
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1289
                    CachedScaledForms isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1290
                        CachedScaledForms := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1291
                        CachedScales := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1292
                    ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1293
                    CachedScaledForms at:formToDraw put:realForm.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1294
                    CachedScales at:formToDraw put:transformation scale.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1295
                ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1296
            ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1297
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1298
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1299
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1300
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1301
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1302
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1303
    self displayDeviceOpaqueForm:realForm x:pX y:pY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1304
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1305
    "Modified: 12.4.1997 / 12:49:02 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1306
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1307
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1308
displayOpaqueString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1309
    "draw a substring at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1310
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1311
     If the transformation involves scaling, 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1312
     the fonts point-size is scaled as appropriate.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1313
     Assuming that device can only draw in device colors, we have to handle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1314
     the case where paint and/or bgPaint are dithered colors"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1315
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1316
    |easy w h savedPaint fgId bgId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1317
     id pX pY fontUsed sz s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1318
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1319
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1320
     if backgroundPaint color is nil, we assume
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1321
     this is a non-opaque draw
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1322
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1323
    bgPaint isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1324
	self displayString:aString from:index1 to:index2 x:x y:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1325
	^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1326
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1327
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1328
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1329
    or:[aString isText]) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1330
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1331
	 hook for non-strings (i.e. attributed text)
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1332
	 that 'thing' should know how to display itself ...
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1333
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1334
	aString displayOpaqueOn:self x:x y:y from:index1 to:index2.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1335
	^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1336
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1337
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1338
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1339
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1340
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1341
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1342
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1343
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1344
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1345
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1346
	transformation noScale ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1347
	    sz := font size.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1348
	    sz isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1349
		"/ oops - not a real font; use original font
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1350
		fontUsed := font
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1351
	    ] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1352
		fontUsed := font size:(transformation applyScaleY:sz) rounded.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1353
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1354
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1355
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1356
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1357
	pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1358
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1359
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1360
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1361
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1362
    fontUsed := fontUsed on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1363
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1364
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1365
    id isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1366
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1367
	 hook for alien fonts
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1368
	 that 'font' should know how to display the string ...
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1369
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1370
	fontUsed displayOpaqueString:aString from:index1 to:index2 x:x y:y in:self.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1371
	^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1372
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1373
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1374
    s := aString.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1375
    s encoding ~~ font encoding ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1376
	s := s encodeInto:(font encoding).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1377
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1378
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1379
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1380
     if bgPaint or paint is not a real Color, we have to do it the hard way ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1381
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1382
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1383
    paint isColor ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1384
	easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1385
    ] ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1386
	fgId := paint colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1387
	fgId isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1388
	    easy := false
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1389
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1390
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1391
    bgPaint isColor ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1392
	easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1393
    ] ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1394
	bgId := bgPaint colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1395
	bgId isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1396
	    easy := false
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1397
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1398
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1399
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1400
    easy ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1401
	deviceFont ~~ fontUsed ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1402
	    device setFont:id in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1403
	    deviceFont := fontUsed
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1404
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1405
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1406
	device setForeground:fgId background:bgId in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1407
	foreground := paint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1408
	background := bgPaint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1409
	device displayOpaqueString:s 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1410
			      from:index1 to:index2
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1411
				 x:pX y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1412
				in:drawableId with:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1413
	^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1414
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1415
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1416
    w := fontUsed widthOf:s from:index1 to:index2.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1417
    h := fontUsed height.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1418
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1419
    (fgId notNil and:[function == #copy]) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1420
	deviceFont ~~ fontUsed ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1421
	    device setFont:id in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1422
	    deviceFont := fontUsed
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1423
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1424
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1425
	 only bg is dithered; fill with bg first ...
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1426
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1427
	savedPaint := paint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1428
	self paint:bgPaint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1429
	self fillDeviceRectangleX:pX y:(pY - fontUsed ascent) width:w height:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1430
	self paint:savedPaint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1431
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1432
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1433
	 then draw using fgPaint (which is a real color)
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1434
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1435
	device displayString:s 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1436
			from:index1 to:index2
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1437
			   x:pX y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1438
			  in:drawableId with:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1439
	^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1440
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1441
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1442
    "/ the very hard case (fg-dither)
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1443
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1444
    self displayDeviceOpaqueString:s from:index1 to:index2 in:fontUsed x:pX y:pY.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1445
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1446
    "Modified: 12.6.1996 / 12:36:33 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1447
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1448
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1449
displayOpaqueString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1450
    "draw a string at the coordinate x/y - draw foreground pixels in paint-color,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1451
     background pixels in bgPaint color. If the transformation involves scaling, 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1452
     the fonts point-size is scaled as appropriate.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1453
     Assuming that device can only draw in device colors, we have to handle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1454
     the case where paint and/or bgPaint are dithered colors or images."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1455
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1456
    |id easy fgId bgId pX pY fontUsed sz s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1457
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1458
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1459
     if backgroundPaint color is nil, we assume
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1460
     this is a non-opaque draw
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1461
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1462
    bgPaint isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1463
	self displayString:aString x:x y:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1464
	^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1465
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1466
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1467
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1468
    or:[aString isText]) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1469
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1470
	 hook for non-strings (i.e. attributed text)
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1471
	 that 'thing' should know how to display itself ...
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1472
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1473
	aString displayOpaqueOn:self x:x y:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1474
	^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1475
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1476
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1477
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1478
     if bgPaint or paint is not a real Color, we have to do it the hard way ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1479
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1480
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1481
    paint isColor ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1482
	easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1483
    ] ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1484
	fgId := paint colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1485
	fgId isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1486
	    easy := false
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1487
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1488
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1489
    bgPaint isColor ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1490
	easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1491
    ] ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1492
	bgId := bgPaint colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1493
	bgId isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1494
	    easy := false
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1495
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1496
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1497
    easy ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1498
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1499
	 for the hard case, use the general drawing method
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1500
	 (no need for optimizations - its slow anyway)
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1501
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1502
	self displayOpaqueString:aString 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1503
			    from:1 to:(aString size)
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1504
			       x:x y:y. 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1505
	^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1506
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1507
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1508
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1509
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1510
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1511
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1512
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1513
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1514
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1515
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1516
	transformation noScale ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1517
	    sz := font size.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1518
	    sz isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1519
		"/ oops - not a real font; use original font
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1520
		fontUsed := font
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1521
	    ] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1522
		fontUsed := font size:(transformation applyScaleY:sz) rounded.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1523
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1524
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1525
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1526
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1527
	pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1528
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1529
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1530
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1531
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1532
    fontUsed := fontUsed on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1533
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1534
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1535
    id isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1536
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1537
	 hook for alien fonts
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1538
	 that 'font' should know how to display the string ...
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1539
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1540
	fontUsed displayOpaqueString:aString from:1 to:(aString size) x:x y:y in:self.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1541
	^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1542
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1543
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1544
    s := aString.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1545
    s encoding ~~ font encoding ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1546
	s := s encodeInto:(font encoding).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1547
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1548
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1549
    deviceFont ~~ fontUsed ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1550
	device setFont:id in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1551
	deviceFont := fontUsed
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1552
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1553
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1554
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1555
    device setForeground:fgId background:bgId in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1556
    foreground := paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1557
    background := bgPaint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1558
    device displayOpaqueString:s 
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1559
			     x:pX y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1560
			    in:drawableId with:gcId.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1561
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1562
    "Modified: 21.5.1996 / 21:16:17 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1563
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1564
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1565
displayPointX:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1566
    "draw a point (with current paint-color); apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1567
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1568
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1569
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1570
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1571
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1572
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1573
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1574
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1575
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1576
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1577
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1578
	pY := y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1579
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1580
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1581
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1582
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1583
    device displayPointX:pX y:pY in:drawableId with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1584
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1585
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1586
displayPolygon:aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1587
    "draw (the outline of) a polygon (with current paint-color).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1588
     Apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1589
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1590
    |newPolygon|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1591
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1592
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1593
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1594
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1595
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1596
	newPolygon := aPolygon collect:[:point | transformation applyTo:point].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1597
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1598
	newPolygon := aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1599
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1600
    (newPolygon findFirst:[:p | 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1601
	(p isPoint not 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1602
	or:[(p x class ~~ SmallInteger)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1603
	or:[(p y class ~~ SmallInteger)]])
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1604
     ]) ~~ 0 ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1605
	newPolygon := newPolygon collect:[:p | p asPoint rounded]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1606
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1607
        
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1608
    device displayPolygon:newPolygon in:drawableId with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1609
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1610
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1611
displayRectangleX:x y:y width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1612
    "draw a rectangle (with current paint-color).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1613
     If transformation is nonNil, drawing is in logical coordinates."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1614
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  1615
    |pX pY nW nH easy fgId bgId|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1616
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1617
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1618
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1619
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1620
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1621
    lineStyle == #doubleDashed ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1622
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1623
         if bgPaint or paint is not a real color, we have to do it the hard way ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1624
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1625
        easy := true.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1626
        paint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1627
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1628
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1629
            fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1630
            fgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1631
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1632
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1633
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1634
        bgPaint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1635
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1636
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1637
            bgId := bgPaint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1638
            bgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1639
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1640
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1641
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1642
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1643
        easy ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1644
            ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1645
                device setForeground:fgId background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1646
                foreground := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1647
                background := bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1648
            ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1649
        ] ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1650
            'DeviceGraphicsContext [warning]: cannot draw dashes with dithered colors' errorPrintCR
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1651
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1652
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1653
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1654
    transformation notNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1655
        pX := transformation applyToX:x.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1656
        pY := transformation applyToY:y.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1657
        nW := transformation applyScaleX:w.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1658
        nH := transformation applyScaleY:h.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1659
        nW < 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1660
              nW := nW abs.  
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1661
              pX := pX - nW.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1662
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1663
        nH < 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1664
              nH := nH abs.  
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1665
              pY := pY - nH.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1666
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1667
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1668
        pX := x.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1669
        pY := y.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1670
        nW := w.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1671
        nH := h
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1672
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1673
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1674
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1675
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1676
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1677
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1678
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1679
    "I asked myself many times if we should draw w/h or (w-1)/(h-1) bits -
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1680
     this one seems mathematically incorrect but allows to draw and fill
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1681
     a rectangle using the same extents.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1682
     I'm not certain if is the right thing to do ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1683
    "
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  1684
    device displayRectangleX:pX 
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1685
                           y:pY 
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1686
                       width:(nW - 1) 
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1687
                      height:(nH - 1)
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1688
                          in:drawableId with:gcId
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1689
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1690
    "Modified: 10.1.1997 / 17:46:41 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1691
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1692
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1693
displayString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1694
    "draw a substring at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1695
     draw foreground-pixels only (in current paint-color), 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1696
     leaving background as-is. If the transformation involves scaling,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1697
     the fonts point-size is scaled as appropriate."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1698
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1699
    |id pX pY fontUsed sz s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1700
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1701
    "hook for non-strings (i.e. attributed text)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1702
    aString isString ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1703
	^ aString displayOn:self x:x y:y from:index1 to:index2
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1704
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1705
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1706
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1707
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1708
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1709
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1710
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1711
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1712
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1713
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1714
	transformation noScale ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1715
	    sz := font size.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1716
	    sz isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1717
		"/ oops - not a real font; use original font
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1718
		fontUsed := font
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1719
	    ] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1720
		fontUsed := font size:(transformation applyScaleY:sz) rounded.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1721
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1722
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1723
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1724
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1725
	pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1726
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1727
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1728
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1729
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1730
    fontUsed := fontUsed on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1731
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1732
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1733
    id isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1734
	"hook for alien fonts"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1735
	font displayString:aString from:index1 to:index2 x:x y:y in:self.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1736
	^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1737
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1738
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1739
    s := aString.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1740
    s encoding ~~ font encoding ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1741
	s := s encodeInto:(font encoding).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1742
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1743
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1744
    deviceFont ~~ fontUsed ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1745
	device setFont:id in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1746
	deviceFont := fontUsed
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1747
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1748
    device displayString:s from:index1 to:index2
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1749
		       x:pX y:pY in:drawableId with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1750
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1751
    "Modified: 21.5.1996 / 21:16:24 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1752
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1753
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1754
displayString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1755
    "draw a string at the coordinate x/y - 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1756
     draw foreground-pixels only (in current paint-color), 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1757
     leaving background as-is. If the transformation involves scaling, 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1758
     the fonts point-size is scaled as appropriate."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1759
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1760
    |id pX pY fontUsed sz s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1761
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1762
    "hook for non-strings (i.e. attributed text)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1763
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1764
    or:[aString isText]) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1765
	^ aString displayOn:self x:x y:y
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1766
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1767
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1768
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1769
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1770
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1771
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1772
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1773
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1774
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1775
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1776
	transformation noScale ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1777
	    sz := font size.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1778
	    sz isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1779
		"/ oops - not a real font; use original font
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1780
		fontUsed := font
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1781
	    ] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1782
		fontUsed := font size:(transformation applyScaleY:sz) rounded.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1783
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1784
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1785
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1786
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1787
	pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1788
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1789
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1790
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1791
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1792
    fontUsed := fontUsed on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1793
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1794
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1795
    id isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1796
	"hook for alien fonts"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1797
	fontUsed displayString:aString x:x y:y in:self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1798
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1799
	s := aString.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1800
	s encoding ~~ fontUsed encoding ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1801
	    s := s encodeInto:(fontUsed encoding).
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1802
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1803
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1804
	deviceFont ~~ fontUsed ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1805
	    device setFont:id in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1806
	    deviceFont := fontUsed
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1807
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1808
	device displayString:s x:pX y:pY in:drawableId with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1809
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1810
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1811
    "Modified: 21.5.1996 / 21:16:30 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1812
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1813
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1814
displayUnscaledForm:formToDraw x:x y:y
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1815
    "draw a form or image non opaque and unscaled; 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1816
     if its a 1-plane bitmap, 1-bits are drawn in the
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1817
     current paint-color, leaving pixels with 0-bits unchanged
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1818
     (i.e. only 1-bits are drawn from the form).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1819
     If its a deep form (i.e. a pixmap) the current paint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1820
     settings are ignored and the form is drawn as-is. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1821
     Care must be taken, that the paint color is correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1822
     (by sending #on: to the color) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1823
     Using functions other than #copy only makes sense if you are
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1824
     certain, that the colors are real colors (actually, only for
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1825
     noColor or allColor).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1826
     The origins coordinate is transformed, but the image itself is unscaled."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1827
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1828
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1829
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1830
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1831
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1832
        pY := transformation applyToY:y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1833
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1834
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1835
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1836
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1837
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1838
    self displayDeviceForm:formToDraw x:pX y:pY
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1839
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1840
    "Modified: 12.4.1997 / 12:48:04 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1841
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1842
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1843
displayUnscaledOpaqueForm:formToDraw x:x y:y
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1844
    "draw a form or image opaque and unscaled; 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1845
     if its a 1-plane bitmap, 1-bits are drawn in the
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1846
     current paint-color, 0 bits in background color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1847
     If its a deep form (i.e. a pixmap) the current paint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1848
     settings are ignored and the form is drawn as-is (opaque). 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1849
     The origins coordinate is transformed, but the image itself is unscaled."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1850
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1851
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1852
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1853
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1854
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1855
        pY := transformation applyToY:y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1856
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1857
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1858
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1859
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1860
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1861
    self displayDeviceOpaqueForm:formToDraw x:pX y:pY
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1862
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1863
    "Modified: 12.4.1997 / 12:49:21 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1864
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1865
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1866
displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1867
    "draw a substring at the transformed coordinate x/y but do not scale the font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1868
     Draw foreground pixels in paint-color, background pixels in bgPaint color."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1869
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1870
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1871
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1872
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1873
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1874
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1875
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1876
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1877
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1878
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1879
    self displayDeviceOpaqueString:aString from:index1 to:index2 in:font x:pX y:pY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1880
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1881
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1882
displayUnscaledOpaqueString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1883
    "draw a string at the transformed coordinate x/y but do not scale the font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1884
     Draw foreground pixels in paint-color, background pixels in bgPaint color."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1885
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1886
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1887
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1888
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1889
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1890
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1891
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1892
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1893
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1894
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1895
    self displayDeviceOpaqueString:aString from:1 to:(aString size) in:font x:pX y:pY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1896
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1897
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1898
displayUnscaledString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1899
    "draw a substring at the transformed coordinate x/y but do not scale the font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1900
     draw foreground-pixels only (in current paint-color), leaving background as-is."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1901
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1902
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1903
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1904
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1905
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1906
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1907
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1908
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1909
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1910
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1911
    self displayDeviceString:aString from:index1 to:index2 in:font x:pX y:pY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1912
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1913
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1914
displayUnscaledString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1915
    "draw a string at the transformed coordinate x/y but do not scale the font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1916
     draw foreground-pixels only (in current paint-color), leaving background as-is."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1917
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1918
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1919
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1920
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1921
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1922
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1923
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1924
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1925
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1926
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1927
    self displayDeviceString:aString from:1 to:(aString size) in:font x:pX y:pY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1928
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1929
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1930
!DeviceGraphicsContext methodsFor:'drawing in device coordinates'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1931
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1932
displayDeviceForm:aForm x:x y:y
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1933
    "draw a form or image non opaque (i.e. only foreground color is drawn); 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1934
     If its a 1-plane bitmap, 1-bits are drawn in the
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1935
     current paint-color, leaving pixels with 0-bits unchanged
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1936
     (i.e. only 1-bits are drawn from the form).
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1937
     If its a deep form (i.e. a pixmap) the current paint
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1938
     settings are ignored and the form is drawn as-is; 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1939
     however, the mask is applied if present.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1940
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1941
     The form should must have been allocated on the same device,
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1942
     otherwise its converted here, which slows down the draw.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1943
     No transformation or scaling is done.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1944
     Care must be taken, that the paint color is correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1945
     (by sending #on: to the color) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1946
     Using functions other than #copy only makes sense if you are
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1947
     certain, that the colors are real colors (actually, only for
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1948
     noColor or allColor)."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1949
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1950
    |id w h easy paintDither tmpForm tmpId tmpGCId 
895
0d49372cded9 if a deep image has a mask, care for it (stamp out & or-in)
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
  1951
     fgId noColor allColor allBits pX pY
1237
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
  1952
     mask maskId deviceForm deviceMask colorMap|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1953
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1954
    w := aForm width.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1955
    h := aForm height.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1956
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1957
    pX := x rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1958
    pY := y rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1959
1034
5f6f417dcb12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1960
    deviceForm := aForm asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1961
    id := deviceForm id.
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1962
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1963
    id isNil ifTrue:[
1237
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
  1964
        'DeviceGraphicsContext [warning]: invalid form draw - ignored' errorPrintCR.
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
  1965
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1966
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1967
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1968
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1969
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1970
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1971
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1972
     a deep form ignores paint/bgPaint settings
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1973
    "
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  1974
    mask := aForm mask.
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  1975
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  1976
    ((aForm depth ~~ 1) 
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  1977
    or:[mask notNil]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1978
        mask notNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1979
            mask depth == 1 ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1980
                'DEVGC: alpha channel not yet supported' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1981
            ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1982
                deviceMask := mask asFormOn:device.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1983
                maskId := deviceMask id.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1984
                maskId notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1985
                    allColor := Color allColor.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1986
                    allBits := allColor colorId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1987
1599
55a782d2c2f5 oops - masked image draw with depth1 images was wrong
Claus Gittinger <cg@exept.de>
parents: 1592
diff changeset
  1988
                    (deviceForm depth == device depth 
55a782d2c2f5 oops - masked image draw with depth1 images was wrong
Claus Gittinger <cg@exept.de>
parents: 1592
diff changeset
  1989
                    and:[aForm maskedPixelsAre0]) ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1990
                        "/ can do it without a temporary pixmap:
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1991
                        "/   or-in the form into the inverse stamped-out area 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1992
                        "/   of the destination.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1993
                        "/   Oring is of course only possible if we know that
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1994
                        "/   masked pixels are already zero in the form.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1995
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1996
                        "/ stamp out using mask
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1997
                        device setForeground:0 background:allBits in:gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1998
                        device setFunction:#and in:gcId.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1999
                        device
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2000
                            copyPlaneFromPixmapId:maskId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2001
                            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2002
                            y:0 
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2003
                            gc:(deviceMask gcId)
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2004
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2005
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2006
                            y:pY 
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2007
                            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2008
                            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2009
                            height:h.
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2010
                        "/ or-in the form
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2011
                        device setFunction:#or in:gcId.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2012
                        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2013
                            copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2014
                            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2015
                            y:0 
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2016
                            gc:(deviceForm gcId)
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2017
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2018
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2019
                            y:pY 
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2020
                            gc:gcId
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2021
                            width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2022
                            height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2023
                    ] ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2024
                        "/ must do it slow, using a temporary form ..
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2025
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2026
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2027
                         create temp-form;
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2028
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2029
                        tmpForm := Form width:w height:h depth:device depth on:device.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2030
                        tmpForm initGC.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2031
                        tmpId := tmpForm id.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2032
                        tmpGCId := tmpForm gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2033
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2034
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2035
                         fill tempform with image
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2036
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2037
                        aForm depth == 1 ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2038
                            (colorMap := aForm colorMap) notNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2039
                                device 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2040
                                    setForeground:((colorMap at:2) on:device) colorId 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2041
                                    background:((colorMap at:1) on:device) colorId 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2042
                                    in:tmpGCId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2043
                            ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2044
                            device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2045
                                copyPlaneFromPixmapId:id
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2046
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2047
                                y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2048
                                gc:gcId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2049
                                to:tmpId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2050
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2051
                                y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2052
                                gc:tmpGCId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2053
                                width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2054
                                height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2055
                        ] ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2056
                            device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2057
                                copyFromPixmapId:id
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2058
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2059
                                y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2060
                                gc:gcId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2061
                                to:tmpId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2062
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2063
                                y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2064
                                gc:tmpGCId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2065
                                width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2066
                                height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2067
                        ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2068
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2069
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2070
                         stamp out mask in temp form
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2071
                        "
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2072
                        device setForeground:allBits background:0 in:tmpGCId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2073
                        device setFunction:#and in:tmpGCId.
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2074
                        device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2075
                            copyPlaneFromPixmapId:maskId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2076
                            x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2077
                            y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2078
                            gc:(deviceMask gcId)
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2079
                            to:tmpId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2080
                            x:0 
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2081
                            y:0 
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2082
                            gc:tmpGCId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2083
                            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2084
                            height:h.
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2085
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2086
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2087
                         stamp out mask in destination
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2088
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2089
                        device setForeground:0 background:allBits in:gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2090
                        device setFunction:#and in:gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2091
                        device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2092
                            copyPlaneFromPixmapId:maskId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2093
                            x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2094
                            y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2095
                            gc:(deviceMask gcId)
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2096
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2097
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2098
                            y:pY 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2099
                            gc:gcId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2100
                            width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2101
                            height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2102
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2103
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2104
                         or-in tempform-bits ...
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2105
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2106
                        device setFunction:#or in:gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2107
                        device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2108
                            copyFromPixmapId:tmpId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2109
                            x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2110
                            y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2111
                            gc:tmpGCId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2112
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2113
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2114
                            y:pY 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2115
                            gc:gcId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2116
                            width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2117
                            height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2118
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2119
                        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2120
                         release tempForm immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2121
                         (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2122
                          this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2123
                        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2124
                        tmpForm destroy.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2125
                    ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2126
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2127
                    "/ restore GC
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2128
                    foreground notNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2129
                        device setForeground:foreground colorId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2130
                    ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2131
                    background notNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2132
                        device setBackground:background colorId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2133
                    ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2134
                    device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2135
                    ^ self
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2136
                ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2137
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2138
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2139
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2140
        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2141
            copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2142
            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2143
            y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2144
            gc:deviceForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2145
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2146
            x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2147
            y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2148
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2149
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2150
            height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2151
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2152
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2153
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2154
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2155
     the following code is somewhat complicated, since it has to deal
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2156
     with dithered paint colors, which cannot be done directly on most
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2157
     devices (actually, a test for the devices capabilities has to be added here)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2158
     (just assume drawing a bitmap with dithered paint color ... sigh)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2159
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2160
1507
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2161
    easy := (function == #copy).
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2162
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2163
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2164
     if paint is not a real color, we have to do it the hard way ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2165
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2166
    easy ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2167
        paint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2168
            paintDither := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2169
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2170
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2171
            paintDither := paint ditherForm.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2172
            paintDither notNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2173
                easy := false.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2174
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2175
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2176
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2177
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2178
    allColor := Color allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2179
    allBits := allColor colorId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2180
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2181
    easy ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2182
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2183
         paint is a real color
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2184
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2185
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2186
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2187
         if paint color is all-0 or all-1's, we can do it in one
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2188
         operation ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2189
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2190
        fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2191
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2192
        ((fgId ~~ ((1 bitShift:device depth)-1))
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2193
        and:[fgId ~~ allBits]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2194
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2195
             clear fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2196
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2197
            device setForeground:0 background:allBits in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2198
            device setFunction:#and in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2199
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2200
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2201
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2202
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2203
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2204
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2205
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2206
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2207
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2208
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2209
                height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2210
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2211
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2212
        fgId ~~ 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2213
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2214
             or-in fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2215
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2216
            device setForeground:fgId background:0 in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2217
            device setFunction:#or in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2218
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2219
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2220
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2221
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2222
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2223
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2224
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2225
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2226
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2227
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2228
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2229
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2230
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2231
         flush foreground/background cache
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2232
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2233
        foreground := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2234
        background := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2235
        device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2236
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2237
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2238
1507
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2239
    function == #or ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2240
        easy := paint notNil
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2241
                and:[paint isColor
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2242
                and:[paint ditherForm isNil]].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2243
        easy ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2244
            easy := bgPaint isNil
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2245
                        or:[bgPaint isColor
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2246
                            and:[bgPaint colorId == 0]]
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2247
        ].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2248
        easy ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2249
            fgId := paint colorId.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2250
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2251
            fgId ~~ 0 ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2252
                "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2253
                 or-in fg-bits ...
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2254
                "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2255
                device setForeground:fgId background:0 in:gcId.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2256
                device
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2257
                    copyPlaneFromPixmapId:id
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2258
                    x:0 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2259
                    y:0 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2260
                    gc:(deviceForm gcId)
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2261
                    to:drawableId
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2262
                    x:pX 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2263
                    y:pY 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2264
                    gc:gcId
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2265
                    width:w 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2266
                    height:h
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2267
            ].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2268
            "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2269
             flush foreground/background cache
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2270
            "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2271
            foreground := nil.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2272
            background := nil.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2273
            ^ self
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2274
        ].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2275
    ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2276
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2277
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2278
     hard case; paint is a dithered color
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2279
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2280
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2281
    noColor := Color noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2282
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2283
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2284
     create temp-form;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2285
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2286
    tmpForm := Form width:w height:h depth:device depth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2287
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2288
     fill tempform
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2289
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2290
    tmpForm paint:paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2291
    tmpForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2292
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2293
     stamp out background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2294
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2295
    tmpForm paint:allColor on:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2296
    tmpForm function:#and.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2297
    tmpForm displayOpaqueForm:deviceForm x:0 y:0.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2298
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2299
     stamp out foreground from destination
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2300
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2301
    device setForeground:0 background:allBits in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2302
    device setFunction:#and in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2303
    device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2304
        copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2305
        x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2306
        y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2307
        gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2308
        to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2309
        x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2310
        y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2311
        gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2312
        width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2313
        height:h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2314
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2315
     or-in temp into destination
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2316
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2317
    device setForeground:allBits background:0 in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2318
    device setFunction:#or in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2319
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2320
    device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2321
        copyFromPixmapId:tmpForm id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2322
        x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2323
        y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2324
        gc:tmpForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2325
        to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2326
        x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2327
        y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2328
        gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2329
        width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2330
        height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2331
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2332
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2333
     release tempForm immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2334
     (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2335
      this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2336
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2337
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2338
    tmpForm destroy.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2339
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2340
     flush foreground/background cache
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2341
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2342
    foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2343
    background := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2344
    device setFunction:function in:gcId.
768
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2345
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2346
    "Modified: 22.4.1997 / 21:48:27 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2347
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2348
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2349
displayDeviceLineFromX:x0 y:y0 toX:x1 y:y1
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2350
    "draw a line (with current paint-color) in device coordinate space.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2351
     This ignores any transformations. The coordinates must be integers."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2352
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2353
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2354
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2355
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2356
    device displayLineFromX:x0 y:y0 toX:x1 y:y1 in:drawableId with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2357
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2358
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2359
displayDeviceOpaqueForm:aForm x:x y:y
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2360
    "draw a form or image opaque (i.e. both fg and bg is drawn); 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2361
     If its a 1-plane bitmap, 1-bits are drawn in the
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2362
     current paint-color and 0-bits in the bgPaint color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2363
     If its a deep form (i.e. a pixmap) the current paint/bgPaint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2364
     settings are ignored and the form drawn as-is. 
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2365
     Any mask is ignored.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2366
     In the 1-plane case, special care must be taken if paint and/or bgPaint 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2367
     dithered colors or patterns, since are that the colors are correctly allocated (by sending #on:
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2368
     to the colors) before doing so.
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2369
     The form should have been allocated on the same device; otherwise,
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2370
     its converted here, which slows down the draw.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2371
     Drawing is in device coordinates; no scaling is done."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2372
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2373
    |id w h easy savedPaint bgForm fgForm tmpForm 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2374
     fgId bgId noColor allColor allBits dx dy
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2375
     pX pY deviceDepth deviceForm|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2376
1033
b5cd84ed805f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  2377
    deviceForm := aForm asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2378
    id := deviceForm id.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2379
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2380
    "temporary ..."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2381
    (id isNil 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2382
    or:[aForm graphicsDevice ~~ device]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2383
        deviceForm := deviceForm asFormOn:device.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2384
        id := deviceForm id.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2385
        id isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2386
            'DeviceGraphicsContext [warning]: invalid form draw - ignored' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2387
            ^ self
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2388
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2389
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2390
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2391
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2392
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2393
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2394
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2395
    w := aForm width.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2396
    h := aForm height.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2397
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2398
    pX := x rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2399
    pY := y rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2400
902
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2401
    "
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2402
     a deep form ignores paint/bgPaint settings
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2403
     and is always drawn opaque.
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2404
    "
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2405
    (aForm depth ~~ 1) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2406
        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2407
            copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2408
            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2409
            y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2410
            gc:deviceForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2411
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2412
            x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2413
            y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2414
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2415
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2416
            height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2417
        ^ self
902
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2418
    ].
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2419
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2420
    "/ if no bgPaint is set, this is a non-opaque draw
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2421
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2422
    bgPaint isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2423
        self displayDeviceForm:aForm x:x y:y.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2424
        ^ self
902
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2425
    ].
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2426
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2427
    "the following code is somewhat complicated, since it has to deal
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2428
     with dithered fg/bg colors, which cannot be done directly on most
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2429
     devices (actually, a test for the devices capabilities has to be added here)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2430
     (just assume drawing a bitmap with dithered fg/bg colors ... sigh)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2431
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2432
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2433
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2434
     if bgPaint or paint is not a real color, we have to do it the hard way ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2435
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2436
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2437
    paint isColor ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2438
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2439
    ] ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2440
        fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2441
        fgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2442
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2443
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2444
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2445
    bgPaint isColor ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2446
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2447
    ] ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2448
        bgId := bgPaint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2449
        bgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2450
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2451
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2452
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2453
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2454
    easy ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2455
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2456
         easy: both paint and bgPaint are real colors
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2457
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2458
        ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2459
            device setForeground:fgId background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2460
            foreground := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2461
            background := bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2462
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2463
        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2464
            copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2465
            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2466
            y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2467
            gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2468
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2469
            x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2470
            y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2471
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2472
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2473
            height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2474
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2475
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2476
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2477
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2478
     hard case: paint and/or bgPaint are dithered or patterns
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2479
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2480
    allColor := Color allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2481
    allBits := allColor colorId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2482
    deviceDepth := device depth.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2483
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2484
    (fgId notNil and:[function == #copy]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2485
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2486
         only bg is dithered; fill with bg first ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2487
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2488
        savedPaint := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2489
        self paint:bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2490
        self fillDeviceRectangleX:pX y:pY width:w height:h.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2491
        self paint:savedPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2492
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2493
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2494
         if paint color is all-0 or all-1's, we can do it in one
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2495
         operation ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2496
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2497
        ((fgId ~~ ((1 bitShift:deviceDepth)-1))
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2498
        and:[fgId ~~ allBits]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2499
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2500
             clear fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2501
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2502
            device setForeground:0 background:allBits in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2503
            device setFunction:#and in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2504
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2505
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2506
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2507
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2508
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2509
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2510
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2511
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2512
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2513
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2514
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2515
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2516
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2517
        fgId ~~ 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2518
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2519
             or-in fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2520
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2521
            device setForeground:fgId background:0 in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2522
            device setFunction:#or in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2523
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2524
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2525
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2526
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2527
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2528
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2529
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2530
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2531
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2532
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2533
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2534
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2535
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2536
         flush foreground/background cache
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2537
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2538
        foreground := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2539
        background := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2540
        device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2541
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2542
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2543
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2544
    (bgId notNil and:[function == #copy]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2545
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2546
         only fg is dithered; fill with fg first ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2547
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2548
        self fillDeviceRectangleX:pX y:pY width:w height:h.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2549
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2550
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2551
         if paint color is all-0 or all-1's, we can do it in one
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2552
         operation ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2553
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2554
        ((bgId ~~ ((1 bitShift:deviceDepth)-1))
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2555
        and:[bgId ~~ allBits]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2556
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2557
             clear bg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2558
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2559
            device setForeground:allBits background:0 in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2560
            device setFunction:#and in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2561
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2562
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2563
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2564
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2565
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2566
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2567
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2568
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2569
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2570
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2571
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2572
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2573
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2574
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2575
         or-in bg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2576
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2577
        bgId ~~ 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2578
            device setForeground:0 background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2579
            device setFunction:#or in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2580
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2581
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2582
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2583
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2584
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2585
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2586
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2587
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2588
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2589
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2590
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2591
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2592
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2593
         flush foreground/background cache
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2594
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2595
        foreground := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2596
        background := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2597
        device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2598
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2599
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2600
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2601
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2602
     very hard case; both fg and bg are dithered colors
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2603
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2604
    noColor := Color noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2605
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2606
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2607
     create temp-forms;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2608
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2609
    bgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2610
    fgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2611
    tmpForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2612
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2613
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2614
     fill
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2615
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2616
    dx := dy := 0.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2617
    maskOrigin notNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2618
        dx := maskOrigin x.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2619
        dy := maskOrigin y
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2620
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2621
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2622
    bgForm paint:bgPaint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2623
    bgForm setMaskOriginX:(x negated + dx) y:(y negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2624
    bgForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2625
    fgForm paint:paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2626
    fgForm setMaskOriginX:(x negated + dx) y:(y negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2627
    fgForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2628
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2629
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2630
     stamp-out background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2631
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2632
    bgForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2633
    bgForm function:#and.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2634
    bgForm displayOpaqueForm:deviceForm x:0 y:0.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2635
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2636
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2637
     stamp-out foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2638
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2639
    fgForm paint:allColor on:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2640
    fgForm function:#and.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2641
    fgForm displayOpaqueForm:deviceForm x:0 y:0.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2642
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2643
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2644
     clear tempform
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2645
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2646
    tmpForm paint:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2647
    tmpForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2648
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2649
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2650
     merge fg-temp and bg-temp into tmp
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2651
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2652
    tmpForm function:#or.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2653
    tmpForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2654
    tmpForm copyFrom:fgForm x:0 y:0 toX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2655
    tmpForm copyFrom:bgForm x:0 y:0 toX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2656
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2657
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2658
     finally, draw it
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2659
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2660
    device setForeground:0 background:allBits in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2661
    device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2662
        copyFromPixmapId:tmpForm id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2663
        x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2664
        y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2665
        gc:tmpForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2666
        to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2667
        x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2668
        y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2669
        gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2670
        width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2671
        height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2672
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2673
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2674
     release tempForms immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2675
     (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2676
      this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2677
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2678
    fgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2679
    bgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2680
    tmpForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2681
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2682
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2683
     flush foreground/background cache
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2684
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2685
    foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2686
    background := nil.
868
65c93e5f6f8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
  2687
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2688
    "Modified: 22.4.1997 / 21:44:10 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2689
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2690
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2691
displayDeviceOpaqueString:aString from:index1 to:index2 in:font x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2692
    "draw a substring at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2693
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2694
     Assuming that device can only draw in device colors, we have to handle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2695
     the case where paint and/or bgPaint are dithered colors.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2696
     No translation or scaling is done."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2697
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2698
    |easy w h savedPaint fgId bgId allColor allBits noColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2699
     id bgForm fgForm tmpForm maskForm dx dy pX pY fontUsed s
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2700
     deviceDepth|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2701
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2702
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2703
     if backgroundPaint color is nil, we assume
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2704
     this is a non-opaque draw
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2705
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2706
    bgPaint isNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2707
        self displayDeviceString:aString from:index1 to:index2 x:x y:y.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2708
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2709
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2710
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2711
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2712
    or:[aString isText]) ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2713
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2714
         hook for non-strings (i.e. attributed text)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2715
         that 'thing' should know how to display itself ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2716
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2717
        aString displayOpaqueOn:self x:x y:y from:index1 to:index2.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2718
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2719
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2720
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2721
    gcId isNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2722
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2723
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2724
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2725
    pX := x rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2726
    pY := y rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2727
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2728
    fontUsed := font on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2729
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2730
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2731
    id isNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2732
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2733
         hook for alien fonts
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2734
         that 'font' should know how to display the string ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2735
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2736
        font displayOpaqueString:aString from:index1 to:index2 x:x y:y in:self.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2737
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2738
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2739
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2740
    s := aString.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2741
    s encoding ~~ font encoding ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2742
        s := s encodeInto:(font encoding).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2743
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2744
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2745
    deviceFont ~~ fontUsed ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2746
        device setFont:id in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2747
        deviceFont := fontUsed
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2748
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2749
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2750
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2751
     if bgPaint or paint is not a real Color, we have to do it the hard way ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2752
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2753
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2754
    paint isColor ifFalse:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2755
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2756
    ] ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2757
        fgId := paint colorId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2758
        fgId isNil ifTrue:[
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2759
            easy := false
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2760
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2761
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2762
    bgPaint isColor ifFalse:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2763
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2764
    ] ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2765
        bgId := bgPaint colorId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2766
        bgId isNil ifTrue:[
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2767
            easy := false
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2768
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2769
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2770
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2771
    easy ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2772
        device setForeground:fgId background:bgId in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2773
        foreground := paint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2774
        background := bgPaint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2775
        device displayOpaqueString:s 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2776
                              from:index1 to:index2
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2777
                                 x:pX y:pY 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2778
                                in:drawableId with:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2779
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2780
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2781
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2782
    w := fontUsed widthOf:s from:index1 to:index2.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2783
    h := fontUsed height.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2784
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2785
    (fgId notNil and:[function == #copy]) ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2786
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2787
         only bg is dithered; fill with bg first ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2788
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2789
        savedPaint := paint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2790
        self paint:bgPaint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2791
        self fillRectangleX:pX y:(pY - fontUsed ascent) width:w height:h.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2792
        self paint:savedPaint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2793
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2794
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2795
         then draw using fgPaint (which is a real color)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2796
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2797
        device displayString:s 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2798
                        from:index1 to:index2
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2799
                           x:pX y:pY 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2800
                          in:drawableId with:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2801
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2802
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2803
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2804
    allColor := Color allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2805
    allBits := allColor colorId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2806
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2807
    deviceDepth := device depth.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2808
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2809
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2810
     the code below is correct, but some (all?) implementations of the
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2811
     X Window system seem to not support ALU-functions when drawing opaque strings.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2812
     Therefore we use the slower code below.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2813
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2814
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2815
"/    (bgId notNil and:[function == #copy]) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2816
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2817
"/       only fg is dithered; fill with fg first ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2818
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2819
"/      self fillRectangleX:pX y:(pY - fontUsed ascent) width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2820
"/
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2821
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2822
"/       if bgPaint color is all-0 or all-1's, we can do it in one
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2823
"/       operation ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2824
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2825
"/      ((bgId ~~ ((1 bitShift:deviceDepth)-1))
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2826
"/      and:[bgId ~~ allBits]) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2827
"/          "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2828
"/           clear bg bits ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2829
"/          "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2830
"/          device setForeground:allBits background:0 in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2831
"/          device setFunction:#and in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2832
"/          device displayOpaqueString:s 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2833
"/                                from:index1 to:index2
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2834
"/                                   x:pX y:pY 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2835
"/                                  in:drawableId with:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2836
"/      ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2837
"/
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2838
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2839
"/       or-in bg bits ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2840
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2841
"/      bgId ~~ 0 ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2842
"/          device setForeground:0 background:bgId in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2843
"/          device setFunction:#or in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2844
"/          device displayOpaqueString:s 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2845
"/                                from:index1 to:index2
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2846
"/                                   x:pX y:pY 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2847
"/                                  in:drawableId with:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2848
"/      ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2849
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2850
"/       flush foreground/background cache
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2851
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2852
"/      foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2853
"/      background := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2854
"/      device setFunction:function in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2855
"/      ^ self
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2856
"/  ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2857
768
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2858
    (bgId notNil and:[function == #copy]) ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2859
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2860
         only fg is dithered; fill with bg first ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2861
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2862
        device setForeground:bgId in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2863
        device setFunction:#copy in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2864
        device setBitmapMask:nil in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2865
        self fillRectangleX:pX y:(pY - fontUsed ascent) width:w height:h.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2866
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2867
        "/ draw fg dithered
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2868
        (mask depth == 1) ifTrue:[
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2869
            device setBitmapMask:mask id in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2870
            device setForeground:foreground colorId background:background colorId in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2871
        ] ifFalse:[
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2872
            device setPixmapMask:mask id in:gcId
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2873
        ].
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2874
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2875
        device displayString:s
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2876
                    from:index1 to:index2 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2877
                       x:pX y:pY
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2878
                      in:drawableId with:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2879
        ^ self.
768
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2880
"/
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2881
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2882
"/       if bgPaint color is all-0 or all-1's, we can do it in one
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2883
"/       operation ...
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2884
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2885
"/      ((bgId ~~ ((1 bitShift:deviceDepth)-1))
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2886
"/      and:[bgId ~~ allBits]) ifTrue:[
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2887
"/          "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2888
"/           clear bg bits ...
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2889
"/          "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2890
"/          device setForeground:allBits background:0 in:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2891
"/          device setFunction:#and in:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2892
"/          device displayOpaqueString:s 
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2893
"/                                from:index1 to:index2
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2894
"/                                   x:pX y:pY 
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2895
"/                                  in:drawableId with:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2896
"/      ].
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2897
"/
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2898
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2899
"/       or-in bg bits ...
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2900
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2901
"/      bgId ~~ 0 ifTrue:[
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2902
"/          device setForeground:0 background:bgId in:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2903
"/          device setFunction:#or in:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2904
"/          device displayOpaqueString:s 
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2905
"/                                from:index1 to:index2
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2906
"/                                   x:pX y:pY 
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2907
"/                                  in:drawableId with:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2908
"/      ].
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2909
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2910
"/       flush foreground/background cache
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2911
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2912
"/      foreground := nil.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2913
"/      background := nil.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2914
"/      device setFunction:function in:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2915
"/      ^ self
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2916
    ].
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2917
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2918
    "
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2919
     very hard case, both fg and bg are dithered colors/images
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2920
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2921
    noColor := Color noColor.
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2922
"/ 'hard: ' print. aString print. ' ' print. paint print. ' ' print. bgPaint printCR.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2923
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2924
     create temp-forms;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2925
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2926
    bgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2927
    fgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2928
    tmpForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2929
    maskForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2930
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2931
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2932
     fill
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2933
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2934
    dx := 0.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2935
    dy := fontUsed ascent.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2936
    maskOrigin notNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2937
        dx := maskOrigin x.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2938
        dy := dy + maskOrigin y
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2939
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2940
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2941
    bgForm paint:bgPaint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2942
    bgForm setMaskOriginX:(pX negated + dx) y:(pY negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2943
    bgForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2944
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2945
    fgForm paint:paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2946
    fgForm setMaskOriginX:(pX negated + dx) y:(pY negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2947
    fgForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2948
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2949
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2950
     stamp-out background (have now bg-bits with fg=0 in bgForm)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2951
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2952
    bgForm font:fontUsed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2953
    bgForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2954
    bgForm function:#and.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2955
    bgForm displayString:s 
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2956
                    from:index1 to:index2 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2957
                       x:0 y:fontUsed ascent.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2958
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2959
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2960
     stamp-out foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2961
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2962
    maskForm font:fontUsed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2963
    maskForm paint:allColor on:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2964
    maskForm displayOpaqueString:s 
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2965
                            from:index1 to:index2 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2966
                               x:0 y:fontUsed ascent.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2967
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2968
    fgForm function:#and.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2969
    fgForm copyFrom:maskForm x:0 y:0 toX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2970
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2971
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2972
     clear tempform
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2973
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2974
    tmpForm paint:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2975
    tmpForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2976
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2977
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2978
     merge fg-temp and bg-temp into tmp
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2979
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2980
    tmpForm function:#or.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2981
    tmpForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2982
    tmpForm copyFrom:fgForm x:0 y:0 toX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2983
    tmpForm copyFrom:bgForm x:0 y:0 toX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2984
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2985
     finally, draw it
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2986
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2987
    device setForeground:0 background:allBits in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2988
    device
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2989
        copyFromId:tmpForm id
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2990
                 x:0 y:0 gc:tmpForm gcId
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2991
                to:drawableId
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2992
                 x:pX y:(pY-fontUsed ascent) gc:gcId
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2993
             width:w height:h.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2994
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2995
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2996
     release tempForms immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2997
     (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2998
      this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2999
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3000
    tmpForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3001
    fgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3002
    bgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3003
    maskForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3004
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3005
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3006
     flush foreground/background cache
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3007
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3008
    foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3009
    background := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3010
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3011
    "Modified: 22.4.1997 / 21:47:15 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3012
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3013
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3014
displayDeviceOpaqueString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3015
    "draw a substring at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3016
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3017
     Assuming that device can only draw in device colors, we have to handle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3018
     the case where paint and/or bgPaint are dithered colors.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3019
     No translation or scaling is done."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3020
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3021
    self displayDeviceOpaqueString:aString from:index1 to:index2 in:font x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3022
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3023
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3024
displayDeviceOpaqueString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3025
    "draw a string at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3026
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3027
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3028
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3029
    self displayDeviceOpaqueString:aString from:1 to:(aString size) in:font x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3030
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3031
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3032
displayDeviceString:aString from:index1 to:index2 in:font x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3033
    "draw a substring at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3034
     draw foreground-pixels only (in current paint-color), leaving background as-is.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3035
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3036
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3037
    |id pX pY fontUsed s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3038
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3039
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3040
     hook for non-strings (i.e. attributed text)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3041
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3042
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3043
    or:[aString isText]) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3044
	^ aString displayOn:self x:x y:y from:index1 to:index2
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3045
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3046
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3047
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3048
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3049
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3050
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3051
    pX := x rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3052
    pY := y rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3053
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3054
    fontUsed := font on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3055
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3056
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3057
    id isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3058
	"hook for alien fonts"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3059
	font displayString:aString from:index1 to:index2 x:x y:y in:self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3060
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3061
	s := aString.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3062
	s encoding ~~ font encoding ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3063
	    s := s encodeInto:(font encoding).
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3064
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3065
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3066
	deviceFont ~~ fontUsed ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3067
	    device setFont:id in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3068
	    deviceFont := fontUsed
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3069
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3070
	device displayString:s from:index1 to:index2
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3071
			   x:pX y:pY in:drawableId with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3072
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3073
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3074
    "Modified: 12.5.1996 / 17:49:22 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3075
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3076
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3077
displayDeviceString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3078
    "draw a substring at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3079
     draw foreground-pixels only (in current paint-color), leaving background as-is.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3080
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3081
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3082
    self displayDeviceString:aString from:index1 to:index2 in:font x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3083
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3084
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3085
displayDeviceString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3086
    "draw a string at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3087
     draw foreground-pixels only (in current paint-color), leaving background as-is.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3088
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3089
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3090
    self displayDeviceString:aString from:1 to:(aString size) in:font x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3091
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3092
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3093
fillDeviceRectangleX:x y:y width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3094
    "draw a filled rectangle in device coordinate space.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3095
     This ignores any transformations. The coordinates must be integers."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3096
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3097
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3098
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3099
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3100
    device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3101
	fillRectangleX:x 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3102
		     y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3103
		 width:w
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3104
		height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3105
		    in:drawableId with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3106
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3107
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3108
!DeviceGraphicsContext methodsFor:'evaluating in another context'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3109
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3110
reverseDo:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3111
    "evaluate aBlock with foreground and background interchanged.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3112
     This can be reimplemented here in a faster way."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3113
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3114
    |oldFg oldBg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3115
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3116
    oldFg := foreground on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3117
    oldBg := background on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3118
    self foreground:background background:foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3119
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3120
    self foreground:oldFg background:oldBg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3121
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3122
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3123
withBackground:fgColor do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3124
    "evaluate aBlock with changed background."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3125
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3126
    |oldBg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3127
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3128
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3129
    self background:fgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3130
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3131
    self background:oldBg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3132
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3133
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3134
withForeground:fgColor background:bgColor do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3135
    "evaluate aBlock with changed foreground and background."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3136
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3137
    |oldFg oldBg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3138
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3139
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3140
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3141
    self foreground:fgColor background:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3142
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3143
    self foreground:oldFg background:oldBg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3144
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3145
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3146
withForeground:fgColor background:bgColor function:aFunction do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3147
    "evaluate aBlock with foreground, background and function"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3148
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3149
    |oldFg oldBg oldFun|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3150
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3151
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3152
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3153
    oldFun := function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3154
    self foreground:fgColor background:bgColor function:aFunction.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3155
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3156
    self foreground:oldFg background:oldBg function:oldFun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3157
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3158
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3159
withForeground:fgColor background:bgColor mask:aMask do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3160
    "evaluate aBlock with foreground, background and mask"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3161
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3162
    |oldFg oldBg oldMask|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3163
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3164
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3165
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3166
    oldMask := mask.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3167
    self foreground:fgColor background:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3168
    self mask:aMask.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3169
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3170
    self foreground:oldFg background:oldBg.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3171
    self mask:oldMask
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3172
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3173
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3174
withForeground:fgColor do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3175
    "evaluate aBlock with changed foreground."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3176
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3177
    |oldFg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3178
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3179
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3180
    self foreground:fgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3181
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3182
    self foreground:oldFg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3183
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3184
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3185
withForeground:fgColor function:aFunction do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3186
    "evaluate aBlock with changed foreground and function."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3187
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3188
    |oldFg oldFun|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3189
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3190
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3191
    oldFun := function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3192
    self foreground:fgColor background:background function:aFunction.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3193
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3194
    self foreground:oldFg background:background function:oldFun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3195
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3196
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3197
xoring:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3198
    "evaluate aBlock with function xoring"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3199
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3200
    |fgPixel bgPixel oldFunction|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3201
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3202
    fgPixel := device blackColor colorId.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3203
    bgPixel := device whiteColor colorId.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3204
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3205
    gcId isNil ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3206
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3207
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3208
    oldFunction := function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3209
    device setForeground:(fgPixel bitXor:bgPixel)
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3210
              background:bgPixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3211
                      in:gcId.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3212
    device setFunction:#xor in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3213
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3214
    paint := nil.        "invalidate"
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3215
    foreground := device blackColor.   
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3216
    background := device whiteColor.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3217
    device setForeground:fgPixel
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3218
              background:bgPixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3219
                      in:gcId.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3220
    device setFunction:oldFunction in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3221
    function := oldFunction
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3222
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3223
    "Modified: 13.1.1997 / 23:03:20 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3224
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3225
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3226
!DeviceGraphicsContext methodsFor:'filling'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3227
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3228
fillArcX:x y:y width:w height:h from:startAngle angle:angle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3229
    "draw a filled arc; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3230
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  3231
    |pX pY nW nH|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3232
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3233
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3234
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3235
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3236
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3237
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3238
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3239
	nW := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3240
	nH := transformation applyScaleY:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3241
	nW < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3242
	      nW := nW abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3243
	      pX := pX - nW.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3244
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3245
	nH < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3246
	      nH := nH abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3247
	      pY := pY - nH.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3248
	].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3249
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3250
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3251
	pY := y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3252
	nW := w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3253
	nH := h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3254
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3255
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3256
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3257
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3258
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3259
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3260
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3261
    device
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3262
	  fillArcX:pX 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3263
		 y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3264
	     width:nW
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3265
	    height:nH 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3266
	      from:startAngle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3267
	     angle:angle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3268
		in:drawableId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3269
	      with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3270
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3271
    "Created: 8.5.1996 / 08:29:45 / cg"
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3272
    "Modified: 4.6.1996 / 17:58:21 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3273
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3274
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3275
fillPolygon:aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3276
    "draw a filled polygon; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3277
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3278
    |newPolygon|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3279
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3280
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3281
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3282
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3283
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3284
	newPolygon := aPolygon collect:[:point | transformation applyTo:point].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3285
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3286
	newPolygon := aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3287
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3288
    (newPolygon findFirst:[:p | 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3289
	(p isPoint not 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3290
	or:[(p x class ~~ SmallInteger)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3291
	or:[(p y class ~~ SmallInteger)]])
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3292
     ]) ~~ 0 ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3293
	newPolygon := newPolygon collect:[:p | p asPoint rounded]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3294
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3295
    device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3296
	fillPolygon:newPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3297
		 in:drawableId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3298
	       with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3299
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3300
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3301
fillRectangleX:x y:y width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3302
    "draw a filled rectangle; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3303
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  3304
    |pX pY nW nH|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3305
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3306
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3307
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3308
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3309
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3310
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3311
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3312
	nW := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3313
	nH := transformation applyScaleY:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3314
	nW < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3315
	      nW := nW abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3316
	      pX := pX - nW.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3317
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3318
	nH < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3319
	      nH := nH abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3320
	      pY := pY - nH.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3321
	].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3322
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3323
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3324
	pY := y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3325
	nW := w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3326
	nH := h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3327
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3328
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3329
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3330
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3331
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3332
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3333
    device
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3334
	fillRectangleX:pX 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3335
		     y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3336
		 width:nW 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3337
		height:nH 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3338
		    in:drawableId with:gcId
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3339
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3340
    "Modified: 4.6.1996 / 17:58:49 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3341
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3342
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3343
!DeviceGraphicsContext methodsFor:'initialization'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3344
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3345
close
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3346
    "same as destroy - for ST-80 compatibility"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3347
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3348
    self destroy
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3349
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3350
    "Created: 2.4.1997 / 19:31:27 / cg"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3351
!
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3352
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3353
createGC
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3354
    "physically create a device GC.
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3355
     Since we do not need a gc-object for the drawable until something is
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3356
     really drawn, none is created up to the first draw.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3357
     This method is sent, when the first drawing happens"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3358
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3359
    gcId := device gcFor:drawableId.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3360
    Lobby registerChange:self.
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3361
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3362
    "Modified: 19.3.1997 / 11:07:52 / cg"
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3363
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3364
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3365
destroy
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3366
    "I am abstract"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3367
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3368
    self shouldNotImplement.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3369
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3370
"/    "when the drawable is destroyed, the associated GC must be destroyed with it"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3371
"/
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3372
"/    gcId notNil ifTrue:[
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3373
"/        device destroyGC:gcId.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3374
"/        gcId := nil.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3375
"/        Lobby registerChange:self.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3376
"/    ]
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3377
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3378
    "Modified: 2.4.1997 / 19:37:53 / cg"
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3379
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3380
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3381
initGC
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3382
    "since we do not need a gc-object for the drawable until something is
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3383
     really drawn, none is created.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3384
     This method is sent, when the first drawing happens"
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3385
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3386
    |fgId bgId p|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3387
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3388
    gcId notNil ifTrue:[^ self].
1514
7c2a921ae46b better error report when drawing on closed view.
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  3389
    drawableId isNil ifTrue:[
1649
fa5238a71c2e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  3390
        self error:'drawing attempt on closed drawable'.
1514
7c2a921ae46b better error report when drawing on closed view.
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  3391
        ^ self
7c2a921ae46b better error report when drawing on closed view.
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  3392
    ].
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3393
    self createGC.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3394
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3395
    foreground isNil ifTrue:[foreground := device blackColor].
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3396
    background isNil ifTrue:[background := device whiteColor].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3397
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3398
    foreground isColor ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3399
        "get device colors from the device indep. colors"
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3400
        foreground := foreground on:device.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3401
        fgId := foreground colorId.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3402
        fgId isNil ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3403
            (foreground grayIntensity >= 50) ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3404
                fgId := device whitepixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3405
            ] ifFalse:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3406
                fgId := device blackpixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3407
            ]
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3408
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3409
    ] ifFalse:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3410
        fgId := device blackpixel.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3411
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3412
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3413
    background isColor ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3414
        background := background on:device.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3415
        bgId := background colorId.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3416
        bgId isNil ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3417
            (background grayIntensity >= 50) ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3418
                bgId := device whitepixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3419
            ] ifFalse:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3420
                bgId := device blackpixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3421
            ]
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3422
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3423
    ] ifFalse:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3424
        bgId := device whitepixel
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3425
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3426
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3427
    "now, this is something the device can work with ..."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3428
    device setForeground:fgId background:bgId in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3429
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3430
    "switch to paint"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3431
    p := paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3432
    paint := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3433
    self paint:p.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3434
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3435
    ((lineWidth ~~ 0) 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3436
    or:[(lineStyle ~~ #solid) 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3437
    or:[(capStyle ~~ #butt)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3438
    or:[joinStyle ~~ #miter]]]) ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3439
        device setLineWidth:lineWidth 
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3440
                      style:lineStyle
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3441
                        cap:capStyle
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3442
                       join:joinStyle
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3443
                         in:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3444
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3445
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3446
    mask notNil ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3447
        (mask depth == 1) ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3448
            device setBitmapMask:(mask id) in:gcId
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3449
        ] ifFalse:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3450
            device setPixmapMask:(mask id) in:gcId
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3451
        ].
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3452
        maskOrigin notNil ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3453
            device setMaskOriginX:maskOrigin x y:maskOrigin y in:gcId
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3454
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3455
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3456
    (function ~~ #copy) ifTrue:[device setFunction:function in:gcId].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3457
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3458
    "defer the getting of a device font 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3459
     - this is now done when the first drawstring occurs,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3460
     since many views (layout-views) will never draw strings and
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3461
     therefore, the overhead of aquiring a font can be avoided.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3462
    "
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3463
"/    font := font on:device.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3464
"/    id := font fontId.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3465
"/    id notNil ifTrue:[
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3466
"/        device setFont:id in:gcId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3467
"/    ]
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3468
1649
fa5238a71c2e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  3469
    "Modified: 24.4.1997 / 12:00:14 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3470
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3471
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3472
initialize
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3473
    "setup everything for later use; actual work is done in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3474
     initColors and initFont, which are usually redefined."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3475
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3476
    "make certain Workstation is initialized - just a check - will vanish soon"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3477
    Display isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3478
        'DeviceGraphicsContext [warning]: Display not initialized when first DeviceGraphicsContext created' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3479
        Workstation initialize
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3480
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3481
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3482
    super initialize.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3483
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
  3484
    foreground isNil ifTrue:[foreground := Black].
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
  3485
    background isNil ifTrue:[background := White].
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
  3486
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3487
    "Modified: 10.1.1997 / 17:46:51 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3488
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3489
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3490
prepareForReinit
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3491
    "kludge - clear drawableId and gcId 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3492
     needed after snapin"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3493
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3494
    gcId := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3495
    drawableId := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3496
    deviceFont := nil
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3497
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3498
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3499
recreate
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3500
    "sent after a snapin, reinit draw stuff for new device"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3501
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3502
    gcId := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3503
    foreground notNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3504
	foreground := foreground on:device
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3505
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3506
    background notNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3507
	background := background on:device
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3508
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3509
    paint notNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3510
	paint := paint on:device
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3511
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3512
    bgPaint notNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3513
	bgPaint := bgPaint on:device
1094
470f906e3687 recreate device font early - this avoids some deviceFont query errors
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  3514
    ].
470f906e3687 recreate device font early - this avoids some deviceFont query errors
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  3515
    font notNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3516
	font := font on:device
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3517
    ]
1094
470f906e3687 recreate device font early - this avoids some deviceFont query errors
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  3518
470f906e3687 recreate device font early - this avoids some deviceFont query errors
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  3519
    "Modified: 28.10.1996 / 13:25:02 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3520
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3521
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3522
reinitialize
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3523
    'DeviceGraphicsContext [warning]: reinit of ' errorPrint. self classNameWithArticle errorPrint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3524
    ' failed' errorPrintCR
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3525
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3526
    "Modified: 10.1.1997 / 17:47:06 / cg"
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3527
!
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3528
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3529
releaseGC
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3530
    "destroy the associated device GC resource - can be done to be nice to the 
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3531
     display if you know that you are done with a drawable."
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3532
844
17d0f74d7d02 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
  3533
    foreground := background := paint := bgPaint := nil.
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3534
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3535
    gcId notNil ifTrue:[
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3536
        device destroyGC:gcId.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3537
        gcId := nil.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3538
        Lobby registerChange:self.
844
17d0f74d7d02 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
  3539
    ].
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3540
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3541
    "Created: 11.6.1996 / 22:07:30 / cg"
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3542
    "Modified: 2.4.1997 / 19:36:30 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3543
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3544
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3545
!DeviceGraphicsContext methodsFor:'instance release'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3546
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3547
disposed
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3548
    "some Drawable has been collected 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3549
     - must release operating system resources"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3550
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3551
    ^ self subclassResponsibility
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3552
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3553
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3554
!DeviceGraphicsContext methodsFor:'private'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3555
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3556
setDevice:aDevice id:aDrawbleId gcId:aGCId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3557
    "private"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3558
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3559
    device := aDevice.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3560
    gcId := aGCId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3561
    drawableId := aDrawbleId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3562
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3563
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3564
setGCForPaint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3565
    "private; given a complex color (i.e. a pixmap or dithered color,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3566
     setup the GC to draw in this color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3567
     A helper for paint and paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3568
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3569
    |dither map pixelId p fg bg vOrg ditherDepth deviceDepth|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3570
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3571
    gcId notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3572
	(p := paint) isColor ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3573
	    paint := p := p on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3574
	    pixelId := p colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3575
	    pixelId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3576
		"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3577
		 a real (undithered) color
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3578
		"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3579
		mask notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3580
		    mask := nil.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3581
		    device setBitmapMask:nil in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3582
		]. 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3583
		(p ~~ foreground) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3584
		    foreground := paint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3585
		    device setForeground:pixelId in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3586
		].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3587
		^ self
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3588
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3589
	    "a dithered color"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3590
	    dither := paint ditherForm.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3591
	] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3592
	    "mhmh - seems to be some kind of form ..."
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3593
	    paint := paint on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3594
	    dither := paint
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3595
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3596
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3597
	 a dithered color or image
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3598
	"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3599
	(ditherDepth := dither depth) == 1 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3600
	    "a simple 0/1 bitmap"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3601
	    map := dither colorMap.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3602
	    "temporary (kludgy) fix for destroyed paint"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3603
	    p := paint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3604
	    map isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3605
		fg := Color black.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3606
		bg := Color white.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3607
	    ] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3608
		fg := map at:2.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3609
		bg := map at:1.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3610
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3611
	    self foreground:fg background:bg.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3612
	    paint := p
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3613
	] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3614
	    deviceDepth := device depth.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3615
	    (ditherDepth ~~ deviceDepth) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3616
		dither := dither asFormOn:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3617
		ditherDepth := dither depth.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3618
		(dither isNil or:[ditherDepth ~~ deviceDepth]) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3619
		    self error:'bad dither'.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3620
		    ^ self
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3621
		]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3622
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3623
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3624
	self mask:dither.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3625
	vOrg := self viewOrigin.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3626
	self setMaskOriginX:vOrg x negated y:vOrg y negated.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3627
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3628
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3629
    "Created: 16.5.1996 / 15:35:51 / cg"
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3630
    "Modified: 12.6.1996 / 12:49:07 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3631
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3632
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3633
!DeviceGraphicsContext methodsFor:'queries'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3634
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3635
horizontalIntegerPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3636
    "return the (rounded) number of pixels per millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3637
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3638
    ^ device horizontalPixelPerMillimeter rounded
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3639
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3640
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3641
horizontalPixelPerInch
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3642
    "return the number of horizontal pixels per inch of the display"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3643
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3644
    ^ device horizontalPixelPerMillimeter * 25.4
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3645
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3646
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3647
horizontalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3648
    "return the number of pixels per millimeter (not rounded)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3649
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3650
    ^ device horizontalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3651
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3652
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3653
horizontalPixelPerMillimeter:millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3654
    "return the number of pixels (not rounded) for millis millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3655
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3656
    ^ device horizontalPixelPerMillimeter * millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3657
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3658
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3659
resolution
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3660
    "return a point consisting of pixel-per-inch horizontally and vertically."
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3661
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3662
    ^ device resolution
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3663
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3664
    "Created: 4.6.1996 / 15:23:55 / cg"
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3665
!
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3666
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3667
verticalIntegerPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3668
    "return the (rounded) number of pixels per millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3669
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3670
    ^ device verticalPixelPerMillimeter rounded
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3671
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3672
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3673
verticalPixelPerInch
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3674
    "return the number of vertical pixels per inch of the display"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3675
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3676
    ^ device verticalPixelPerMillimeter * 25.4
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3677
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3678
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3679
verticalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3680
    "return the number of pixels per millimeter (not rounded)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3681
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3682
    ^ device verticalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3683
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3684
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3685
verticalPixelPerMillimeter:millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3686
    "return the number of pixels (not rounded) for millis millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3687
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3688
    ^ device verticalPixelPerMillimeter * millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3689
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3690
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  3691
!DeviceGraphicsContext class methodsFor:'documentation'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3692
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3693
version
1715
c70e31496f91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  3694
    ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.43 1997-05-06 14:34:47 cg Exp $'
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3695
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3696
DeviceGraphicsContext initialize!