DeviceGraphicsContext.st
author Claus Gittinger <cg@exept.de>
Mon, 06 Jun 2005 19:40:25 +0200
changeset 4389 a1ddea4bf248
parent 4291 85475200669d
child 4403 3342601d3fed
permissions -rw-r--r--
care for negative clipRect extent
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
3275
b40f47ec5661 comment
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
    13
"{ Package: 'stx:libview' }"
b40f47ec5661 comment
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
    14
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
GraphicsContext subclass:#DeviceGraphicsContext
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	instanceVariableNames:'drawableId gcId deviceFont foreground background'
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	classVariableNames:'CachedScaledForms CachedScales Lobby'
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	category:'Graphics-Support'
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
    22
!DeviceGraphicsContext class methodsFor:'documentation'!
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
 COPYRIGHT (c) 1992 by Claus Gittinger
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
	      All Rights Reserved
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 This software is furnished under a license and may be used
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 hereby transferred.
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
!
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
documentation
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    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
    41
    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
    42
    printer pages or fax pages).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    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
    45
    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
    46
    exist in the system.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    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
    48
    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
    49
    drawing functions (see GraphicsContext drawing vs. basic drawing category).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    The added variables foreground/background are the drawing colors actually 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    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
    53
    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
    54
    totally replaced by paint/bgPaint 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    (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
    56
     fg/bg makes sense)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    [Instance variables:]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    60
	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
    61
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    62
	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
    63
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    64
	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
    65
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    66
	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
    67
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    68
	background      <Color>         the device background color used for drawing
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    [see also:]
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    71
	DeviceWorkstation
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    72
	Color Font Cursor
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    [author:]
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    75
	Claus Gittinger
732
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
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
    80
!DeviceGraphicsContext class methodsFor:'initialization'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
initialize
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
    Lobby isNil ifTrue:[
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    84
        Lobby := Registry new.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    ]
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    86
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    87
    "Modified: / 29.1.1998 / 12:56:12 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
    90
!DeviceGraphicsContext class methodsFor:'instance creation'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
new
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    "create a new drawable - take the current display as
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
     its device (for now, this may be changed until the view is
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
     physically created)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
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
    '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
    99
"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    ^ self onDevice:Screen current "Display"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
on:aDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    "create a new drawable on aDevice"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
3429
7f87cd2ae010 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3300
diff changeset
   106
    <resource:#obsolete>
7f87cd2ae010 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3300
diff changeset
   107
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   108
    "/ 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
   109
    "/ operating on a model.
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   110
    "/ Please use #onDevice: to avoid confusion.
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   111
1255
bdf4cbcae668 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   112
    self obsoleteMethodWarning:'use #onDevice:'.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    ^ self onDevice:aDevice
1255
bdf4cbcae668 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   114
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   115
    "Modified: 5.6.1997 / 21:04:16 / cg"
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
onDevice:aDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    "create a new drawable on aDevice"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
    |newDrawable|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    newDrawable := self basicNew.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
     set display before its initialized 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
     - 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
   128
     intitialize method(s)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    newDrawable device:aDevice.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    newDrawable initialize.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    ^ newDrawable
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   133
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   134
    "Modified: 2.4.1997 / 19:19:35 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
   137
!DeviceGraphicsContext class methodsFor:'cleanup'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
lowSpaceCleanup
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    CachedScaledForms := CachedScales := nil
1224
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
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   143
releaseResourcesOnDevice:aDevice
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   144
    "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
   145
     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
   146
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   147
    Lobby unregisterAllForWhich:[:aDrawable | aDrawable graphicsDevice == aDevice]
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   148
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   149
    "Created: 16.1.1997 / 16:43:52 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
3880
c4c8268a2d9f method category rename
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   152
!DeviceGraphicsContext methodsFor:'Compatibility-ST80'!
3188
67ce53b6b843 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3160
diff changeset
   153
67ce53b6b843 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3160
diff changeset
   154
key
67ce53b6b843 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3160
diff changeset
   155
    ^ self id
67ce53b6b843 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3160
diff changeset
   156
! !
67ce53b6b843 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3160
diff changeset
   157
3942
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   158
!DeviceGraphicsContext methodsFor:'Compatibility-VW'!
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   159
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   160
displayBackgroundIfNeededOn: aGraphicsContext
4070
efd0ffb52d43 clear -> clearView
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
   161
    aGraphicsContext clearView.
3942
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   162
!
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   163
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   164
inactiveForegroundColor
3943
2d4dbd3f9aa6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3942
diff changeset
   165
    "a dummy method to support VW widgets"
2d4dbd3f9aa6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3942
diff changeset
   166
3942
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   167
    ^ self foregroundColor
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   168
!
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   169
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   170
selectionBackgroundColor
3943
2d4dbd3f9aa6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3942
diff changeset
   171
    "a dummy method to support VW widgets"
2d4dbd3f9aa6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3942
diff changeset
   172
3942
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   173
    ^ self foregroundColor
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   174
!
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   175
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   176
selectionForegroundColor
3943
2d4dbd3f9aa6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3942
diff changeset
   177
    "a dummy method to support VW widgets"
2d4dbd3f9aa6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3942
diff changeset
   178
3942
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   179
    ^ self backgroundColor
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   180
!
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   181
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   182
separatorColor
3943
2d4dbd3f9aa6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3942
diff changeset
   183
    "a dummy method to support VW widgets"
2d4dbd3f9aa6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3942
diff changeset
   184
3942
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   185
    ^ self foregroundColor
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   186
! !
ee09c1391e61 some more dummies for VW widgets
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
   187
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
!DeviceGraphicsContext methodsFor:'accessing'!
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
at:aPoint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
    "return the pixel at the coordinate given by aPoint"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
3160
89905f311a09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3137
diff changeset
   193
    ^ self atX:aPoint x y:aPoint y
89905f311a09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3137
diff changeset
   194
89905f311a09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3137
diff changeset
   195
    "Modified: / 29.1.2000 / 12:17:42 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
4204
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   198
at:aPoint put:aPixelColor
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    "set a pixel"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
4204
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   201
    ^ self atX:aPoint x y:aPoint y put:aPixelColor
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   202
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   203
    "
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   204
     Display rootView at:(0@0) put:(Color red).
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   205
     Display rootView at:(1@1) put:(Color red).
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   206
     Display rootView at:(2@2) put:(Color red).
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   207
     Display rootView at:(3@3) put:(Color red).
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   208
     Display rootView at:(4@4) put:(Color red).
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   209
     Display rootView at:(5@5) put:(Color red).
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   210
    "
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
atX:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
    "return the pixel at the coordinate given by x/y"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
2714
e5d16e41cbab need gcId-argument in getPixel
Claus Gittinger <cg@exept.de>
parents: 2680
diff changeset
   216
    ^ device getPixelX:x y:y from:drawableId with:gcId
e5d16e41cbab need gcId-argument in getPixel
Claus Gittinger <cg@exept.de>
parents: 2680
diff changeset
   217
e5d16e41cbab need gcId-argument in getPixel
Claus Gittinger <cg@exept.de>
parents: 2680
diff changeset
   218
    "Modified: / 22.5.1999 / 01:40:23 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
4204
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   221
atX:x y:y put:aPixelColor
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
    "set a pixel"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
    |oldFg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    oldFg := foreground.
4204
947a5a5620d3 comments
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
   227
    self foreground:aPixelColor.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    self displayPointX:x y:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
    self foreground:oldFg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
backgroundPaint:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
    "set the background-paint color; this is used in opaque-draw
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
     operations"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
    (aColor ~~ bgPaint) ifTrue:[
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   237
        aColor notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   238
            bgPaint := aColor.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   239
            gcId notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   240
                bgPaint isColor ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   241
                    bgPaint := aColor onDevice:device.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   242
                    bgPaint colorId notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   243
                        background := bgPaint.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   244
                        gcId notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   245
                            device setBackground:(bgPaint colorId) in:gcId.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   246
                        ].
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   247
                        ^ self
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   248
                    ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   249
                ].
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   250
                self paint:paint on:aColor
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   251
            ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   252
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
basicFont
2918
1e777dc8588a #font answers device font if possible (cg)
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   257
    "return the font for drawing"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
    ^ font
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    "Created: 12.5.1996 / 11:17:59 / cg"
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
basicFont:aFont
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
    "set the font for drawing if it has changed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
     This is a low level entry, which is not to be redefined
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
     (i.e. it must not imply a redraw operation)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
    |id|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
    (aFont ~~ font) ifTrue:[
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   272
        aFont notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   273
            font := aFont.
3928
ad6ac8dbaaae oops: font was not device specific unless a draw operation
Claus Gittinger <cg@exept.de>
parents: 3883
diff changeset
   274
            device notNil ifTrue:[
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   275
                font := font onDevice:device.
3928
ad6ac8dbaaae oops: font was not device specific unless a draw operation
Claus Gittinger <cg@exept.de>
parents: 3883
diff changeset
   276
                gcId notNil ifTrue:[
ad6ac8dbaaae oops: font was not device specific unless a draw operation
Claus Gittinger <cg@exept.de>
parents: 3883
diff changeset
   277
                    id := font fontId.
ad6ac8dbaaae oops: font was not device specific unless a draw operation
Claus Gittinger <cg@exept.de>
parents: 3883
diff changeset
   278
                    id notNil ifTrue:[
ad6ac8dbaaae oops: font was not device specific unless a draw operation
Claus Gittinger <cg@exept.de>
parents: 3883
diff changeset
   279
                        device setFont:id in:gcId
ad6ac8dbaaae oops: font was not device specific unless a draw operation
Claus Gittinger <cg@exept.de>
parents: 3883
diff changeset
   280
                    ]
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   281
                ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   282
            ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   283
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
    "Modified: 23.2.1996 / 17:01:06 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
    "Created: 23.2.1996 / 17:16:51 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
!
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
capStyle:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
    "set the style in which the endpoints of lines
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
     are drawn - aSymbol may be #notLast, #butt, #round, #projecting"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
    |s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
    (s := aSymbol) isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   297
	s := #butt.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
    (s ~~ capStyle) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   301
	capStyle := s.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   302
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   303
	    device setLineWidth:lineWidth 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   304
			  style:lineStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   305
			    cap:s
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   306
			   join:joinStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   307
			     in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   308
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
    "Modified: 12.5.1996 / 22:23:03 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   314
clipByChildren
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   315
    "drawing shall be done into my view only (default)"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   316
3429
7f87cd2ae010 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3300
diff changeset
   317
    <resource:#obsolete>
7f87cd2ae010 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3300
diff changeset
   318
1722
4ceaeda95cc3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   319
    self obsoleteMethodWarning:'use #clippedByChildren:true'.
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   320
    ^ self clippedByChildren:true
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   321
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   322
    "Created: 17.7.1996 / 13:25:55 / cg"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   323
!
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   324
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
clipRect
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
    "return the clipping rectangle for drawing. If there is currently no clipRect,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
     a dummy is created."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
    |rect|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
2680
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   331
    (rect := clipRect) isNil ifTrue:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   332
        rect := 0@0 extent:(self extent).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
    ].
2680
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   334
    transformation notNil ifTrue:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   335
        rect := transformation applyInverseTo:rect.
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   336
    ].
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   337
    ^ rect
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
    "Modified: 10.4.1996 / 14:32:22 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   342
clippedByChildren:aBoolean
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   343
    "turn on/off drawing over children.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   344
     If on, a superview may draw 'over' its children.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   345
     If off (the default), drawing is 'under' its children.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   346
     Only useful for the rootView, to draw over any visible views.
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   347
     (for example, when dragging a rubber-line)"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   348
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   349
    gcId isNil ifTrue:[
1680
f47862c358fb pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
   350
        self initGC
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   351
    ].
1715
c70e31496f91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   352
    device noClipIn:drawableId gc:gcId.
c70e31496f91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   353
    device setClipByChildren:aBoolean in:drawableId gc:gcId.
1722
4ceaeda95cc3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   354
"/    device noClipIn:drawableId gc:gcId.
4ceaeda95cc3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   355
1714
66143e4f3fcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   356
"/
66143e4f3fcf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
   357
"/    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
   358
"/
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   359
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   360
    "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
   361
    "Modified: 29.4.1997 / 15:33:55 / dq"
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   362
!
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   363
735
44ad59ece2db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
   364
clippingRectangle:aRectangleOrNil
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
    "set the clipping rectangle for drawing (in logical coordinates);
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
     a nil argument turn off clipping (i.e. whole view is drawable)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
2680
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   368
    |x y w h r|
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   369
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   370
    (r := aRectangleOrNil) isNil ifTrue:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   371
        clipRect isNil ifTrue:[^ self].
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   372
        gcId notNil ifTrue:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   373
            device noClipIn:drawableId gc:gcId
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   374
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
    ] ifFalse:[
2680
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   376
        clipRect notNil ifTrue:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   377
            (clipRect = aRectangleOrNil) ifTrue:[^ self]
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   378
        ].
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   379
        gcId notNil ifTrue:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   380
            x := aRectangleOrNil left.
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   381
            y := aRectangleOrNil top.
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   382
            w := aRectangleOrNil width.
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   383
            h := aRectangleOrNil height.
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   384
            transformation notNil ifTrue:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   385
                x := transformation applyToX:x.
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   386
                y := transformation applyToY:y.
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   387
                w := transformation applyScaleX:w.
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   388
                h := transformation applyScaleY:h.
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   389
            ].
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   390
            (x class == SmallInteger) ifFalse:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   391
                w := w + (x - x truncated).
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   392
                x := x truncated
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   393
            ].
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   394
            (y class == SmallInteger) ifFalse:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   395
                h := h + (y - y truncated).
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   396
                y := y truncated
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   397
            ].
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   398
            (w class == SmallInteger) ifFalse:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   399
                w := w truncated + 1
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   400
            ].
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   401
            (h class == SmallInteger) ifFalse:[
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   402
                h := h truncated + 1
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   403
            ].
4389
a1ddea4bf248 care for negative clipRect extent
Claus Gittinger <cg@exept.de>
parents: 4291
diff changeset
   404
            w := w max:0.
a1ddea4bf248 care for negative clipRect extent
Claus Gittinger <cg@exept.de>
parents: 4291
diff changeset
   405
            h := h max:0.
2680
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   406
            device setClipX:x y:y width:w height:h in:drawableId gc:gcId.
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   407
            r := Rectangle left:x top:y width:w height:h
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   408
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
    ].
2680
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   410
    clipRect := r
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   411
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   412
    "Created: / 28.5.1996 / 19:40:20 / cg"
78abc6171873 always remember the deviceClipRect internally;
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   413
    "Modified: / 16.5.1999 / 19:40:37 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
1842
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   416
colorAt:aPoint
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   417
    "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
   418
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   419
    ^ self colorAtX:(aPoint x) y:(aPoint y)
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   420
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   421
    "Modified: 1.8.1997 / 20:01:58 / cg"
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   422
!
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   423
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   424
colorAtX:x y:y
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   425
    "return the color of the pixel at the coordinate given by aPoint"
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   426
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   427
    |pixel|
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   428
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   429
    pixel := self atX:x y:y.
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   430
    device getScaledRGBFrom:pixel into:[:r :g :b |
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   431
        ^ Color scaledRed:r scaledGreen:g scaledBlue:b
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   432
    ].
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   433
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   434
    "Created: 1.8.1997 / 20:01:32 / cg"
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   435
!
502aa16b146e added #colorAt:
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
   436
