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