DeviceGraphicsContext.st
author Claus Gittinger <cg@exept.de>
Mon, 26 Jan 1998 18:58:15 +0100
changeset 2016 bef5fe2ec2ca
parent 2013 d77c7dcbf840
child 2018 1ad552e97c67
permissions -rw-r--r--
checkin from browser
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
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   102
    "/ send out a warning: #on: is typically used to create a view
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   103
    "/ operating on a model.
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   104
    "/ Please use #onDevice: to avoid confusion.
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   105
1255
bdf4cbcae668 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   106
    self obsoleteMethodWarning:'use #onDevice:'.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
    ^ self onDevice:aDevice
1255
bdf4cbcae668 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   108
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   109
    "Modified: 5.6.1997 / 21:04:16 / cg"
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
onDevice:aDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    "create a new drawable on aDevice"
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
    |newDrawable|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    newDrawable := self basicNew.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
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
     set display before its initialized 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
     - 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
   122
     intitialize method(s)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    newDrawable device:aDevice.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    newDrawable initialize.
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   126
"/    Lobby register:newDrawable.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
    ^ newDrawable
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   128
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   129
    "Modified: 2.4.1997 / 19:19:35 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
   132
!DeviceGraphicsContext class methodsFor:'cleanup'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
lowSpaceCleanup
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    CachedScaledForms := CachedScales := nil
1224
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   136
!
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
releaseResourcesOnDevice:aDevice
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   139
    "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
   140
     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
   141
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   142
    Lobby unregisterAllForWhich:[:aDrawable | aDrawable graphicsDevice == aDevice]
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   143
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   144
    "Created: 16.1.1997 / 16:43:52 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
!DeviceGraphicsContext methodsFor:'accessing'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
at:aPoint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
    "return the pixel at the coordinate given by aPoint"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    ^ device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
	getPixelX:(aPoint x)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
		y:(aPoint y)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
	     from:drawableId
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
at:aPoint put:aPixel
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    "set a pixel"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    |oldFg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    self foreground:aPixel.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    self displayPointX:(aPoint x) y:(aPoint y).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    self foreground:oldFg
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
atX:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    "return the pixel at the coordinate given by x/y"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
    ^ device getPixelX:x y:y from:drawableId
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
atX:x y:y put:aPixel
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    "set a pixel"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
    |oldFg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    self foreground:aPixel.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    self displayPointX:x y:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    self foreground:oldFg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
!
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
backgroundPaint:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
    "set the background-paint color; this is used in opaque-draw
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
     operations"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
    (aColor ~~ bgPaint) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
	aColor notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
	    bgPaint := aColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
	    gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
		bgPaint isColor ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
		    bgPaint := aColor on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
		    bgPaint colorId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
			background := bgPaint.
2013
d77c7dcbf840 oops - dont pass a deviceId as gcId (in #backgroundPaint:)
Claus Gittinger <cg@exept.de>
parents: 1996
diff changeset
   198
			gcId notNil ifTrue:[
d77c7dcbf840 oops - dont pass a deviceId as gcId (in #backgroundPaint:)
Claus Gittinger <cg@exept.de>
parents: 1996
diff changeset
   199
			    device setBackground:(bgPaint colorId) in:gcId.
d77c7dcbf840 oops - dont pass a deviceId as gcId (in #backgroundPaint:)
Claus Gittinger <cg@exept.de>
parents: 1996
diff changeset
   200
			].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
			^ self
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
		self paint:paint on:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
	    ]
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
    ].
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
basicFont
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    "return set the font for drawing"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
    ^ font
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
    "Created: 12.5.1996 / 11:17:59 / cg"
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
basicFont:aFont
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
    "set the font for drawing if it has changed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
     This is a low level entry, which is not to be redefined
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
     (i.e. it must not imply a redraw operation)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
    |id|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
    (aFont ~~ font) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   226
	aFont notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   227
	    font := aFont.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   228
	    gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   229
		font := font on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   230
		id := font fontId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   231
		id notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   232
		    device setFont:id in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   233
		]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   234
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   235
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
    "Modified: 23.2.1996 / 17:01:06 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
    "Created: 23.2.1996 / 17:16:51 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
!
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
capStyle:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
    "set the style in which the endpoints of lines
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
     are drawn - aSymbol may be #notLast, #butt, #round, #projecting"
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|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
    (s := aSymbol) isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   249
	s := #butt.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    (s ~~ capStyle) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   253
	capStyle := s.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   254
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   255
	    device setLineWidth:lineWidth 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   256
			  style:lineStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   257
			    cap:s
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   258
			   join:joinStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   259
			     in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   260
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
    "Modified: 12.5.1996 / 22:23:03 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   266
clipByChildren
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   267
    "drawing shall be done into my view only (default)"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   268
1722
4ceaeda95cc3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   269
    self obsoleteMethodWarning:'use #clippedByChildren:true'.
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   270
    ^ self clippedByChildren:true
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   271
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   272
    "Created: 17.7.1996 / 13:25:55 / cg"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   273
!
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   274
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
clipRect
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
    "return the clipping rectangle for drawing. If there is currently no clipRect,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
     a dummy is created."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    |rect|
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 isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   282
	rect := 0@0 extent:(self extent).
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   283
	transformation notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   284
	    rect := transformation applyInverseTo:rect.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   285
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   286
	^ rect
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
    ^ clipRect
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
    "Modified: 10.4.1996 / 14:32:22 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   293
clippedByChildren:aBoolean
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   294
    "turn on/off drawing over children.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   295
     If on, a superview may draw 'over' its children.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   296
     If off (the default), drawing is 'under' its children.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   297
     Only useful for the rootView, to draw over any visible views.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   298
     (for example, when dragging a rubber-line)"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   299
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   300
    gcId isNil ifTrue:[
1680
f47862c358fb pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
   301
        self initGC
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   302
    ].
1715
c70e31496f91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   303
    device noClipIn:drawableId gc:gcId.
c70e31496f91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   304
    device setClipByChildren:aBoolean in:drawableId gc:gcId.
1722
4ceaeda95cc3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   305
"/    device noClipIn:drawableId gc:gcId.
4ceaeda95cc3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   306
1714
66143e4f3fcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   307
"/
66143e4f3fcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   308
"/    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
   309
"/
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   310
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   311
    "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
   312
    "Modified: 29.4.1997 / 15:33:55 / dq"
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   313
!
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   314
735
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
   315
clippingRectangle:aRectangleOrNil
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
    "set the clipping rectangle for drawing (in logical coordinates);
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
     a nil argument turn off clipping (i.e. whole view is drawable)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
    |x y w h|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
    aRectangleOrNil isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   322
	clipRect isNil ifTrue:[^ self].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   323
	gcId notNil ifTrue:[
1712
647c6019cec4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1680
diff changeset
   324
	    device noClipIn:drawableId gc:gcId
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   325
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   327
	clipRect notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   328
	    (clipRect = aRectangleOrNil) ifTrue:[^ self]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   329
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   330
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   331
	    x := aRectangleOrNil left.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   332
	    y := aRectangleOrNil top.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   333
	    w := aRectangleOrNil width.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   334
	    h := aRectangleOrNil height.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   335
	    transformation notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   336
		x := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   337
		y := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   338
		w := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   339
		h := transformation applyScaleY:h.
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
	    (x class == SmallInteger) ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   342
		w := w + (x - x truncated).
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   343
		x := x truncated
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   344
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   345
	    (y class == SmallInteger) ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   346
		h := h + (y - y truncated).
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   347
		y := y truncated
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   348
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   349
	    (w class == SmallInteger) ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   350
		w := w truncated + 1
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   351
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   352
	    (h class == SmallInteger) ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   353
		h := h truncated + 1
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   354
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   355
1712
647c6019cec4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1680
diff changeset
   356
	    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
   357
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
    clipRect := aRectangleOrNil
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
    "Modified: 22.5.1996 / 13:12:07 / cg"
735
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
   362
    "Created: 28.5.1996 / 19:40:20 / cg"
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
clippingRectangleOrNil
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
    "return the clipping rectangle for drawing, nil if there is none."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
    ^ clipRect
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
    "Created: 10.4.1996 / 14:32:02 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
1842
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   373
colorAt:aPoint
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   374
    "return the color of the pixel at the coordinate given by x@y"
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   375
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   376
    ^ self colorAtX:(aPoint x) y:(aPoint y)
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   377
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   378
    "Modified: 1.8.1997 / 20:01:58 / cg"
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   379
!
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   380
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   381
colorAtX:x y:y
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   382
    "return the color of the pixel at the coordinate given by aPoint"
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   383
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   384
    |pixel|
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   385
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   386
    pixel := self atX:x y:y.
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   387
    device getScaledRGBFrom:pixel into:[:r :g :b |
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   388
        ^ Color scaledRed:r scaledGreen:g scaledBlue:b
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   389
    ].
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   390
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   391
    "Created: 1.8.1997 / 20:01:32 / cg"
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   392
!
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   393
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   394
dashStyle:aDashList offset:dashOffset
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   395
    "define dashes. Each element of the dashList specifies the length
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   396
     of a corresponding dash. For example, setting it to [4 4]
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   397
     defines 4on-4off dashing; 
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   398
     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
   399
     The dashOffset specifies where in the dashList the dashing starts.
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   400
     This may not be supported by all graphics devices."
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   401
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   402
    gcId notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   403
	device setDashes:(ByteArray withAll:aDashList)
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   404
	      dashOffset:dashOffset
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   405
		      in:gcId
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   406
    ]
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   407
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   408
    "Modified: 4.6.1996 / 19:03:06 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   409
!
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   410
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
    "return the device, the receiver is associated with"
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
    ^ device
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
device:aDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
    "set 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
    device := aDevice
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
font:aFont
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
    "set the font for drawing if it has changed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
     This should be redefined in some widget to perform an automatic
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
     redraw. See also: #basicFont:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
    (aFont ~~ font) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   429
	self basicFont:aFont
732
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
    "Modified: 6.3.1996 / 18:17:40 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
!
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
function:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
    "set the drawing function if it has changed"
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
    (aSymbol ~~ function) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
	function := aSymbol.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
	    device setFunction:aSymbol in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
	]
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
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
    "return the receivers graphic context id on the device"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
    ^ gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
graphicsDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
    "return the device, the receiver is associated with.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
     Same as #device, for ST-80 compatibility."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
    ^ device
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
    "Created: 9.5.1996 / 01:37:58 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
!
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
id
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
    "return the id of the dravable on the device"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
    ^ drawableId
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
joinStyle:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
    "set the style in which 2 lines are connected in polygons -
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
     aSymbol may be #miter, #bevel, #round"
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|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
    (s := aSymbol) isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   474
	s := #miter
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
    (s ~~ joinStyle) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   477
	joinStyle := s.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
        
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   479
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   480
	    device setLineWidth:lineWidth 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   481
			  style:lineStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   482
			    cap:capStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   483
			   join:s
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   484
			     in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   485
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
    ]
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
    "Modified: 12.5.1996 / 22:20:43 / cg"
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
lineStyle:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
    "set the style in which lines are drawn -
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
     aSymbol may be #solid, #dashed, #doubleDashed"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
    |s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
    (s := aSymbol) isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   498
	s := #solid
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
    (s ~~ lineStyle) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   501
	lineStyle := s.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   502
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   503
	    device setLineWidth:lineWidth 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   504
			  style:s
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   505
			    cap:capStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   506
			   join:joinStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   507
			     in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   508
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
    ]
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
    "Modified: 12.5.1996 / 22:21:25 / cg"
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
lineWidth:aNumber
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
    "set the line width for drawing if it has changed"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
    |n|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
    (aNumber ~~ lineWidth) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
	lineWidth := aNumber.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
	transformation isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
	    n := aNumber.
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
	    n := transformation applyScaleX:aNumber.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
	    n := n rounded
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
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
	    device setLineWidth:n 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
			  style:lineStyle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
			    cap:capStyle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
			   join:joinStyle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
			     in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
	]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