4199
c01c62e8c7a5 dummy container
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   437
container
c01c62e8c7a5 dummy container
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   438
    "return my container - for protocol compatibility"
c01c62e8c7a5 dummy container
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   439
c01c62e8c7a5 dummy container
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   440
    ^ nil
c01c62e8c7a5 dummy container
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   441
!
c01c62e8c7a5 dummy container
Claus Gittinger <cg@exept.de>
parents: 4172
diff changeset
   442
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   443
dashStyle:aDashList offset:dashOffset
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   444
    "define dashes. Each element of the dashList specifies the length
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   445
     of a corresponding dash. For example, setting it to [4 4]
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   446
     defines 4on-4off dashing; 
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   447
     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
   448
     The dashOffset specifies where in the dashList the dashing starts.
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   449
     This may not be supported by all graphics devices."
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   450
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   451
    gcId notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   452
	device setDashes:(ByteArray withAll:aDashList)
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   453
	      dashOffset:dashOffset
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   454
		      in:gcId
786
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   455
    ]
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   456
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   457
    "Modified: 4.6.1996 / 19:03:06 / cg"
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   458
!
af5fecf93126 added dashStyle: ...
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   459
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
    "return the device, the receiver is associated with"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
    ^ device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
!
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
device:aDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
    "set the device"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
    device := aDevice
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
2343
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   472
deviceClippingRectangle:aRectangleOrNil
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   473
    "set the clipping rectangle for drawing (in device coordinates);
3275
b40f47ec5661 comment
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
   474
     a nil argument turns off clipping (i.e. whole view is drawable - incl. margins)"
2343
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   475
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   476
    |x y w h|
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   477
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   478
    aRectangleOrNil isNil ifTrue:[
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   479
        clipRect isNil ifTrue:[^ self].
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   480
        gcId notNil ifTrue:[
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   481
            device noClipIn:drawableId gc:gcId
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   482
        ]
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   483
    ] ifFalse:[
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   484
        clipRect notNil ifTrue:[
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   485
            (clipRect = aRectangleOrNil) ifTrue:[^ self]
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   486
        ].
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   487
        gcId notNil ifTrue:[
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   488
            x := aRectangleOrNil left.
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   489
            y := aRectangleOrNil top.
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   490
            w := aRectangleOrNil width.
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   491
            h := aRectangleOrNil height.
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   492
            device setClipX:x y:y width:w height:h in:drawableId gc:gcId
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   493
        ]
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   494
    ].
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   495
    clipRect := aRectangleOrNil
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   496
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   497
    "Modified: / 22.5.1996 / 13:12:07 / cg"
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   498
    "Created: / 14.9.1998 / 18:50:31 / cg"
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   499
!
9e8d62561418 added #deviceClippingRectangle:
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   500
2918
1e777dc8588a #font answers device font if possible (cg)
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   501
font
1e777dc8588a #font answers device font if possible (cg)
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   502
    "return the font for drawing - here, a device font is returned if
1e777dc8588a #font answers device font if possible (cg)
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   503
     the GC is realized."
1e777dc8588a #font answers device font if possible (cg)
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   504
1e777dc8588a #font answers device font if possible (cg)
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   505
    device notNil ifTrue:[
3928
ad6ac8dbaaae oops: font was not device specific unless a draw operation
Claus Gittinger <cg@exept.de>
parents: 3883
diff changeset
   506
        font := font onDevice:device
2918
1e777dc8588a #font answers device font if possible (cg)
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   507
    ].
1e777dc8588a #font answers device font if possible (cg)
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   508
    ^ font
1e777dc8588a #font answers device font if possible (cg)
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   509
!
1e777dc8588a #font answers device font if possible (cg)
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   510
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
font:aFont
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
    "set the font for drawing if it has changed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
     This should be redefined in some widget to perform an automatic
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
     redraw. See also: #basicFont:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
    (aFont ~~ font) ifTrue:[
4031
31728329be82 font-change sends a change notification
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
   517
        self basicFont:aFont.
31728329be82 font-change sends a change notification
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
   518
        self changed:#font.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
    "Modified: 6.3.1996 / 18:17:40 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
function:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
    "set the drawing function if it has changed"
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
    (aSymbol ~~ function) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
	function := aSymbol.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
	    device setFunction:aSymbol in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
	]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
    ]
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
gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
    "return the receivers graphic context id on the device"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
    ^ gcId
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
graphicsDevice
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
    "return the device, the receiver is associated with.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
     Same as #device, for ST-80 compatibility."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
    ^ device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
    "Created: 9.5.1996 / 01:37:58 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
id
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
    "return the id of the dravable on the device"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
    ^ drawableId
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
joinStyle:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
    "set the style in which 2 lines are connected in polygons -
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
     aSymbol may be #miter, #bevel, #round"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
    |s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
    (s := aSymbol) isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   563
	s := #miter
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
    (s ~~ joinStyle) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   566
	joinStyle := s.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
        
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   568
	gcId notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   569
	    device setLineWidth:lineWidth 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   570
			  style:lineStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   571
			    cap:capStyle
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   572
			   join:s
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   573
			     in:gcId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   574
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
    "Modified: 12.5.1996 / 22:20:43 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   578
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
lineStyle:aSymbol
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   581
    "set the style in which lines are drawn -
2360
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   582
     aSymbol may be #solid, #dashed, #doubleDashed,
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   583
     #dotted, #dashDot or #dashDotDot."
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   585
    |s|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   586
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
    (s := aSymbol) isNil ifTrue:[
2360
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   588
        s := #solid
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
    (s ~~ lineStyle) ifTrue:[
2360
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   591
        lineStyle := s.
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   592
        gcId notNil ifTrue:[
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   593
            device setLineWidth:lineWidth 
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   594
                          style:s
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   595
                            cap:capStyle
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   596
                           join:joinStyle
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   597
                             in:gcId
c7ca5d55d8ce comment
Claus Gittinger <cg@exept.de>
parents: 2343
diff changeset
   598
        ]
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
    "Modified: 12.5.1996 / 22:21:25 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   602
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
lineWidth:aNumber
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   605
    "set the line width for drawing if it has changed"
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
    |n|
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
    (aNumber ~~ lineWidth) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
	lineWidth := aNumber.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
	transformation isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
	    n := aNumber.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
	] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
	    n := transformation applyScaleX:aNumber.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
	    n := n rounded
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
	].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
	    device setLineWidth:n 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
			  style:lineStyle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
			    cap:capStyle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
			   join:joinStyle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
			     in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
	]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
mask:aForm
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
    "set the mask form for drawing"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
    |id|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
    (aForm ~~ mask) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
	mask := aForm.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
	gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
	    (mask == nil) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
		device setBitmapMask:nil in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
	    ] ifFalse:[
1033
b5cd84ed805f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   638
		mask := mask asFormOn:device.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
		id := mask id.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
		(mask depth == 1) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
		    device setBitmapMask:id in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
		] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
		    device setPixmapMask:id in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
		]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
	    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
	]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
2018
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   650
maskOrigin:aPoint
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   651
    "set the origin of the mask-pattern"
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   652
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   653
    |x y|
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   654
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   655
    x := aPoint x.
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   656
    y := aPoint y.
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   657
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   658
    (maskOrigin isNil or:[
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   659
     ((x ~= maskOrigin x) or:[y ~= maskOrigin y]) ]) ifTrue:[
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   660
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   661
        maskOrigin := aPoint.
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   662
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   663
        transformation notNil ifTrue:[
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   664
            x := transformation applyToX:x.
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   665
            y := transformation applyToY:y.
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   666
        ].
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   667
        x := x rounded.
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   668
        y := y rounded.
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   669
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   670
        gcId notNil ifTrue:[
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   671
            device setMaskOriginX:x y:y in:gcId
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   672
        ]
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   673
    ]
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   674
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   675
    "Created: / 26.1.1998 / 19:03:02 / cg"
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   676
!
1ad552e97c67 maskOrigin
Claus Gittinger <cg@exept.de>
parents: 2016
diff changeset
   677
2016
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   678
maskOriginX:orgX y:orgY
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   679
    "set the origin of the pattern"
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   680
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   681
    |x y|
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   682
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   683
    transformation notNil ifTrue:[
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   684
        x := transformation applyToX:orgX.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   685
        y := transformation applyToY:orgY.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   686
    ] ifFalse:[
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   687
        x := orgX.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   688
        y := orgY
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   689
    ].
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   690
    x := x rounded.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   691
    y := y rounded.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   692
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   693
    (maskOrigin isNil or:[
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   694
     ((x ~~ maskOrigin x) or:[y ~~ maskOrigin y]) ]) ifTrue:[
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   695
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   696
        maskOrigin := x @ y.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   697
        gcId notNil ifTrue:[
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   698
            device setMaskOriginX:x y:y in:gcId
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   699
        ]
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   700
    ]
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   701
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   702
    "Created: / 26.1.1998 / 18:51:18 / cg"
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   703
!
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   704
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   705
noClipByChildren
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   706
    "drawing shall also be done into subviews"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   707
3429
7f87cd2ae010 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3300
diff changeset
   708
    <resource:#obsolete>
7f87cd2ae010 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3300
diff changeset
   709
1722
4ceaeda95cc3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   710
    self obsoleteMethodWarning:'use #clippedByChildren:false'.
950
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   711
    ^ self clippedByChildren:false
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   712
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   713
    "Created: 17.7.1996 / 14:15:54 / cg"
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   714
!
d4d907fc7d78 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
   715
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
paint:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   717
    "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
   718
     or even an image."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   719
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
    (aColor ~~ paint) ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   721
	aColor notNil ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   722
	    paint := aColor.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   723
	    self setGCForPaint.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   724
	]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   725
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   726
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   727
    "Modified: 16.5.1996 / 15:35:57 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   728
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   729
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   730
paint:fgColor on:bgColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
    "set the paint and background-paint color. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   732
     The bg-paint is used in opaque-draw operations"
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
    |fgId bgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   735
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
    ((fgColor ~~ paint) or:[bgColor ~~ bgPaint]) ifTrue:[
1742
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   737
        fgColor notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   738
            paint := fgColor
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   739
        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   740
        bgColor notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   741
            bgPaint := bgColor
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   742
        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   743
        gcId notNil ifTrue:[
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   744
            paint := paint onDevice:device.
1742
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   745
            paint isColor ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   746
                fgId := paint colorId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   747
                fgId notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   748
                    mask notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   749
                        mask := nil.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   750
                        device setBitmapMask:nil in:gcId
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   751
                    ]. 
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   752
                    bgPaint := bgPaint onDevice:device.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   753
                    bgPaint isColor ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   754
                        bgId := bgPaint colorId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   755
                        bgId notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   756
                            "the common case, both are real colors"
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   757
                            (paint ~~ foreground) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   758
                                foreground := paint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   759
                                (bgPaint ~~ background) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   760
                                    background := bgPaint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   761
                                    device setForeground:fgId background:bgId in:gcId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   762
                                    ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   763
                                ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   764
                                device setForeground:fgId in:gcId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   765
                                ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   766
                            ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   767
                            (bgPaint ~~ background) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   768
                                background := bgPaint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   769
                                device setBackground:bgId in:gcId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   770
                            ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   771
                            ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   772
                        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   773
                        "bgPaint is dithered, setup paint here, leave bgPaint
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   774
                         till next opaque draw comes around."
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   775
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   776
                        (paint ~~ foreground) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   777
                            foreground := paint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   778
                            device setForeground:fgId in:gcId
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   779
                        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   780
                        ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   781
                    ]
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   782
                ]
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   783
            ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   784
            "either paint or bgPaint (or both) are dithered colors,
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   785
             setup for paint, leave bg-problem till next opaque draw
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   786
             comes around.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   787
            "
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   788
            self setGCForPaint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   789
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   790
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
1742
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
   792
    "Modified: 6.6.1997 / 12:56:55 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
paint:fgColor on:bgColor function:f
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   796
    "set paint, background-paint and function"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   797
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   798
    self paint:fgColor on:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   799
    self function:f
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   800
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
    "Modified: 16.5.1996 / 15:36:35 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
setGraphicsExposures:aBoolean
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
    "want to if aBoolean is true - or dont want to be notified
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
     of graphics exposures"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
    gcId notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
	device setGraphicsExposures:aBoolean in:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
1092
1b6391f333de category rename
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
   813
!DeviceGraphicsContext methodsFor:'accessing-internals'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
    "return the current background drawing color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
     OBSOLETE: use #paint: / #backgroundPaint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   819
    ^ background
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
    "Modified: 12.5.1996 / 22:28:09 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
background:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
    "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
   826
     OBSOLETE: this method will vanish; use #paint: / #backgroundPaint: / #paint:on:"
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
    |bgId|
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
    (aColor ~~ background) ifTrue:[
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   831
        aColor notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   832
            background := aColor.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   833
            gcId notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   834
                background := background onDevice:device.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   835
                bgId := background colorId.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   836
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   837
                "
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   838
                 mhmh the following is a kludge ....
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   839
                "
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   840
                bgId isNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   841
                    (background grayIntensity >= 50) ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   842
                        bgId := device whitepixel
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   843
                    ] ifFalse:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   844
                        bgId := device blackpixel
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   845
                    ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   846
                ].
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   847
                device setBackground:bgId in:gcId
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   848
            ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   849
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   852
    "Modified: 28.5.1996 / 20:44:55 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   855
foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
    "return the current foreground drawing color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
     OBSOLETE: use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
    ^ foreground
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
    "Modified: 12.5.1996 / 22:28:03 / cg"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
