diff -r 975687991916 -r 95dafe4184d5 Image.st --- a/Image.st Thu Apr 24 21:55:43 1997 +0200 +++ b/Image.st Thu Apr 24 23:13:56 1997 +0200 @@ -227,272 +227,282 @@ examples " reading from a file (many formats are supported): - [exBegin] - (Image fromFile:'bitmaps/claus.gif') inspect - [exEnd] - [exBegin] - (Image fromFile:'bitmaps/SmalltalkX.xbm') inspect - [exEnd] - [exBegin] - (Image fromFile:'bitmaps/okSmily_up.bmp') inspect - [exEnd] + [exBegin] + (Image fromFile:'bitmaps/gifImages/claus.gif') inspect + [exEnd] + [exBegin] + (Image fromFile:'bitmaps/SmalltalkX.xbm') inspect + [exEnd] + [exBegin] + (Image fromFile:'bitmaps/winBitmaps/okSmily_up.bmp') inspect + [exEnd] inline image: default: depth=1 & #blackIs0 - [exBegin] - (Image width:8 height:8 - fromArray:#( 2r11111111 - 2r10000001 - 2r10000001 - 2r10000001 - 2r10000001 - 2r10000001 - 2r10000001 - 2r11111111 )) inspect - [exEnd] + [exBegin] + (Image width:8 height:8 + fromArray:#( 2r11111111 + 2r10000001 + 2r10000001 + 2r10000001 + 2r10000001 + 2r10000001 + 2r10000001 + 2r11111111 )) inspect + [exEnd] with #whiteIs0 photometric - [exBegin] - ((Image width:8 height:8 - fromArray:#( 2r11111111 - 2r10000001 - 2r10000001 - 2r10000001 - 2r10000001 - 2r10000001 - 2r10000001 - 2r11111111 )) - photometric:#whiteIs0) - inspect - [exEnd] + [exBegin] + ((Image width:8 height:8 + fromArray:#( 2r11111111 + 2r10000001 + 2r10000001 + 2r10000001 + 2r10000001 + 2r10000001 + 2r10000001 + 2r11111111 )) + photometric:#whiteIs0) + inspect + [exEnd] with a colorMap - [exBegin] - ((Image width:8 height:8 - fromArray:#( 2r11111111 - 2r10000001 - 2r10000001 - 2r10000001 - 2r10000001 - 2r10000001 - 2r10000001 - 2r11111111 )) - colorMap:(Array with:(Color red) - with:(Color yellow))) - inspect - [exEnd] + [exBegin] + ((Image width:8 height:8 + fromArray:#( 2r11111111 + 2r10000001 + 2r10000001 + 2r10000001 + 2r10000001 + 2r10000001 + 2r10000001 + 2r11111111 )) + colorMap:(Array with:(Color red) + with:(Color yellow))) + inspect + [exEnd] a depth4 greyScale image: - [exBegin] - ((Depth4Image - width:4 - height:4 - fromArray:#[ - 16r01 16r23 - 16r45 16r67 - 16r89 16rab - 16rcd 16ref - ]) - magnifiedBy:30) - inspect - [exEnd] + [exBegin] + (Depth4Image + width:8 + height:4 + fromArray:#[ + 16r00 16r11 16r22 16r33 + 16r44 16r55 16r66 16r77 + 16r88 16r99 16raa 16rbb + 16rcc 16rdd 16ree 16rff + ]) inspect + [exEnd] + ((Depth4Image + width:4 + height:4 + fromArray:#[ + 16r01 16r23 + 16r45 16r67 + 16r89 16rab + 16rcd 16ref + ]) + magnifiedBy:30) + inspect + [exEnd] the following has the same effect: - [exBegin] - ((Image - width:4 - height:4 - depth:4 - fromArray:#[ - 16r01 16r23 - 16r45 16r67 - 16r89 16rab - 16rcd 16ref - ]) - magnifiedBy:30) - inspect - [exEnd] + [exBegin] + ((Image + width:4 + height:4 + depth:4 + fromArray:#[ + 16r01 16r23 + 16r45 16r67 + 16r89 16rab + 16rcd 16ref + ]) + magnifiedBy:30) + inspect + [exEnd] with reverse grey-interpretation: - [exBegin] - ((Depth4Image - width:4 - height:4 - fromArray:#[ - 16r01 16r23 - 16r45 16r67 - 16r89 16rab - 16rcd 16ref - ]) - photometric:#whiteIs0; - magnifiedBy:30) - inspect - [exEnd] + [exBegin] + ((Depth4Image + width:4 + height:4 + fromArray:#[ + 16r01 16r23 + 16r45 16r67 + 16r89 16rab + 16rcd 16ref + ]) + photometric:#whiteIs0; + magnifiedBy:30) + inspect + [exEnd] with 1-bit-per-pixel rgb interpretation: - [exBegin] - ((Depth4Image - width:4 - height:4 - fromArray:#[ - 16r01 16r23 - 16r45 16r67 - 16r89 16rab - 16rcd 16ref - ]) - photometric:#rgb; - samplesPerPixel:3; - bitsPerSample:#(1 1 1); - magnifiedBy:30) - inspect - [exEnd] + [exBegin] + ((Depth4Image + width:4 + height:4 + fromArray:#[ + 16r01 16r23 + 16r45 16r67 + 16r89 16rab + 16rcd 16ref + ]) + photometric:#rgb; + samplesPerPixel:3; + bitsPerSample:#(1 1 1); + magnifiedBy:30) + inspect + [exEnd] with 1/2/1 rgb interpretation: - [exBegin] - ((Depth4Image - width:4 - height:4 - fromArray:#[ - 16r01 16r23 - 16r45 16r67 - 16r89 16rab - 16rcd 16ref - ]) - photometric:#rgb; - samplesPerPixel:3; - bitsPerSample:#(1 2 1); - magnifiedBy:30) - inspect - [exEnd] + [exBegin] + ((Depth4Image + width:4 + height:4 + fromArray:#[ + 16r01 16r23 + 16r45 16r67 + 16r89 16rab + 16rcd 16ref + ]) + photometric:#rgb; + samplesPerPixel:3; + bitsPerSample:#(1 2 1); + magnifiedBy:30) + inspect + [exEnd] a 2/2/0 rgb image (i.e. no blue): - [exBegin] - |i| - - i := Depth4Image - width:4 - height:4 - fromArray:#[ 16r01 16r23 - 16r45 16r67 - 16r89 16rab - 16rcd 16ref ]. - i photometric:#rgb. - i samplesPerPixel:3. - i bitsPerSample:#(2 2 0). - - i := i magnifiedBy:30. - i inspect. - [exEnd] + [exBegin] + |i| + + i := Depth4Image + width:4 + height:4 + fromArray:#[ 16r01 16r23 + 16r45 16r67 + 16r89 16rab + 16rcd 16ref ]. + i photometric:#rgb. + i samplesPerPixel:3. + i bitsPerSample:#(2 2 0). + + i := i magnifiedBy:30. + i inspect. + [exEnd] a 0/0/4 rgb image (i.e. no red or green): - [exBegin] - |i| - - i := Depth4Image - width:4 - height:4 - fromArray:#[ 16r01 16r23 - 16r45 16r67 - 16r89 16rab - 16rcd 16ref ]. - i photometric:#rgb. - i samplesPerPixel:3. - i bitsPerSample:#(0 0 4). - - i := i magnifiedBy:30. - i inspect. - [exEnd] + [exBegin] + |i| + + i := Depth4Image + width:4 + height:4 + fromArray:#[ 16r01 16r23 + 16r45 16r67 + 16r89 16rab + 16rcd 16ref ]. + i photometric:#rgb. + i samplesPerPixel:3. + i bitsPerSample:#(0 0 4). + + i := i magnifiedBy:30. + i inspect. + [exEnd] a 2plane greyscale image: - [exBegin] - ((Depth2Image - width:4 - height:4 - fromArray:#[ - 4r0123 - 4r1230 - 4r2301 - 4r3012 - ]) - magnifiedBy:30) - inspect - [exEnd] + [exBegin] + ((Depth2Image + width:4 + height:4 + fromArray:#[ + 4r0123 + 4r1230 + 4r2301 + 4r3012 + ]) + magnifiedBy:30) + inspect + [exEnd] with colors: - [exBegin] - ((Depth2Image - width:4 - height:4 - fromArray:#[ - 4r0123 - 4r1230 - 4r2301 - 4r3012 - ]) - colorMap:(Array with:(Color black) - with:(Color red) - with:(Color green) - with:(Color blue)); - magnifiedBy:30) - inspect - [exEnd] + [exBegin] + ((Depth2Image + width:4 + height:4 + fromArray:#[ + 4r0123 + 4r1230 + 4r2301 + 4r3012 + ]) + colorMap:(Array with:(Color black) + with:(Color red) + with:(Color green) + with:(Color blue)); + magnifiedBy:30) + inspect + [exEnd] depth8 image with 3/3/2 rgb interpretation: - [exBegin] - ((Depth8Image - width:16 - height:16 - fromArray:(ByteArray withAll:(0 to:16rFF))) - photometric:#rgb; - samplesPerPixel:3; - bitsPerSample:#(3 3 2); - magnifiedBy:30) - inspect - [exEnd] + [exBegin] + ((Depth8Image + width:16 + height:16 + fromArray:(ByteArray withAll:(0 to:16rFF))) + photometric:#rgb; + samplesPerPixel:3; + bitsPerSample:#(3 3 2); + magnifiedBy:30) + inspect + [exEnd] depth8 image with 2/2/2 rgb interpretation: - [exBegin] - ((Depth8Image - width:8 - height:8 - fromArray:(ByteArray withAll:(0 to:16r3F))) - photometric:#rgb; - samplesPerPixel:3; - bitsPerSample:#(2 2 2); - magnifiedBy:30) - inspect - [exEnd] + [exBegin] + ((Depth8Image + width:8 + height:8 + fromArray:(ByteArray withAll:(0 to:16r3F))) + photometric:#rgb; + samplesPerPixel:3; + bitsPerSample:#(2 2 2); + magnifiedBy:30) + inspect + [exEnd] storing (only a few formats are currently supported): - [exBegin] - |img| - - img := Image fromFile:'bitmaps/okSmily_up.bmp'. - img saveOn:'myImage.tiff'. - (Image fromFile:'myImage.tiff') inspect - [exEnd] + [exBegin] + |img| + + img := Image fromFile:'bitmaps/okSmily_up.bmp'. + img saveOn:'myImage.tiff'. + (Image fromFile:'myImage.tiff') inspect + [exEnd] magnifying (any factor): - [exBegin] - ((Image fromFile:'bitmaps/claus.gif') - magnifiedTo:(48@48)) - inspect - [exEnd] - [exBegin] - ((Image fromFile:'bitmaps/claus.gif') - magnifiedBy:0.7) - inspect - [exEnd] + [exBegin] + ((Image fromFile:'bitmaps/claus.gif') + magnifiedTo:(48@48)) + inspect + [exEnd] + [exBegin] + ((Image fromFile:'bitmaps/claus.gif') + magnifiedBy:0.7) + inspect + [exEnd] rotating (currently, only multiples of 90 degrees are supported): - [exBegin] - ((Image fromFile:'bitmaps/claus.gif') - rotated:90) - inspect - [exEnd] - [exBegin] - (((Image fromFile:'bitmaps/claus.gif') - magnifiedBy:0.3@0.7) rotated:270) - inspect - [exEnd] + [exBegin] + ((Image fromFile:'bitmaps/claus.gif') + rotated:90) + inspect + [exEnd] + [exBegin] + (((Image fromFile:'bitmaps/claus.gif') + magnifiedBy:0.3@0.7) rotated:270) + inspect + [exEnd] " ! ! @@ -772,9 +782,9 @@ |newImage| self == Image ifTrue:[ - newImage := self implementorForDepth:anImage depth. + newImage := (self implementorForDepth:anImage depth) new. ] ifFalse:[ - newImage := self new. + newImage := self new. ]. ^ newImage fromSubImage:anImage in:aRectangle. @@ -801,7 +811,7 @@ " "Created: 20.9.1995 / 01:05:43 / claus" - "Modified: 10.6.1996 / 18:11:08 / cg" + "Modified: 24.4.1997 / 23:13:02 / cg" ! new @@ -4537,9 +4547,8 @@ "/ the temporary helper image is only needed to allow "/ the rowAt:putAll: calls below. - i := Image implementorForDepth:usedDeviceBitsPerPixel. - i width:width. - i height:height. + i := (Image implementorForDepth:usedDeviceBitsPerPixel) new. + i width:width height:height. imageBits := ByteArray new:(i bytesPerRow * height). i bits:imageBits. @@ -4572,7 +4581,7 @@ ^ form "Created: 20.10.1995 / 22:05:10 / cg" - "Modified: 24.4.1997 / 16:52:32 / cg" + "Modified: 24.4.1997 / 23:11:16 / cg" ! ! !Image methodsFor:'converting palette images'! @@ -10621,6 +10630,6 @@ !Image class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.190 1997-04-24 19:55:43 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.191 1997-04-24 21:13:56 cg Exp $' ! ! Image initialize!