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