mask:aForm
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
    "set the mask form for drawing"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
    |id|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
    (aForm ~~ mask) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
	mask := aForm.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
	    (mask == nil) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
		device setBitmapMask:nil in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
	    ] ifFalse:[
1033
b5cd84ed805f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   548
		mask := mask asFormOn:device.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
		id := mask id.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
		(mask depth == 1) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
		    device setBitmapMask:id in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
		] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
		    device setPixmapMask:id in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
		]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
	    ]
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
    ]
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
2016
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   560
maskOriginX:orgX y:orgY
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   561
    "set the origin of the pattern"
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   562
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   563
    |x y|
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   564
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   565
    transformation notNil ifTrue:[
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   566
        x := transformation applyToX:orgX.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   567
        y := transformation applyToY:orgY.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   568
    ] ifFalse:[
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   569
        x := orgX.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   570
        y := orgY
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   571
    ].
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   572
    x := x rounded.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   573
    y := y rounded.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   574
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   575
    (maskOrigin isNil or:[
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   576
     ((x ~~ maskOrigin x) or:[y ~~ maskOrigin y]) ]) ifTrue:[
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   577
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   578
        maskOrigin := x @ y.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   579
        gcId notNil ifTrue:[
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   580
            device setMaskOriginX:x y:y in:gcId
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   581
        ]
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   582
    ]
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   583
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   584
    "Created: / 26.1.1998 / 18:51:18 / cg"
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   585
!
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   586
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   587
noClipByChildren
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   588
    "drawing shall also be done into subviews"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   589
1722
4ceaeda95cc3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   590
    self obsoleteMethodWarning:'use #clippedByChildren:false'.
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   591
    ^ self clippedByChildren:false
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   592
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   593
    "Created: 17.7.1996 / 14:15:54 / cg"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   594
!
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   595
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   596
paint:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   597
    "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
   598
     or even an image."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
    (aColor ~~ paint) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   601
	aColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   602
	    paint := aColor.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   603
	    self setGCForPaint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   604
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   605
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
    "Modified: 16.5.1996 / 15:35:57 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   608
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
paint:fgColor on:bgColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
    "set the paint and background-paint color. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
     The bg-paint is used in opaque-draw operations"
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
    |fgId bgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
    ((fgColor ~~ paint) or:[bgColor ~~ bgPaint]) ifTrue:[
1742
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   617
        fgColor notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   618
            paint := fgColor
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   619
        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   620
        bgColor notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   621
            bgPaint := bgColor
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   622
        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   623
        gcId notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   624
            paint := paint on:device.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   625
            paint isColor ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   626
                fgId := paint colorId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   627
                fgId notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   628
                    mask notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   629
                        mask := nil.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   630
                        device setBitmapMask:nil in:gcId
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   631
                    ]. 
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   632
                    bgPaint := bgPaint onDevice:device.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   633
                    bgPaint isColor ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   634
                        bgId := bgPaint colorId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   635
                        bgId notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   636
                            "the common case, both are real colors"
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   637
                            (paint ~~ foreground) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   638
                                foreground := paint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   639
                                (bgPaint ~~ background) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   640
                                    background := bgPaint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   641
                                    device setForeground:fgId background:bgId in:gcId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   642
                                    ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   643
                                ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   644
                                device setForeground:fgId in:gcId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   645
                                ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   646
                            ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   647
                            (bgPaint ~~ background) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   648
                                background := bgPaint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   649
                                device setBackground:bgId in:gcId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   650
                            ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   651
                            ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   652
                        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   653
                        "bgPaint is dithered, setup paint here, leave bgPaint
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   654
                         till next opaque draw comes around."
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   655
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   656
                        (paint ~~ foreground) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   657
                            foreground := paint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   658
                            device setForeground:fgId in:gcId
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   659
                        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   660
                        ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   661
                    ]
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   662
                ]
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   663
            ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   664
            "either paint or bgPaint (or both) are dithered colors,
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   665
             setup for paint, leave bg-problem till next opaque draw
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   666
             comes around.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   667
            "
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   668
            self setGCForPaint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   669
        ]
732
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
1742
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   672
    "Modified: 6.6.1997 / 12:56:55 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
!
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
paint:fgColor on:bgColor function:f
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
    "set paint, background-paint and function"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
    self paint:fgColor on:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
    self function:f
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
    "Modified: 16.5.1996 / 15:36:35 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
!
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
setGraphicsExposures:aBoolean
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
    "want to if aBoolean is true - or dont want to be notified
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
     of graphics exposures"
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
    gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
	device setGraphicsExposures:aBoolean in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   692
1092
1b6391f333de category rename
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
   693
!DeviceGraphicsContext methodsFor:'accessing-internals'!
732
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
background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   696
    "return the current background drawing color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   697
     OBSOLETE: use #paint: / #backgroundPaint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   698
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   699
    ^ background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   700
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   701
    "Modified: 12.5.1996 / 22:28:09 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
background:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   705
    "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
   706
     OBSOLETE: this method will vanish; use #paint: / #backgroundPaint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   708
    |bgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   709
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   710
    (aColor ~~ background) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   711
	aColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   712
	    background := aColor.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   713
	    gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   714
		background := background on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   715
		bgId := background colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   716
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   717
		"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   718
		 mhmh the following is a kludge ....
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   719
		"
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   720
		bgId isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   721
		    (background grayIntensity >= 50) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   722
			bgId := device whitepixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   723
		    ] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   724
			bgId := device blackpixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   725
		    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   726
		].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   727
		device setBackground:bgId in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   728
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   729
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   730
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   732
    "Modified: 28.5.1996 / 20:44:55 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
!
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
foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
    "return the current foreground drawing color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   737
     OBSOLETE: use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   738
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   739
    ^ foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   740
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   741
    "Modified: 12.5.1996 / 22:28:03 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   742
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   743
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   744
foreground:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   745
    "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
   746
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   748
    |fgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   749
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   750
    (aColor ~~ foreground) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   751
	aColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   752
	    foreground := aColor.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   753
	    gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   754
		(foreground class == SmallInteger) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   755
		    fgId := foreground
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   756
		] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   757
		    foreground := foreground on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   758
		    fgId := foreground colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   759
		].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   760
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   761
		"mhmh the following is a kludge ...."
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   762
		fgId isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   763
		    (foreground grayIntensity >= 50) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   764
			fgId := device whitepixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   765
		    ] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   766
			fgId := device blackpixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   767
		    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   768
		].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   769
		device setForeground:fgId in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   770
		paint := foreground
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   771
	    ]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   772
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   773
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   775
    "Modified: 28.5.1996 / 20:45:02 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
foreground:fgColor background:bgColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   779
    "set both internal foreground and internal background colors 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   780
     - these must be real colors.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   783
    |fgPixel bgPixel|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   785
    ((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
   786
	fgColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   787
	    foreground := fgColor
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   788
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   789
	bgColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   790
	    background := bgColor
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   791
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   792
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   793
	    foreground := foreground on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   794
	    background := background on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   795
	    fgPixel := foreground colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   796
	    bgPixel := background colorId.
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
	    "mhmh the following is a kludge ...."
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   799
	    fgPixel isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   800
		(foreground grayIntensity >= 50) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   801
		    fgPixel := device whitepixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   802
		] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   803
		    fgPixel := device blackpixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   804
		]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   805
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   806
	    bgPixel isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   807
		(background grayIntensity >= 50) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   808
		    bgPixel := device whitepixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   809
		] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   810
		    bgPixel := device blackpixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   811
		]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   812
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   813
	    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
   814
	    paint := foreground
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   815
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   818
    "Modified: 28.5.1996 / 20:45:27 / cg"
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
foreground:fgColor background:bgColor function:fun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
    "set foreground, background colors and function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
    self foreground:fgColor background:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
    self function:fun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
    "Modified: 12.5.1996 / 22:28:34 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   830
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   831
foreground:aColor function:fun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
    "set the foreground color and function for drawing.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
    |fgPixel|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
    ((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
   838
	foreground := aColor.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   839
	function := fun.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   840
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   841
	    foreground := foreground on:device.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   842
	    fgPixel := foreground colorId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   843
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   844
	    "mhmh the following is a kludge ...."
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   845
	    fgPixel isNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   846
		(foreground grayIntensity >= 50) ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   847
		    fgPixel := device whitepixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   848
		] ifFalse:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   849
		    fgPixel := device blackpixel
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   850
		]
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   851
	    ].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   852
	    device setForeground:fgPixel in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   853
	    device setFunction:fun in:gcId.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   854
	    paint := foreground
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   855
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   858
    "Modified: 28.5.1996 / 20:45:09 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   861
!DeviceGraphicsContext methodsFor:'bit blitting'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
2016
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   863
copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth padding:pad width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   864
    "copy bits from a smalltalk byteArray.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   865
     The bits found there are supposed to be in the devices native format (i.e.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   866
     translated to allocated color indices on pseudoColor devices and padded as required.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   867
     The byteOrder is MSB and will be converted as appropriate by the underlying devices 
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   868
     method to whatever the device needs."
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   869
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   870
    device
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   871
        drawBits:aByteArray
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   872
	bitsPerPixel:bpp 
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   873
	depth:depth  
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   874
	padding:pad
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   875
        width:srcW height:srcH
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   876
        x:srcX y:srcY
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   877
        into:drawableId
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   878
        x:dstX y:dstY 
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   879
        width:(self width) height:(self height)
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   880
        with:gcId.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   881
!
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   882
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
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
   884
    "copy bits from a smalltalk byteArray.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
     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
   886
     translated to allocated color indices on pseudoColor devices and padded as required.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   887
     The byteOrder is MSB and will be converted as appropriate by the underlying devices 
1996
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   888
     method to whatever the device needs.
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   889
     Assumes the source bits are in ST/X's natural padding (i.e. 8-bit padded)"
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   890
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   891
    device
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   892
	drawBits:aByteArray
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   893
	bitsPerPixel:bpp 
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   894
	depth:depth  
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   895
	padding:8
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   896
	width:srcW height:srcH
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   897
	x:srcX y:srcY
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   898
	into:drawableId
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   899
	x:dstX y:dstY 
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   900
	width:(self width) height:(self height)
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   901
	with:gcId.
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   902
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   903
    "Created: 21.10.1995 / 00:04:22 / cg"
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   904
!
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
   905
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
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
   907
    "copy from aDrawable into the receiver;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
     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
   909
     All coordinates are in device coordinates."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   910
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   911
    ^ self
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   912
        copyFrom:aDrawable 
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   913
        x:srcX y:srcY 
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   914
        toX:dstX y:dstY 
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   915
        width:w height:h
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   916
        async:false
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   917
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   918
    "Modified: 29.1.1997 / 13:12:36 / cg"
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   919
!
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   920
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   921
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
   922
    "copy from aDrawable into the receiver;
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   923
     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
   924
     All coordinates are in device coordinates.
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   925
     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
   926
     - otherwise, it returns when the scroll operation is finished.
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   927
     (not all devices care for this).
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   928
     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
   929
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   930
    |deviceDrawable id srcGCId asy|
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   931
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   932
    aDrawable graphicsDevice ~~ device ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   933
        deviceDrawable := aDrawable asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   934
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   935
        deviceDrawable := aDrawable
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   936
    ].
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   937
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   938
    id := deviceDrawable id.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   939
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   940
    "temporary ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   941
     this fixes a problem after restart on another display,
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   942
     when a file-bitmap was not found. 
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   943
     In this case, the id of the bitmap will be nil. 
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   944
     This will be fixed soon (no longer use device>>bitmapFromFile:).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   945
    "
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   946
    id isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   947
        'DeviceGraphicsContext [warning]: invalid bitmap copy - ignored' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   948
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   950
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   951
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   952
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   953
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   954
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   955
    srcGCId := deviceDrawable gcId.
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   956
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
   957
    ((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
   958
        deviceDrawable isForm ifTrue:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   959
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   960
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   961
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   962
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   963
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   964
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   965
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   966
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   967
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   968
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   969
                height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   970
        ] ifFalse:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   971
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   972
                copyPlaneFromId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   973
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   974
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   975
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   976
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   977
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   978
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   979
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   980
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   981
                height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   982
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   983
    ] ifFalse:[
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   984
        deviceDrawable isForm ifTrue:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   985
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   986
                copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   987
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   988
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   989
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   990
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   991
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   992
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   993
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   994
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   995
                height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   996
        ] ifFalse:[
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   997
            asy := async or:[self isView not].
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   998
            asy ifFalse:[
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   999
                self catchExpose
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1000
            ].
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1001
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1002
                copyFromId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1003
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1004
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1005
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1006
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1007
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1008
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1009
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1010
                width:w 
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1011
                height:h.
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1012
            asy ifFalse:[
1294
a5abff742fd8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
  1013
                device flush.
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1014
                self waitForExpose
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1015
            ]
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1016
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1017
    ]