foreground:aColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
    "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
   866
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
    |fgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
    (aColor ~~ foreground) ifTrue:[
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   871
        aColor notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   872
            foreground := aColor.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   873
            gcId notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   874
                (foreground class == SmallInteger) ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   875
                    fgId := foreground
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   876
                ] ifFalse:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   877
                    foreground := foreground onDevice:device.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   878
                    fgId := foreground colorId.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   879
                ].
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   880
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   881
                "mhmh the following is a kludge ...."
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   882
                fgId isNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   883
                    (foreground grayIntensity >= 50) ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   884
                        fgId := device whitepixel
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   885
                    ] ifFalse:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   886
                        fgId := device blackpixel
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   887
                    ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   888
                ].
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   889
                device setForeground:fgId in:gcId.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   890
                paint := foreground
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   891
            ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   892
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   893
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   894
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   895
    "Modified: 28.5.1996 / 20:45:02 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   896
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   897
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   898
foreground:fgColor background:bgColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
    "set both internal foreground and internal background colors 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
     - these must be real colors.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
    |fgPixel bgPixel|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
    ((fgColor ~~ foreground) or:[bgColor ~~ background]) ifTrue:[
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   906
        fgColor notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   907
            foreground := fgColor
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   908
        ].
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   909
        bgColor notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   910
            background := bgColor
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   911
        ].
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   912
        gcId notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   913
            foreground := foreground onDevice:device.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   914
            background := background onDevice:device.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   915
            fgPixel := foreground colorId.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   916
            bgPixel := background colorId.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   917
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   918
            "mhmh the following is a kludge ...."
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   919
            fgPixel isNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   920
                (foreground grayIntensity >= 50) ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   921
                    fgPixel := device whitepixel
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   922
                ] ifFalse:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   923
                    fgPixel := device blackpixel
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   924
                ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   925
            ].
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   926
            bgPixel isNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   927
                (background grayIntensity >= 50) ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   928
                    bgPixel := device whitepixel
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   929
                ] ifFalse:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   930
                    bgPixel := device blackpixel
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   931
                ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   932
            ].
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   933
            device setForeground:fgPixel background:bgPixel in:gcId.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   934
            paint := foreground
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   935
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   936
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   937
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   938
    "Modified: 28.5.1996 / 20:45:27 / cg"
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   941
foreground:fgColor background:bgColor function:fun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   942
    "set foreground, background colors and function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   943
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   944
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   945
    self foreground:fgColor background:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   946
    self function:fun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   947
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   948
    "Modified: 12.5.1996 / 22:28:34 / cg"
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
foreground:aColor function:fun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   952
    "set the foreground color and function for drawing.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   953
     OBSOLETE: this method will vanish; use #paint: / #paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   954
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   955
    |fgPixel|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   956
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   957
    ((aColor ~~ foreground) or:[fun ~~ function]) ifTrue:[
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   958
        foreground := aColor.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   959
        function := fun.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   960
        gcId notNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   961
            foreground := foreground onDevice:device.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   962
            fgPixel := foreground colorId.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   963
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   964
            "mhmh the following is a kludge ...."
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   965
            fgPixel isNil ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   966
                (foreground grayIntensity >= 50) ifTrue:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   967
                    fgPixel := device whitepixel
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   968
                ] ifFalse:[
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   969
                    fgPixel := device blackpixel
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   970
                ]
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   971
            ].
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   972
            device setForeground:fgPixel in:gcId.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   973
            device setFunction:fun in:gcId.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   974
            paint := foreground
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   975
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   976
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   977
745
d4465098f2c0 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
   978
    "Modified: 28.5.1996 / 20:45:09 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   979
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   980
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   981
!DeviceGraphicsContext methodsFor:'bit blitting'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
2016
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   983
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
   984
    "copy bits from a smalltalk byteArray.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   985
     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
   986
     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
   987
     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
   988
     method to whatever the device needs."
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   989
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   990
    device
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   991
        drawBits:aByteArray
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   992
	bitsPerPixel:bpp 
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   993
	depth:depth  
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   994
	padding:pad
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   995
        width:srcW height:srcH
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   996
        x:srcX y:srcY
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   997
        into:drawableId
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   998
        x:dstX y:dstY 
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
   999
        width:(self width) height:(self height)
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
  1000
        with:gcId.
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
  1001
!
bef5fe2ec2ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2013
diff changeset
  1002
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1003
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
  1004
    "copy bits from a smalltalk byteArray.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1005
     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
  1006
     translated to allocated color indices on pseudoColor devices and padded as required.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1007
     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
  1008
     method to whatever the device needs.
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1009
     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
  1010
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1011
    device
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1012
	drawBits:aByteArray
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1013
	bitsPerPixel:bpp 
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1014
	depth:depth  
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1015
	padding:8
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1016
	width:srcW height:srcH
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1017
	x:srcX y:srcY
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1018
	into:drawableId
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1019
	x:dstX y:dstY 
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1020
	width:(self width) height:(self height)
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1021
	with:gcId.
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1022
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1023
    "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
  1024
!
d8b8149ab79d added interface to specify padding in drawBits method
Claus Gittinger <cg@exept.de>
parents: 1842
diff changeset
  1025
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1026
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
  1027
    "copy from aDrawable into the receiver;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1028
     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
  1029
     All coordinates are in device coordinates."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1030
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1031
    ^ self
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1032
        copyFrom:aDrawable 
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1033
        x:srcX y:srcY 
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1034
        toX:dstX y:dstY 
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1035
        width:w height:h
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1036
        async:false
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1037
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1038
    "Modified: 29.1.1997 / 13:12:36 / cg"
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1039
!
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1040
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1041
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
  1042
    "copy from aDrawable into the receiver;
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1043
     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
  1044
     All coordinates are in device coordinates.
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1045
     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
  1046
     - otherwise, it returns when the scroll operation is finished.
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1047
     (not all devices care for this).
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1048
     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
  1049
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1050
    |deviceDrawable id srcGCId asy|
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1051
2210
18d4e83d08ad care for images being passed to #copyFrom: as source.
Claus Gittinger <cg@exept.de>
parents: 2192
diff changeset
  1052
    ((aDrawable graphicsDevice ~~ device)
18d4e83d08ad care for images being passed to #copyFrom: as source.
Claus Gittinger <cg@exept.de>
parents: 2192
diff changeset
  1053
    or:[aDrawable isImage]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1054
        deviceDrawable := aDrawable asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1055
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1056
        deviceDrawable := aDrawable
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1057
    ].
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1058
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1059
    id := deviceDrawable id.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1060
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1061
    "temporary ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1062
     this fixes a problem after restart on another display,
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1063
     when a file-bitmap was not found. 
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1064
     In this case, the id of the bitmap will be nil. 
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1065
     This will be fixed soon (no longer use device>>bitmapFromFile:).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1066
    "
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1067
    id isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1068
        'DeviceGraphicsContext [warning]: invalid bitmap copy - ignored' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1069
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1070
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1071
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1072
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1073
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1074
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1075
2065
27bf0cf42e45 changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2049
diff changeset
  1076
    deviceDrawable gcId isNil ifTrue:[deviceDrawable initGC].
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1077
    srcGCId := deviceDrawable gcId.
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1078
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1079
    ((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
  1080
        deviceDrawable isForm ifTrue:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1081
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1082
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1083
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1084
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1085
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1086
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1087
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1088
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1089
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1090
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1091
                height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1092
        ] ifFalse:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1093
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1094
                copyPlaneFromId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1095
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1096
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1097
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1098
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1099
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1100
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1101
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1102
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1103
                height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1104
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1105
    ] ifFalse:[
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1106
        deviceDrawable isForm ifTrue:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1107
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1108
                copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1109
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1110
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1111
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1112
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1113
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1114
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1115
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1116
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1117
                height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1118
        ] ifFalse:[
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1119
            asy := async or:[self isView not].
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1120
            asy ifFalse:[
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1121
                self catchExpose
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1122
            ].
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1123
            device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1124
                copyFromId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1125
                x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1126
                y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1127
                gc:srcGCId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1128
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1129
                x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1130
                y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1131
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1132
                width:w 
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1133
                height:h.
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1134
            asy ifFalse:[
1294
a5abff742fd8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
  1135
                device flush.
1291
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1136
                self waitForExpose
1480f8aae3bb explicit sync/async bitBlt.
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1137
            ]
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1138
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1139
    ]
868
65c93e5f6f8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
  1140
2210
18d4e83d08ad care for images being passed to #copyFrom: as source.
Claus Gittinger <cg@exept.de>
parents: 2192
diff changeset
  1141
    "Created: / 29.1.1997 / 13:02:10 / cg"
18d4e83d08ad care for images being passed to #copyFrom: as source.
Claus Gittinger <cg@exept.de>
parents: 2192
diff changeset
  1142
    "Modified: / 31.7.1998 / 17:23:43 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1143
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1144
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1145
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
  1146
    "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
  1147
     background, while 1's are drawn with foreground color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1148
     The depth of aDrawable must (should) be 1.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1149
     The drawable must have been allocated on the same device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1150
     All coordinates are in device coordinates."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1151
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  1152
    |deviceDrawable id|
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1153
2210
18d4e83d08ad care for images being passed to #copyFrom: as source.
Claus Gittinger <cg@exept.de>
parents: 2192
diff changeset
  1154
    ((aDrawable graphicsDevice ~~ device)
18d4e83d08ad care for images being passed to #copyFrom: as source.
Claus Gittinger <cg@exept.de>
parents: 2192
diff changeset
  1155
    or:[aDrawable isImage]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1156
        deviceDrawable := aDrawable asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1157
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1158
        deviceDrawable := aDrawable
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1159
    ].
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1160
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1161
    id := deviceDrawable id.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1162
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1163
    "temporary ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1164
     this fixes a problem after restart on another display,
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1165
     when a file-bitmap was not found. 
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1166
     In this case, the id of the bitmap will be nil.
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1167
     This will be fixed soon (no longer use device>>bitmapFromFile:).
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1168
    "
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  1169
    id isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1170
        'DeviceGraphicsContext [warning]: invalid copyPlane - ignored' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1171
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1172
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1173
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1174
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1175
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1176
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1177
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1178
    deviceDrawable isForm ifTrue:[
2271
46b68ae54cbc win32 needs source-gc to be initialized in a bitBlt.
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  1179
        deviceDrawable gcId isNil ifTrue:[
46b68ae54cbc win32 needs source-gc to be initialized in a bitBlt.
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  1180
            deviceDrawable initGC
46b68ae54cbc win32 needs source-gc to be initialized in a bitBlt.
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  1181
        ].
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1182
        device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1183
            copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1184
            x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1185
            y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1186
            gc:(deviceDrawable gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1187
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1188
            x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1189
            y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1190
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1191
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1192
            height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1193
    ] ifFalse:[
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1194
        device
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1195
            copyPlaneFromId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1196
            x:srcX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1197
            y:srcY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1198
            gc:(deviceDrawable gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1199
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1200
            x:dstX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1201
            y:dstY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1202
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1203
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1204
            height:h
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1205
    ]
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  1206
2271
46b68ae54cbc win32 needs source-gc to be initialized in a bitBlt.
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  1207
    "Modified: / 22.8.1998 / 15:15:52 / cg"
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1210
!DeviceGraphicsContext methodsFor:'copying'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1211
3611
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3569
diff changeset
  1212
executor
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3569
diff changeset
  1213
    "I am abstract"
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3569
diff changeset
  1214
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3569
diff changeset
  1215
    self subclassResponsibility.
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3569
diff changeset
  1216
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3569
diff changeset
  1217
    "Created: 2.4.1997 / 19:22:11 / cg"
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3569
diff changeset
  1218
!
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3569
diff changeset
  1219
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1220
postCopy
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1221
    "this may not be enough to allow copying of views ..."
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
    super postCopy.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1224
    device := drawableId := gcId := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1225
    self recreate
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1226
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1227
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1228
!DeviceGraphicsContext methodsFor:'drawing'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1229
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1230
displayArcX:x y:y width:w height:h from:startAngle angle:angle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1231
    "draw an arc; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1232
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  1233
    |pX pY nW nH sA a|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1234
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1235
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1236
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1237
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1238
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1239
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1240
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1241
	nW := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1242
	nH := transformation applyScaleY:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1243
	nW < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1244
	      nW := nW abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1245
	      pX := pX - nW.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1246
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1247
	nH < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1248
	      nH := nH abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1249
	      pY := pY - nH.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1250
	].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1251
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1252
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1253
	pY := y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1254
	nW := w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1255
	nH := h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1256
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1257
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1258
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1259
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1260
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1262
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  1263
    sA := startAngle.
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  1264
    sA isInteger ifFalse:[sA := sA asFloat].
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  1265
    a := angle.
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  1266
    a isInteger ifFalse:[a := a asFloat].
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  1267
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1268
    device
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1269
	  displayArcX:pX 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1270
		    y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1271
		width:nW 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1272
	       height:nH 
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  1273
		 from:sA 
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  1274
		angle:a
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1275
		   in:drawableId 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  1276
		 with:gcId
732
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
    "Created: 8.5.1996 / 08:31:30 / cg"
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  1279
    "Modified: 4.6.1996 / 17:59:28 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1280
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1281
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1282
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
  1283
    "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
  1284
     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
  1285
     current paint-color, leaving pixels with 0-bits unchanged
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1286
     (i.e. only 1-bits are drawn from the form).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1287
     If its a deep form (i.e. a pixmap) the current paint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1288
     settings are ignored and the form is drawn as-is. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1289
     Care must be taken, that the paint color is correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1290
     (by sending #on: to the color) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1291
     Using functions other than #copy only makes sense if you are
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1292
     certain, that the colors are real colors (actually, only for
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1293
     noColor or allColor)."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1294
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1295
    |realForm pX pY w h nW nH|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1296
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1297
    realForm := formToDraw.
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
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1300
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1301
        pY := transformation applyToY:y.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1302
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1303
        transformation noScale ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1304
            w := formToDraw width.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1305
            h := formToDraw height.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1306
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1307
            nW := (transformation applyScaleX:w) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1308
            nH := (transformation applyScaleY:h) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1309
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1310
            ((nW ~= w) or:[nH ~= h]) ifTrue:[
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
                "/ 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
  1313
                "/ 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
  1314
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1315
                realForm := nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1316
                CachedScaledForms notNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1317
                    (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
  1318
                        realForm := CachedScaledForms at:formToDraw ifAbsent:nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1319
                    ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1320
                ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1321
                realForm isNil ifTrue:[
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
                    "/ nope - must do the work ...
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
                    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
  1326
                    CachedScaledForms isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1327
                        CachedScaledForms := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1328
                        CachedScales := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1329
                    ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1330
                    CachedScaledForms at:formToDraw put:realForm.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1331
                    CachedScales at:formToDraw put:transformation scale.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1332
                ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1333
            ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1334
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1335
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1336
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1337
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1338
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1339
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1340
    self displayDeviceForm:realForm x:pX y:pY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1341
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1342
    "Modified: 12.4.1997 / 12:47:29 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1343
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1344
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1345
displayLineFromX:x0 y:y0 toX:x1 y:y1
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1346
    "draw a line (with current paint-color); apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1347
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1348
    |pX0 pY0 pX1 pY1 easy fgId bgId|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1349
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1350
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1351
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1352
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1353
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1354
    lineStyle == #doubleDashed ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1355
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1356
         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
  1357
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1358
        easy := true.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1359
        paint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1360
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1361
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1362
            fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1363
            fgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1364
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1365
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1366
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1367
        bgPaint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1368
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1369
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1370
            bgId := bgPaint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1371
            bgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1372
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1373
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1374
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1375
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1376
        easy ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1377
            ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1378
                device setForeground:fgId background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1379
                foreground := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1380
                background := bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1381
            ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1382
        ] ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1383
            'DeviceGraphicsContext [warning]: cannot draw dashes with dithered colors' errorPrintCR
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1384
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1385
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1386
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1387
    transformation notNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1388
        pX0 := transformation applyToX:x0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1389
        pY0 := transformation applyToY:y0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1390
        pX1 := transformation applyToX:x1.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1391
        pY1 := transformation applyToY:y1.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1392
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1393
        pX0 := x0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1394
        pY0 := y0.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1395
        pX1 := x1.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1396
        pY1 := y1
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1399
    pX0 := pX0 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1400
    pY0 := pY0 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1401
    pX1 := pX1 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1402
    pY1 := pY1 rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1403
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1404
    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
  1405
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1406
    "Modified: 10.1.1997 / 17:46:32 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1407
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1408
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1409
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
  1410
    "draw a form or image opaque; 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1411
     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
  1412
     current paint-color and 0-bits in the bgPaint color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1413
     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
  1414
     settings are ignored and the form drawn as-is. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1415
     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
  1416
     dithered colors or patterns, since are that the colors are correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1417
     (by sending #on: to the colors) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1418
     If there is a transformation, the image is scaled as appropiate."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1419
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1420
    |w h realForm pX pY nW nH|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1421
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1422
    bgPaint isNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1423
        "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1424
        "/ actually not an opaque draw
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1425
        "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1426
        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
  1427
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1428
    ].
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
    realForm := formToDraw.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1431
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1432
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1433
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1434
        pY := transformation applyToY:y.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1435
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1436
        transformation noScale ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1437
            w := formToDraw width.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1438
            h := formToDraw height.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1439
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1440
            nW := (transformation applyScaleX:w) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1441
            nH := (transformation applyScaleY:h) rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1442
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1443
            ((nW ~= w) or:[nH ~= h]) ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1444
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1445
                "/ 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
  1446
                "/ 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
  1447
                "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1448
                realForm := nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1449
                CachedScaledForms notNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1450
                    (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
  1451
                        realForm := CachedScaledForms at:formToDraw ifAbsent:nil.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1452
                    ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1453
                ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1454
                realForm isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1455
                    "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1456
                    "/ nope - must do the work ...
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1457
                    "/
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1458
                    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
  1459
                    CachedScaledForms isNil ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1460
                        CachedScaledForms := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1461
                        CachedScales := WeakIdentityDictionary new.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1462
                    ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1463
                    CachedScaledForms at:formToDraw put:realForm.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1464
                    CachedScales at:formToDraw put:transformation scale.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1465
                ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1466
            ]
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1467
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1468
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1469
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1470
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1471
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1472
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1473
    self displayDeviceOpaqueForm:realForm x:pX y:pY
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1474
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1475
    "Modified: 12.4.1997 / 12:49:02 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1476
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1477
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1478
displayOpaqueString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1479
    "draw a substring at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1480
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1481
     If the transformation involves scaling, 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1482
     the fonts point-size is scaled as appropriate.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1483
     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
  1484
     the case where paint and/or bgPaint are dithered colors"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1485
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1486
    |easy w h savedPaint fgId bgId
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1487
     id pX pY fontUsed fontsEncoding sz s|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1488
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1489
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1490
     if backgroundPaint color is nil, we assume
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1491
     this is a non-opaque draw
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1492
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1493
    bgPaint isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1494
        self displayString:aString from:index1 to:index2 x:x y:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1495
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1496
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1497
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1498
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1499
    or:[aString isText]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1500
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1501
         hook for non-strings (i.e. attributed text)
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1502
         that 'thing' should know how to display itself ...
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1503
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1504
        aString displayOpaqueOn:self x:x y:y from:index1 to:index2.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1505
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1506
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1507
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1508
    gcId isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1509
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1510
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1511
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1512
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1513
    transformation notNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1514
        pX := transformation applyToX:x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1515
        pY := transformation applyToY:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1516
        transformation noScale ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1517
            sz := font size.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1518
            sz isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1519
                "/ oops - not a real font; use original font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1520
                fontUsed := font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1521
            ] ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1522
                fontUsed := font size:(transformation applyScaleY:sz) rounded.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1523
            ]
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1524
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1525
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1526
        pX := x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1527
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1528
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1529
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1530
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1531
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  1532
    fontUsed := fontUsed onDevice:device.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1533
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1534
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1535
    id isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1536
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1537
         hook for alien fonts
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1538
         that 'font' should know how to display the string ...
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1539
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1540
        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
  1541
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1542
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1543
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1544
    s := aString.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1545
    fontUsed := fontUsed onDevice:device.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1546
    fontsEncoding := fontUsed encoding.
4056
67c4686afbc6 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1547
    (characterEncoding ~~ fontsEncoding) ifTrue:[
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1548
        s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding.
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
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1552
     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
  1553
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1554
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1555
    paint isColor ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1556
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1557
    ] ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1558
        fgId := paint colorId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1559
        fgId isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1560
            easy := false
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1561
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1562
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1563
    bgPaint isColor ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1564
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1565
    ] ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1566
        bgId := bgPaint colorId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1567
        bgId isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1568
            easy := false
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1569
        ]
