Depth32Image.st
author Claus Gittinger <cg@exept.de>
Tue, 29 Apr 2003 20:45:23 +0200
changeset 3866 c01473a90934
parent 3263 bd92a12c9316
child 4761 9672fbf6ad20
permissions -rw-r--r--
eliminated most references to bytes (will be replaced by pixelAccessor soon)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
3263
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
    13
"{ Package: 'stx:libview' }"
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
    14
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
Image subclass:#Depth32Image
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	instanceVariableNames:''
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	classVariableNames:''
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	category:'Graphics-Images'
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!Depth32Image class methodsFor:'documentation'!
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
copyright
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
              All Rights Reserved
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 This software is furnished under a license and may be used
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 hereby transferred.
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
documentation
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    this class represents 32 bit images.
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    Only the minimum protocol is implemented here; much more is
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    needed for higher performance operations on depth32 images.
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    (however, 32bit images are very seldom used, so falling back into the
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    slow general methods from Image should not hurt too much ..)
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    [author:]
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
        Claus Gittinger
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    [see also:]
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
        Depth1Image Depth2Image Depth4Image Depth8Image Depth16Image Depth24Image
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
        ImageReader
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
! !
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
!Depth32Image class methodsFor:'queries'!
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
imageDepth
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    "return the depth of images represented by instances of
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
     this class - here we return 32"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    ^ 32
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    "Modified: 20.4.1996 / 23:40:01 / cg"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    "Created: 24.4.1997 / 19:00:28 / cg"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
! !
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
3263
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
    67
!Depth32Image methodsFor:'accessing-pixels'!
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
pixelAtX:x y:y
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    "retrieve a pixel at x/y; return a pixelValue.
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
     Pixels start at x=0 , y=0 for upper left pixel, end at
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
     x = width-1, y=height-1 for lower right pixel"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
1669
d156d2623f41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    74
    |pixelIndex "{ Class: SmallInteger }"|
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
1669
d156d2623f41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    76
    pixelIndex := (width * 4 * y) + 1 + (x * 4).
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    "left pixel in high bits"
1669
d156d2623f41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    79
    ^ bytes doubleWordAt:pixelIndex MSB:true.
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    "Created: 24.4.1997 / 19:00:28 / cg"
1669
d156d2623f41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    82
    "Modified: 24.4.1997 / 23:11:05 / cg"
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
!
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
pixelAtX:x y:y put:aPixelValue
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    "set the pixel at x/y to aPixelValue.
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
     Pixels start at x=0 , y=0 for upper left pixel, end at
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
     x = width-1, y=height-1 for lower right pixel"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
1669
d156d2623f41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    90
    |pixelIndex "{ Class: SmallInteger }"|
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
1669
d156d2623f41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    92
    pixelIndex := (width * 4 * y) + 1 + (x * 4).
d156d2623f41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    93
    bytes doubleWordAt:pixelIndex put:aPixelValue MSB:true
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
    "Created: 24.4.1997 / 19:00:28 / cg"
1669
d156d2623f41 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
    96
    "Modified: 24.4.1997 / 23:10:51 / cg"
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
! !
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
!Depth32Image methodsFor:'queries'!
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
bitsPerPixel
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    "return the number of bits per pixel"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    ^ 32
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
    "Created: 24.4.1997 / 19:00:28 / cg"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
!
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
bitsPerRow
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    "return the number of bits in one scanline of the image"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
3866
c01473a90934 eliminated most references to bytes
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   112
    ^ width * 32
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
    "Created: 24.4.1997 / 19:00:28 / cg"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
!
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
bytesPerRow
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
    "return the number of bytes in one scanline of the image"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
    ^ width * 4.
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
    "Created: 24.4.1997 / 19:00:28 / cg"
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
! !
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
!Depth32Image class methodsFor:'documentation'!
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
version
3866
c01473a90934 eliminated most references to bytes
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   128
    ^ '$Header: /cvs/stx/stx/libview/Depth32Image.st,v 1.4 2003-04-29 18:45:10 cg Exp $'
1663
a2be19b14666 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
! !