868
65c93e5f6f8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
  1018
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1019
    "Created: 29.1.1997 / 13:02:10 / cg"
1294
a5abff742fd8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
  1020
    "Modified: 29.1.1997 / 13:34:33 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1021
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1022
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1023
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
  1024
    "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
  1025
     background, while 1's are drawn with foreground color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1026
     The depth of aDrawable must (should) be 1.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1027
     The drawable must have been allocated on the same device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1028
     All coordinates are in device coordinates."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1029
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  1030
    |deviceDrawable id|
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1031
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1032
    aDrawable graphicsDevice ~~ device ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1033
        deviceDrawable := aDrawable asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1034
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1035
        deviceDrawable := aDrawable
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1036
    ].
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1037
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1038
    id := deviceDrawable id.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1039
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1040
    "temporary ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1041
     this fixes a problem after restart on another display,
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1042
     when a file-bitmap was not found. 
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1043
     In this case, the id of the bitmap will be nil.
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1044
     This will be fixed soon (no longer use device>>bitmapFromFile:).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1045
    "
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1046
    id isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1047
        'DeviceGraphicsContext [warning]: invalid copyPlane - ignored' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1048
        ^ self
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1051
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1052
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1053
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1054
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1055
    deviceDrawable isForm ifTrue:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1056
        device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1057
            copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1058
            x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1059
            y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1060
            gc:(deviceDrawable gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1061
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1062
            x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1063
            y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1064
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1065
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1066
            height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1067
    ] ifFalse:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1068
        device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1069
            copyPlaneFromId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1070
            x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1071
            y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1072
            gc:(deviceDrawable gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1073
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1074
            x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1075
            y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1076
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1077
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1078
            height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1079
    ]
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1080
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1081
    "Modified: 18.1.1997 / 17:17:53 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1082
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1083
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1084
!DeviceGraphicsContext methodsFor:'copying'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1085
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1086
postCopy
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1087
    "this may not be enough to allow copying of views ..."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1088
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1089
    super postCopy.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1090
    device := drawableId := gcId := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1091
    self recreate
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1092
!
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1093
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1094
shallowCopyForFinalization
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1095
    "I am abstract"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1096
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1097
    self shouldNotImplement.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1098
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1099
    "Created: 2.4.1997 / 19:22:11 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1100
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1101
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1102
!DeviceGraphicsContext methodsFor:'drawing'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1103
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1104
displayArcX:x y:y width:w height:h from:startAngle angle:angle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1105
    "draw an arc; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1106
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  1107
    |pX pY nW nH|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1108
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1109
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1110
	self initGC
732
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
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1113
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1114
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1115
	nW := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1116
	nH := transformation applyScaleY:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1117
	nW < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1118
	      nW := nW abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1119
	      pX := pX - nW.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1120
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1121
	nH < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1122
	      nH := nH abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1123
	      pY := pY - nH.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1124
	].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1125
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1126
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1127
	pY := y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1128
	nW := w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1129
	nH := h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1130
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1131
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1132
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1133
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1134
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1135
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1136
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1137
    device
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1138
	  displayArcX:pX 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1139
		    y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1140
		width:nW 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1141
	       height:nH 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1142
		 from:startAngle 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1143
		angle:angle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1144
		   in:drawableId 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1145
		 with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1146
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1147
    "Created: 8.5.1996 / 08:31:30 / cg"
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  1148
    "Modified: 4.6.1996 / 17:59:28 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1149
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1150
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1151
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
  1152
    "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
  1153
     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
  1154
     current paint-color, leaving pixels with 0-bits unchanged
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1155
     (i.e. only 1-bits are drawn from the form).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1156
     If its a deep form (i.e. a pixmap) the current paint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1157
     settings are ignored and the form is drawn as-is. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1158
     Care must be taken, that the paint color is correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1159
     (by sending #on: to the color) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1160
     Using functions other than #copy only makes sense if you are
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1161
     certain, that the colors are real colors (actually, only for
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1162
     noColor or allColor)."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1163
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1164
    |realForm pX pY w h nW nH|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1165
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1166
    realForm := formToDraw.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1167
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1168
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1169
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1170
        pY := transformation applyToY:y.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1171
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1172
        transformation noScale ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1173
            w := formToDraw width.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1174
            h := formToDraw height.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1175
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1176
            nW := (transformation applyScaleX:w) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1177
            nH := (transformation applyScaleY:h) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1178
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1179
            ((nW ~= w) or:[nH ~= h]) ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1180
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1181
                "/ 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
  1182
                "/ 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
  1183
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1184
                realForm := nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1185
                CachedScaledForms notNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1186
                    (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
  1187
                        realForm := CachedScaledForms at:formToDraw ifAbsent:nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1188
                    ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1189
                ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1190
                realForm isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1191
                    "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1192
                    "/ nope - must do the work ...
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1193
                    "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1194
                    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
  1195
                    CachedScaledForms isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1196
                        CachedScaledForms := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1197
                        CachedScales := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1198
                    ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1199
                    CachedScaledForms at:formToDraw put:realForm.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1200
                    CachedScales at:formToDraw put:transformation scale.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1201
                ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1202
            ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1203
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1204
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1205
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1206
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1207
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1208
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1209
    self displayDeviceForm:realForm x:pX y:pY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1210
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1211
    "Modified: 12.4.1997 / 12:47:29 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1212
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1213
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1214
displayLineFromX:x0 y:y0 toX:x1 y:y1
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1215
    "draw a line (with current paint-color); apply transformation if nonNil"
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
    |pX0 pY0 pX1 pY1 easy fgId bgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1218
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1219
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1220
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1221
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1222
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1223
    lineStyle == #doubleDashed ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1224
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1225
         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
  1226
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1227
        easy := true.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1228
        paint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1229
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1230
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1231
            fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1232
            fgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1233
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1234
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1235
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1236
        bgPaint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1237
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1238
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1239
            bgId := bgPaint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1240
            bgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1241
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1242
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1243
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1244
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1245
        easy ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1246
            ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1247
                device setForeground:fgId background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1248
                foreground := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1249
                background := bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1250
            ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1251
        ] ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1252
            'DeviceGraphicsContext [warning]: cannot draw dashes with dithered colors' errorPrintCR
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1253
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1254
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1255
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1256
    transformation notNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1257
        pX0 := transformation applyToX:x0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1258
        pY0 := transformation applyToY:y0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1259
        pX1 := transformation applyToX:x1.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1260
        pY1 := transformation applyToY:y1.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1262
        pX0 := x0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1263
        pY0 := y0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1264
        pX1 := x1.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1265
        pY1 := y1
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1266
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1267
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1268
    pX0 := pX0 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1269
    pY0 := pY0 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1270
    pX1 := pX1 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1271
    pY1 := pY1 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1272
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1273
    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
  1274
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1275
    "Modified: 10.1.1997 / 17:46:32 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1276
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1277
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1278
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
  1279
    "draw a form or image opaque; 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1280
     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
  1281
     current paint-color and 0-bits in the bgPaint color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1282
     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
  1283
     settings are ignored and the form drawn as-is. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1284
     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
  1285
     dithered colors or patterns, since are that the colors are correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1286
     (by sending #on: to the colors) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1287
     If there is a transformation, the image is scaled as appropiate."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1288
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1289
    |w h realForm pX pY nW nH|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1290
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1291
    bgPaint isNil ifTrue:[
1592
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
        "/ actually not an opaque draw
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1294
        "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1295
        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
  1296
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1297
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1298
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1299
    realForm := formToDraw.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1300
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1301
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1302
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1303
        pY := transformation applyToY:y.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1304
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1305
        transformation noScale ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1306
            w := formToDraw width.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1307
            h := formToDraw height.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1308
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1309
            nW := (transformation applyScaleX:w) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1310
            nH := (transformation applyScaleY:h) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1311
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1312
            ((nW ~= w) or:[nH ~= h]) ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1313
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1314
                "/ 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
  1315
                "/ 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
  1316
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1317
                realForm := nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1318
                CachedScaledForms notNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1319
                    (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
  1320
                        realForm := CachedScaledForms at:formToDraw ifAbsent:nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1321
                    ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1322
                ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1323
                realForm isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1324
                    "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1325
                    "/ nope - must do the work ...
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1326
                    "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1327
                    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
  1328
                    CachedScaledForms isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1329
                        CachedScaledForms := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1330
                        CachedScales := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1331
                    ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1332
                    CachedScaledForms at:formToDraw put:realForm.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1333
                    CachedScales at:formToDraw put:transformation scale.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1334
                ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1335
            ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1336
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1337
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1338
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1339
        pY := y.
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
    self displayDeviceOpaqueForm:realForm x:pX y:pY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1343
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1344
    "Modified: 12.4.1997 / 12:49:02 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1345
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1346
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1347
displayOpaqueString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1348
    "draw a substring at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1349
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1350
     If the transformation involves scaling, 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1351
     the fonts point-size is scaled as appropriate.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1352
     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
  1353
     the case where paint and/or bgPaint are dithered colors"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1354
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1355
    |easy w h savedPaint fgId bgId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1356
     id pX pY fontUsed sz s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1357
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
     if backgroundPaint color is nil, we assume
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1360
     this is a non-opaque draw
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
    bgPaint isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1363
        self displayString:aString from:index1 to:index2 x:x y:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1364
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1365
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1366
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1367
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1368
    or:[aString isText]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1369
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1370
         hook for non-strings (i.e. attributed text)
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1371
         that 'thing' should know how to display itself ...
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1372
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1373
        aString displayOpaqueOn:self x:x y:y from:index1 to:index2.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1374
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1375
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1376
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1377
    gcId isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1378
        self initGC
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1381
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1382
    transformation notNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1383
        pX := transformation applyToX:x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1384
        pY := transformation applyToY:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1385
        transformation noScale ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1386
            sz := font size.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1387
            sz isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1388
                "/ oops - not a real font; use original font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1389
                fontUsed := font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1390
            ] ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1391
                fontUsed := font size:(transformation applyScaleY:sz) rounded.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1392
            ]
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1393
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1394
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1395
        pX := x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1396
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1397
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1398
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1399
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1400
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1401
    fontUsed := fontUsed on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1402
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1403
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1404
    id isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1405
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1406
         hook for alien fonts
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1407
         that 'font' should know how to display the string ...
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1408
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1409
        fontUsed displayOpaqueString:aString from:index1 to:index2 x:x y:y in:self.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1410
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1411
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1412
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1413
    s := aString.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1414
    s encoding ~~ font encoding ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1415
        s := s encodeForDisplayInto:(font encoding).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1416
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1417
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
     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
  1420
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1421
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1422
    paint isColor ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1423
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1424
    ] ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1425
        fgId := paint colorId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1426
        fgId isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1427
            easy := false
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1428
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1429
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1430
    bgPaint isColor ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1431
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1432
    ] ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1433
        bgId := bgPaint colorId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1434
        bgId isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1435
            easy := false
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1436
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1437
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1438
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1439
    easy ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1440
        deviceFont ~~ fontUsed ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1441
            device setFont:id in:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1442
            deviceFont := fontUsed
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1443
        ].
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1444
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1445
        device setForeground:fgId background:bgId in:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1446
        foreground := paint.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1447
        background := bgPaint.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1448
        device displayOpaqueString:s 
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1449
                              from:index1 to:index2
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1450
                                 x:pX y:pY 
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1451
                                in:drawableId with:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1452
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1453
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1454
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1455
    w := fontUsed widthOf:s from:index1 to:index2.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1456
    h := fontUsed height.
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
    (fgId notNil and:[function == #copy]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1459
        deviceFont ~~ fontUsed ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1460
            device setFont:id in:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1461
            deviceFont := fontUsed
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1462
        ].
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1463
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1464
         only bg is dithered; fill with bg first ...
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1465
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1466
        savedPaint := paint.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1467
        self paint:bgPaint.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1468
        self fillDeviceRectangleX:pX y:(pY - fontUsed ascent) width:w height:h.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1469
        self paint:savedPaint.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1470
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1471
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1472
         then draw using fgPaint (which is a real color)
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1473
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1474
        device displayString:s 
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1475
                        from:index1 to:index2
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1476
                           x:pX y:pY 
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1477
                          in:drawableId with:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1478
        ^ self
732
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
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1481
    "/ the very hard case (fg-dither)
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1482
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1483
    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
  1484
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1485
    "Modified: 30.6.1997 / 15:06:15 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1486
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1487
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1488
displayOpaqueString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1489
    "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
  1490
     background pixels in bgPaint color. If the transformation involves scaling, 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1491
     the fonts point-size is scaled as appropriate.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1492
     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
  1493
     the case where paint and/or bgPaint are dithered colors or images."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1494
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1495
    |id easy fgId bgId pX pY fontUsed sz s|
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
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1498
     if backgroundPaint color is nil, we assume
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1499
     this is a non-opaque draw
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1500
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1501
    bgPaint isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1502
        self displayString:aString x:x y:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1503
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1504
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1505
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1506
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1507
    or:[aString isText]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1508
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1509
         hook for non-strings (i.e. attributed text)
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1510
         that 'thing' should know how to display itself ...
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1511
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1512
        aString displayOpaqueOn:self x:x y:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1513
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1514
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1515
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1516
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1517
     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
  1518
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1519
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1520
    paint isColor ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1521
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1522
    ] ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1523
        fgId := paint colorId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1524
        fgId isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1525
            easy := false
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1526
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1527
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1528
    bgPaint isColor ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1529
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1530
    ] ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1531
        bgId := bgPaint colorId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1532
        bgId isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1533
            easy := false
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1534
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1535
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1536
    easy ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1537
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1538
         for the hard case, use the general drawing method
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1539
         (no need for optimizations - its slow anyway)
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1540
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1541
        self displayOpaqueString:aString 
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1542
                            from:1 to:(aString size)
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1543
                               x:x y:y. 
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1544
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1545
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1546
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1547
    gcId isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1548
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1549
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1550
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1551
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1552
    transformation notNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1553
        pX := transformation applyToX:x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1554
        pY := transformation applyToY:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1555
        transformation noScale ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1556
            sz := font size.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1557
            sz isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1558
                "/ oops - not a real font; use original font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1559
                fontUsed := font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1560
            ] ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1561
                fontUsed := font size:(transformation applyScaleY:sz) rounded.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1562
            ]
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1563
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1564
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1565
        pX := x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1566
        pY := y.
