ImageMask.st
author Claus Gittinger <cg@exept.de>
Mon, 03 Apr 2017 12:10:45 +0200
changeset 7992 449abf3b7d08
parent 6479 388fa0684b52
child 8122 24692d82a3d5
permissions -rw-r--r--
#BUGFIX by cg class: WindowSensor changed: #updateModifierStateFrom:device:
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
1626
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
Depth1Image subclass:#ImageMask
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:''
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'Graphics-Images'
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!ImageMask class methodsFor:'documentation'!
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
copyright
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 (c) 1997 by eXept Software AG / Claus Gittinger
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
              All Rights Reserved
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 hereby transferred.
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
"
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
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
documentation
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    instances of this class represent image masks;
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    if added to an image (via #mask:), only pixels for which the 
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    corresponding mask pixel is 1 are drawn.
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    ImageMask does not add anything new - basically, its a depth1-image.
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    [See also:]
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
        Image ImageReader
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    [author:]
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
        Claus Gittinger
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
"
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
! !
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
6479
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    55
!ImageMask methodsFor:'initialization'!
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    56
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    57
initialize
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    58
    super initialize.
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    59
    bitsPerSample := samplesPerPixel := 1.
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    60
! !
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    61
2679
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    62
!ImageMask methodsFor:'private'!
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    63
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    64
colormapFromImage:anImage
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    65
    "I have no colormap"
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    66
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    67
    photometric := #blackIs0.
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    68
    ^ self
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    69
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    70
    "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
    71
! !
aaf12b43b321 imageMasks have no colorMap (and always blackIs0-photometric)
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
    72
1626
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
!ImageMask methodsFor:'queries'!
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
isMask
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    ^ true
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    "Created: 22.4.1997 / 14:12:20 / cg"
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
! !
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
!ImageMask class methodsFor:'documentation'!
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
version
6479
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    84
    ^ '$Header: /cvs/stx/stx/libview/ImageMask.st,v 1.4 2014-05-23 08:17:29 stefan Exp $'
1626
bc20e8147ab5 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
! !
6479
388fa0684b52 Change images to use ImageMask instances instead of Depth1Image instances as
Stefan Vogel <sv@exept.de>
parents: 3851
diff changeset
    86