Depth64Image.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 06 Sep 2017 10:04:18 +0200
branchjv
changeset 8180 25149dfd68e0
parent 7822 ecb148190095
child 7900 071c5d996122
child 8426 e2051b1553f0
permissions -rw-r--r--
Build files: removed a bunch of make rules for long-dead unsupported systems ...in order to unify and simplify the build. If a need to support this ancient systems arose, these hacks may ni longer be needed (due to new versions of tools) or the hacks would have to be written again (better) or retrieved from SCM (worse). Time will show.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2009 by eXept Software AG
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libview' }"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
7211
1e72cd273ab3 call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
    14
"{ NameSpace: Smalltalk }"
1e72cd273ab3 call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
    15
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
Image subclass:#Depth64Image
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Graphics-Images'
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!Depth64Image class methodsFor:'documentation'!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
copyright
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 COPYRIGHT (c) 2009 by eXept Software AG
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
              All Rights Reserved
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 hereby transferred.
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
documentation
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    this class represents 64 bit images as possibly provided by png 4x16bit rgba images.
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    Such images are normally not used in real world applications, as humans cannot differentiate 
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    more than roughly 200 distinct color tone values. However, in image processing (false-color) applications,
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    such a fine grain image makes sense and is sometimes used.
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    [author:]
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
        Claus Gittinger
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    [see also:]
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
        Depth1Image Depth2Image Depth4Image Depth8Image Depth16Image Depth24Image Depth32Image
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
        ImageReader
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
! !
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
!Depth64Image class methodsFor:'queries'!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
defaultPhotometric
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    "return the default photometric pixel interpretation"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
5323
a90a212f9429 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
    60
    ^ #rgb
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
imageDepth
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    "return the depth of images represented by instances of
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
     this class - here we return 64"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    ^ 64
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
! !
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
!Depth64Image methodsFor:'accessing-pixels'!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
pixelAtX:x y:y
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    "retrieve a pixel at x/y; return a pixelValue.
7517
c41855f2c494 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7281
diff changeset
    74
     The interpretation of the returned value depends on the photometric
c41855f2c494 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7281
diff changeset
    75
     and the colormap. See also Image>>atX:y:)
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
     Pixels start at x=0 , y=0 for upper left pixel, end at
7281
89956b990563 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7213
diff changeset
    77
     x = width-1, y=height-1 for lower right pixel.
89956b990563 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7213
diff changeset
    78
     The pixel value contains r/g/b/a in msb order (i.e. r at high, a at low bits)"
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    |pixelIndex "{ Class: SmallInteger }"|
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
6297
ea0fe952c3a5 pixelfunction support
Claus Gittinger <cg@exept.de>
parents: 5325
diff changeset
    82
    pixelFunction notNil ifTrue:[^ pixelFunction value:x value:y].
ea0fe952c3a5 pixelfunction support
Claus Gittinger <cg@exept.de>
parents: 5325
diff changeset
    83
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    pixelIndex := (width * 8 * y) + 1 + (x * 8).
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
7211
1e72cd273ab3 call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
    86
    ^ ((bytes unsignedInt16At:pixelIndex MSB:true) bitShift:48)
1e72cd273ab3 call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
    87
    + ((bytes unsignedInt16At:pixelIndex+2 MSB:true) bitShift:32)
1e72cd273ab3 call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
    88
    + ((bytes unsignedInt16At:pixelIndex+4 MSB:true) bitShift:16)
7213
55e7421aab9d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
    89
    + (bytes unsignedInt16At:pixelIndex+6 MSB:true).
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
pixelAtX:x y:y put:aPixelValue
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    "set the pixel at x/y to aPixelValue.
7517
c41855f2c494 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7281
diff changeset
    94
     The interpretation of the pixelValue depends on the photometric
c41855f2c494 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7281
diff changeset
    95
     and the colormap. (see also: Image>>atX:y:put:)
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
     Pixels start at x=0 , y=0 for upper left pixel, end at
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
     x = width-1, y=height-1 for lower right pixel"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    |pixelIndex "{ Class: SmallInteger }"|
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    pixelIndex := (width * 8 * y) + 1 + (x * 8).
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    bytes isNil ifTrue:[
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
        self createPixelStore
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    ].
7211
1e72cd273ab3 call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   105
    bytes unsignedInt16At:pixelIndex put:((aPixelValue bitShift:-48) bitAnd:16rFFFF) MSB:true.
1e72cd273ab3 call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   106
    bytes unsignedInt16At:pixelIndex+2 put:((aPixelValue bitShift:-32) bitAnd:16rFFFF) MSB:true.
1e72cd273ab3 call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   107
    bytes unsignedInt16At:pixelIndex+4 put:((aPixelValue bitShift:-16) bitAnd:16rFFFF) MSB:true.
1e72cd273ab3 call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   108
    bytes unsignedInt16At:pixelIndex+6 put:(aPixelValue bitAnd:16rFFFF) MSB:true.
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
! !
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
!Depth64Image methodsFor:'initialization'!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
initialize
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
    super initialize.
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    samplesPerPixel := 4. 
7822
ecb148190095 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7517
diff changeset
   116
    bitsPerSample := #[16 16 16 16].
ecb148190095 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7517
diff changeset
   117
ecb148190095 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7517
diff changeset
   118
    "Modified: / 31-01-2017 / 13:11:33 / stefan"
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
! !
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
!Depth64Image methodsFor:'queries'!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
bitsPerPixel
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    "return the number of bits per pixel"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    ^ 64
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
bitsPerRow
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    "return the number of bits in one scanline of the image"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    ^ width * 64
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
bytesPerRow
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    "return the number of bytes in one scanline of the image"
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    ^ width * 8.
5325
e213afc8874c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5323
diff changeset
   139
!
e213afc8874c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5323
diff changeset
   140
e213afc8874c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5323
diff changeset
   141
hasAlphaChannel
e213afc8874c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5323
diff changeset
   142
    ^ true
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
! !
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
!Depth64Image class methodsFor:'documentation'!
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
version
7211
1e72cd273ab3 call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
   148
    ^ '$Header$'
7213
55e7421aab9d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
   149
!
55e7421aab9d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
   150
55e7421aab9d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
   151
version_CVS
55e7421aab9d #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
   152
    ^ '$Header$'
5306
2f2855e29c04 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
! !
6297
ea0fe952c3a5 pixelfunction support
Claus Gittinger <cg@exept.de>
parents: 5325
diff changeset
   154