732
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 := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1569
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1570
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1571
    fontUsed := fontUsed on:device.
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
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1574
    id isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1575
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1576
         hook for alien fonts
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1577
         that 'font' should know how to display the string ...
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1578
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1579
        fontUsed displayOpaqueString:aString from:1 to:(aString size) x:x y:y in:self.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1580
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1581
    ].
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
    s := aString.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1584
    s encoding ~~ font encoding ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1585
        s := s encodeForDisplayInto:(font encoding).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1586
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1587
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1588
    deviceFont ~~ fontUsed ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1589
        device setFont:id in:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1590
        deviceFont := fontUsed
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1593
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1594
    device setForeground:fgId background:bgId in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1595
    foreground := paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1596
    background := bgPaint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1597
    device displayOpaqueString:s 
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1598
                             x:pX y:pY 
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1599
                            in:drawableId with:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1600
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1601
    "Modified: 30.6.1997 / 15:06:17 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1602
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1603
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1604
displayPointX:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1605
    "draw a point (with current paint-color); apply transformation if nonNil"
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
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1608
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1609
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1610
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1611
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1612
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1613
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1614
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1615
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1616
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1617
	pY := y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1618
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1619
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1620
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1621
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1622
    device displayPointX:pX y:pY in:drawableId with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1623
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1624
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1625
displayPolygon:aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1626
    "draw (the outline of) a polygon (with current paint-color).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1627
     Apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1628
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1629
    |newPolygon|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1630
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1631
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1632
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1633
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1634
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1635
	newPolygon := aPolygon collect:[:point | transformation applyTo:point].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1636
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1637
	newPolygon := aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1638
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1639
    (newPolygon findFirst:[:p | 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1640
	(p isPoint not 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1641
	or:[(p x class ~~ SmallInteger)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1642
	or:[(p y class ~~ SmallInteger)]])
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1643
     ]) ~~ 0 ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1644
	newPolygon := newPolygon collect:[:p | p asPoint rounded]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1645
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1646
        
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1647
    device displayPolygon:newPolygon in:drawableId with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1648
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1649
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1650
displayRectangleX:x y:y width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1651
    "draw a rectangle (with current paint-color).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1652
     If transformation is nonNil, drawing is in logical coordinates."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1653
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  1654
    |pX pY nW nH easy fgId bgId|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1655
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1656
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1657
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1658
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1659
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1660
    lineStyle == #doubleDashed ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1661
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1662
         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
  1663
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1664
        easy := true.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1665
        paint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1666
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1667
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1668
            fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1669
            fgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1670
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1671
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1672
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1673
        bgPaint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1674
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1675
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1676
            bgId := bgPaint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1677
            bgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1678
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1679
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1680
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1681
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1682
        easy ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1683
            ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1684
                device setForeground:fgId background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1685
                foreground := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1686
                background := bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1687
            ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1688
        ] ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1689
            'DeviceGraphicsContext [warning]: cannot draw dashes with dithered colors' errorPrintCR
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1690
        ].
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
    transformation notNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1694
        pX := transformation applyToX:x.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1695
        pY := transformation applyToY:y.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1696
        nW := transformation applyScaleX:w.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1697
        nH := transformation applyScaleY:h.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1698
        nW < 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1699
              nW := nW abs.  
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1700
              pX := pX - nW.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1701
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1702
        nH < 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1703
              nH := nH abs.  
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1704
              pY := pY - nH.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1705
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1706
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1707
        pX := x.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1708
        pY := y.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1709
        nW := w.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1710
        nH := h
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1711
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1712
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1713
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1714
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1715
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1716
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1717
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1718
    "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
  1719
     this one seems mathematically incorrect but allows to draw and fill
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1720
     a rectangle using the same extents.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1721
     I'm not certain if is the right thing to do ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1722
    "
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  1723
    device displayRectangleX:pX 
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1724
                           y:pY 
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1725
                       width:(nW - 1) 
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1726
                      height:(nH - 1)
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1727
                          in:drawableId with:gcId
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1728
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1729
    "Modified: 10.1.1997 / 17:46:41 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1730
!
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
displayString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1733
    "draw a substring at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1734
     draw foreground-pixels only (in current paint-color), 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1735
     leaving background as-is. If the transformation involves scaling,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1736
     the fonts point-size is scaled as appropriate."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1737
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1738
    |id pX pY fontUsed sz s fEnc|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1739
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1740
    "hook for non-strings (i.e. attributed text)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1741
    aString isString ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1742
        ^ aString displayOn:self x:x y:y from:index1 to:index2
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1745
    gcId isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1746
        self initGC
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1749
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1750
    transformation notNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1751
        pX := transformation applyToX:x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1752
        pY := transformation applyToY:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1753
        transformation noScale ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1754
            sz := font size.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1755
            sz isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1756
                "/ oops - not a real font; use original font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1757
                fontUsed := font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1758
            ] ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1759
                fontUsed := font size:(transformation applyScaleY:sz) rounded.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1760
            ]
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1761
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1762
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1763
        pX := x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1764
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1765
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1766
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1767
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1768
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1769
    fontUsed := fontUsed on:device.
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
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1772
    id isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1773
        "hook for alien fonts"
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1774
        font displayString:aString from:index1 to:index2 x:x y:y in:self.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1775
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1776
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1777
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1778
    s := aString.
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1779
    s encoding ~~ (fEnc := font encoding) ifTrue:[
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1780
        s := s encodeForDisplayInto:fEnc.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1781
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1782
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1783
    deviceFont ~~ fontUsed ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1784
        device setFont:id in:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1785
        deviceFont := fontUsed
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1786
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1787
    device displayString:s from:index1 to:index2
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1788
                       x:pX y:pY in:drawableId with:gcId
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1789
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1790
    "Modified: 1.7.1997 / 17:08:44 / cg"
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1793
displayString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1794
    "draw a string at the coordinate x/y - 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1795
     draw foreground-pixels only (in current paint-color), 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1796
     leaving background as-is. If the transformation involves scaling, 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1797
     the fonts point-size is scaled as appropriate."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1798
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1799
    |id pX pY fontUsed sz s fEnc|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1800
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1801
    "hook for non-strings (i.e. attributed text)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1802
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1803
    or:[aString isText]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1804
        ^ aString displayOn:self x:x y:y
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1805
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1806
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1807
    gcId isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1808
        self initGC
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
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1812
    transformation notNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1813
        pX := transformation applyToX:x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1814
        pY := transformation applyToY:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1815
        transformation noScale ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1816
            sz := font size.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1817
            sz isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1818
                "/ oops - not a real font; use original font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1819
                fontUsed := font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1820
            ] ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1821
                fontUsed := font size:(transformation applyScaleY:sz) rounded.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1822
            ]
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1823
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1824
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1825
        pX := x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1826
        pY := y.
732
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 := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1829
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1830
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1831
    fontUsed := fontUsed on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1832
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1833
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1834
    id isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1835
        "hook for alien fonts"
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1836
        fontUsed displayString:aString x:x y:y in:self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1837
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1838
        s := aString.
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1839
        s encoding ~~ (fEnc := fontUsed encoding) ifTrue:[
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1840
            s := s encodeForDisplayInto:fEnc.
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1841
        ].
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1842
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1843
        deviceFont ~~ fontUsed ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1844
            device setFont:id in:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1845
            deviceFont := fontUsed
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1846
        ].
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1847
        device displayString:s x:pX y:pY in:drawableId with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1848
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1849
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1850
    "Modified: 1.7.1997 / 17:08:35 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1851
