author | Claus Gittinger <cg@exept.de> |
Sat, 11 Nov 1995 16:54:10 +0100 | |
changeset 219 | 9ff0660f447f |
parent 193 | 3abcc2ee1641 |
child 281 | 4f04a56b1641 |
permissions | -rw-r--r-- |
193 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
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 |
||
13 |
Image subclass:#Depth16Image |
|
14 |
instanceVariableNames:'' |
|
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'Graphics-Images' |
|
18 |
! |
|
19 |
||
20 |
!Depth16Image class methodsFor:'documentation'! |
|
21 |
||
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
25 |
All Rights Reserved |
|
26 |
||
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
version |
|
219
9ff0660f447f
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
37 |
^ '$Header: /cvs/stx/stx/libview/Depth16Image.st,v 1.2 1995-11-11 15:49:03 cg Exp $' |
193 | 38 |
! |
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
this class represents 16 bit images. |
|
43 |
Only the minimum protocol is implemented here; much more is |
|
44 |
needed for higher performance operations on depth16 images. |
|
45 |
(however, 16bit images are seldom used, so falling back into the |
|
46 |
slow general methods from Image should not hurt too much ..) |
|
47 |
" |
|
48 |
! ! |
|
49 |
||
50 |
!Depth16Image class methodsFor:'queries'! |
|
51 |
||
52 |
imageDepth |
|
53 |
^ 16 |
|
54 |
! ! |
|
55 |
||
56 |
!Depth16Image methodsFor:'queries'! |
|
57 |
||
58 |
bitsPerPixel |
|
59 |
"return the number of bits per pixel" |
|
60 |
||
61 |
^ 16 |
|
62 |
! |
|
63 |
||
64 |
bitsPerRow |
|
65 |
"return the number of bits in one scanline of the image" |
|
66 |
||
67 |
^ width * 16 |
|
68 |
! |
|
69 |
||
70 |
bitsPerSample |
|
71 |
"return the number of bits per sample. |
|
72 |
The return value is an array of bits-per-plane." |
|
73 |
||
74 |
^ #(16) |
|
75 |
! |
|
76 |
||
77 |
bytesPerRow |
|
78 |
"return the number of bytes in one scanline of the image" |
|
79 |
||
80 |
^ width * 2. |
|
81 |
! |
|
82 |
||
83 |
samplesPerPixel |
|
84 |
"return the number of samples per pixel in the image." |
|
85 |
||
86 |
^ 1 |
|
87 |
! ! |
|
88 |
||
89 |
!Depth16Image methodsFor:'accessing'! |
|
90 |
||
91 |
valueAtX:x y:y |
|
92 |
"retrieve a pixel at x/y; return a pixelValue. |
|
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 |
|lineIndex "{ Class: SmallInteger }"| |
|
97 |
||
98 |
lineIndex := (width * 2 * y) + 1. |
|
99 |
||
100 |
"left pixel in high bits" |
|
101 |
^ bytes wordAt:(lineIndex + (x * 2)) MSB:true. |
|
102 |
! |
|
103 |
||
104 |
atX:x y:y putValue:aPixelValue |
|
105 |
"set the pixel at x/y to aPixelValue. |
|
106 |
Pixels start at x=0 , y=0 for upper left pixel, end at |
|
107 |
x = width-1, y=height-1 for lower right pixel" |
|
108 |
||
109 |
|lineIndex "{ Class: SmallInteger }"| |
|
110 |
||
111 |
lineIndex := (width * 2 * y) + 1. |
|
112 |
||
113 |
bytes wordAt:(lineIndex + (x * 2)) put:aPixelValue MSB:true |
|
114 |
! ! |