Depth16Image.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Apr 1996 18:26:07 +0200
changeset 611 e0442439a3c6
parent 579 e381761190c4
child 813 8bc17dba7a02
permissions -rw-r--r--
documentation

"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

Image subclass:#Depth16Image
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Graphics-Images'
!

!Depth16Image class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    this class represents 16 bit images.
    Only the minimum protocol is implemented here; much more is
    needed for higher performance operations on depth16 images.
    (however, 16bit images are seldom used, so falling back into the
    slow general methods from Image should not hurt too much ..)

    [author:]
        Claus Gittinger

    [see also:]
        Depth1Image Depth2Image Depth4Image Depth8Image Depth24Image
        ImageReader
"
! !

!Depth16Image class methodsFor:'queries'!

imageDepth
    "return the depth of images represented by instances of
     this class - here we return 16"

    ^ 16

    "Modified: 20.4.1996 / 23:40:01 / cg"
! !

!Depth16Image methodsFor:'accessing'!

atX:x y:y putValue:aPixelValue
    "set the pixel at x/y to aPixelValue.
     Pixels start at x=0 , y=0 for upper left pixel, end at
     x = width-1, y=height-1 for lower right pixel"

    |lineIndex "{ Class: SmallInteger }"|

    lineIndex := (width * 2 * y) + 1.

    bytes wordAt:(lineIndex + (x * 2)) put:aPixelValue MSB:true
!

valueAtX:x y:y
    "retrieve a pixel at x/y; return a pixelValue.
     Pixels start at x=0 , y=0 for upper left pixel, end at
     x = width-1, y=height-1 for lower right pixel"

    |lineIndex "{ Class: SmallInteger }"|

    lineIndex := (width * 2 * y) + 1.

    "left pixel in high bits"
    ^ bytes wordAt:(lineIndex + (x * 2)) MSB:true.
! !

!Depth16Image methodsFor:'queries'!

bitsPerPixel
    "return the number of bits per pixel"

    ^ 16
!

bitsPerRow
    "return the number of bits in one scanline of the image"

    ^  width * 16
!

bitsPerSample
    "return the number of bits per sample.
     The return value is an array of bits-per-plane."

    ^  #(16)
!

bytesPerRow
    "return the number of bytes in one scanline of the image"

    ^ width * 2.
!

samplesPerPixel
    "return the number of samples per pixel in the image."

    ^ 1
! !

!Depth16Image class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview/Depth16Image.st,v 1.5 1996-04-25 16:22:00 cg Exp $'
! !