732
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
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1572
    deviceFont ~~ fontUsed ifTrue:[
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1573
        device setFont:id in:gcId.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1574
        deviceFont := fontUsed
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1575
    ].
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1576
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1577
    easy ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1578
        device setForeground:fgId background:bgId in:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1579
        foreground := paint.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1580
        background := bgPaint.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1581
        device displayOpaqueString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId.
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1582
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1583
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1584
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1585
    w := fontUsed widthOf:s from:index1 to:index2.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1586
    h := fontUsed height.
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
    (fgId notNil and:[function == #copy]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1589
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1590
         only bg is dithered; fill with bg first ...
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1591
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1592
        savedPaint := paint.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1593
        self paint:bgPaint.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1594
        self fillDeviceRectangleX:pX y:(pY - fontUsed ascent) width:w height:h.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1595
        self paint:savedPaint.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1596
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1597
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1598
         then draw using fgPaint (which is a real color)
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1599
        "
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1600
        device displayString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId.
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1601
        ^ self
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
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1604
    "/ the very hard case (fg-dither)
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1605
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1606
    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
  1607
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1608
    "Modified: 30.6.1997 / 15:06:15 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1609
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1610
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1611
displayOpaqueString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1612
    "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
  1613
     background pixels in bgPaint color. If the transformation involves scaling, 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1614
     the fonts point-size is scaled as appropriate.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1615
     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
  1616
     the case where paint and/or bgPaint are dithered colors or images."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1617
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1618
    |id easy fgId bgId pX pY fontUsed fontsEncoding sz s|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1619
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1620
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1621
     if backgroundPaint color is nil, we assume
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1622
     this is a non-opaque draw
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
    bgPaint isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1625
        self displayString:aString x:x y:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1626
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1627
    ].
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
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1630
    or:[aString isText]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1631
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1632
         hook for non-strings (i.e. attributed text)
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1633
         that 'thing' should know how to display itself ...
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1634
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1635
        aString displayOpaqueOn:self x:x y:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1636
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1637
    ].
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
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1640
     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
  1641
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1642
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1643
    paint isColor ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1644
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1645
    ] ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1646
        fgId := paint colorId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1647
        fgId isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1648
            easy := false
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1649
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1650
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1651
    bgPaint isColor ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1652
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1653
    ] ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1654
        bgId := bgPaint colorId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1655
        bgId isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1656
            easy := false
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1657
        ]
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
    easy ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1660
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1661
         for the hard case, use the general drawing method
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1662
         (no need for optimizations - its slow anyway)
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1663
        "
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1664
        self displayOpaqueString:aString from:1 to:(aString size) x:x y:y. 
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1665
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1666
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1667
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1668
    gcId isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1669
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1670
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1671
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1672
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1673
    transformation notNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1674
        pX := transformation applyToX:x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1675
        pY := transformation applyToY:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1676
        transformation noScale ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1677
            sz := font size.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1678
            sz isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1679
                "/ oops - not a real font; use original font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1680
                fontUsed := font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1681
            ] ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1682
                fontUsed := font size:(transformation applyScaleY:sz) rounded.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1683
            ]
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1684
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1685
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1686
        pX := x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1687
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1688
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1689
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1690
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1691
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1692
    s := aString.
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  1693
    fontUsed := fontUsed onDevice:device.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1694
    fontsEncoding := fontUsed encoding.
4056
67c4686afbc6 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1695
    (characterEncoding ~~ fontsEncoding) ifTrue:[
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1696
        s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1697
    ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1698
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1699
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1700
    id isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1701
        "
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1702
         hook for alien fonts
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1703
         that 'font' should know how to display the string ...
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1704
        "
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1705
        fontUsed displayOpaqueString:s from:1 to:(s size) x:x y:y in:self.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1706
    ] ifFalse:[
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1707
        deviceFont ~~ fontUsed ifTrue:[
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1708
            device setFont:id in:gcId.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1709
            deviceFont := fontUsed
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1710
        ].
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1711
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1712
        device setForeground:fgId background:bgId in:gcId.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1713
        foreground := paint.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1714
        background := bgPaint.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1715
        device displayOpaqueString:s x:pX y:pY in:drawableId with:gcId.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1716
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1717
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1718
    "Modified: 30.6.1997 / 15:06:17 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1719
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1720
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1721
displayPointX:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1722
    "draw a point (with current paint-color); apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1723
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1724
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1725
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1726
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1727
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1728
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1729
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1730
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1731
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1732
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1733
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1734
	pY := y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1735
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1736
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1737
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1738
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1739
    device displayPointX:pX y:pY in:drawableId with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1740
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1741
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1742
displayPolygon:aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1743
    "draw (the outline of) a polygon (with current paint-color).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1744
     Apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1745
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1746
    |newPolygon|
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
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1749
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1750
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1751
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1752
	newPolygon := aPolygon collect:[:point | transformation applyTo:point].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1753
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1754
	newPolygon := aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1755
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1756
    (newPolygon findFirst:[:p | 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1757
	(p isPoint not 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1758
	or:[(p x class ~~ SmallInteger)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1759
	or:[(p y class ~~ SmallInteger)]])
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1760
     ]) ~~ 0 ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1761
	newPolygon := newPolygon collect:[:p | p asPoint rounded]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1762
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1763
        
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1764
    device displayPolygon:newPolygon in:drawableId with:gcId
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1767
displayRectangleX:x y:y width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1768
    "draw a rectangle (with current paint-color).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1769
     If transformation is nonNil, drawing is in logical coordinates."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1770
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  1771
    |pX pY nW nH easy fgId bgId|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1772
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1773
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1774
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1775
    ].
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
    lineStyle == #doubleDashed ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1778
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1779
         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
  1780
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1781
        easy := true.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1782
        paint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1783
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1784
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1785
            fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1786
            fgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1787
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1788
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1789
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1790
        bgPaint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1791
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1792
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1793
            bgId := bgPaint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1794
            bgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1795
                easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1796
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1797
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1798
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1799
        easy ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1800
            ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1801
                device setForeground:fgId background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1802
                foreground := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1803
                background := bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1804
            ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1805
        ] ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1806
            'DeviceGraphicsContext [warning]: cannot draw dashes with dithered colors' errorPrintCR
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1807
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1808
    ].
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
    transformation notNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1811
        pX := transformation applyToX:x.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1812
        pY := transformation applyToY:y.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1813
        nW := transformation applyScaleX:w.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1814
        nH := transformation applyScaleY:h.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1815
        nW < 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1816
              nW := nW abs.  
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1817
              pX := pX - nW.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1818
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1819
        nH < 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1820
              nH := nH abs.  
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1821
              pY := pY - nH.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1822
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1823
    ] ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1824
        pX := x.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1825
        pY := y.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1826
        nW := w.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1827
        nH := h
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1828
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1829
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1830
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1831
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1832
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1833
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1834
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1835
    "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
  1836
     this one seems mathematically incorrect but allows to draw and fill
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1837
     a rectangle using the same extents.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1838
     I'm not certain if is the right thing to do ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1839
    "
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  1840
    device displayRectangleX:pX 
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1841
                           y:pY 
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1842
                       width:(nW - 1) 
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1843
                      height:(nH - 1)
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1844
                          in:drawableId with:gcId
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1845
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1846
    "Modified: 10.1.1997 / 17:46:41 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1847
!
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
displayString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1850
    "draw a substring at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1851
     draw foreground-pixels only (in current paint-color), 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1852
     leaving background as-is. If the transformation involves scaling,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1853
     the fonts point-size is scaled as appropriate."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1854
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1855
    |id pX pY fontUsed sz s fontsEncoding|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1856
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1857
    "hook for non-strings (i.e. attributed text)"
3666
01d7bf1d2333 fixed Text drawing in displayString
Michael Beyl <mb@exept.de>
parents: 3630
diff changeset
  1858
    (aString isString not
01d7bf1d2333 fixed Text drawing in displayString
Michael Beyl <mb@exept.de>
parents: 3630
diff changeset
  1859
    or:[aString isText]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1860
        ^ aString displayOn:self x:x y:y from:index1 to:index2
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1861
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1862
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1863
    gcId isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1864
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1865
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1866
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1867
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1868
    transformation notNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1869
        pX := transformation applyToX:x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1870
        pY := transformation applyToY:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1871
        transformation noScale ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1872
            sz := font size.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1873
            sz isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1874
                "/ oops - not a real font; use original font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1875
                fontUsed := font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1876
            ] ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1877
                fontUsed := font size:(transformation applyScaleY:sz) rounded.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1878
            ]
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1879
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1880
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1881
        pX := x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1882
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1883
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1884
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1885
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1886
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1887
    s := aString.
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  1888
    fontUsed := fontUsed onDevice:device.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1889
    fontsEncoding := fontUsed encoding.
4056
67c4686afbc6 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1890
    (characterEncoding ~~ fontsEncoding) ifTrue:[
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1891
        s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1892
    ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1893
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1894
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1895
    id isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1896
        "hook for alien fonts"
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1897
        font displayString:s from:index1 to:index2 x:x y:y in:self.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1898
    ] ifFalse:[
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1899
        deviceFont ~~ fontUsed ifTrue:[
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1900
            device setFont:id in:gcId.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1901
            deviceFont := fontUsed
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1902
        ].
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1903
        device displayString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId
732
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
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1906
    "Modified: 1.7.1997 / 17:08:44 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1907
!
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
displayString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1910
    "draw a string at the coordinate x/y - 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1911
     draw foreground-pixels only (in current paint-color), 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1912
     leaving background as-is. If the transformation involves scaling, 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1913
     the fonts point-size is scaled as appropriate."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1914
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1915
    |id pX pY fontUsed sz s fontsEncoding|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1916
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1917
    "hook for non-strings (i.e. attributed text)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1918
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1919
    or:[aString isText]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1920
        ^ aString displayOn:self x:x y:y
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1921
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1922
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1923
    gcId isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1924
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1925
    ].
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
    fontUsed := font.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1928
    transformation notNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1929
        pX := transformation applyToX:x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1930
        pY := transformation applyToY:y.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1931
        transformation noScale ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1932
            sz := font size.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1933
            sz isNil ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1934
                "/ oops - not a real font; use original font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1935
                fontUsed := font
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1936
            ] ifFalse:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1937
                fontUsed := font size:(transformation applyScaleY:sz) rounded.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1938
            ]
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1939
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1940
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1941
        pX := x.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1942
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1943
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1944
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1945
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1946
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1947
    s := aString.
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  1948
    fontUsed := fontUsed onDevice:device.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1949
    fontsEncoding := fontUsed encoding.
4056
67c4686afbc6 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1950
    (characterEncoding ~~ fontsEncoding) ifTrue:[
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1951
        s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1952
    ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1953
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1954
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1955
    id isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1956
        "hook for alien fonts"
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  1957
        fontUsed displayString:s x:x y:y in:self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1958
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1959
        deviceFont ~~ fontUsed ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1960
            device setFont:id in:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1961
            deviceFont := fontUsed
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1962
        ].
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  1963
        device displayString:s x:pX y:pY in:drawableId with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1964
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1965
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1966
    "Modified: 1.7.1997 / 17:08:35 / cg"
