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