Depth16Image.st
author Claus Gittinger <cg@exept.de>
Mon, 10 Jun 1996 19:25:04 +0200
changeset 813 8bc17dba7a02
parent 611 e0442439a3c6
child 1659 a38cf5be1aa8
permissions -rw-r--r--
removed obsolete comversion stuff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
193
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
Image subclass:#Depth16Image
579
e381761190c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 281
diff changeset
    14
	instanceVariableNames:''
e381761190c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 281
diff changeset
    15
	classVariableNames:''
e381761190c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 281
diff changeset
    16
	poolDictionaries:''
e381761190c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 281
diff changeset
    17
	category:'Graphics-Images'
193
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
!
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!Depth16Image class methodsFor:'documentation'!
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
copyright
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
"
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
 COPYRIGHT (c) 1995 by Claus Gittinger
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
	      All Rights Reserved
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 This software is furnished under a license and may be used
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 only in accordance with the terms of that license and with the
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 be provided or otherwise made available to, or used by, any
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 other person.  No title to or ownership of the software is
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 hereby transferred.
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
"
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
!
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
documentation
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
"
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
    this class represents 16 bit images.
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
    Only the minimum protocol is implemented here; much more is
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    needed for higher performance operations on depth16 images.
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    (however, 16bit images are seldom used, so falling back into the
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    slow general methods from Image should not hurt too much ..)
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 579
diff changeset
    43
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 579
diff changeset
    44
    [author:]
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 579
diff changeset
    45
        Claus Gittinger
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 579
diff changeset
    46
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 579
diff changeset
    47
    [see also:]
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 579
diff changeset
    48
        Depth1Image Depth2Image Depth4Image Depth8Image Depth24Image
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 579
diff changeset
    49
        ImageReader
193
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
"
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
! !
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
!Depth16Image class methodsFor:'queries'!
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
imageDepth
579
e381761190c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 281
diff changeset
    56
    "return the depth of images represented by instances of
e381761190c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 281
diff changeset
    57
     this class - here we return 16"
e381761190c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 281
diff changeset
    58
193
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    ^ 16
579
e381761190c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 281
diff changeset
    60
e381761190c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 281
diff changeset
    61
    "Modified: 20.4.1996 / 23:40:01 / cg"
193
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
! !
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
281
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    64
!Depth16Image methodsFor:'accessing'!
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    65
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    66
atX:x y:y putValue:aPixelValue
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    67
    "set the pixel at x/y to aPixelValue.
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    68
     Pixels start at x=0 , y=0 for upper left pixel, end at
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    69
     x = width-1, y=height-1 for lower right pixel"
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    70
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    71
    |lineIndex "{ Class: SmallInteger }"|
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    72
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    73
    lineIndex := (width * 2 * y) + 1.
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    74
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    75
    bytes wordAt:(lineIndex + (x * 2)) put:aPixelValue MSB:true
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    76
!
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    77
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    78
valueAtX:x y:y
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    79
    "retrieve a pixel at x/y; return a pixelValue.
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    80
     Pixels start at x=0 , y=0 for upper left pixel, end at
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    81
     x = width-1, y=height-1 for lower right pixel"
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    82
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    83
    |lineIndex "{ Class: SmallInteger }"|
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    84
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    85
    lineIndex := (width * 2 * y) + 1.
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    86
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    87
    "left pixel in high bits"
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    88
    ^ bytes wordAt:(lineIndex + (x * 2)) MSB:true.
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    89
! !
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    90
193
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
!Depth16Image methodsFor:'queries'!
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
bitsPerPixel
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    "return the number of bits per pixel"
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    ^ 16
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
!
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
bitsPerRow
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    "return the number of bits in one scanline of the image"
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    ^  width * 16
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
!
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
bytesPerRow
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
    "return the number of bytes in one scanline of the image"
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
    ^ width * 2.
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
! !
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
281
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   111
!Depth16Image class methodsFor:'documentation'!
193
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
281
4f04a56b1641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   113
version
813
8bc17dba7a02 removed obsolete comversion stuff
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   114
    ^ '$Header: /cvs/stx/stx/libview/Depth16Image.st,v 1.6 1996-06-10 17:24:20 cg Exp $'
193
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
! !