732
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
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
  1970
    "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
  1971
     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
  1972
     current paint-color, leaving pixels with 0-bits unchanged
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1973
     (i.e. only 1-bits are drawn from the form).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1974
     If its a deep form (i.e. a pixmap) the current paint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1975
     settings are ignored and the form is drawn as-is. 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1976
     Care must be taken, that the paint color is correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1977
     (by sending #on: to the color) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1978
     Using functions other than #copy only makes sense if you are
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1979
     certain, that the colors are real colors (actually, only for
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1980
     noColor or allColor).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1981
     The origins coordinate is transformed, but the image itself is unscaled."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1982
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1983
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1984
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1985
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1986
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1987
        pY := transformation applyToY:y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1988
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1989
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1990
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1991
    ].
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
    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
  1994
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  1995
    "Modified: 12.4.1997 / 12:48:04 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1996
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1997
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1998
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
  1999
    "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
  2000
     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
  2001
     current paint-color, 0 bits in background color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2002
     If its a deep form (i.e. a pixmap) the current paint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2003
     settings are ignored and the form is drawn as-is (opaque). 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2004
     The origins coordinate is transformed, but the image itself is unscaled."
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
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2007
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2008
    transformation notNil ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2009
        pX := transformation applyToX:x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2010
        pY := transformation applyToY:y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2011
    ] ifFalse:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2012
        pX := x.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2013
        pY := y.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2014
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2015
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2016
    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
  2017
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2018
    "Modified: 12.4.1997 / 12:49:21 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2019
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2020
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2021
displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2022
    "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
  2023
     Draw foreground pixels in paint-color, background pixels in bgPaint color."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2024
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2025
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2026
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2027
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2028
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2029
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2030
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2031
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2032
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2033
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2034
    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
  2035
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2036
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2037
displayUnscaledOpaqueString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2038
    "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
  2039
     Draw foreground pixels in paint-color, background pixels in bgPaint color."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2040
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2041
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2042
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2043
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2044
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2045
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2046
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2047
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2048
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2049
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2050
    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
  2051
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2052
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2053
displayUnscaledString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2054
    "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
  2055
     draw foreground-pixels only (in current paint-color), leaving background as-is."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2056
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2057
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2058
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2059
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2060
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2061
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2062
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2063
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2064
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2065
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2066
    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
  2067
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2068
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2069
displayUnscaledString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2070
    "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
  2071
     draw foreground-pixels only (in current paint-color), leaving background as-is."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2072
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2073
    |pX pY|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2074
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2075
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2076
	pX := transformation applyToX:x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2077
	pY := transformation applyToY:y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2078
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2079
	pX := x.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2080
	pY := y.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2081
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2082
    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
  2083
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2084
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2085
!DeviceGraphicsContext methodsFor:'drawing in device coordinates'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2086
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2087
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
  2088
    "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
  2089
     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
  2090
     current paint-color, leaving pixels with 0-bits unchanged
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2091
     (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
  2092
     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
  2093
     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
  2094
     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
  2095
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2096
     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
  2097
     otherwise its converted here, which slows down the draw.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2098
     No transformation or scaling is done.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2099
     Care must be taken, that the paint color is correctly allocated 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2100
     (by sending #on: to the color) before doing so.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2101
     Using functions other than #copy only makes sense if you are
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2102
     certain, that the colors are real colors (actually, only for
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2103
     noColor or allColor)."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2104
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2105
    |id w h easy paintDither tmpForm tmpId tmpGCId 
3530
d90974c7d477 setForegroundColor/setBackgroundColor
james
parents: 3429
diff changeset
  2106
     fgId noColor allColor allBits pX pY 
2865
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2107
     mask maskId deviceForm deviceFormGCId deviceMask colorMap|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2108
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2109
    w := aForm width.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2110
    h := aForm height.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2111
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2112
    pX := x rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2113
    pY := y rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2114
1034
5f6f417dcb12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  2115
    deviceForm := aForm asFormOn:device.
2192
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2116
    deviceForm isNil ifTrue:[
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2117
        'DeviceGraphicsContext [warning]: cannot create device-form' errorPrintCR.
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2118
        ^self
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2119
    ].
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2120
    id := deviceForm id.
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2121
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2122
    id isNil ifTrue:[
1237
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
  2123
        'DeviceGraphicsContext [warning]: invalid form draw - ignored' errorPrintCR.
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
  2124
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2125
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2126
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2127
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2128
    ].
2865
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2129
    (deviceFormGCId := deviceForm gcId) isNil ifTrue:[
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2130
        "/ device needGCForBitmapSource  - i.e. WIN32
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2131
        device platformName ~= 'X11' ifTrue:[
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2132
            deviceForm initGC.
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2133
            deviceFormGCId := deviceForm gcId.
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2134
        ]
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2135
    ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2136
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2137
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2138
     a deep form ignores paint/bgPaint settings
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2139
    "
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  2140
    mask := aForm mask.
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  2141
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  2142
    ((aForm depth ~~ 1) 
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  2143
    or:[mask notNil]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2144
        mask notNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2145
            mask depth == 1 ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2146
                'DEVGC: alpha channel not yet supported' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2147
            ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2148
                deviceMask := mask asFormOn:device.
2192
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2149
                deviceMask isNil ifTrue:[
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2150
                    'DeviceGraphicsContext [warning]: cannot create device-mask' errorPrintCR.
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2151
                    ^self
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2152
                ].
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2153
                maskId := deviceMask id.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2154
                maskId notNil ifTrue:[
2192
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2155
                    deviceMask gcId isNil ifTrue:[deviceMask initGC].
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2156
                    allColor := Color allColor.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2157
                    allBits := allColor colorId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2158
1599
55a782d2c2f5 oops - masked image draw with depth1 images was wrong
Claus Gittinger <cg@exept.de>
parents: 1592
diff changeset
  2159
                    (deviceForm depth == device depth 
55a782d2c2f5 oops - masked image draw with depth1 images was wrong
Claus Gittinger <cg@exept.de>
parents: 1592
diff changeset
  2160
                    and:[aForm maskedPixelsAre0]) ifTrue:[
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2161
                        "/ 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
  2162
                        "/   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
  2163
                        "/   of the destination.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2164
                        "/   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
  2165
                        "/   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
  2166
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2167
                        "/ stamp out using mask
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2168
                        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
  2169
                        device setFunction:#and in:gcId.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2170
                        device
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2171
                            copyPlaneFromPixmapId:maskId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2172
                            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2173
                            y:0 
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2174
                            gc:(deviceMask gcId)
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2175
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2176
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2177
                            y:pY 
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2178
                            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2179
                            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2180
                            height:h.
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2181
                        "/ or-in the form
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2182
                        device setFunction:#or in:gcId.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2183
                        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2184
                            copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2185
                            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2186
                            y:0 
2865
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2187
                            gc:deviceFormGCId
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2188
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2189
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2190
                            y:pY 
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2191
                            gc:gcId
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2192
                            width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2193
                            height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2194
                    ] ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2195
                        "/ 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
  2196
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2197
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2198
                         create temp-form;
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2199
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2200
                        tmpForm := Form width:w height:h depth:device depth on:device.
2192
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2201
                        tmpForm isNil ifTrue:[
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2202
                            'DeviceGraphicsContext [warning]: cannot create temp form' errorPrintCR.
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2203
                            ^self
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2204
                        ].
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2205
                        tmpForm initGC.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2206
                        tmpId := tmpForm id.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2207
                        tmpGCId := tmpForm gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2208
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2209
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2210
                         fill tempform with image
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2211
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2212
                        aForm depth == 1 ifTrue:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2213
                            (colorMap := aForm colorMap) notNil ifTrue:[
3569
38818408ecae care for monochrome image with a single color in its colorMap
Claus Gittinger <cg@exept.de>
parents: 3530
diff changeset
  2214
                                colorMap size < 2 ifTrue:[
38818408ecae care for monochrome image with a single color in its colorMap
Claus Gittinger <cg@exept.de>
parents: 3530
diff changeset
  2215
                                    device 
38818408ecae care for monochrome image with a single color in its colorMap
Claus Gittinger <cg@exept.de>
parents: 3530
diff changeset
  2216
                                        setForegroundColor:(colorMap at:1) 
38818408ecae care for monochrome image with a single color in its colorMap
Claus Gittinger <cg@exept.de>
parents: 3530
diff changeset
  2217
                                        in:tmpGCId.
38818408ecae care for monochrome image with a single color in its colorMap
Claus Gittinger <cg@exept.de>
parents: 3530
diff changeset
  2218
                                ] ifFalse:[
38818408ecae care for monochrome image with a single color in its colorMap
Claus Gittinger <cg@exept.de>
parents: 3530
diff changeset
  2219
                                    device 
38818408ecae care for monochrome image with a single color in its colorMap
Claus Gittinger <cg@exept.de>
parents: 3530
diff changeset
  2220
                                        setForegroundColor:(colorMap at:2) 
38818408ecae care for monochrome image with a single color in its colorMap
Claus Gittinger <cg@exept.de>
parents: 3530
diff changeset
  2221
                                        backgroundColor:(colorMap at:1) 
38818408ecae care for monochrome image with a single color in its colorMap
Claus Gittinger <cg@exept.de>
parents: 3530
diff changeset
  2222
                                        in:tmpGCId.
38818408ecae care for monochrome image with a single color in its colorMap
Claus Gittinger <cg@exept.de>
parents: 3530
diff changeset
  2223
                                ]
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2224
                            ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2225
                            device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2226
                                copyPlaneFromPixmapId:id
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2227
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2228
                                y:0 
2865
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2229
                                gc:deviceFormGCId
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2230
                                to:tmpId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2231
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2232
                                y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2233
                                gc:tmpGCId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2234
                                width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2235
                                height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2236
                        ] ifFalse:[
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2237
                            device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2238
                                copyFromPixmapId:id
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2239
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2240
                                y:0 
2865
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2241
                                gc:deviceFormGCId
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2242
                                to:tmpId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2243
                                x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2244
                                y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2245
                                gc:tmpGCId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2246
                                width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2247
                                height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2248
                        ].
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2249
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2250
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2251
                         stamp out mask in temp form
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2252
                        "
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2253
                        device setForeground:allBits background:0 in:tmpGCId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2254
                        device setFunction:#and in:tmpGCId.
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2255
                        device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2256
                            copyPlaneFromPixmapId:maskId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2257
                            x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2258
                            y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2259
                            gc:(deviceMask gcId)
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2260
                            to:tmpId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2261
                            x:0 
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2262
                            y:0 
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2263
                            gc:tmpGCId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2264
                            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2265
                            height:h.
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2266
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2267
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2268
                         stamp out mask in destination
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2269
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2270
                        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
  2271
                        device setFunction:#and in:gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2272
                        device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2273
                            copyPlaneFromPixmapId:maskId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2274
                            x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2275
                            y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2276
                            gc:(deviceMask gcId)
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2277
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2278
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2279
                            y:pY 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2280
                            gc:gcId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2281
                            width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2282
                            height:h.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2283
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2284
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2285
                         or-in tempform-bits ...
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2286
                        "
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2287
                        device setFunction:#or in:gcId.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2288
                        device
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2289
                            copyFromPixmapId:tmpId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2290
                            x:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2291
                            y:0 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2292
                            gc:tmpGCId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2293
                            to:drawableId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2294
                            x:pX 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2295
                            y:pY 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2296
                            gc:gcId
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2297
                            width:w 
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2298
                            height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2299
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2300
                        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2301
                         release tempForm immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2302
                         (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2303
                          this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2304
                        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2305
                        tmpForm destroy.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2306
                    ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2307
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2308
                    "/ restore GC
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2309
                    foreground notNil ifTrue:[
3530
d90974c7d477 setForegroundColor/setBackgroundColor
james
parents: 3429
diff changeset
  2310
                        device setForegroundColor:foreground in:gcId.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2311
                    ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2312
                    background notNil ifTrue:[
3530
d90974c7d477 setForegroundColor/setBackgroundColor
james
parents: 3429
diff changeset
  2313
                        device setBackgroundColor:background in:gcId 
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2314
                    ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2315
                    device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2316
                    ^ self
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2317
                ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2318
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2319
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2320
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2321
        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2322
            copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2323
            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2324
            y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2325
            gc:deviceForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2326
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2327
            x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2328
            y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2329
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2330
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2331
            height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2332
        ^ self
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2335
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2336
     the following code is somewhat complicated, since it has to deal
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2337
     with dithered paint colors, which cannot be done directly on most
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2338
     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
  2339
     (just assume drawing a bitmap with dithered paint color ... sigh)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2340
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2341
1507
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2342
    easy := (function == #copy).
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2343
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2344
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2345
     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
  2346
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2347
    easy ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2348
        paint isColor ifFalse:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2349
            paintDither := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2350
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2351
        ] ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2352
            paintDither := paint ditherForm.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2353
            paintDither notNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2354
                easy := false.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2355
            ]
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2356
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2357
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2358
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2359
    allColor := Color allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2360
    allBits := allColor colorId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2361
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2362
    easy ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2363
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2364
         paint is a real color
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2365
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2366
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2367
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2368
         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
  2369
         operation ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2370
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2371
        fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2372
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2373
        ((fgId ~~ ((1 bitShift:device depth)-1))
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2374
        and:[fgId ~~ allBits]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2375
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2376
             clear fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2377
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2378
            device setForeground:0 background:allBits in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2379
            device setFunction:#and in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2380
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2381
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2382
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2383
                y:0 
2865
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2384
                gc:deviceFormGCId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2385
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2386
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2387
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2388
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2389
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2390
                height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2391
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2392
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2393
        fgId ~~ 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2394
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2395
             or-in fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2396
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2397
            device setForeground:fgId background:0 in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2398
            device setFunction:#or in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2399
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2400
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2401
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2402
                y:0 
2865
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2403
                gc:deviceFormGCId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2404
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2405
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2406
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2407
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2408
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2409
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2410
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2411
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2412
         flush foreground/background cache
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2413
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2414
        foreground := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2415
        background := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2416
        device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2417
        ^ self
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
1507
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2420
    function == #or ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2421
        easy := paint notNil
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2422
                and:[paint isColor
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2423
                and:[paint ditherForm isNil]].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2424
        easy ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2425
            easy := bgPaint isNil
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2426
                        or:[bgPaint isColor
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2427
                            and:[bgPaint colorId == 0]]
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2428
        ].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2429
        easy ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2430
            fgId := paint colorId.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2431
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2432
            fgId ~~ 0 ifTrue:[
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2433
                "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2434
                 or-in fg-bits ...
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2435
                "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2436
                device setForeground:fgId background:0 in:gcId.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2437
                device
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2438
                    copyPlaneFromPixmapId:id
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2439
                    x:0 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2440
                    y:0 
2865
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2441
                    gc:deviceFormGCId
1507
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2442
                    to:drawableId
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2443
                    x:pX 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2444
                    y:pY 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2445
                    gc:gcId
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2446
                    width:w 
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2447
                    height:h
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2448
            ].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2449
            "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2450
             flush foreground/background cache
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2451
            "
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2452
            foreground := nil.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2453
            background := nil.
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2454
            ^ self
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2455
        ].
358603f58138 faster drawing in or-mode.
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
  2456
    ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2457
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2458
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2459
     hard case; paint is a dithered color
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2460
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2461
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2462
    noColor := Color noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2463
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2464
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2465
     create temp-form;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2466
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2467
    tmpForm := Form width:w height:h depth:device depth on:device.
2192
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2468
    tmpForm isNil ifTrue:[
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2469
        'DeviceGraphicsContext [warning]: cannot create temp form' errorPrintCR.
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2470
        ^self
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2471
    ].
732
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
     fill tempform
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
    tmpForm paint:paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2476
    tmpForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2477
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2478
     stamp out background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2479
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2480
    tmpForm paint:allColor on:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2481
    tmpForm function:#and.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2482
    tmpForm displayOpaqueForm:deviceForm x:0 y:0.
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
     stamp out foreground from destination
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2485
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2486
    device setForeground:0 background:allBits in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2487
    device setFunction:#and in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2488
    device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2489
        copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2490
        x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2491
        y:0 
2865
a97dc9f1e21a no need to create a GC for source bitmap under X
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  2492
        gc:deviceFormGCId
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2493
        to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2494
        x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2495
        y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2496
        gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2497
        width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2498
        height:h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2499
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2500
     or-in temp into destination
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2501
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2502
    device setForeground:allBits background:0 in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2503
    device setFunction:#or in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2504
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2505
    device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2506
        copyFromPixmapId:tmpForm id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2507
        x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2508
        y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2509
        gc:tmpForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2510
        to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2511
        x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2512
        y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2513
        gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2514
        width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2515
        height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2516
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2517
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2518
     release tempForm immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2519
     (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2520
      this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2521
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2522
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2523
    tmpForm destroy.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2524
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2525
     flush foreground/background cache
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2526
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2527
    foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2528
    background := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2529
    device setFunction:function in:gcId.
768
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  2530
2192
01f76f23f03f handle case when no deviceForms can be created,
Claus Gittinger <cg@exept.de>
parents: 2065
diff changeset
  2531
    "Modified: / 27.7.1998 / 20:07:22 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2532
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2533
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2534
displayDeviceLineFromX:x0 y:y0 toX:x1 y:y1
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2535
    "draw a line (with current paint-color) in device coordinate space.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2536
     This ignores any transformations. The coordinates must be integers."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2537
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2538
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2539
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2540
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2541
    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
  2542
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2543
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2544
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
  2545
    "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
  2546
     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
  2547
     current paint-color and 0-bits in the bgPaint color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2548
     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
  2549
     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
  2550
     Any mask is ignored.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2551
     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
  2552
     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
  2553
     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
  2554
     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
  2555
     its converted here, which slows down the draw.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2556
     Drawing is in device coordinates; no scaling is done."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2557
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2558
    |id w h easy savedPaint bgForm fgForm tmpForm 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2559
     fgId bgId noColor allColor allBits dx dy
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2560
     pX pY deviceDepth deviceForm|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2561
1033
b5cd84ed805f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  2562
    deviceForm := aForm asFormOn:device.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2563
    id := deviceForm id.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2564
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2565
    "temporary ..."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2566
    (id isNil 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2567
    or:[aForm graphicsDevice ~~ device]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2568
        deviceForm := deviceForm asFormOn:device.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2569
        id := deviceForm id.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2570
        id isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2571
            'DeviceGraphicsContext [warning]: invalid form draw - ignored' errorPrintCR.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2572
            ^ self
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2573
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2574
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2575
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2576
    gcId isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2577
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2578
    ].
2065
27bf0cf42e45 changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2049
diff changeset
  2579
    deviceForm gcId isNil ifTrue:[deviceForm initGC].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2580
1592
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2581
    w := aForm width.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2582
    h := aForm height.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2583
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2584
    pX := x rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2585
    pY := y rounded.
7ec770f2047a faster image drawing if masked pixels are known
Claus Gittinger <cg@exept.de>
parents: 1517
diff changeset
  2586
902
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2587
    "
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2588
     a deep form ignores paint/bgPaint settings
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2589
     and is always drawn opaque.
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2590
    "
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2591
    (aForm depth ~~ 1) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2592
        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2593
            copyFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2594
            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2595
            y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2596
            gc:deviceForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2597
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2598
            x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2599
            y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2600
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2601
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2602
            height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2603
        ^ self
902
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2604
    ].
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2605
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2606
    "/ 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
  2607
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2608
    bgPaint isNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2609
        self displayDeviceForm:aForm x:x y:y.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2610
        ^ self
902
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2611
    ].
7f5d81d377de opaque image display fix
Claus Gittinger <cg@exept.de>
parents: 895
diff changeset
  2612
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2613
    "the following code is somewhat complicated, since it has to deal
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2614
     with dithered fg/bg colors, which cannot be done directly on most
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2615
     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
  2616
     (just assume drawing a bitmap with dithered fg/bg colors ... sigh)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2617
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2618
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2619
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2620
     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
  2621
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2622
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2623
    paint isColor ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2624
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2625
    ] ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2626
        fgId := paint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2627
        fgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2628
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2629
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2630
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2631
    bgPaint isColor ifFalse:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2632
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2633
    ] ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2634
        bgId := bgPaint colorId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2635
        bgId isNil ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2636
            easy := false
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2637
        ]
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
    easy ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2641
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2642
         easy: both paint and bgPaint are real colors
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2643
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2644
        ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2645
            device setForeground:fgId background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2646
            foreground := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2647
            background := bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2648
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2649
        device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2650
            copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2651
            x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2652
            y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2653
            gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2654
            to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2655
            x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2656
            y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2657
            gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2658
            width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2659
            height:h.
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2660
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2661
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2662
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2663
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2664
     hard case: paint and/or bgPaint are dithered or patterns
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2665
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2666
    allColor := Color allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2667
    allBits := allColor colorId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2668
    deviceDepth := device depth.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2669
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2670
    (fgId notNil and:[function == #copy]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2671
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2672
         only bg is dithered; fill with bg first ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2673
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2674
        savedPaint := paint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2675
        self paint:bgPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2676
        self fillDeviceRectangleX:pX y:pY width:w height:h.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2677
        self paint:savedPaint.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2678
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2679
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2680
         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
  2681
         operation ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2682
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2683
        ((fgId ~~ ((1 bitShift:deviceDepth)-1))
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2684
        and:[fgId ~~ allBits]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2685
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2686
             clear fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2687
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2688
            device setForeground:0 background:allBits in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2689
            device setFunction:#and in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2690
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2691
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2692
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2693
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2694
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2695
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2696
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2697
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2698
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2699
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2700
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2701
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2702
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2703
        fgId ~~ 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2704
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2705
             or-in fg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2706
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2707
            device setForeground:fgId background:0 in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2708
            device setFunction:#or in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2709
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2710
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2711
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2712
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2713
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2714
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2715
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2716
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2717
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2718
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2719
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2720
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2721
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2722
         flush foreground/background cache
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2723
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2724
        foreground := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2725
        background := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2726
        device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2727
        ^ self
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
    (bgId notNil and:[function == #copy]) ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2731
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2732
         only fg is dithered; fill with fg first ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2733
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2734
        self fillDeviceRectangleX:pX y:pY width:w height:h.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2735
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2736
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2737
         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
  2738
         operation ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2739
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2740
        ((bgId ~~ ((1 bitShift:deviceDepth)-1))
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2741
        and:[bgId ~~ allBits]) ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2742
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2743
             clear bg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2744
            "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2745
            device setForeground:allBits background:0 in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2746
            device setFunction:#and in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2747
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2748
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2749
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2750
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2751
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2752
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2753
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2754
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2755
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2756
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2757
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2758
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2759
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2760
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2761
         or-in bg-bits ...
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2762
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2763
        bgId ~~ 0 ifTrue:[
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2764
            device setForeground:0 background:bgId in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2765
            device setFunction:#or in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2766
            device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2767
                copyPlaneFromPixmapId:id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2768
                x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2769
                y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2770
                gc:(deviceForm gcId)
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2771
                to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2772
                x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2773
                y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2774
                gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2775
                width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2776
                height:h
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2777
        ].
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2778
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2779
         flush foreground/background cache
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2780
        "
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2781
        foreground := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2782
        background := nil.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2783
        device setFunction:function in:gcId.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2784
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2785
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2786
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
     very hard case; both fg and bg are dithered colors
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
    noColor := Color noColor.
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
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2793
     create temp-forms;
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2794
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2795
    bgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2796
    fgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2797
    tmpForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2798
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2799
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2800
     fill
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2801
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2802
    dx := dy := 0.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2803
    maskOrigin notNil ifTrue:[
1177
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2804
        dx := maskOrigin x.
e89408c15bb5 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2805
        dy := maskOrigin y
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2806
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2807
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2808
    bgForm paint:bgPaint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2809
    bgForm setMaskOriginX:(x negated + dx) y:(y negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2810
    bgForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2811
    fgForm paint:paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2812
    fgForm setMaskOriginX:(x negated + dx) y:(y negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2813
    fgForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2814
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2815
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2816
     stamp-out background
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2817
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2818
    bgForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2819
    bgForm function:#and.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2820
    bgForm displayOpaqueForm:deviceForm x:0 y:0.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2821
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2822
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2823
     stamp-out foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2824
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2825
    fgForm paint:allColor on:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2826
    fgForm function:#and.
976
807b42b00353 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 975
diff changeset
  2827
    fgForm displayOpaqueForm:deviceForm x:0 y:0.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2828
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2829
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2830
     clear tempform
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2831
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2832
    tmpForm paint:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2833
    tmpForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2834
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2835
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2836
     merge fg-temp and bg-temp into tmp
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2837
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2838
    tmpForm function:#or.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2839
    tmpForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2840
    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
  2841
    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
  2842
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2843
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2844
     finally, draw it
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
    device setForeground:0 background:allBits in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2847
    device
1249
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2848
        copyFromPixmapId:tmpForm id
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2849
        x:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2850
        y:0 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2851
        gc:tmpForm gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2852
        to:drawableId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2853
        x:pX 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2854
        y:pY 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2855
        gc:gcId
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2856
        width:w 
5224bb7a97bf use new copy interface, to avoid useless noExpose events
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2857
        height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2858
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2859
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2860
     release tempForms immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2861
     (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2862
      this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2863
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2864
    fgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2865
    bgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2866
    tmpForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2867
732
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
     flush foreground/background cache
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2870
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2871
    foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2872
    background := nil.
868
65c93e5f6f8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 844
diff changeset
  2873
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2874
    "Modified: 22.4.1997 / 21:44:10 / cg"
732
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
displayDeviceOpaqueString:aString from:index1 to:index2 in:font x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2878
    "draw a substring at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2879
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2880
     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
  2881
     the case where paint and/or bgPaint are dithered colors.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2882
     No translation or scaling is done."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2883
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2884
    |easy w h savedPaint fgId bgId allColor allBits noColor
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2885
     id bgForm fgForm tmpForm maskForm dx dy pX pY fontUsed s
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  2886
     deviceDepth fontsEncoding ascent|
732
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
     if backgroundPaint color is nil, we assume
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2890
     this is a non-opaque draw
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2891
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2892
    bgPaint isNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2893
        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
  2894
        ^ self
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2897
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2898
    or:[aString isText]) ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2899
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2900
         hook for non-strings (i.e. attributed text)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2901
         that 'thing' should know how to display itself ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2902
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2903
        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
  2904
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2905
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2906
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2907
    gcId isNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2908
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2909
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2910
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2911
    pX := x rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2912
    pY := y rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2913
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  2914
    s := aString.
4172
0d5bc2a70b83 Do not refer to uninitialized variable fontUsed
Stefan Vogel <sv@exept.de>
parents: 4146
diff changeset
  2915
    fontUsed := font onDevice:device.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  2916
    fontsEncoding := fontUsed encoding.
4056
67c4686afbc6 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  2917
    (characterEncoding ~~ fontsEncoding) ifTrue:[
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  2918
        s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  2919
    ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2920
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2921
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2922
    id isNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2923
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2924
         hook for alien fonts
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2925
         that 'font' should know how to display the string ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2926
        "
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  2927
        font displayOpaqueString:s from:index1 to:index2 x:x y:y in:self.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2928
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2929
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2930
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2931
    deviceFont ~~ fontUsed ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2932
        device setFont:id in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2933
        deviceFont := fontUsed
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2934
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2935
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2936
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2937
     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
  2938
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2939
    easy := true.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2940
    paint isColor ifFalse:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2941
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2942
    ] ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2943
        fgId := paint colorId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2944
        fgId isNil ifTrue:[
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2945
            easy := false
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2946
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2947
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2948
    bgPaint isColor ifFalse:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2949
        easy := false
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2950
    ] ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2951
        bgId := bgPaint colorId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2952
        bgId isNil ifTrue:[
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2953
            easy := false
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2954
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2955
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2956
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2957
    easy ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2958
        device setForeground:fgId background:bgId in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2959
        foreground := paint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2960
        background := bgPaint.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  2961
        device displayOpaqueString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2962
        ^ self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2963
    ].
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
    w := fontUsed widthOf:s from:index1 to:index2.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2966
    h := fontUsed height.
3666
01d7bf1d2333 fixed Text drawing in displayString
Michael Beyl <mb@exept.de>
parents: 3630
diff changeset
  2967
    ascent := fontUsed ascent.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2968
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2969
    (fgId notNil and:[function == #copy]) ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2970
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2971
         only bg is dithered; fill with bg first ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2972
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2973
        savedPaint := paint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2974
        self paint:bgPaint.
3666
01d7bf1d2333 fixed Text drawing in displayString
Michael Beyl <mb@exept.de>
parents: 3630
diff changeset
  2975
        self fillRectangleX:pX y:(pY - ascent) width:w height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2976
        self paint:savedPaint.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2977
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2978
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2979
         then draw using fgPaint (which is a real color)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2980
        "
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  2981
        device displayString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  2982
        ^ self
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2985
    allColor := Color allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2986
    allBits := allColor colorId.
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
    deviceDepth := device depth.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2989
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
     the code below is correct, but some (all?) implementations of the
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2992
     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
  2993
     Therefore we use the slower code below.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2994
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2995
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2996
"/    (bgId notNil and:[function == #copy]) ifTrue:[
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
"/       only fg is dithered; fill with fg first ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2999
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3000
"/      self fillRectangleX:pX y:(pY - fontUsed ascent) width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3001
"/
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3002
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3003
"/       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
  3004
"/       operation ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3005
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3006
"/      ((bgId ~~ ((1 bitShift:deviceDepth)-1))
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3007
"/      and:[bgId ~~ allBits]) ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3008
"/          "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3009
"/           clear bg bits ...
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
"/          device setForeground:allBits background:0 in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3012
"/          device setFunction:#and in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3013
"/          device displayOpaqueString:s 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3014
"/                                from:index1 to:index2
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3015
"/                                   x:pX y:pY 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3016
"/                                  in:drawableId with:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3017
"/      ].
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
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3020
"/       or-in bg bits ...
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3021
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3022
"/      bgId ~~ 0 ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3023
"/          device setForeground:0 background:bgId in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3024
"/          device setFunction:#or in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3025
"/          device displayOpaqueString:s 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3026
"/                                from:index1 to:index2
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3027
"/                                   x:pX y:pY 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3028
"/                                  in:drawableId with:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3029
"/      ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3030
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3031
"/       flush foreground/background cache
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3032
"/      "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3033
"/      foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3034
"/      background := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3035
"/      device setFunction:function in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3036
"/      ^ self
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3037
"/  ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3038
768
77e4f9d30a22 fixes for b&w screens
Claus Gittinger <cg@exept.de>
parents: 745
diff changeset
  3039
    (bgId notNil and:[function == #copy]) ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3040
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3041
         only fg is dithered; fill with bg first ...
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3042
        "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3043
        device setForeground:bgId in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3044
        device setFunction:#copy in:gcId.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3045
        device setBitmapMask:nil in:gcId.
3666
01d7bf1d2333 fixed Text drawing in displayString
Michael Beyl <mb@exept.de>
parents: 3630
diff changeset
  3046
        self fillRectangleX:pX y:(pY - ascent) width:w height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3047
2024
4ab032384c63 checkin from browser
tz
parents: 2018
diff changeset
  3048
        mask notNil ifTrue:[
4ab032384c63 checkin from browser
tz
parents: 2018
diff changeset
  3049
            "/ draw fg dithered
4ab032384c63 checkin from browser
tz
parents: 2018
diff changeset
  3050
            (mask depth == 1) ifTrue:[
4ab032384c63 checkin from browser
tz
parents: 2018
diff changeset
  3051
                device setBitmapMask:mask id in:gcId.
3530
d90974c7d477 setForegroundColor/setBackgroundColor
james
parents: 3429
diff changeset
  3052
                device setForegroundColor:foreground backgroundColor:background in:gcId.
2024
4ab032384c63 checkin from browser
tz
parents: 2018
diff changeset
  3053
            ] ifFalse:[
4ab032384c63 checkin from browser
tz
parents: 2018
diff changeset
  3054
                device setPixmapMask:mask id in:gcId
4ab032384c63 checkin from browser
tz
parents: 2018
diff changeset
  3055
            ].
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3056
        ].
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3057
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3058
        device displayString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3059
        ^ self.
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3060
    ].
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3061
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3062
    "
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3063
     very hard case, both fg and bg are dithered colors/images
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3064
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3065
    noColor := Color noColor.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3066
732
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
     create temp-forms;
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
    bgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3071
    fgForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3072
    tmpForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3073
    maskForm := Form width:w height:h depth:deviceDepth on:device.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3074
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3075
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3076
     fill
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
    dx := 0.
3666
01d7bf1d2333 fixed Text drawing in displayString
Michael Beyl <mb@exept.de>
parents: 3630
diff changeset
  3079
    dy := ascent.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3080
    maskOrigin notNil ifTrue:[
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3081
        dx := maskOrigin x.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3082
        dy := dy + maskOrigin y
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3083
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3084
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3085
    bgForm paint:bgPaint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3086
    bgForm setMaskOriginX:(pX negated + dx) y:(pY negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3087
    bgForm fillRectangleX:0 y:0 width:w height:h.
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
    fgForm paint:paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3090
    fgForm setMaskOriginX:(pX negated + dx) y:(pY negated + dy).
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3091
    fgForm fillRectangleX:0 y:0 width:w height:h.
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
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3094
     stamp-out background (have now bg-bits with fg=0 in bgForm)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3095
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3096
    bgForm font:fontUsed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3097
    bgForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3098
    bgForm function:#and.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3099
    bgForm displayString:s from:index1 to:index2 x:0 y:ascent.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3100
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3101
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3102
     stamp-out foreground
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3103
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3104
    maskForm font:fontUsed.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3105
    maskForm paint:allColor on:noColor.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3106
    maskForm displayOpaqueString:s from:index1 to:index2 x:0 y:ascent.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3107
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3108
    fgForm function:#and.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3109
    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
  3110
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
     clear tempform
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3113
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3114
    tmpForm paint:noColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3115
    tmpForm fillRectangleX:0 y:0 width:w height:h.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3116
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3117
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3118
     merge fg-temp and bg-temp into tmp
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3119
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3120
    tmpForm function:#or.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3121
    tmpForm paint:noColor on:allColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3122
    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
  3123
    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
  3124
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3125
     finally, draw it
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3126
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3127
    device setForeground:0 background:allBits in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3128
    device
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3129
        copyFromId:tmpForm id
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3130
        x:0 y:0 gc:tmpForm gcId
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3131
        to:drawableId
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3132
        x:pX y:(pY-ascent) gc:gcId
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3133
        width:w height:h.
1637
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3134
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3135
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3136
     release tempForms immediately
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3137
     (although GC will eventually do it, 
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3138
      this creates less stress to the Xserver in the meanwhile ...)
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3139
    "
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3140
    tmpForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3141
    fgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3142
    bgForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3143
    maskForm destroy.
4e6372dce15d release temporary forms early
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  3144
732
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
     flush foreground/background cache
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3147
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3148
    foreground := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3149
    background := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3150
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  3151
    "Modified: 1.7.1997 / 17:08:46 / cg"
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3154
displayDeviceOpaqueString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3155
    "draw a substring at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3156
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3157
     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
  3158
     the case where paint and/or bgPaint are dithered colors.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3159
     No translation or scaling is done."
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
    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
  3162
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3163
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3164
displayDeviceOpaqueString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3165
    "draw a string at the coordinate x/y - draw foreground pixels in
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3166
     paint-color and background pixels in bgPaint-color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3167
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3168
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3169
    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
  3170
!
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
displayDeviceString:aString from:index1 to:index2 in:font x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3173
    "draw a substring at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3174
     draw foreground-pixels only (in current paint-color), leaving background as-is.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3175
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3176
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3177
    |id pX pY fontUsed s fontsEncoding|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3178
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3179
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3180
     hook for non-strings (i.e. attributed text)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3181
    "
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3182
    (aString isString not
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3183
    or:[aString isText]) ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3184
        ^ aString displayOn:self x:x y:y from:index1 to:index2
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3185
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3186
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3187
    gcId isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3188
        self initGC
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3191
    pX := x rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3192
    pY := y rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3193
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3194
    s := aString.
4172
0d5bc2a70b83 Do not refer to uninitialized variable fontUsed
Stefan Vogel <sv@exept.de>
parents: 4146
diff changeset
  3195
    fontUsed := font onDevice:device.
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3196
    fontsEncoding := fontUsed encoding.
4056
67c4686afbc6 characterEncoding stuff
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  3197
    (characterEncoding ~~ fontsEncoding) ifTrue:[
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3198
        s := CharacterEncoder encodeString:s from:characterEncoding into:fontsEncoding.
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3199
    ].
732
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
    id := fontUsed fontId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3202
    id isNil ifTrue:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3203
        "hook for alien fonts"
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3204
        font displayString:s from:index1 to:index2 x:x y:y in:self
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3205
    ] ifFalse:[
1797
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3206
        deviceFont ~~ fontUsed ifTrue:[
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3207
            device setFont:id in:gcId.
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3208
            deviceFont := fontUsed
2cb44d740a7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1742
diff changeset
  3209
        ].
4026
882de378f763 no longer as string for its encoding;
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
  3210
        device displayString:s from:index1 to:index2 x:pX y:pY in:drawableId with:gcId
732
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
1805
532a11ba8458 tuned-out another send if encoding is wrong in display-string
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  3213
    "Modified: 1.7.1997 / 17:08:48 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3214
!
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
displayDeviceString:aString from:index1 to:index2 x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3217
    "draw a substring at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3218
     draw foreground-pixels only (in current paint-color), leaving background as-is.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3219
     No translation or scaling is done"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3220
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3221
    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
  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
displayDeviceString:aString x:x y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3225
    "draw a string at the coordinate x/y -  
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3226
     draw foreground-pixels only (in current paint-color), leaving background as-is.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3227
     No translation or scaling is done"
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
    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
  3230
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3231
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3232
fillDeviceRectangleX:x y:y width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3233
    "draw a filled rectangle in device coordinate space.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3234
     This ignores any transformations. The coordinates must be integers."
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
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3237
	self initGC
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
    device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3240
	fillRectangleX:x 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3241
		     y:y
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3242
		 width:w
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3243
		height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3244
		    in:drawableId with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3245
! !
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
!DeviceGraphicsContext methodsFor:'evaluating in another context'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3248
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3249
reverseDo:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3250
    "evaluate aBlock with foreground and background interchanged.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3251
     This can be reimplemented here in a faster way."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3252
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3253
    |oldFg oldBg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3254
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3255
    oldFg := foreground.
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3256
    oldBg := background.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3257
    self foreground:background background:foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3258
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3259
    self foreground:oldFg background:oldBg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3260
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3261
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3262
withBackground:fgColor do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3263
    "evaluate aBlock with changed background."
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
    |oldBg|
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
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3268
    self background:fgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3269
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3270
    self background:oldBg
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3273
withForeground:fgColor background:bgColor do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3274
    "evaluate aBlock with changed foreground and background."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3275
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3276
    |oldFg oldBg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3277
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3278
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3279
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3280
    self foreground:fgColor background:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3281
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3282
    self foreground:oldFg background:oldBg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3283
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3284
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3285
withForeground:fgColor background:bgColor function:aFunction do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3286
    "evaluate aBlock with foreground, background and function"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3287
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3288
    |oldFg oldBg oldFun|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3289
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3290
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3291
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3292
    oldFun := function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3293
    self foreground:fgColor background:bgColor function:aFunction.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3294
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3295
    self foreground:oldFg background:oldBg function:oldFun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3296
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3297
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3298
withForeground:fgColor background:bgColor mask:aMask do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3299
    "evaluate aBlock with foreground, background and mask"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3300
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3301
    |oldFg oldBg oldMask|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3302
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3303
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3304
    oldBg := background.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3305
    oldMask := mask.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3306
    self foreground:fgColor background:bgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3307
    self mask:aMask.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3308
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3309
    self foreground:oldFg background:oldBg.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3310
    self mask:oldMask
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3311
!
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
withForeground:fgColor do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3314
    "evaluate aBlock with changed foreground."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3315
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3316
    |oldFg|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3317
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3318
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3319
    self foreground:fgColor.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3320
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3321
    self foreground:oldFg
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3322
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3323
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3324
withForeground:fgColor function:aFunction do:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3325
    "evaluate aBlock with changed foreground and function."
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
    |oldFg oldFun|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3328
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3329
    oldFg := foreground.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3330
    oldFun := function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3331
    self foreground:fgColor background:background function:aFunction.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3332
    aBlock value.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3333
    self foreground:oldFg background:background function:oldFun
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3334
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3335
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3336
xoring:aBlock
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3337
    "evaluate aBlock with function xoring"
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
    |fgPixel bgPixel oldFunction|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3340
2322
6c42f2e0213c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2271
diff changeset
  3341
    fgPixel := device blackpixel.
6c42f2e0213c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2271
diff changeset
  3342
    bgPixel := device whitepixel.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3343
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3344
    gcId isNil ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3345
        self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3346
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3347
    oldFunction := function.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3348
    device setForeground:(fgPixel bitXor:bgPixel)
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3349
              background:bgPixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3350
                      in:gcId.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3351
    device setFunction:#xor in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3352
    aBlock value.
2322
6c42f2e0213c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2271
diff changeset
  3353
2879
f1e9b8310d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2865
diff changeset
  3354
    paint := bgPaint := nil.        "invalidate"
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3355
    foreground := device blackColor.   
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3356
    background := device whiteColor.
2322
6c42f2e0213c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2271
diff changeset
  3357
    device setForeground:fgPixel background:bgPixel in:gcId.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3358
    device setFunction:oldFunction in:gcId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3359
    function := oldFunction
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3360
2322
6c42f2e0213c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2271
diff changeset
  3361
    "Modified: / 10.9.1998 / 12:17:39 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3362
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3363
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3364
!DeviceGraphicsContext methodsFor:'filling'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3365
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3366
fillArcX:x y:y width:w height:h from:startAngle angle:angle
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3367
    "draw a filled arc; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3368
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  3369
    |pX pY nW nH sA a|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3370
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3371
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3372
	self initGC
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3373
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3374
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3375
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3376
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3377
	nW := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3378
	nH := transformation applyScaleY:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3379
	nW < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3380
	      nW := nW abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3381
	      pX := pX - nW.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3382
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3383
	nH < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3384
	      nH := nH abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3385
	      pY := pY - nH.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3386
	].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3387
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3388
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3389
	pY := y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3390
	nW := w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3391
	nH := h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3392
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3393
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3394
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3395
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3396
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3397
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3398
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  3399
    sA := startAngle.
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  3400
    sA isInteger ifFalse:[sA := sA asFloat].
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  3401
    a := angle.
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  3402
    a isInteger ifFalse:[a := a asFloat].
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  3403
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3404
    device
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3405
	  fillArcX:pX 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3406
		 y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3407
	     width:nW
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3408
	    height:nH 
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  3409
	      from:sA
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
  3410
	     angle:a
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3411
		in:drawableId
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3412
	      with:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3413
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3414
    "Created: 8.5.1996 / 08:29:45 / cg"
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3415
    "Modified: 4.6.1996 / 17:58:21 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3416
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3417
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3418
fillPolygon:aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3419
    "draw a filled polygon; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3420
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3421
    |newPolygon|
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3422
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3423
    gcId isNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3424
	self initGC
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3425
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3426
    transformation notNil ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3427
	newPolygon := aPolygon collect:[:point | transformation applyTo:point].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3428
    ] ifFalse:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3429
	newPolygon := aPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3430
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3431
    (newPolygon findFirst:[:p | 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3432
	(p isPoint not 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3433
	or:[(p x class ~~ SmallInteger)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3434
	or:[(p y class ~~ SmallInteger)]])
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3435
     ]) ~~ 0 ifTrue:[
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3436
	newPolygon := newPolygon collect:[:p | p asPoint rounded]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3437
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3438
    device
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3439
	fillPolygon:newPolygon
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3440
		 in:drawableId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3441
	       with:gcId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3442
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3443
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3444
fillRectangleX:x y:y width:w height:h
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3445
    "draw a filled rectangle; apply transformation if nonNil"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3446
1064
2d0783c97f32 removed unused vars
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  3447
    |pX pY nW nH|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3448
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3449
    gcId isNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3450
	self initGC
732
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
    transformation notNil ifTrue:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3453
	pX := transformation applyToX:x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3454
	pY := transformation applyToY:y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3455
	nW := transformation applyScaleX:w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3456
	nH := transformation applyScaleY:h.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3457
	nW < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3458
	      nW := nW abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3459
	      pX := pX - nW.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3460
	].
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3461
	nH < 0 ifTrue:[
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3462
	      nH := nH abs.  
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3463
	      pY := pY - nH.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3464
	].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3465
    ] ifFalse:[
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3466
	pX := x.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3467
	pY := y.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3468
	nW := w.
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3469
	nH := h.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3470
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3471
    pX := pX rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3472
    pY := pY rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3473
    nW := nW rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3474
    nH := nH rounded.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3475
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3476
    device
1029
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3477
	fillRectangleX:pX 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3478
		     y:pY 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3479
		 width:nW 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3480
		height:nH 
0b03a4f98dcd pass srcGC to bitBlitter (req'd for WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  3481
		    in:drawableId with:gcId
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3482
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3483
    "Modified: 4.6.1996 / 17:58:49 / cg"
732
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
3612
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3486
!DeviceGraphicsContext methodsFor:'finalization'!
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3487
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3488
finalize
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3489
    "some Drawable has been collected 
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3490
     - must release operating system resources"
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3491
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3492
    ^ self subclassResponsibility
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3493
! !
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3494
3883
4e01a59afccb method category rename
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  3495
!DeviceGraphicsContext methodsFor:'initialization & release'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3496
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3497
close
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3498
    "same as destroy - for ST-80 compatibility"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3499
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3500
    self destroy
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3501
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3502
    "Created: 2.4.1997 / 19:31:27 / cg"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3503
!
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3504
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3505
createGC
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3506
    "physically create a device GC.
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3507
     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
  3508
     really drawn, none is created up to the first draw.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3509
     This method is sent, when the first drawing happens"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3510
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3511
    gcId := device gcFor:drawableId.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3512
    Lobby registerChange:self.
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3513
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3514
    "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
  3515
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3516
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3517
destroy
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3518
    "I am abstract"
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3519
2913
c51ac85e9aa2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  3520
    self subclassResponsibility.
1517
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3521
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3522
"/    "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
  3523
"/
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3524
"/    gcId notNil ifTrue:[
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3525
"/        device destroyGC:gcId.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3526
"/        gcId := nil.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3527
"/        Lobby registerChange:self.
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3528
"/    ]
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3529
ac751bb3dfdf no need for registration here;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3530
    "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
  3531
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3532
3612
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3533
finalizationLobby
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3534
    "answer the registry used for finalization.
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3535
     DeviceGraphicContexts have their own Registry"
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3536
6e0f462e0b7a Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  3537
    ^ Lobby
2572
447398073628 category change
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  3538
!
447398073628 category change
Claus Gittinger <cg@exept.de>
parents: 2360
diff changeset
  3539
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3540
initGC
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3541
    "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
  3542
     really drawn, none is created.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3543
     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
  3544
4135
a47337e09c40 preset font if already ok for device
werner
parents: 4070
diff changeset
  3545
    |fgId bgId p fontId|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3546
1453
e93293618275 only fetch id's once in displayForm.
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3547
    gcId notNil ifTrue:[^ self].
1514
7c2a921ae46b better error report when drawing on closed view.
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  3548
    drawableId isNil ifTrue:[
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  3549
        "/
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  3550
        "/ the drawable has been closed (or was never open)
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  3551
        "/ no drawing is possible.
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  3552
        "/
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  3553
        ^ DrawingOnClosedDrawableSignal raiseRequest
1514
7c2a921ae46b better error report when drawing on closed view.
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  3554
    ].
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3555
    self createGC.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3556
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3557
    foreground isNil ifTrue:[foreground := device blackColor].
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3558
    background isNil ifTrue:[background := device whiteColor].
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
    foreground isColor ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3561
        "get device colors from the device indep. colors"
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3562
        foreground := foreground onDevice:device.
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3563
        fgId := foreground colorId.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3564
        fgId isNil ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3565
            (foreground grayIntensity >= 50) ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3566
                fgId := device whitepixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3567
            ] ifFalse:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3568
                fgId := device blackpixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3569
            ]
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3570
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3571
    ] ifFalse:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3572
        fgId := device blackpixel.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3573
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3574
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3575
    background isColor ifTrue:[
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3576
        background := background onDevice:device.
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3577
        bgId := background colorId.
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3578
        bgId isNil ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3579
            (background grayIntensity >= 50) ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3580
                bgId := device whitepixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3581
            ] ifFalse:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3582
                bgId := device blackpixel
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3583
            ]
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3584
        ].
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3585
    ] ifFalse:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3586
        bgId := device whitepixel
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3587
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3588
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3589
    "now, this is something the device can work with ..."
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3590
    device setForeground:fgId background:bgId in:gcId.
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
    "switch to paint"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3593
    p := paint.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3594
    paint := nil.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3595
    self paint:p.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3596
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3597
    ((lineWidth ~~ 0) 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3598
    or:[(lineStyle ~~ #solid) 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3599
    or:[(capStyle ~~ #butt)
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3600
    or:[joinStyle ~~ #miter]]]) ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3601
        device setLineWidth:lineWidth 
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3602
                      style:lineStyle
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3603
                        cap:capStyle
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3604
                       join:joinStyle
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3605
                         in:gcId
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3606
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3607
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3608
    mask notNil ifTrue:[
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3609
        (mask depth == 1) ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3610
            device setBitmapMask:(mask id) in:gcId
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3611
        ] ifFalse:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3612
            device setPixmapMask:(mask id) in:gcId
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3613
        ].
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3614
        maskOrigin notNil ifTrue:[
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3615
            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
  3616
        ]
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3617
    ].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3618
    (function ~~ #copy) ifTrue:[device setFunction:function in:gcId].
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3619
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3620
    "defer the getting of a device font 
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3621
     - this is now done when the first drawstring occurs,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3622
     since many views (layout-views) will never draw strings and
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3623
     therefore, the overhead of aquiring a font can be avoided.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3624
    "
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3625
"/    font := font on:device.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3626
"/    id := font fontId.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3627
"/    id notNil ifTrue:[
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3628
"/        device setFont:id in:gcId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
  3629
"/    ]
1199
f113f6a4c04a use new device black/whiteColor interface
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3630
4135
a47337e09c40 preset font if already ok for device
werner
parents: 4070
diff changeset
  3631
    font notNil ifTrue:[
4146
4c46ae30bd64 Use #graphicsDevice
Stefan Vogel <sv@exept.de>
parents: 4135
diff changeset
  3632
        font graphicsDevice == device ifTrue:[
4135
a47337e09c40 preset font if already ok for device
werner
parents: 4070
diff changeset
  3633
            (fontId := font fontId) notNil ifTrue:[
a47337e09c40 preset font if already ok for device
werner
parents: 4070
diff changeset
  3634
                device setFont:fontId in:gcId
a47337e09c40 preset font if already ok for device
werner
parents: 4070
diff changeset
  3635
            ]
a47337e09c40 preset font if already ok for device
werner
parents: 4070
diff changeset
  3636
        ]
a47337e09c40 preset font if already ok for device
werner
parents: 4070
diff changeset
  3637
    ]
a47337e09c40 preset font if already ok for device
werner
parents: 4070
diff changeset
  3638
        
a47337e09c40 preset font if already ok for device
werner
parents: 4070
diff changeset
  3639
2031
d369d38213cf dont use #error when drawing on a closed drawable;
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  3640
    "Modified: / 29.1.1998 / 12:55:24 / cg"
4291
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3641
!
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3642
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3643
initialize
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3644
    "setup everything for later use; actual work is done in
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3645
     initColors and initFont, which are usually redefined."
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3646
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3647
    super initialize.
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3648
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3649
    "/ just in case, someone redefined new without setting device
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3650
    device isNil ifTrue:[device := Screen current].
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3651
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3652
    foreground isNil ifTrue:[foreground := Black].
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3653
    background isNil ifTrue:[background := White].
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3654
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3655
    "Modified: 10.1.1997 / 17:46:51 / cg"
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3656
!
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3657
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3658
prepareForReinit
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3659
    "kludge - clear drawableId and gcId 
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3660
     needed after snapin"
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3661
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3662
    gcId := nil.
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3663
    drawableId := nil.
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3664
    deviceFont := nil
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3665
!
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3666
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3667
recreate
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3668
    "sent after a snapin or a migration, reinit draw stuff for new device"
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3669
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3670
    gcId := nil.
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3671
    foreground notNil ifTrue:[
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3672
        foreground := foreground onDevice:device
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3673
    ].
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3674
    background notNil ifTrue:[
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3675
        background := background onDevice:device
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3676
    ].
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3677
    paint notNil ifTrue:[
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3678
        paint := paint onDevice:device
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3679
    ].
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3680
    bgPaint notNil ifTrue:[
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3681
        bgPaint := bgPaint onDevice:device
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3682
    ].
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3683
    font notNil ifTrue:[
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3684
        font := font onDevice:device
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3685
    ]
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3686
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3687
    "Modified: 28.10.1996 / 13:25:02 / cg"
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3688
!
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3689
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3690
reinitialize
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3691
    'DeviceGraphicsContext [warning]: reinit of ' errorPrint. self classNameWithArticle errorPrint.
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3692
    ' failed' errorPrintCR
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3693
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3694
    "Modified: 10.1.1997 / 17:47:06 / cg"
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3695
!
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3696
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3697
releaseGC
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3698
    "destroy the associated device GC resource - can be done to be nice to the 
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3699
     display if you know that you are done with a drawable."
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3700
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3701
    |id|
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3702
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3703
    foreground := background := paint := bgPaint := nil.
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3704
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3705
    id := gcId.
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3706
    id notNil ifTrue:[
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3707
        gcId := nil.
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3708
        device destroyGC:id.
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3709
        Lobby registerChange:self.
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3710
    ].
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3711
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3712
    "Created: 11.6.1996 / 22:07:30 / cg"
85475200669d nil gcId before desroying GC
Stefan Vogel <sv@exept.de>
parents: 4204
diff changeset
  3713
    "Modified: 2.4.1997 / 19:36:30 / cg"
732
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
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3716
!DeviceGraphicsContext methodsFor:'private'!
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
setDevice:aDevice id:aDrawbleId gcId:aGCId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3719
    "private"
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 := aDevice.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3722
    gcId := aGCId.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3723
    drawableId := aDrawbleId
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3724
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3725
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3726
setGCForPaint
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3727
    "private; given a complex color (i.e. a pixmap or dithered color,
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3728
     setup the GC to draw in this color.
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3729
     A helper for paint and paint:on:"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3730
832
064890dcfabd fixed opaque string draw with deep-dither
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  3731
    |dither map pixelId p fg bg vOrg ditherDepth deviceDepth|
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3733
    gcId notNil ifTrue:[
1742
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3734
        (p := paint) isColor ifTrue:[
2835
963425946ff3 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
  3735
            paint := p := p onDevice:device.
1742
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3736
            pixelId := p colorId.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3737
            pixelId notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3738
                "
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3739
                 a real (undithered) color
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3740
                "
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3741
                mask notNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3742
                    mask := nil.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3743
                    device setBitmapMask:nil in:gcId
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3744
                ]. 
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3745
                (p ~~ foreground) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3746
                    foreground := paint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3747
                    device setForeground:pixelId in:gcId
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3748
                ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3749
                ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3750
            ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3751
            "a dithered color"
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3752
            dither := paint ditherForm.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3753
        ] ifFalse:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3754
            "mhmh - seems to be some kind of form ..."
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3755
            paint := paint onDevice:device.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3756
            dither := paint
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3757
        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3758
        "
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3759
         a dithered color or image
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3760
        "
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3761
        (ditherDepth := dither depth) == 1 ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3762
            "a simple 0/1 bitmap"
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3763
            map := dither colorMap.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3764
            "temporary (kludgy) fix for destroyed paint"
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3765
            p := paint.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3766
            map isNil ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3767
                fg := Color black.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3768
                bg := Color white.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3769
            ] ifFalse:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3770
                fg := map at:2.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3771
                bg := map at:1.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3772
            ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3773
            self foreground:fg background:bg.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3774
            paint := p
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3775
        ] ifFalse:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3776
            deviceDepth := device depth.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3777
            (ditherDepth ~~ deviceDepth) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3778
                dither := dither asFormOn:device.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3779
                ditherDepth := dither depth.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3780
                (dither isNil or:[ditherDepth ~~ deviceDepth]) ifTrue:[
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3781
                    self error:'bad dither'.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3782
                    ^ self
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3783
                ]
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3784
            ]
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3785
        ].
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3786
        self mask:dither.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3787
        vOrg := self viewOrigin.
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3788
        self setMaskOriginX:vOrg x negated y:vOrg y negated.
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3789
    ]
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3790
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3791
    "Created: 16.5.1996 / 15:35:51 / cg"
1742
ca904d85a84c #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  3792
    "Modified: 6.6.1997 / 12:55:38 / cg"
2049
1ceec8ef240e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  3793
!
1ceec8ef240e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  3794
1ceec8ef240e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  3795
setId:aDrawbleId
1ceec8ef240e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  3796
    "private"
1ceec8ef240e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  3797
1ceec8ef240e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  3798
    drawableId := aDrawbleId
1ceec8ef240e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  3799
1ceec8ef240e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  3800
    "Created: / 6.2.1998 / 12:44:45 / cg"
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3801
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3802
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3803
!DeviceGraphicsContext methodsFor:'queries'!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3804
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3805
horizontalIntegerPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3806
    "return the (rounded) number of pixels per millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3807
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3808
    ^ device horizontalPixelPerMillimeter rounded
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3809
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3810
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3811
horizontalPixelPerInch
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3812
    "return the number of horizontal pixels per inch of the display"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3813
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3814
    ^ device horizontalPixelPerMillimeter * 25.4
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3815
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3816
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3817
horizontalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3818
    "return the number of pixels per millimeter (not rounded)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3819
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3820
    ^ device horizontalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3821
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3822
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3823
horizontalPixelPerMillimeter:millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3824
    "return the number of pixels (not rounded) for millis millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3825
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3826
    ^ device horizontalPixelPerMillimeter * millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3827
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3828
784
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3829
resolution
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3830
    "return a point consisting of pixel-per-inch horizontally and vertically."
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3831
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3832
    ^ device resolution
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3833
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3834
    "Created: 4.6.1996 / 15:23:55 / cg"
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3835
!
be774c8a672f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 768
diff changeset
  3836
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3837
verticalIntegerPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3838
    "return the (rounded) number of pixels per millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3839
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3840
    ^ device verticalPixelPerMillimeter rounded
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3841
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3842
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3843
verticalPixelPerInch
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3844
    "return the number of vertical pixels per inch of the display"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3845
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3846
    ^ device verticalPixelPerMillimeter * 25.4
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3847
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3848
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3849
verticalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3850
    "return the number of pixels per millimeter (not rounded)"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3851
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3852
    ^ device verticalPixelPerMillimeter
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3853
!
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3854
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3855
verticalPixelPerMillimeter:millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3856
    "return the number of pixels (not rounded) for millis millimeter"
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3857
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3858
    ^ device verticalPixelPerMillimeter * millis
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3859
! !
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3860
1085
3513a4cae87b handle depth1-images with a mask
Claus Gittinger <cg@exept.de>
parents: 1064
diff changeset
  3861
!DeviceGraphicsContext class methodsFor:'documentation'!
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3862
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3863
version
4389
a1ddea4bf248 care for negative clipRect extent
Claus Gittinger <cg@exept.de>
parents: 4291
diff changeset
  3864
    ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.104 2005-06-06 17:40:21 cg Exp $'
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3865
! !
3880
c4c8268a2d9f method category rename
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
  3866
732
af737b0a3a37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3867
DeviceGraphicsContext initialize!