Depth32Image.st
author Claus Gittinger <cg@exept.de>
Thu, 24 Apr 1997 19:03:15 +0200
changeset 1663 a2be19b14666
child 1669 d156d2623f41
permissions -rw-r--r--
intitial checkin

"
 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:#Depth32Image
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Graphics-Images'
!

!Depth32Image 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 32 bit images.
    Only the minimum protocol is implemented here; much more is
    needed for higher performance operations on depth32 images.
    (however, 32bit images are very 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 Depth16Image Depth24Image
        ImageReader
"
! !

!Depth32Image class methodsFor:'queries'!

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

    ^ 32

    "Modified: 20.4.1996 / 23:40:01 / cg"
    "Created: 24.4.1997 / 19:00:28 / cg"
! !

!Depth32Image methodsFor:'accessing - pixels'!

pixelAtX: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 doubleWordAt:(lineIndex + (x * 2)) MSB:true.

    "Created: 24.4.1997 / 19:00:28 / cg"
!

pixelAtX:x y:y put: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 doubleWordAt:(lineIndex + (x * 2)) put:aPixelValue MSB:true

    "Created: 24.4.1997 / 19:00:28 / cg"
! !

!Depth32Image methodsFor:'queries'!

bitsPerPixel
    "return the number of bits per pixel"

    ^ 32

    "Created: 24.4.1997 / 19:00:28 / cg"
!

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

    ^  width * 32

    "Created: 24.4.1997 / 19:00:28 / cg"
!

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

    ^ width * 4.

    "Created: 24.4.1997 / 19:00:28 / cg"
! !

!Depth32Image class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview/Depth32Image.st,v 1.1 1997-04-24 17:03:15 cg Exp $'
! !