author | Claus Gittinger <cg@exept.de> |
Wed, 13 Sep 2017 10:26:19 +0200 | |
changeset 8175 | a6bf93e434e4 |
parent 8084 | 95a21362ceba |
child 8200 | b16bae6c33f6 |
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 |
||
7900 | 46 |
For now, the rest of the system (for example, the image editor) cannot reallydeal with |
47 |
such images. So some work may be required in the future. |
|
48 |
||
5306 | 49 |
[author:] |
50 |
Claus Gittinger |
|
51 |
||
52 |
[see also:] |
|
53 |
Depth1Image Depth2Image Depth4Image Depth8Image Depth16Image Depth24Image Depth32Image |
|
54 |
ImageReader |
|
55 |
" |
|
56 |
! ! |
|
57 |
||
58 |
!Depth64Image class methodsFor:'queries'! |
|
59 |
||
60 |
defaultPhotometric |
|
61 |
"return the default photometric pixel interpretation" |
|
62 |
||
8084 | 63 |
^ #rgba |
64 |
||
65 |
"Modified: / 22-08-2017 / 17:40:01 / cg" |
|
5306 | 66 |
! |
67 |
||
68 |
imageDepth |
|
69 |
"return the depth of images represented by instances of |
|
70 |
this class - here we return 64" |
|
71 |
||
72 |
^ 64 |
|
73 |
! ! |
|
74 |
||
75 |
!Depth64Image methodsFor:'accessing-pixels'! |
|
76 |
||
77 |
pixelAtX:x y:y |
|
78 |
"retrieve a pixel at x/y; return a pixelValue. |
|
7517 | 79 |
The interpretation of the returned value depends on the photometric |
80 |
and the colormap. See also Image>>atX:y:) |
|
5306 | 81 |
Pixels start at x=0 , y=0 for upper left pixel, end at |
7281 | 82 |
x = width-1, y=height-1 for lower right pixel. |
83 |
The pixel value contains r/g/b/a in msb order (i.e. r at high, a at low bits)" |
|
5306 | 84 |
|
85 |
|pixelIndex "{ Class: SmallInteger }"| |
|
86 |
||
6297 | 87 |
pixelFunction notNil ifTrue:[^ pixelFunction value:x value:y]. |
88 |
||
5306 | 89 |
pixelIndex := (width * 8 * y) + 1 + (x * 8). |
90 |
||
7211
1e72cd273ab3
call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
91 |
^ ((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
|
92 |
+ ((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
|
93 |
+ ((bytes unsignedInt16At:pixelIndex+4 MSB:true) bitShift:16) |
7213 | 94 |
+ (bytes unsignedInt16At:pixelIndex+6 MSB:true). |
5306 | 95 |
! |
96 |
||
97 |
pixelAtX:x y:y put:aPixelValue |
|
98 |
"set the pixel at x/y to aPixelValue. |
|
7517 | 99 |
The interpretation of the pixelValue depends on the photometric |
100 |
and the colormap. (see also: Image>>atX:y:put:) |
|
5306 | 101 |
Pixels start at x=0 , y=0 for upper left pixel, end at |
102 |
x = width-1, y=height-1 for lower right pixel" |
|
103 |
||
104 |
|pixelIndex "{ Class: SmallInteger }"| |
|
105 |
||
106 |
pixelIndex := (width * 8 * y) + 1 + (x * 8). |
|
107 |
bytes isNil ifTrue:[ |
|
108 |
self createPixelStore |
|
109 |
]. |
|
7211
1e72cd273ab3
call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
110 |
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
|
111 |
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
|
112 |
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
|
113 |
bytes unsignedInt16At:pixelIndex+6 put:(aPixelValue bitAnd:16rFFFF) MSB:true. |
5306 | 114 |
! ! |
115 |
||
116 |
!Depth64Image methodsFor:'initialization'! |
|
117 |
||
118 |
initialize |
|
119 |
super initialize. |
|
120 |
samplesPerPixel := 4. |
|
7822 | 121 |
bitsPerSample := #[16 16 16 16]. |
122 |
||
123 |
"Modified: / 31-01-2017 / 13:11:33 / stefan" |
|
5306 | 124 |
! ! |
125 |
||
126 |
!Depth64Image methodsFor:'queries'! |
|
127 |
||
128 |
bitsPerPixel |
|
129 |
"return the number of bits per pixel" |
|
130 |
||
131 |
^ 64 |
|
132 |
! |
|
133 |
||
134 |
bitsPerRow |
|
135 |
"return the number of bits in one scanline of the image" |
|
136 |
||
137 |
^ width * 64 |
|
138 |
! |
|
139 |
||
140 |
bytesPerRow |
|
141 |
"return the number of bytes in one scanline of the image" |
|
142 |
||
143 |
^ width * 8. |
|
5325 | 144 |
! |
145 |
||
146 |
hasAlphaChannel |
|
147 |
^ true |
|
5306 | 148 |
! ! |
149 |
||
150 |
!Depth64Image class methodsFor:'documentation'! |
|
151 |
||
152 |
version |
|
7211
1e72cd273ab3
call the renamed basic methods for short access:
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
153 |
^ '$Header$' |
7213 | 154 |
! |
155 |
||
156 |
version_CVS |
|
157 |
^ '$Header$' |
|
5306 | 158 |
! ! |
6297 | 159 |