!
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
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
  1854
    "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
  1855
     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
  1856
     current paint-color, leaving pixels with 0-bits unchanged
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1857
     (i.e. only 1-bits are drawn from the form).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1858
     If its a deep form (i.e. a pixmap) the current paint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1859
     settings are ignored and the form is drawn as-is. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1860
     Care must be taken, that the paint color is correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1861
     (by sending #on: to the color) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1862
     Using functions other than #copy only makes sense if you are
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1863
     certain, that the colors are real colors (actually, only for
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1864
     noColor or allColor).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1865
     The origins coordinate is transformed, but the image itself is unscaled."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1866
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1867
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1868
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1869
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1870
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1871
        pY := transformation applyToY:y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1872
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1873
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1874
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1875
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1876
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1877
    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
  1878
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1879
    "Modified: 12.4.1997 / 12:48:04 / cg"
732
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
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
  1883
    "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
  1884
     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
  1885
     current paint-color, 0 bits in background color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1886
     If its a deep form (i.e. a pixmap) the current paint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1887
     settings are ignored and the form is drawn as-is (opaque). 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1888
     The origins coordinate is transformed, but the image itself is unscaled."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1889
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1890
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1891
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1892
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1893
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1894
        pY := transformation applyToY:y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1895
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1896
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1897
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1898
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1899
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1900
    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
  1901
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1902
    "Modified: 12.4.1997 / 12:49:21 / cg"
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1905
displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1906
    "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
  1907
     Draw foreground pixels in paint-color, background pixels in bgPaint color."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1908
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1909
    |pX pY|
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
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1912
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1913
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1914
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1915
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1916
	pY := y.
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
    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
  1919
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1920
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1921
displayUnscaledOpaqueString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1922
    "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
  1923
     Draw foreground pixels in paint-color, background pixels in bgPaint color."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1924
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1925
    |pX pY|
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
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1928
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1929
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1930
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1931
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1932
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1933
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1934
    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
  1935
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1936
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1937
displayUnscaledString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1938
    "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
  1939
     draw foreground-pixels only (in current paint-color), leaving background as-is."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1940
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1941
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1942
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1943
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1944
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1945
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1946
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1947
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1948
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1949
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1950
    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
  1951
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1952
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1953
displayUnscaledString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1954
    "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
  1955
     draw foreground-pixels only (in current paint-color), leaving background as-is."
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 pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1958
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1959
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1960
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1961
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1962
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1963
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1964
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1965
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1966
    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
  1967
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1968
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1969
!DeviceGraphicsContext methodsFor:'drawing in device coordinates'!
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
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
  1972
    "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
  1973
     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
  1974
     current paint-color, leaving pixels with 0-bits unchanged
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1975
     (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
  1976
     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
  1977
     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
  1978
     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
  1979
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1980
     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
  1981
     otherwise its converted here, which slows down the draw.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1982
     No transformation or scaling is done.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1983
     Care must be taken, that the paint color is correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1984
     (by sending #on: to the color) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1985
     Using functions other than #copy only makes sense if you are
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1986
     certain, that the colors are real colors (actually, only for
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1987
     noColor or allColor)."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1988
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1989
    |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
  1990
     fgId noColor allColor allBits pX pY
1237
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
  1991
     mask maskId deviceForm deviceMask colorMap|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1992
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1993
    w := aForm width.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1994
    h := aForm height.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1995
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1996
    pX := x rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1997
    pY := y rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1998
1034
5f6f417dcb12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1999
    deviceForm := aForm asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2000
    id := deviceForm id.
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2001
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2002
    id isNil ifTrue:[
1237
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
  2003
        'DeviceGraphicsContext [warning]: invalid form draw - ignored' errorPrintCR.
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
  2004
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2005
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2006
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2007
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2008
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2009
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2010
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2011
     a deep form ignores paint/bgPaint settings
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2012
    "
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  2013
    mask := aForm mask.
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  2014
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  2015
    ((aForm depth ~~ 1) 
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  2016
    or:[mask notNil]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2017
        mask notNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2018
            mask depth == 1 ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2019
                'DEVGC: alpha channel not yet supported' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2020
            ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2021
                deviceMask := mask asFormOn:device.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2022
                maskId := deviceMask id.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2023
                maskId notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2024
                    allColor := Color allColor.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2025
                    allBits := allColor colorId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2026
1599
55a782d2c2f5 oops - masked image draw with depth1 images was wrong
Claus Gittinger <cg@exept.de>
parents: 1592
diff changeset
  2027
                    (deviceForm depth == device depth 
55a782d2c2f5 oops - masked image draw with depth1 images was wrong
Claus Gittinger <cg@exept.de>
parents: 1592
diff changeset
  2028
                    and:[aForm maskedPixelsAre0]) ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2029
                        "/ 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
  2030
                        "/   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
  2031
                        "/   of the destination.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2032
                        "/   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
  2033
                        "/   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
  2034
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2035
                        "/ stamp out using mask
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2036
                        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
  2037
                        device setFunction:#and in:gcId.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2038
                        device
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2039
                            copyPlaneFromPixmapId:maskId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2040
                            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2041
                            y:0 
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2042
                            gc:(deviceMask gcId)
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2043
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2044
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2045
                            y:pY 
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2046
                            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2047
                            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2048
                            height:h.
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2049
                        "/ or-in the form
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2050
                        device setFunction:#or in:gcId.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2051
                        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2052
                            copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2053
                            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2054
                            y:0 
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2055
                            gc:(deviceForm gcId)
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2056
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2057
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2058
                            y:pY 
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2059
                            gc:gcId
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2060
                            width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2061
                            height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2062
                    ] ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2063
                        "/ 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
  2064
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2065
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2066
                         create temp-form;
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
                        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
  2069
                        tmpForm initGC.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2070
                        tmpId := tmpForm id.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2071
                        tmpGCId := tmpForm gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2072
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2073
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2074
                         fill tempform with image
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2075
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2076
                        aForm depth == 1 ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2077
                            (colorMap := aForm colorMap) notNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2078
                                device 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2079
                                    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
  2080
                                    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
  2081
                                    in:tmpGCId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2082
                            ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2083
                            device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2084
                                copyPlaneFromPixmapId:id
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2085
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2086
                                y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2087
                                gc:gcId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2088
                                to:tmpId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2089
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2090
                                y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2091
                                gc:tmpGCId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2092
                                width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2093
                                height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2094
                        ] ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2095
                            device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2096
                                copyFromPixmapId:id
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2097
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2098
                                y:0 
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
                                to:tmpId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2101
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2102
                                y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2103
                                gc:tmpGCId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2104
                                width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2105
                                height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2106
                        ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2107
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2108
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2109
                         stamp out mask in temp form
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2110
                        "
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2111
                        device setForeground:allBits background:0 in:tmpGCId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2112
                        device setFunction:#and in:tmpGCId.
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2113
                        device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2114
                            copyPlaneFromPixmapId:maskId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2115
                            x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2116
                            y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2117
                            gc:(deviceMask gcId)
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2118
                            to:tmpId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2119
                            x:0 
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2120
                            y:0 
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2121
                            gc:tmpGCId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2122
                            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2123
                            height:h.
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2124
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2125
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2126
                         stamp out mask in destination
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2127
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2128
                        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
  2129
                        device setFunction:#and in:gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2130
                        device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2131
                            copyPlaneFromPixmapId:maskId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2132
                            x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2133
                            y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2134
                            gc:(deviceMask gcId)
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2135
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2136
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2137
                            y:pY 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2138
                            gc:gcId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2139
                            width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2140
                            height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2141
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2142
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2143
                         or-in tempform-bits ...
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2144
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2145
                        device setFunction:#or in:gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2146
                        device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2147
                            copyFromPixmapId:tmpId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2148
                            x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2149
                            y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2150
                            gc:tmpGCId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2151
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2152
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2153
                            y:pY 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2154
                            gc:gcId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2155
                            width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2156
                            height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2157
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2158
                        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2159
                         release tempForm immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2160
                         (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2161
                          this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2162
                        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2163
                        tmpForm destroy.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2164
                    ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2165
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2166
                    "/ restore GC
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2167
                    foreground notNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2168
                        device setForeground:foreground colorId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2169
                    ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2170
                    background notNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2171
                        device setBackground:background colorId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2172
                    ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2173
                    device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2174
                    ^ self
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2175
                ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2176
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2177
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2178
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2179
        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2180
            copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2181
            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2182
            y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2183
            gc:deviceForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2184
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2185
            x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2186
            y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2187
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2188
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2189
            height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2190
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2191
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2192
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2193
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2194
     the following code is somewhat complicated, since it has to deal
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2195
     with dithered paint colors, which cannot be done directly on most
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2196
     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
  2197
     (just assume drawing a bitmap with dithered paint color ... sigh)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2198
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2199
1507
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2200
    easy := (function == #copy).
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2201
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2202
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2203
     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
  2204
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2205
    easy ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2206
        paint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2207
            paintDither := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2208
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2209
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2210
            paintDither := paint ditherForm.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2211
            paintDither notNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2212
                easy := false.
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
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2215
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2216
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2217
    allColor := Color allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2218
    allBits := allColor colorId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2219
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2220
    easy ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2221
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2222
         paint is a real color
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2223
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2224
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2225
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2226
         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
  2227
         operation ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2228
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2229
        fgId := paint colorId.
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
        ((fgId ~~ ((1 bitShift:device depth)-1))
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2232
        and:[fgId ~~ allBits]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2233
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2234
             clear fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2235
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2236
            device setForeground:0 background:allBits in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2237
            device setFunction:#and in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2238
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2239
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2240
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2241
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2242
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2243
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2244
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2245
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2246
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2247
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2248
                height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2249
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2250
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2251
        fgId ~~ 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2252
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2253
             or-in fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2254
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2255
            device setForeground:fgId background:0 in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2256
            device setFunction:#or in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2257
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2258
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2259
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2260
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2261
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2262
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2263
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2264
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2265
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2266
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2267
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2268
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2269
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2270
         flush foreground/background cache
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2271
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2272
        foreground := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2273
        background := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2274
        device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2275
        ^ self
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
1507
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2278
    function == #or ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2279
        easy := paint notNil
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2280
                and:[paint isColor
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2281
                and:[paint ditherForm isNil]].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2282
        easy ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2283
            easy := bgPaint isNil
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2284
                        or:[bgPaint isColor
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2285
                            and:[bgPaint colorId == 0]]
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2286
        ].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2287
        easy ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2288
            fgId := paint colorId.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2289
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2290
            fgId ~~ 0 ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2291
                "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2292
                 or-in fg-bits ...
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2293
                "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2294
                device setForeground:fgId background:0 in:gcId.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2295
                device
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2296
                    copyPlaneFromPixmapId:id
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2297
                    x:0 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2298
                    y:0 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2299
                    gc:(deviceForm gcId)
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2300
                    to:drawableId
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2301
                    x:pX 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2302
                    y:pY 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2303
                    gc:gcId
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2304
                    width:w 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2305
                    height:h
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2306
            ].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2307
            "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2308
             flush foreground/background cache
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2309
            "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2310
            foreground := nil.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2311
            background := nil.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2312
            ^ self
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2313
        ].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2314
    ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2315
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
     hard case; paint is a dithered color
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2318
    "
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
    noColor := Color noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2321
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2322
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2323
     create temp-form;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2324
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2325
    tmpForm := Form width:w height:h depth:device depth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2326
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2327
     fill tempform
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2328
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2329
    tmpForm paint:paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2330
    tmpForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2331
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2332
     stamp out background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2333
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2334
    tmpForm paint:allColor on:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2335
    tmpForm function:#and.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2336
    tmpForm displayOpaqueForm:deviceForm x:0 y:0.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2337
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2338
     stamp out foreground from destination
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
    device setForeground:0 background:allBits in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2341
    device setFunction:#and in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2342
    device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2343
        copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2344
        x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2345
        y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2346
        gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2347
        to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2348
        x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2349
        y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2350
        gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2351
        width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2352
        height:h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2353
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2354
     or-in temp into destination
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 setForeground:allBits background:0 in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2357
    device setFunction:#or in:gcId.
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
    device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2360
        copyFromPixmapId:tmpForm id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2361
        x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2362
        y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2363
        gc:tmpForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2364
        to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2365
        x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2366
        y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2367
        gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2368
        width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2369
        height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2370
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2371
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2372
     release tempForm immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2373
     (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2374
      this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2375
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2376
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2377
    tmpForm destroy.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2378
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2379
     flush foreground/background cache
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2380
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2381
    foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2382
    background := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2383
    device setFunction:function in:gcId.
768
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2384
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2385
    "Modified: 22.4.1997 / 21:48:27 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2386
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2387
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2388
displayDeviceLineFromX:x0 y:y0 toX:x1 y:y1
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2389
    "draw a line (with current paint-color) in device coordinate space.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2390
     This ignores any transformations. The coordinates must be integers."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2391
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2392
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2393
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2394
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2395
    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
  2396
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2397
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2398
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
  2399
    "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
  2400
     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
  2401
     current paint-color and 0-bits in the bgPaint color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2402
     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
  2403
     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
  2404
     Any mask is ignored.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2405
     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
  2406
     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
  2407
     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
  2408
     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
  2409
     its converted here, which slows down the draw.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2410
     Drawing is in device coordinates; no scaling is done."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2411
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2412
    |id w h easy savedPaint bgForm fgForm tmpForm 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2413
     fgId bgId noColor allColor allBits dx dy
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2414
     pX pY deviceDepth deviceForm|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2415
1033
b5cd84ed805f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  2416
    deviceForm := aForm asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2417
    id := deviceForm id.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2418
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2419
    "temporary ..."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2420
    (id isNil 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2421
    or:[aForm graphicsDevice ~~ device]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2422
        deviceForm := deviceForm asFormOn:device.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2423
        id := deviceForm id.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2424
        id isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2425
            'DeviceGraphicsContext [warning]: invalid form draw - ignored' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2426
            ^ self
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2427
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2428
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2429
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2430
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2431
        self initGC
732
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
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2434
    w := aForm width.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2435
    h := aForm height.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2436
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2437
    pX := x rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2438
    pY := y rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2439
902
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2440
    "
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2441
     a deep form ignores paint/bgPaint settings
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2442
     and is always drawn opaque.
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2443
    "
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2444
    (aForm depth ~~ 1) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2445
        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2446
            copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2447
            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2448
            y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2449
            gc:deviceForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2450
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2451
            x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2452
            y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2453
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2454
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2455
            height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2456
        ^ self
902
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2457
    ].
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2458
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2459
    "/ 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
  2460
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2461
    bgPaint isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2462
        self displayDeviceForm:aForm x:x y:y.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2463
        ^ self
902
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2464
    ].
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2465
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2466
    "the following code is somewhat complicated, since it has to deal
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2467
     with dithered fg/bg colors, which cannot be done directly on most
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2468
     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
  2469
     (just assume drawing a bitmap with dithered fg/bg colors ... sigh)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2470
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2471
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2472
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2473
     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
  2474
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2475
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2476
    paint isColor ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2477
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2478
    ] ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2479
        fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2480
        fgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2481
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2482
        ]
732
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
    bgPaint isColor ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2485
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2486
    ] ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2487
        bgId := bgPaint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2488
        bgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2489
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2490
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2491
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2492
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2493
    easy ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2494
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2495
         easy: both paint and bgPaint are real colors
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
        ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2498
            device setForeground:fgId background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2499
            foreground := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2500
            background := bgPaint.
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
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2503
            copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2504
            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2505
            y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2506
            gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2507
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2508
            x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2509
            y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2510
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2511
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2512
            height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2513
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2514
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2515
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2516
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2517
     hard case: paint and/or bgPaint are dithered or patterns
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2518
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2519
    allColor := Color allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2520
    allBits := allColor colorId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2521
    deviceDepth := device depth.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2522
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2523
    (fgId notNil and:[function == #copy]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2524
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2525
         only bg is dithered; fill with bg first ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2526
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2527
        savedPaint := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2528
        self paint:bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2529
        self fillDeviceRectangleX:pX y:pY width:w height:h.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2530
        self paint:savedPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2531
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2532
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2533
         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
  2534
         operation ...
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
        ((fgId ~~ ((1 bitShift:deviceDepth)-1))
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2537
        and:[fgId ~~ allBits]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2538
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2539
             clear fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2540
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2541
            device setForeground:0 background:allBits in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2542
            device setFunction:#and in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2543
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2544
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2545
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2546
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2547
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2548
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2549
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2550
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2551
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2552
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2553
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2554
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2555
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2556
        fgId ~~ 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2557
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2558
             or-in fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2559
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2560
            device setForeground:fgId background:0 in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2561
            device setFunction:#or in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2562
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2563
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2564
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2565
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2566
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2567
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2568
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2569
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2570
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2571
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2572
                height:h
1177
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
         flush foreground/background cache
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
        foreground := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2578
        background := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2579
        device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2580
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2581
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2582
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2583
    (bgId notNil and:[function == #copy]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2584
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2585
         only fg is dithered; fill with fg first ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2586
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2587
        self fillDeviceRectangleX:pX y:pY width:w height:h.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2588
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2589
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2590
         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
  2591
         operation ...
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
        ((bgId ~~ ((1 bitShift:deviceDepth)-1))
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2594
        and:[bgId ~~ allBits]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2595
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2596
             clear bg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2597
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2598
            device setForeground:allBits background:0 in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2599
            device setFunction:#and in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2600
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2601
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2602
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2603
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2604
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2605
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2606
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2607
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2608
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2609
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2610
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2611
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2612
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2613
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2614
         or-in bg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2615
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2616
        bgId ~~ 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2617
            device setForeground:0 background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2618
            device setFunction:#or in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2619
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2620
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2621
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2622
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2623
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2624
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2625
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2626
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2627
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2628
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2629
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2630
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2631
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2632
         flush foreground/background cache
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2633
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2634
        foreground := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2635
        background := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2636
        device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2637
        ^ self
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2640
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2641
     very hard case; both fg and bg are dithered colors
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
    noColor := Color noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2644
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
     create temp-forms;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2647
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2648
    bgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2649
    fgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2650
    tmpForm := Form width:w height:h depth:deviceDepth on:device.
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
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2653
     fill
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2654
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2655
    dx := dy := 0.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2656
    maskOrigin notNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2657
        dx := maskOrigin x.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2658
        dy := maskOrigin y
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2661
    bgForm paint:bgPaint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2662
    bgForm setMaskOriginX:(x negated + dx) y:(y negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2663
    bgForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2664
    fgForm paint:paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2665
    fgForm setMaskOriginX:(x negated + dx) y:(y negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2666
    fgForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2667
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2668
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2669
     stamp-out background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2670
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2671
    bgForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2672
    bgForm function:#and.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2673
    bgForm displayOpaqueForm:deviceForm x:0 y:0.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2674
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2675
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2676
     stamp-out foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2677
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2678
    fgForm paint:allColor on:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2679
    fgForm function:#and.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2680
    fgForm displayOpaqueForm:deviceForm x:0 y:0.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2681
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
     clear tempform
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
    tmpForm paint:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2686
    tmpForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2687
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2688
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2689
     merge fg-temp and bg-temp into tmp
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
    tmpForm function:#or.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2692
    tmpForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2693
    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
  2694
    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
  2695
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2696
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2697
     finally, draw it
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2698
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2699
    device setForeground:0 background:allBits in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2700
    device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2701
        copyFromPixmapId:tmpForm id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2702
        x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2703
        y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2704
        gc:tmpForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2705
        to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2706
        x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2707
        y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2708
        gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2709
        width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2710
        height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2711
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2712
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2713
     release tempForms immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2714
     (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2715
      this creates less stress to the Xserver in the meanwhile ...)
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
    fgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2718
    bgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2719
    tmpForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2720
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2721
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2722
     flush foreground/background cache
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
    foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2725
    background := nil.
868
65c93e5f6f8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
  2726
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2727
    "Modified: 22.4.1997 / 21:44:10 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2728
!
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
displayDeviceOpaqueString:aString from:index1 to:index2 in:font x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2731
    "draw a substring at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2732
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2733
     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
  2734
     the case where paint and/or bgPaint are dithered colors.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2735
     No translation or scaling is done."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2736
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2737
    |easy w h savedPaint fgId bgId allColor allBits noColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2738
     id bgForm fgForm tmpForm maskForm dx dy pX pY fontUsed s
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2739
     deviceDepth fEnc|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2740
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2741
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2742
     if backgroundPaint color is nil, we assume
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2743
     this is a non-opaque draw
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
    bgPaint isNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2746
        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
  2747
        ^ self
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
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2751
    or:[aString isText]) ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2752
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2753
         hook for non-strings (i.e. attributed text)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2754
         that 'thing' should know how to display itself ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2755
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2756
        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
  2757
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2758
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2759
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2760
    gcId isNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2761
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2762
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2763
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2764
    pX := x rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2765
    pY := y rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2766
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2767
    fontUsed := font on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2768
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2769
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2770
    id isNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2771
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2772
         hook for alien fonts
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2773
         that 'font' should know how to display the string ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2774
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2775
        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
  2776
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2777
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2778
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2779
    s := aString.
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2780
    s encoding ~~ (fEnc := font encoding) ifTrue:[
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2781
        s := s encodeForDisplayInto:fEnc.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2782
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2783
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2784
    deviceFont ~~ fontUsed ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2785
        device setFont:id in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2786
        deviceFont := fontUsed
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2787
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2788
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2789
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2790
     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
  2791
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2792
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2793
    paint isColor ifFalse:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2794
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2795
    ] ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2796
        fgId := paint colorId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2797
        fgId isNil ifTrue:[
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2798
            easy := false
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2799
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2800
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2801
    bgPaint isColor ifFalse:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2802
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2803
    ] ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2804
        bgId := bgPaint colorId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2805
        bgId isNil ifTrue:[
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2806
            easy := false
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2807
        ]
732
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
    easy ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2811
        device setForeground:fgId background:bgId in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2812
        foreground := paint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2813
        background := bgPaint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2814
        device displayOpaqueString:s 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2815
                              from:index1 to:index2
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2816
                                 x:pX y:pY 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2817
                                in:drawableId with:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2818
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2819
    ].
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
    w := fontUsed widthOf:s from:index1 to:index2.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2822
    h := fontUsed height.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2823
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2824
    (fgId notNil and:[function == #copy]) ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2825
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2826
         only bg is dithered; fill with bg first ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2827
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2828
        savedPaint := paint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2829
        self paint:bgPaint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2830
        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
  2831
        self paint:savedPaint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2832
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2833
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2834
         then draw using fgPaint (which is a real color)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2835
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2836
        device displayString:s 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2837
                        from:index1 to:index2
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2838
                           x:pX y:pY 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2839
                          in:drawableId with:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2840
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2841
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2842
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2843
    allColor := Color allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2844
    allBits := allColor colorId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2845
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2846
    deviceDepth := device depth.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2847
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
     the code below is correct, but some (all?) implementations of the
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2850
     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
  2851
     Therefore we use the slower code below.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2852
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2853
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2854
"/    (bgId notNil and:[function == #copy]) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2855
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2856
"/       only fg is dithered; fill with fg first ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2857
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2858
"/      self fillRectangleX:pX y:(pY - fontUsed ascent) width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2859
"/
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2860
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2861
"/       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
  2862
"/       operation ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2863
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2864
"/      ((bgId ~~ ((1 bitShift:deviceDepth)-1))
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2865
"/      and:[bgId ~~ allBits]) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2866
"/          "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2867
"/           clear bg bits ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2868
"/          "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2869
"/          device setForeground:allBits background:0 in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2870
"/          device setFunction:#and in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2871
"/          device displayOpaqueString:s 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2872
"/                                from:index1 to:index2
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2873
"/                                   x:pX y:pY 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2874
"/                                  in:drawableId with:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2875
"/      ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2876
"/
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2877
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2878
"/       or-in bg bits ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2879
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2880
"/      bgId ~~ 0 ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2881
"/          device setForeground:0 background:bgId in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2882
"/          device setFunction:#or in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2883
"/          device displayOpaqueString:s 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2884
"/                                from:index1 to:index2
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2885
"/                                   x:pX y:pY 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2886
"/                                  in:drawableId with:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2887
"/      ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2888
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2889
"/       flush foreground/background cache
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2890
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2891
"/      foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2892
"/      background := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2893
"/      device setFunction:function in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2894
"/      ^ self
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2895
"/  ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2896
768
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2897
    (bgId notNil and:[function == #copy]) ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2898
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2899
         only fg is dithered; fill with bg first ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2900
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2901
        device setForeground:bgId in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2902
        device setFunction:#copy in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2903
        device setBitmapMask:nil in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2904
        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
  2905
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2906
        "/ draw fg dithered
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2907
        (mask depth == 1) ifTrue:[
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2908
            device setBitmapMask:mask id in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2909
            device setForeground:foreground colorId background:background colorId in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2910
        ] ifFalse:[
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2911
            device setPixmapMask:mask id in:gcId
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2912
        ].
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2913
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2914
        device displayString:s
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2915
                    from:index1 to:index2 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2916
                       x:pX y:pY
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2917
                      in:drawableId with:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2918
        ^ self.
768
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2919
"/
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2920
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2921
"/       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
  2922
"/       operation ...
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2923
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2924
"/      ((bgId ~~ ((1 bitShift:deviceDepth)-1))
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2925
"/      and:[bgId ~~ allBits]) ifTrue:[
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2926
"/          "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2927
"/           clear bg bits ...
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2928
"/          "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2929
"/          device setForeground:allBits background:0 in:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2930
"/          device setFunction:#and in:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2931
"/          device displayOpaqueString:s 
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2932
"/                                from:index1 to:index2
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2933
"/                                   x:pX y:pY 
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2934
"/                                  in:drawableId with:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2935
"/      ].
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2936
"/
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2937
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2938
"/       or-in bg bits ...
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2939
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2940
"/      bgId ~~ 0 ifTrue:[
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2941
"/          device setForeground:0 background:bgId in:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2942
"/          device setFunction:#or in:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2943
"/          device displayOpaqueString:s 
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2944
"/                                from:index1 to:index2
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2945
"/                                   x:pX y:pY 
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2946
"/                                  in:drawableId with:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2947
"/      ].
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2948
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2949
"/       flush foreground/background cache
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2950
"/      "
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2951
"/      foreground := nil.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2952
"/      background := nil.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2953
"/      device setFunction:function in:gcId.
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2954
"/      ^ self
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2955
    ].
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2956
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2957
    "
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2958
     very hard case, both fg and bg are dithered colors/images
732
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
    noColor := Color noColor.
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2961
"/ 'hard: ' print. aString print. ' ' print. paint print. ' ' print. bgPaint printCR.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2962
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2963
     create temp-forms;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2964
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2965
    bgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2966
    fgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2967
    tmpForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2968
    maskForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2969
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
     fill
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2972
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2973
    dx := 0.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2974
    dy := fontUsed ascent.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2975
    maskOrigin notNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2976
        dx := maskOrigin x.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2977
        dy := dy + maskOrigin y
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2978
    ].
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
    bgForm paint:bgPaint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2981
    bgForm setMaskOriginX:(pX negated + dx) y:(pY negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2982
    bgForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2983
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2984
    fgForm paint:paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2985
    fgForm setMaskOriginX:(pX negated + dx) y:(pY negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2986
    fgForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2987
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2988
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2989
     stamp-out background (have now bg-bits with fg=0 in bgForm)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2990
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2991
    bgForm font:fontUsed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2992
    bgForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2993
    bgForm function:#and.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2994
    bgForm displayString:s 
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2995
                    from:index1 to:index2 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2996
                       x:0 y:fontUsed ascent.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2997
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2998
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2999
     stamp-out foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3000
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3001
    maskForm font:fontUsed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3002
    maskForm paint:allColor on:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3003
    maskForm displayOpaqueString:s 
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3004
                            from:index1 to:index2 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3005
                               x:0 y:fontUsed ascent.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3006
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3007
    fgForm function:#and.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3008
    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
  3009
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3010
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3011
     clear tempform
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
    tmpForm paint:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3014
    tmpForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3015
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3016
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3017
     merge fg-temp and bg-temp into tmp
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3018
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3019
    tmpForm function:#or.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3020
    tmpForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3021
    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
  3022
    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
  3023
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3024
     finally, draw it
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3025
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3026
    device setForeground:0 background:allBits in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3027
    device
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3028
        copyFromId:tmpForm id
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3029
                 x:0 y:0 gc:tmpForm gcId
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3030
                to:drawableId
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3031
                 x:pX y:(pY-fontUsed ascent) gc:gcId
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3032
             width:w height:h.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3033
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3034
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3035
     release tempForms immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3036
     (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3037
      this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3038
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3039
    tmpForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3040
    fgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3041
    bgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3042
    maskForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3043
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3044
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3045
     flush foreground/background cache
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
    foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3048
    background := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3049
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  3050
    "Modified: 1.7.1997 / 17:08:46 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3051
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3052
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3053
displayDeviceOpaqueString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3054
    "draw a substring at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3055
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3056
     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
  3057
     the case where paint and/or bgPaint are dithered colors.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3058
     No translation or scaling is done."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3059
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3060
    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
  3061
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3062
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3063
displayDeviceOpaqueString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3064
    "draw a string at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3065
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3066
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3067
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3068
    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
  3069
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3070
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3071
displayDeviceString:aString from:index1 to:index2 in:font x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3072
    "draw a substring at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3073
     draw foreground-pixels only (in current paint-color), leaving background as-is.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3074
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3075
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  3076
    |id pX pY fontUsed s fEnc|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3077
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3078
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3079
     hook for non-strings (i.e. attributed text)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3080
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3081
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3082
    or:[aString isText]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3083
        ^ aString displayOn:self x:x y:y from:index1 to:index2
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3086
    gcId isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3087
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3088
    ].
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
    pX := x rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3091
    pY := y rounded.
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
    fontUsed := font on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3094
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3095
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3096
    id isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3097
        "hook for alien fonts"
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3098
        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
  3099
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3100
        s := aString.
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  3101
        s encoding ~~ (fEnc := font encoding) ifTrue:[
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  3102
            s := s encodeForDisplayInto:fEnc.
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3103
        ].
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3104
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3105
        deviceFont ~~ fontUsed ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3106
            device setFont:id in:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3107
            deviceFont := fontUsed
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3108
        ].
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3109
        device displayString:s from:index1 to:index2
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3110
                           x:pX y:pY in:drawableId with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3111
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3112
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  3113
    "Modified: 1.7.1997 / 17:08:48 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3114
!
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
displayDeviceString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3117
    "draw a substring at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3118
     draw foreground-pixels only (in current paint-color), leaving background as-is.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3119
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3120
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3121
    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
  3122
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3123
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3124
displayDeviceString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3125
    "draw a string at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3126
     draw foreground-pixels only (in current paint-color), leaving background as-is.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3127
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3128
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3129
    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
  3130
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3131
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3132
fillDeviceRectangleX:x y:y width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3133
    "draw a filled rectangle in device coordinate space.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3134
     This ignores any transformations. The coordinates must be integers."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3135
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3136
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3137
	self initGC
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
    device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3140
	fillRectangleX:x 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3141
		     y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3142
		 width:w
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3143
		height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3144
		    in:drawableId with:gcId
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3147
!DeviceGraphicsContext methodsFor:'evaluating in another context'!
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
reverseDo:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3150
    "evaluate aBlock with foreground and background interchanged.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3151
     This can be reimplemented here in a faster way."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3152
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3153
    |oldFg oldBg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3154
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3155
    oldFg := foreground on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3156
    oldBg := background on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3157
    self foreground:background background:foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3158
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3159
    self foreground:oldFg background:oldBg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3160
!
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
withBackground:fgColor do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3163
    "evaluate aBlock with changed background."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3164
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3165
    |oldBg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3166
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3167
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3168
    self background:fgColor.
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 background:oldBg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3171
!
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
withForeground:fgColor background:bgColor do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3174
    "evaluate aBlock with changed foreground and background."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3175
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3176
    |oldFg oldBg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3177
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3178
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3179
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3180
    self foreground:fgColor background:bgColor.
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 background:oldBg
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 background:bgColor function:aFunction do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3186
    "evaluate aBlock with foreground, background 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 oldBg 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
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3192
    oldFun := function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3193
    self foreground:fgColor background:bgColor function:aFunction.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3194
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3195
    self foreground:oldFg background:oldBg function:oldFun
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3198
withForeground:fgColor background:bgColor mask:aMask do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3199
    "evaluate aBlock with foreground, background and mask"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3200
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3201
    |oldFg oldBg oldMask|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3202
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3203
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3204
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3205
    oldMask := mask.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3206
    self foreground:fgColor background:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3207
    self mask:aMask.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3208
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3209
    self foreground:oldFg background:oldBg.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3210
    self mask:oldMask
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3211
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3212
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3213
withForeground:fgColor do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3214
    "evaluate aBlock with changed foreground."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3215
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3216
    |oldFg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3217
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3218
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3219
    self foreground:fgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3220
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3221
    self foreground:oldFg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3222
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3223
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3224
withForeground:fgColor function:aFunction do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3225
    "evaluate aBlock with changed foreground and function."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3226
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3227
    |oldFg oldFun|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3228
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3229
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3230
    oldFun := function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3231
    self foreground:fgColor background:background function:aFunction.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3232
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3233
    self foreground:oldFg background:background function:oldFun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3234
!
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
xoring:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3237
    "evaluate aBlock with function xoring"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3238
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3239
    |fgPixel bgPixel oldFunction|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3240
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3241
    fgPixel := device blackColor colorId.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3242
    bgPixel := device whiteColor colorId.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3243
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3244
    gcId isNil ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3245
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3246
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3247
    oldFunction := function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3248
    device setForeground:(fgPixel bitXor:bgPixel)
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3249
              background:bgPixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3250
                      in:gcId.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3251
    device setFunction:#xor in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3252
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3253
    paint := nil.        "invalidate"
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3254
    foreground := device blackColor.   
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3255
    background := device whiteColor.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3256
    device setForeground:fgPixel
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3257
              background:bgPixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3258
                      in:gcId.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3259
    device setFunction:oldFunction in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3260
    function := oldFunction
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3261
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3262
    "Modified: 13.1.1997 / 23:03:20 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3263
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3264
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3265
!DeviceGraphicsContext methodsFor:'filling'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3266
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3267
fillArcX:x y:y width:w height:h from:startAngle angle:angle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3268
    "draw a filled arc; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3269
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  3270
    |pX pY nW nH|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3271
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3272
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3273
	self initGC
732
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
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3276
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3277
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3278
	nW := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3279
	nH := transformation applyScaleY:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3280
	nW < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3281
	      nW := nW abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3282
	      pX := pX - nW.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3283
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3284
	nH < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3285
	      nH := nH abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3286
	      pY := pY - nH.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3287
	].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3288
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3289
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3290
	pY := y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3291
	nW := w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3292
	nH := h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3293
    ].
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
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3296
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3297
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3298
    nH := nH rounded.
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
    device
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3301
	  fillArcX:pX 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3302
		 y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3303
	     width:nW
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3304
	    height:nH 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3305
	      from:startAngle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3306
	     angle:angle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3307
		in:drawableId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3308
	      with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3309
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3310
    "Created: 8.5.1996 / 08:29:45 / cg"
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3311
    "Modified: 4.6.1996 / 17:58:21 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3312
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3313
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3314
fillPolygon:aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3315
    "draw a filled polygon; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3316
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3317
    |newPolygon|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3318
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3319
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3320
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3321
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3322
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3323
	newPolygon := aPolygon collect:[:point | transformation applyTo:point].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3324
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3325
	newPolygon := aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3326
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3327
    (newPolygon findFirst:[:p | 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3328
	(p isPoint not 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3329
	or:[(p x class ~~ SmallInteger)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3330
	or:[(p y class ~~ SmallInteger)]])
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3331
     ]) ~~ 0 ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3332
	newPolygon := newPolygon collect:[:p | p asPoint rounded]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3333
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3334
    device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3335
	fillPolygon:newPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3336
		 in:drawableId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3337
	       with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3338
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3339
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3340
fillRectangleX:x y:y width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3341
    "draw a filled rectangle; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3342
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  3343
    |pX pY nW nH|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3344
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3345
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3346
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3347
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3348
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3349
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3350
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3351
	nW := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3352
	nH := transformation applyScaleY:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3353
	nW < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3354
	      nW := nW abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3355
	      pX := pX - nW.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3356
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3357
	nH < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3358
	      nH := nH abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3359
	      pY := pY - nH.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3360
	].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3361
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3362
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3363
	pY := y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3364
	nW := w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3365
	nH := h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3366
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3367
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3368
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3369
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3370
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3371
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3372
    device
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3373
	fillRectangleX:pX 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3374
		     y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3375
		 width:nW 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3376
		height:nH 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3377
		    in:drawableId with:gcId
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3378
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3379
    "Modified: 4.6.1996 / 17:58:49 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3380
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3381
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3382
!DeviceGraphicsContext methodsFor:'initialization'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3383
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3384
close
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3385
    "same as destroy - for ST-80 compatibility"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3386
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3387
    self destroy
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3388
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3389
    "Created: 2.4.1997 / 19:31:27 / cg"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3390
!
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3391
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3392
createGC
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3393
    "physically create a device GC.
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3394
     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
  3395
     really drawn, none is created up to the first draw.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3396
     This method is sent, when the first drawing happens"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3397
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3398
    gcId := device gcFor:drawableId.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3399
    Lobby registerChange:self.
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3400
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3401
    "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
  3402
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3403
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3404
destroy
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3405
    "I am abstract"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3406
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3407
    self shouldNotImplement.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3408
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3409
"/    "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
  3410
"/
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3411
"/    gcId notNil ifTrue:[
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3412
"/        device destroyGC:gcId.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3413
"/        gcId := nil.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3414
"/        Lobby registerChange:self.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3415
"/    ]
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3416
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3417
    "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
  3418
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3419
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3420
initGC
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3421
    "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
  3422
     really drawn, none is created.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3423
     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
  3424
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3425
    |fgId bgId p|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3426
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3427
    gcId notNil ifTrue:[^ self].
1514
7c2a921ae46b better error report when drawing on closed view.
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  3428
    drawableId isNil ifTrue:[
1649
fa5238a71c2e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  3429
        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
  3430
        ^ self
7c2a921ae46b better error report when drawing on closed view.
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  3431
    ].
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3432
    self createGC.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3433
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3434
    foreground isNil ifTrue:[foreground := device blackColor].
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3435
    background isNil ifTrue:[background := device whiteColor].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3436
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3437
    foreground isColor ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3438
        "get device colors from the device indep. colors"
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3439
        foreground := foreground on:device.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3440
        fgId := foreground colorId.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3441
        fgId isNil ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3442
            (foreground grayIntensity >= 50) ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3443
                fgId := device whitepixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3444
            ] ifFalse:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3445
                fgId := device blackpixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3446
            ]
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3447
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3448
    ] ifFalse:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3449
        fgId := device blackpixel.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3450
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3451
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3452
    background isColor ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3453
        background := background on:device.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3454
        bgId := background colorId.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3455
        bgId isNil ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3456
            (background grayIntensity >= 50) ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3457
                bgId := device whitepixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3458
            ] ifFalse:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3459
                bgId := device blackpixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3460
            ]
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3461
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3462
    ] ifFalse:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3463
        bgId := device whitepixel
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3464
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3465
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3466
    "now, this is something the device can work with ..."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3467
    device setForeground:fgId background:bgId in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3468
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3469
    "switch to paint"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3470
    p := paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3471
    paint := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3472
    self paint:p.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3473
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3474
    ((lineWidth ~~ 0) 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3475
    or:[(lineStyle ~~ #solid) 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3476
    or:[(capStyle ~~ #butt)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3477
    or:[joinStyle ~~ #miter]]]) ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3478
        device setLineWidth:lineWidth 
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3479
                      style:lineStyle
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3480
                        cap:capStyle
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3481
                       join:joinStyle
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3482
                         in:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3483
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3484
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3485
    mask notNil ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3486
        (mask depth == 1) ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3487
            device setBitmapMask:(mask id) in:gcId
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3488
        ] ifFalse:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3489
            device setPixmapMask:(mask id) in:gcId
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3490
        ].
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3491
        maskOrigin notNil ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3492
            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
  3493
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3494
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3495
    (function ~~ #copy) ifTrue:[device setFunction:function in:gcId].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3496
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3497
    "defer the getting of a device font 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3498
     - this is now done when the first drawstring occurs,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3499
     since many views (layout-views) will never draw strings and
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3500
     therefore, the overhead of aquiring a font can be avoided.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3501
    "
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3502
"/    font := font on:device.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3503
"/    id := font fontId.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3504
"/    id notNil ifTrue:[
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3505
"/        device setFont:id in:gcId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3506
"/    ]
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3507
1649
fa5238a71c2e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  3508
    "Modified: 24.4.1997 / 12:00:14 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3509
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3510
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3511
initialize
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3512
    "setup everything for later use; actual work is done in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3513
     initColors and initFont, which are usually redefined."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3514
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3515
    "make certain Workstation is initialized - just a check - will vanish soon"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3516
    Display isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3517
        'DeviceGraphicsContext [warning]: Display not initialized when first DeviceGraphicsContext created' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3518
        Workstation initialize
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3519
    ].
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
    super initialize.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3522
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
  3523
    foreground isNil ifTrue:[foreground := Black].
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
  3524
    background isNil ifTrue:[background := White].
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
  3525
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3526
    "Modified: 10.1.1997 / 17:46:51 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3527
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3528
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3529
prepareForReinit
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3530
    "kludge - clear drawableId and gcId 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3531
     needed after snapin"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3532
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3533
    gcId := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3534
    drawableId := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3535
    deviceFont := nil
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3536
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3537
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3538
recreate
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3539
    "sent after a snapin, reinit draw stuff for new device"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3540
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3541
    gcId := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3542
    foreground notNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3543
	foreground := foreground on:device
732
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
    background notNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3546
	background := background on:device
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3547
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3548
    paint notNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3549
	paint := paint on:device
732
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
    bgPaint notNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3552
	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
  3553
    ].
470f906e3687 recreate device font early - this avoids some deviceFont query errors
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  3554
    font notNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3555
	font := font on:device
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3556
    ]
1094
470f906e3687 recreate device font early - this avoids some deviceFont query errors
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  3557
470f906e3687 recreate device font early - this avoids some deviceFont query errors
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  3558
    "Modified: 28.10.1996 / 13:25:02 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3559
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3560
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3561
reinitialize
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3562
    'DeviceGraphicsContext [warning]: reinit of ' errorPrint. self classNameWithArticle errorPrint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3563
    ' failed' errorPrintCR
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3564
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  3565
    "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
  3566
!
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3567
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3568
releaseGC
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3569
    "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
  3570
     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
  3571
844
17d0f74d7d02 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
  3572
    foreground := background := paint := bgPaint := nil.
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3573
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3574
    gcId notNil ifTrue:[
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3575
        device destroyGC:gcId.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3576
        gcId := nil.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3577
        Lobby registerChange:self.
844
17d0f74d7d02 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
  3578
    ].
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3579
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3580
    "Created: 11.6.1996 / 22:07:30 / cg"
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3581
    "Modified: 2.4.1997 / 19:36:30 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3582
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3583
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3584
!DeviceGraphicsContext methodsFor:'instance release'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3585
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3586
disposed
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3587
    "some Drawable has been collected 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3588
     - must release operating system resources"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3589
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3590
    ^ self subclassResponsibility
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3591
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3592
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3593
!DeviceGraphicsContext methodsFor:'private'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3594
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3595
setDevice:aDevice id:aDrawbleId gcId:aGCId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3596
    "private"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3597
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3598
    device := aDevice.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3599
    gcId := aGCId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3600
    drawableId := aDrawbleId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3601
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3602
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3603
setGCForPaint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3604
    "private; given a complex color (i.e. a pixmap or dithered color,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3605
     setup the GC to draw in this color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3606
     A helper for paint and paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3607
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3608
    |dither map pixelId p fg bg vOrg ditherDepth deviceDepth|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3609
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3610
    gcId notNil ifTrue:[
1742
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3611
        (p := paint) isColor ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3612
            paint := p := p on:device.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3613
            pixelId := p colorId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3614
            pixelId notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3615
                "
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3616
                 a real (undithered) color
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3617
                "
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3618
                mask notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3619
                    mask := nil.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3620
                    device setBitmapMask:nil in:gcId
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3621
                ]. 
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3622
                (p ~~ foreground) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3623
                    foreground := paint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3624
                    device setForeground:pixelId in:gcId
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3625
                ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3626
                ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3627
            ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3628
            "a dithered color"
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3629
            dither := paint ditherForm.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3630
        ] ifFalse:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3631
            "mhmh - seems to be some kind of form ..."
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3632
            paint := paint onDevice:device.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3633
            dither := paint
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3634
        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3635
        "
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3636
         a dithered color or image
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3637
        "
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3638
        (ditherDepth := dither depth) == 1 ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3639
            "a simple 0/1 bitmap"
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3640
            map := dither colorMap.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3641
            "temporary (kludgy) fix for destroyed paint"
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3642
            p := paint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3643
            map isNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3644
                fg := Color black.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3645
                bg := Color white.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3646
            ] ifFalse:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3647
                fg := map at:2.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3648
                bg := map at:1.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3649
            ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3650
            self foreground:fg background:bg.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3651
            paint := p
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3652
        ] ifFalse:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3653
            deviceDepth := device depth.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3654
            (ditherDepth ~~ deviceDepth) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3655
                dither := dither asFormOn:device.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3656
                ditherDepth := dither depth.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3657
                (dither isNil or:[ditherDepth ~~ deviceDepth]) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3658
                    self error:'bad dither'.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3659
                    ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3660
                ]
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3661
            ]
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3662
        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3663
        self mask:dither.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3664
        vOrg := self viewOrigin.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3665
        self setMaskOriginX:vOrg x negated y:vOrg y negated.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3666
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3667
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3668
    "Created: 16.5.1996 / 15:35:51 / cg"
