ImageMask.st
author matilk
Wed, 13 Sep 2017 09:40:34 +0200
changeset 8174 2704c965b97b
parent 8122 24692d82a3d5
child 8186 1ca1ff27bae7
permissions -rw-r--r--
#BUGFIX by Maren class: DeviceGraphicsContext changed: #displayDeviceOpaqueForm:x:y: nil check
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1626
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
3851
34637f468b2a also handle subclasses of ExternalBytes (Mapped..)
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
    12
"{ Package: 'stx:libview' }"
34637f468b2a also handle subclasses of ExternalBytes (Mapped..)
Claus Gittinger <cg@exept.de>
parents: 2679
diff changeset
    13
8122
24692d82a3d5 #DOCUMENTATION by mawalch
mawalch
parents: 6479
diff changeset
    14
"{ NameSpace: Smalltalk }"
24692d82a3d5 #DOCUMENTATION by mawalch
mawalch
parents: 6479
diff changeset
    15
1626
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
Depth1Image subclass:#ImageMask
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Graphics-Images'
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!ImageMask class methodsFor:'documentation'!
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
copyright
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
              All Rights Reserved
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 hereby transferred.
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
!
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
documentation
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
"
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    instances of this class represent image masks;
8122
24692d82a3d5 #DOCUMENTATION by mawalch
mawalch
parents: 6479
diff changeset
    43
    if added to an image (via #mask:), only pixels for which the
1626
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    corresponding mask pixel is 1 are drawn.
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
8122
24692d82a3d5 #DOCUMENTATION by mawalch
mawalch
parents: 6479
diff changeset
    46
    ImageMask does not add anything new - basically, it is a Depth1Image.
1626
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    [See also:]
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
        Image ImageReader
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    [author:]
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
        Claus Gittinger
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
"
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
! !
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
6479
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    56
!ImageMask methodsFor:'initialization'!
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    57
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    58
initialize
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    59
    super initialize.
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    60
    bitsPerSample := samplesPerPixel := 1.
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    61
! !
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    62
2679
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    63
!ImageMask methodsFor:'private'!
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    64
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    65
colormapFromImage:anImage
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    66
    "I have no colormap"
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    67
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    68
    photometric := #blackIs0.
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    69
    ^ self
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    70
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    71
    "Created: / 18.5.1999 / 20:09:25 / cg"
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    72
! !
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    73
1626
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
!ImageMask methodsFor:'queries'!
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
isMask
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    ^ true
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    "Created: 22.4.1997 / 14:12:20 / cg"
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
! !
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
!ImageMask class methodsFor:'documentation'!
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
version
8122
24692d82a3d5 #DOCUMENTATION by mawalch
mawalch
parents: 6479
diff changeset
    85
    ^ '$Header$'
1626
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
! !
6479
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    87