1742
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3669
    "Modified: 6.6.1997 / 12:55:38 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3670
! !
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
!DeviceGraphicsContext methodsFor:'queries'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3673
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3674
horizontalIntegerPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3675
    "return the (rounded) number of pixels per millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3676
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3677
    ^ device horizontalPixelPerMillimeter rounded
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3680
horizontalPixelPerInch
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3681
    "return the number of horizontal pixels per inch of the display"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3682
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3683
    ^ device horizontalPixelPerMillimeter * 25.4
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3686
horizontalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3687
    "return the number of pixels per millimeter (not rounded)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3688
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3689
    ^ device horizontalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3690
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3691
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3692
horizontalPixelPerMillimeter:millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3693
    "return the number of pixels (not rounded) for millis millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3694
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3695
    ^ device horizontalPixelPerMillimeter * millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3696
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3697
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3698
resolution
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3699
    "return a point consisting of pixel-per-inch horizontally and vertically."
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3700
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3701
    ^ device resolution
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3702
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3703
    "Created: 4.6.1996 / 15:23:55 / cg"
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3704
!
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3705
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3706
verticalIntegerPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3707
    "return the (rounded) number of pixels per millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3708
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3709
    ^ device verticalPixelPerMillimeter rounded
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3710
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3711
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3712
verticalPixelPerInch
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3713
    "return the number of vertical pixels per inch of the display"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3714
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3715
    ^ device verticalPixelPerMillimeter * 25.4
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3716
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3717
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3718
verticalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3719
    "return the number of pixels per millimeter (not rounded)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3720
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3721
    ^ device verticalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3722
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3723
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3724
verticalPixelPerMillimeter:millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3725
    "return the number of pixels (not rounded) for millis millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3726
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3727
    ^ device verticalPixelPerMillimeter * millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3728
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3729
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  3730
!DeviceGraphicsContext class methodsFor:'documentation'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3731
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3732
version
2016
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
  3733
    ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.52 1998-01-26 17:58:15 cg Exp $'
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3734
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3735
DeviceGraphicsContext initialize!