--- a/Image.st Tue Sep 04 21:00:20 2001 +0200
+++ b/Image.st Wed Sep 05 17:38:53 2001 +0200
@@ -245,319 +245,319 @@
any default bitmaps, or make certain that your application
finds its bitmaps - even if they are in a separate directory)
- [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]
+ [exBegin]
+ (Image fromFile:'goodies/bitmaps/gifImages/claus.gif') inspect
+ [exEnd]
+ [exBegin]
+ (Image fromFile:'libtool/bitmaps/SmalltalkX.xbm') inspect
+ [exEnd]
+ [exBegin]
+ (Image fromFile:'goodies/bitmaps/winBitmaps/okSmily_up.bmp') inspect
+ [exEnd]
The following examples demonstrate various depth
and colorMap variations ...
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:
(default photometric is #blackIs0)
- [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]
+ [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]
the same, magnified:
- [exBegin]
- ((Depth4Image
- width:4
- height:4
- fromArray:#[
- 16r01 16r23
- 16r45 16r67
- 16r89 16rab
- 16rcd 16ref
- ])
- magnifiedBy:30)
- inspect
- [exEnd]
+ [exBegin]
+ ((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:10)
- inspect
- [exEnd]
+ [exBegin]
+ ((Depth8Image
+ width:16
+ height:16
+ fromArray:(ByteArray withAll:(0 to:16rFF)))
+ photometric:#rgb;
+ samplesPerPixel:3;
+ bitsPerSample:#(3 3 2);
+ magnifiedBy:10)
+ 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:10)
- inspect
- [exEnd]
+ [exBegin]
+ ((Depth8Image
+ width:8
+ height:8
+ fromArray:(ByteArray withAll:(0 to:16r3F)))
+ photometric:#rgb;
+ samplesPerPixel:3;
+ bitsPerSample:#(2 2 2);
+ magnifiedBy:10)
+ inspect
+ [exEnd]
trueColor image:
- [exBegin]
- ((Depth24Image
- width:4
- height:4
- fromArray:#[
- 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00
- 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00
- 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF
- 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF
- ])
- photometric:#rgb;
- samplesPerPixel:3;
- bitsPerSample:#(8 8 8);
- magnifiedBy:30)
- inspect
- [exEnd]
+ [exBegin]
+ ((Depth24Image
+ width:4
+ height:4
+ fromArray:#[
+ 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00
+ 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00
+ 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF
+ 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF
+ ])
+ photometric:#rgb;
+ samplesPerPixel:3;
+ bitsPerSample:#(8 8 8);
+ magnifiedBy:30)
+ inspect
+ [exEnd]
storing - only a few formats (TIFF, XBM, XPM) currently support storing:
- [exBegin]
- |img|
-
- img := Image fromFile:'bitmaps/okSmily_up.bmp'.
- img saveOn:'myImage.tiff'.
- (Image fromFile:'myImage.tiff') inspect
- [exEnd]
+ [exBegin]
+ |img|
+
+ img := Image fromFile:'goodies/bitmaps/winBitmaps/okSmily_up.bmp'.
+ img saveOn:'myImage.tiff'.
+ (Image fromFile:'myImage.tiff') inspect
+ [exEnd]
magnifying (any factor):
- [exBegin]
- ((Image fromFile:'bitmaps/gifImages/claus.gif')
- magnifiedTo:(48@48))
- inspect
- [exEnd]
- [exBegin]
- ((Image fromFile:'bitmaps/gifImages/claus.gif')
- magnifiedBy:0.7)
- inspect
- [exEnd]
+ [exBegin]
+ ((Image fromFile:'goodies/bitmaps/gifImages/claus.gif')
+ magnifiedTo:(48@48))
+ inspect
+ [exEnd]
+ [exBegin]
+ ((Image fromFile:'goodies/bitmaps/gifImages/claus.gif')
+ magnifiedBy:0.7)
+ inspect
+ [exEnd]
rotating:
- [exBegin]
- ((Image fromFile:'bitmaps/gifImages/claus.gif')
- rotated:90)
- inspect
- [exEnd]
- [exBegin]
- (((Image fromFile:'bitmaps/gifImages/claus.gif')
- magnifiedBy:0.3@0.7) rotated:270)
- inspect
- [exEnd]
- [exBegin]
- (((Image fromFile:'bitmaps/gifImages/claus.gif')
- ) rotated:30)
- inspect
- [exEnd]
+ [exBegin]
+ ((Image fromFile:'goodies/bitmaps/gifImages/claus.gif')
+ rotated:90)
+ inspect
+ [exEnd]
+ [exBegin]
+ (((Image fromFile:'goodies/bitmaps/gifImages/claus.gif')
+ magnifiedBy:0.3@0.7) rotated:270)
+ inspect
+ [exEnd]
+ [exBegin]
+ (((Image fromFile:'goodies/bitmaps/gifImages/claus.gif')
+ ) rotated:30)
+ inspect
+ [exEnd]
negative:
- [exBegin]
- ((Image fromFile:'bitmaps/gifImages/claus.gif')
- negative)
- inspect
- [exEnd]
+ [exBegin]
+ ((Image fromFile:'goodies/bitmaps/gifImages/claus.gif')
+ negative)
+ inspect
+ [exEnd]
"
! !
@@ -873,13 +873,13 @@
(self == Image
or:[anImage class == self
- and:[photometricOrNil isNil or:[photometricOrNil == anImage photometric]]]) ifTrue:[^ anImage].
+ and:[photometricOrNil isNil or:[photometricOrNil == anImage photometric]]]) ifTrue:[^ anImage].
^ self new fromImage:anImage photometric:photometricOrNil.
"
|i1 i8|
- i1 := Image fromFile:'bitmaps/SBrowser.xbm'.
+ i1 := Image fromFile:'goodies/bitmaps/SBrowser.xbm'.
i8 := Depth8Image fromImage:i1.
i8 inspect
"
@@ -945,9 +945,9 @@
|cls newImage|
self == Image ifTrue:[
- cls := (self implementorForDepth:anImage depth).
+ cls := (self implementorForDepth:anImage depth).
] ifFalse:[
- cls := self.
+ cls := self.
].
newImage := cls new.
^ newImage fromSubImage:anImage in:aRectangle.
@@ -955,21 +955,21 @@
"
|i1 i8|
- i1 := Image fromFile:'bitmaps/garfield.gif'.
+ i1 := Image fromFile:'goodies/bitmaps/garfield.gif'.
i8 := Depth8Image fromSubImage:i1 in:(0@0 corner:20@20).
i8 inspect
"
"
|i1 i8|
- i1 := Image fromFile:'bitmaps/claus.gif'.
+ i1 := Image fromFile:'goodies/bitmaps/claus.gif'.
i8 := Depth8Image fromSubImage:i1 in:(70@50 extent:50@50).
i8 inspect
"
"
|i1 i8|
- i1 := Image fromFile:'bitmaps/claus.gif'.
+ i1 := Image fromFile:'goodies/bitmaps/claus.gif'.
i8 := Image fromSubImage:i1 in:(70@50 extent:50@50).
i8 inspect
"
@@ -1300,19 +1300,19 @@
inStream := Smalltalk systemFileStreamFor:name.
inStream isNil ifTrue:[
- inStream := Smalltalk bitmapFileStreamFor:name.
- inStream isNil ifTrue:[
-
- "/ this signal is a query - if noone seems to
- "/ care, return nil.
- "/ However, a handler may provide a replacement.
+ inStream := Smalltalk bitmapFileStreamFor:name.
+ inStream isNil ifTrue:[
+
+ "/ this signal is a query - if noone seems to
+ "/ care, return nil.
+ "/ However, a handler may provide a replacement.
"/ ('IMAGE: ' , aFileName , ' does not exist or is not readable') infoPrintCR.
- ^ ImageNotFoundQuerySignal
- raiseRequestWith:aFileName
- errorString:('IMAGE [warning]: ''' , aFileName asFilename pathName, ''' does not exist or is not readable').
- ].
- name := 'bitmaps/' , name.
+ ^ ImageNotFoundQuerySignal
+ raiseRequestWith:aFileName
+ errorString:('IMAGE [warning]: ''' , aFileName asFilename pathName, ''' does not exist or is not readable').
+ ].
+ name := 'bitmaps/' , name.
].
inStream notNil ifTrue:[pathName := inStream pathName].
inStream close.
@@ -1325,14 +1325,14 @@
"/ handle compressed-suffix
"/
(#('Z' 'gz') includes:suffix) ifTrue:[
- fn := fn withoutSuffix.
- nm := fn name.
- suffix := fn suffix.
- mustDecompress := true.
+ fn := fn withoutSuffix.
+ nm := fn name.
+ suffix := fn suffix.
+ mustDecompress := true.
].
suffix isEmpty ifTrue:[
- suffix := nm.
+ suffix := nm.
].
"/ get the imageReader class from the files extension
@@ -1340,26 +1340,26 @@
readerClass := MIMETypes imageReaderForSuffix:suffix.
readerClass notNil ifTrue:[
- mustDecompress == true ifTrue:[
- inPipe := PipeStream readingFrom:'gunzip <' , pathName.
- inPipe notNil ifTrue:[
- [
- image := readerClass fromStream:inPipe.
- ] valueNowOrOnUnwindDo:[
- inPipe close
- ].
- image notNil ifTrue:[^ image].
- ]
- ] ifFalse:[
- BadImageFormatQuerySignal handle:[:ex |
- (readersErrorMsg := ex errorString) infoPrintCR.
- image := nil.
- ex return.
- ] do:[
- image := readerClass fromFile:name.
- ].
- image notNil ifTrue:[^ image].
- ]
+ mustDecompress == true ifTrue:[
+ inPipe := PipeStream readingFrom:'gunzip <' , pathName.
+ inPipe notNil ifTrue:[
+ [
+ image := readerClass fromStream:inPipe.
+ ] valueNowOrOnUnwindDo:[
+ inPipe close
+ ].
+ image notNil ifTrue:[^ image].
+ ]
+ ] ifFalse:[
+ BadImageFormatQuerySignal handle:[:ex |
+ (readersErrorMsg := ex errorString) infoPrintCR.
+ image := nil.
+ ex return.
+ ] do:[
+ image := readerClass fromFile:name.
+ ].
+ image notNil ifTrue:[^ image].
+ ]
].
"
@@ -1369,15 +1369,15 @@
therefore, it takes a bit longer.
"
MIMETypes imageReaderClasses do:[:mimeReaderClass |
- (mimeReaderClass notNil
- and:[mimeReaderClass ~~ readerClass]) ifTrue:[
- (mimeReaderClass isValidImageFile:name) ifTrue:[
- image := mimeReaderClass fromFile:name.
- image notNil ifTrue:[
- ^ image
- ]
- ]
- ]
+ (mimeReaderClass notNil
+ and:[mimeReaderClass ~~ readerClass]) ifTrue:[
+ (mimeReaderClass isValidImageFile:name) ifTrue:[
+ image := mimeReaderClass fromFile:name.
+ image notNil ifTrue:[
+ ^ image
+ ]
+ ]
+ ]
].
"/ nope - unknown format
@@ -1388,16 +1388,16 @@
"/ 'IMAGE: unknown image file format: ' infoPrint. aFileName infoPrintNL.
^ ImageNotFoundQuerySignal
- raiseRequestWith:aFileName
- errorString:(readersErrorMsg ? ('IMAGE [warning]: unknown image file format: ''' , aFileName asFilename pathName , '''')).
-
- "
- Image fromFile:'bitmaps/gifImages/claus.gif'
- Image fromFile:'bitmaps/gifImages/garfield.gif'
-
- Image fromFile:'bitmaps/winBitmaps/a11.ico'
+ raiseRequestWith:aFileName
+ errorString:(readersErrorMsg ? ('IMAGE [warning]: unknown image file format: ''' , aFileName asFilename pathName , '''')).
+
+ "
+ Image fromFile:'goodies/bitmaps/gifImages/claus.gif'
+ Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'
+
+ Image fromFile:'goodies/bitmaps/winBitmaps/a11.ico'
Image fromFile:'czech.xpm.gz'
- Image fromFile:'bitmaps/hello_world.icon'
+ Image fromFile:'goodies/bitmaps/hello_world.icon'
"
"
@@ -1408,10 +1408,10 @@
Image imageNotFoundQuerySignal
handle:[:ex |
- Transcript showCR:ex errorString.
- ex proceedWith:nil
+ Transcript showCR:ex errorString.
+ ex proceedWith:nil
] do:[
- Image fromFile:'fooBar'
+ Image fromFile:'fooBar'
]
"
@@ -1420,7 +1420,7 @@
Image imageNotFoundQuerySignal
answer:(Image fromFile:'bitmaps/SmalltalkX.xbm')
do:[
- Image fromFile:'fooBar'
+ Image fromFile:'fooBar'
]
"
@@ -1442,6 +1442,7 @@
^ Smalltalk imageFromFileNamed:aFileName inPackage:aPackage
"
+ Image fromFile:'goodies/bitmaps/SBrowser.xbm'
Image fromFile:'bitmaps/SBrowser.xbm' inPackage:'stx:libtool'
Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages'
"
@@ -1528,10 +1529,10 @@
this format ...
"
MIMETypes imageReaderClasses do:[:readerClass |
- readerClass notNil ifTrue:[
- image := readerClass fromStream:aStream.
- image notNil ifTrue:[^ image].
- ]
+ readerClass notNil ifTrue:[
+ image := readerClass fromStream:aStream.
+ image notNil ifTrue:[^ image].
+ ]
].
"
@@ -1540,14 +1541,14 @@
"/ 'Image [info]: unknown image file format in stream: ' infoPrintCR.
^ ImageNotFoundQuerySignal
- raiseRequestWith:aStream
- errorString:('IMAGE [warning]: unknown image file format in stream').
-
- "
- Image fromFile:'bitmaps/dano.tiff'
- Image fromFile:'bitmaps/test.fax'
- Image fromFile:'bitmaps/voice.tiff'
- Image fromFile:'voice.tiff'
+ raiseRequestWith:aStream
+ errorString:('IMAGE [warning]: unknown image file format in stream').
+
+ "
+ Image fromFile:'goodies/bitmaps/dano.tiff'
+ Image fromFile:'goodies/bitmaps/test.fax'
+ Image fromFile:'goodies/bitmaps/voice.tiff'
+ Image fromFile:'goodies/voice.tiff'
Image fromFile:'../fileIn/bitmaps/claus.gif'
Image fromFile:'../fileIn/bitmaps/garfield.gif'
@@ -1556,9 +1557,9 @@
Image fromFile:'../goodies/faces/next.com/steve.face'
Image fromFile:'/LocalLibrary/Images/OS2/dos3.ico'
- Image fromFile:'bitmaps/globe1.xbm'
- Image fromFile:'bitmaps/globe1.xbm.Z'
- Image fromFile:'bitmaps/hello_world.icon'
+ Image fromFile:'goodies/bitmaps/globe1.xbm'
+ Image fromFile:'goodies/bitmaps/globe1.xbm.Z'
+ Image fromFile:'goodies/bitmaps/hello_world.icon'
"
"Created: 13.9.1996 / 18:06:00 / cg"
@@ -2762,13 +2763,13 @@
"
|i|
- i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
(i rowAt:0) inspect
"
"
|i|
- i := Image fromFile:'bitmaps/SBrowser.xbm'.
+ i := Image fromFile:'goodies/bitmaps/SBrowser.xbm'.
(i rowAt:0) inspect
"
@@ -3330,9 +3331,9 @@
deviceDepth := aDevice depth.
deviceDepth == 8 ifFalse:[
- (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
- ^ nil.
- ]
+ (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
+ ^ nil.
+ ]
].
pseudoBits := self floydSteinbergDitheredDepth8BitsColors:fixColors.
@@ -3347,51 +3348,51 @@
"/
map := Array new:256.
fixColors do:[:clr |
- map at:clr colorId + 1 put:clr
+ map at:clr colorId + 1 put:clr
].
f colorMap:map.
f initGC.
f bits:pseudoBits.
aDevice
- drawBits:pseudoBits
- bitsPerPixel:8
- depth:deviceDepth
- padding:8
- width:width height:height
- x:0 y:0
- into:(f id) x:0 y:0
- width:width height:height
- with:(f gcId).
+ drawBits:pseudoBits
+ bitsPerPixel:8
+ depth:deviceDepth
+ padding:8
+ width:width height:height
+ x:0 y:0
+ into:(f id) x:0 y:0
+ width:width height:height
+ with:(f gcId).
^ f
"
example:
- color reduction from Depth8 to Depth4 (dithering) can be done by:
+ color reduction from Depth8 to Depth4 (dithering) can be done by:
|img8 reducedImg8 img4 map form|
map := #(
- (0 0 0)
- (0 0 100)
- (0 50 0)
- (0 50 100)
- (0 100 0)
- (0 100 100)
- (100 0 0)
- (100 0 100)
- (100 50 0)
- (100 50 100)
- (100 100 0)
- (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
- green:(rgb at:2)
- blue:(rgb at:3)) on:Display].
-
- img8 := Image fromFile:'bitmaps/bf.im8'.
+ (0 0 0)
+ (0 0 100)
+ (0 50 0)
+ (0 50 100)
+ (0 100 0)
+ (0 100 100)
+ (100 0 0)
+ (100 0 100)
+ (100 50 0)
+ (100 50 100)
+ (100 100 0)
+ (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
+ green:(rgb at:2)
+ blue:(rgb at:3)) on:Display].
+
+ img8 := Image fromFile:'goodies/bitmaps/bf.im8'.
form := img8 paletteImageAsDitheredPseudoFormOn:Display
- colors:map
- nRed:2
- nGreen:3
- nBlue:2.
+ colors:map
+ nRed:2
+ nGreen:3
+ nBlue:2.
img8 := Depth8Image fromForm:form. 'dithered version of original image'.
img4 := Depth4Image fromImage:img8.
"
@@ -3413,9 +3414,9 @@
deviceDepth := aDevice depth.
deviceDepth == 8 ifFalse:[
- (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
- ^ nil
- ]
+ (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
+ ^ nil
+ ]
].
pseudoBits := self floydSteinbergDitheredDepth8BitsColors:fixColors nRed:nRed nGreen:nGreen nBlue:nBlue.
@@ -3430,51 +3431,51 @@
"/
map := Array new:256.
fixColors do:[:clr |
- map at:clr colorId + 1 put:clr
+ map at:clr colorId + 1 put:clr
].
f colorMap:map.
f initGC.
f bits:pseudoBits.
aDevice
- drawBits:pseudoBits
- bitsPerPixel:8
- depth:deviceDepth
- padding:8
- width:width height:height
- x:0 y:0
- into:(f id) x:0 y:0
- width:width height:height
- with:(f gcId).
+ drawBits:pseudoBits
+ bitsPerPixel:8
+ depth:deviceDepth
+ padding:8
+ width:width height:height
+ x:0 y:0
+ into:(f id) x:0 y:0
+ width:width height:height
+ with:(f gcId).
^ f
"
example:
- color reduction from Depth8 to Depth4 (dithering) can be done by:
+ color reduction from Depth8 to Depth4 (dithering) can be done by:
|img8 reducedImg8 img4 map form|
map := #(
- (0 0 0)
- (0 0 100)
- (0 50 0)
- (0 50 100)
- (0 100 0)
- (0 100 100)
- (100 0 0)
- (100 0 100)
- (100 50 0)
- (100 50 100)
- (100 100 0)
- (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
- green:(rgb at:2)
- blue:(rgb at:3)) on:Display].
-
- img8 := Image fromFile:'bitmaps/bf.im8'.
+ (0 0 0)
+ (0 0 100)
+ (0 50 0)
+ (0 50 100)
+ (0 100 0)
+ (0 100 100)
+ (100 0 0)
+ (100 0 100)
+ (100 50 0)
+ (100 50 100)
+ (100 100 0)
+ (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
+ green:(rgb at:2)
+ blue:(rgb at:3)) on:Display].
+
+ img8 := Image fromFile:'goodies/bitmaps/bf.im8'.
form := img8 paletteImageAsDitheredPseudoFormOn:Display
- colors:map
- nRed:2
- nGreen:3
- nBlue:2.
+ colors:map
+ nRed:2
+ nGreen:3
+ nBlue:2.
img8 := Depth8Image fromForm:form. 'dithered version of original image'.
img4 := Depth4Image fromImage:img8.
"
@@ -3490,12 +3491,12 @@
depth := aDevice depth.
(depth == 1
or:[aDevice hasGrayscales not]) ifTrue:[
- "/ for monochrome, there is specialized
- "/ monochrome dither code available
-
- bits := self floydSteinbergDitheredMonochromeBits.
+ "/ for monochrome, there is specialized
+ "/ monochrome dither code available
+
+ bits := self floydSteinbergDitheredMonochromeBits.
] ifFalse:[
- bits := self floydSteinbergDitheredGrayBitsDepth:depth.
+ bits := self floydSteinbergDitheredGrayBitsDepth:depth.
].
^ self makeDeviceGrayPixmapOn:aDevice depth:depth fromArray:bits
@@ -3503,7 +3504,7 @@
"
|i|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
(i asFloydSteinbergDitheredGrayFormOn:Display) inspect
"
@@ -3524,17 +3525,17 @@
|ditheredBits|
(depth == 1) ifTrue:[
- ^ self asFloydSteinbergDitheredMonochromeImage
+ ^ self asFloydSteinbergDitheredMonochromeImage
].
ditheredBits := self floydSteinbergDitheredGrayBitsDepth:depth.
^ (self class implementorForDepth:depth)
- width:width height:height fromArray:ditheredBits
+ width:width height:height fromArray:ditheredBits
"
|i|
- i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
i inspect.
(i asFloydSteinbergDitheredGrayImageDepth:1) inspect.
(i asFloydSteinbergDitheredGrayImageDepth:2) inspect.
@@ -3545,11 +3546,11 @@
|i|
i := Depth24Image width:4 height:1
- fromArray:#[
- 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00
- 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00
- 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00
- 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00].
+ fromArray:#[
+ 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00
+ 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00
+ 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00
+ 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00 16rFF 16r00 16r00].
i := i magnifiedBy:4@1.
i inspect.
@@ -3562,13 +3563,13 @@
|i|
i := Depth24Image width:4 height:6
- fromArray:#[
- 16r00 16r00 16r00 16r00 16r00 16r80 16r00 16r00 16rff 16r00 16r80 16r00
- 16r00 16r80 16r80 16r00 16rFF 16r00 16r00 16rFF 16r80 16r00 16rFF 16rFF
- 16r80 16r00 16r00 16r80 16r00 16r80 16r80 16r00 16rff 16r80 16r80 16r00
- 16r80 16r80 16r80 16r80 16rFF 16r00 16r80 16rFF 16r80 16r80 16rFF 16rFF
- 16rFF 16r00 16r00 16rFF 16r00 16r80 16rFF 16r00 16rff 16rFF 16r80 16r00
- 16rFF 16r80 16r80 16rFF 16rFF 16r00 16rFF 16rFF 16r80 16rFF 16rFF 16rFF].
+ fromArray:#[
+ 16r00 16r00 16r00 16r00 16r00 16r80 16r00 16r00 16rff 16r00 16r80 16r00
+ 16r00 16r80 16r80 16r00 16rFF 16r00 16r00 16rFF 16r80 16r00 16rFF 16rFF
+ 16r80 16r00 16r00 16r80 16r00 16r80 16r80 16r00 16rff 16r80 16r80 16r00
+ 16r80 16r80 16r80 16r80 16rFF 16r00 16r80 16rFF 16r80 16r80 16rFF 16rFF
+ 16rFF 16r00 16r00 16rFF 16r00 16r80 16rFF 16r00 16rff 16rFF 16r80 16r00
+ 16rFF 16r80 16r80 16rFF 16rFF 16r00 16rFF 16rFF 16r80 16rFF 16rFF 16rFF].
i := i magnifiedBy:30.
i inspect.
@@ -3589,7 +3590,7 @@
"
|i|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
i inspect.
(i asFloydSteinbergDitheredGrayImageDepth:1) inspect.
(i asFloydSteinbergDitheredGrayImageDepth:2) inspect.
@@ -3600,14 +3601,14 @@
|i|
i := Depth4Image
- width:4
- height:4
- fromArray:#[
- 16r01 16r23
- 16r45 16r67
- 16r89 16rab
- 16rcd 16ref
- ].
+ width:4
+ height:4
+ fromArray:#[
+ 16r01 16r23
+ 16r45 16r67
+ 16r89 16rab
+ 16rcd 16ref
+ ].
i := i magnifiedBy:30.
i inspect.
(i asFloydSteinbergDitheredGrayImageDepth:1) inspect.
@@ -3630,7 +3631,7 @@
"
|i f|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
(i asFloydSteinbergDitheredMonochromeFormOn:Display) inspect.
"
@@ -3638,16 +3639,16 @@
|i f|
i := Depth2Image width:8 height:8
- fromArray:#[
- 4r0000 4r0000
- 4r0000 4r0000
- 4r1111 4r1111
- 4r1111 4r1111
- 4r2222 4r2222
- 4r2222 4r2222
- 4r3333 4r3333
- 4r3333 4r3333
- ].
+ fromArray:#[
+ 4r0000 4r0000
+ 4r0000 4r0000
+ 4r1111 4r1111
+ 4r1111 4r1111
+ 4r2222 4r2222
+ 4r2222 4r2222
+ 4r3333 4r3333
+ 4r3333 4r3333
+ ].
(i asFloydSteinbergDitheredMonochromeFormOn:Display) inspect.
"
@@ -3666,7 +3667,7 @@
"
|i|
- i := Image fromFile:'garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
i inspect.
i asFloydSteinbergDitheredMonochromeImage inspect.
i asBurkesDitheredMonochromeImage inspect.
@@ -3676,7 +3677,7 @@
"
|i|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
i inspect.
i asFloydSteinbergDitheredMonochromeImage inspect.
i asBurkesDitheredMonochromeImage inspect.
@@ -3687,14 +3688,14 @@
|i|
i := Depth4Image
- width:4
- height:4
- fromArray:#[
- 16r01 16r23
- 16r45 16r67
- 16r89 16rab
- 16rcd 16ref
- ].
+ width:4
+ height:4
+ fromArray:#[
+ 16r01 16r23
+ 16r45 16r67
+ 16r89 16rab
+ 16rcd 16ref
+ ].
i := i magnifiedBy:30.
i inspect.
i asFloydSteinbergDitheredMonochromeImage inspect.
@@ -3714,22 +3715,22 @@
deviceDepth := aDevice depth.
has8BitImage := (deviceDepth == 8)
- or:[ (aDevice supportedImageFormatForDepth:8) notNil ].
+ or:[ (aDevice supportedImageFormatForDepth:8) notNil ].
has8BitImage ifFalse:[
- deviceDepth == 4 ifFalse:[^ nil].
-
- pseudoBits8 := self nfloydSteinbergDitheredDepth8BitsColors:colors.
- pseudoBits8 isNil ifTrue:[^ nil].
- "/ convert to devices depth
-
- pseudoBits := ByteArray new:(width*4+7//8 * height).
- pseudoBits8 compressPixels:4 width:width height:height into:pseudoBits mapping:nil.
- d := 4.
+ deviceDepth == 4 ifFalse:[^ nil].
+
+ pseudoBits8 := self nfloydSteinbergDitheredDepth8BitsColors:colors.
+ pseudoBits8 isNil ifTrue:[^ nil].
+ "/ convert to devices depth
+
+ pseudoBits := ByteArray new:(width*4+7//8 * height).
+ pseudoBits8 compressPixels:4 width:width height:height into:pseudoBits mapping:nil.
+ d := 4.
] ifTrue:[
- pseudoBits := self nfloydSteinbergDitheredDepth8BitsColors:colors.
- pseudoBits isNil ifTrue:[^ nil].
- d := 8.
+ pseudoBits := self nfloydSteinbergDitheredDepth8BitsColors:colors.
+ pseudoBits isNil ifTrue:[^ nil].
+ d := 8.
].
f := Form width:width height:height depth:deviceDepth on:aDevice.
@@ -3741,35 +3742,35 @@
"/
map := Array new:256 withAll:0.
colors do:[:clr |
- clr notNil ifTrue:[
- map at:clr colorId + 1 put:clr
- ]
+ clr notNil ifTrue:[
+ map at:clr colorId + 1 put:clr
+ ]
].
f colorMap:map.
f initGC.
f bits:pseudoBits.
aDevice
- drawBits:pseudoBits
- bitsPerPixel:d
- depth:deviceDepth
- padding:8
- width:width height:height
- x:0 y:0
- into:(f id) x:0 y:0
- width:width height:height
- with:(f gcId).
+ drawBits:pseudoBits
+ bitsPerPixel:d
+ depth:deviceDepth
+ padding:8
+ width:width height:height
+ x:0 y:0
+ into:(f id) x:0 y:0
+ width:width height:height
+ with:(f gcId).
^ f
"
|i|
- i := Image fromFile:'bitmaps/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/garfield.gif'.
(i asFloydSteinbergDitheredPseudoFormUsing:(Smalltalk at:#'Color:DitherColors') on:Display) inspect
|i|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
(i asFloydSteinbergDitheredPseudoFormUsing:(Smalltalk at:#'Color:DitherColors') on:Display) inspect
"
@@ -3852,7 +3853,7 @@
"
|i|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
(i asGrayFormOn:Display) inspect.
"
@@ -3895,7 +3896,7 @@
"
|i|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
(i asGrayFormOn:Display) inspect.
"
@@ -3928,28 +3929,28 @@
((aDevice == device) and:[monoDeviceForm notNil]) ifTrue:[^ monoDeviceForm].
depth == 1 ifTrue:[
- ((aDevice == device) and:[deviceForm notNil]) ifTrue:[^ deviceForm].
+ ((aDevice == device) and:[deviceForm notNil]) ifTrue:[^ deviceForm].
].
form := self asMonochromeFormOn:aDevice dither:DitherAlgorithm.
(device isNil or:[aDevice == device]) ifTrue:[
- "remember this form in the receiver ..."
-
- form notNil ifTrue:[
- monoDeviceForm := form.
- device isNil ifTrue:[
- device := aDevice.
- Lobby register:self
- ] ifFalse:[
- Lobby registerChange:self
- ].
- "
- can save space, by not keeping the images data-bits
- twice (here and in the device form)
- "
- form forgetBits
- ]
+ "remember this form in the receiver ..."
+
+ form notNil ifTrue:[
+ monoDeviceForm := form.
+ device isNil ifTrue:[
+ device := aDevice.
+ Lobby register:self
+ ] ifFalse:[
+ Lobby registerChange:self
+ ].
+ "
+ can save space, by not keeping the images data-bits
+ twice (here and in the device form)
+ "
+ form forgetBits
+ ]
].
^ form
@@ -3957,7 +3958,7 @@
"
|i|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
(i asMonochromeFormOn:Display) inspect.
"
@@ -4008,9 +4009,9 @@
deviceDepth := aDevice depth.
deviceDepth == 8 ifFalse:[
- (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
- ^ nil
- ]
+ (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
+ ^ nil
+ ]
].
pseudoBits := self nearestPaintDepth8BitsColors:fixColors.
@@ -4025,51 +4026,51 @@
"/
map := Array new:256.
fixColors do:[:clr |
- map at:clr colorId + 1 put:clr
+ map at:clr colorId + 1 put:clr
].
f colorMap:map.
f initGC.
f bits:pseudoBits.
aDevice
- drawBits:pseudoBits
- bitsPerPixel:8
- depth:deviceDepth
- padding:8
- width:width height:height
- x:0 y:0
- into:(f id) x:0 y:0
- width:width height:height
- with:(f gcId).
+ drawBits:pseudoBits
+ bitsPerPixel:8
+ depth:deviceDepth
+ padding:8
+ width:width height:height
+ x:0 y:0
+ into:(f id) x:0 y:0
+ width:width height:height
+ with:(f gcId).
^ f
"
example:
- color reduction from Depth8 to Depth4 (dithering) can be done by:
+ color reduction from Depth8 to Depth4 (dithering) can be done by:
|img8 reducedImg8 img4 map form|
map := #(
- (0 0 0)
- (0 0 100)
- (0 50 0)
- (0 50 100)
- (0 100 0)
- (0 100 100)
- (100 0 0)
- (100 0 100)
- (100 50 0)
- (100 50 100)
- (100 100 0)
- (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
- green:(rgb at:2)
- blue:(rgb at:3)) on:Display].
-
- img8 := Image fromFile:'bitmaps/claus.gif'.
+ (0 0 0)
+ (0 0 100)
+ (0 50 0)
+ (0 50 100)
+ (0 100 0)
+ (0 100 100)
+ (100 0 0)
+ (100 0 100)
+ (100 50 0)
+ (100 50 100)
+ (100 100 0)
+ (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
+ green:(rgb at:2)
+ blue:(rgb at:3)) on:Display].
+
+ img8 := Image fromFile:'goodies/bitmaps/claus.gif'.
form := img8 asNearestPaintDepth8FormOn:Display
- colors:map
- nRed:2
- nGreen:3
- nBlue:2.
+ colors:map
+ nRed:2
+ nGreen:3
+ nBlue:2.
img8 := Depth8Image fromForm:form. 'dithered version of original image'.
img4 := Depth4Image fromImage:img8.
"
@@ -4091,9 +4092,9 @@
deviceDepth := aDevice depth.
deviceDepth == 8 ifFalse:[
- (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
- ^ nil
- ]
+ (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
+ ^ nil
+ ]
].
pseudoBits := self nearestPaintDepth8BitsColors:fixColors nRed:nRed nGreen:nGreen nBlue:nBlue.
@@ -4108,51 +4109,51 @@
"/
map := Array new:256.
fixColors do:[:clr |
- map at:clr colorId + 1 put:clr
+ map at:clr colorId + 1 put:clr
].
f colorMap:map.
f initGC.
f bits:pseudoBits.
aDevice
- drawBits:pseudoBits
- bitsPerPixel:8
- depth:deviceDepth
- padding:8
- width:width height:height
- x:0 y:0
- into:(f id) x:0 y:0
- width:width height:height
- with:(f gcId).
+ drawBits:pseudoBits
+ bitsPerPixel:8
+ depth:deviceDepth
+ padding:8
+ width:width height:height
+ x:0 y:0
+ into:(f id) x:0 y:0
+ width:width height:height
+ with:(f gcId).
^ f
"
example:
- color reduction from Depth8 to Depth4 (dithering) can be done by:
+ color reduction from Depth8 to Depth4 (dithering) can be done by:
|img8 reducedImg8 img4 map form|
map := #(
- (0 0 0)
- (0 0 100)
- (0 50 0)
- (0 50 100)
- (0 100 0)
- (0 100 100)
- (100 0 0)
- (100 0 100)
- (100 50 0)
- (100 50 100)
- (100 100 0)
- (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
- green:(rgb at:2)
- blue:(rgb at:3)) on:Display].
-
- img8 := Image fromFile:'bitmaps/claus.gif'.
+ (0 0 0)
+ (0 0 100)
+ (0 50 0)
+ (0 50 100)
+ (0 100 0)
+ (0 100 100)
+ (100 0 0)
+ (100 0 100)
+ (100 50 0)
+ (100 50 100)
+ (100 100 0)
+ (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
+ green:(rgb at:2)
+ blue:(rgb at:3)) on:Display].
+
+ img8 := Image fromFile:'goodies/bitmaps/claus.gif'.
form := img8 asNearestPaintDepth8FormOn:Display
- colors:map
- nRed:2
- nGreen:3
- nBlue:2.
+ colors:map
+ nRed:2
+ nGreen:3
+ nBlue:2.
img8 := Depth8Image fromForm:form. 'dithered version of original image'.
img4 := Depth4Image fromImage:img8.
"
@@ -4170,23 +4171,23 @@
depth := aDevice depth.
(depth == 1
or:[aDevice hasGrayscales not]) ifTrue:[
- "/ for monochrome, there is highly specialized
- "/ monochrome dither code available
-
- ^ self asOrderedDitheredMonochromeFormOn:aDevice
+ "/ for monochrome, there is highly specialized
+ "/ monochrome dither code available
+
+ ^ self asOrderedDitheredMonochromeFormOn:aDevice
].
bits := self
- orderedDitheredGrayBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
- ditherWidth:8
- depth:depth.
+ orderedDitheredGrayBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
+ ditherWidth:8
+ depth:depth.
^ self makeDeviceGrayPixmapOn:aDevice depth:depth fromArray:bits
"
|i|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
(i asOrderedDitheredGrayFormOn:Display) inspect
"
@@ -4202,31 +4203,31 @@
dither := self class orderedDitherMatrixOfSize:8.
(depth == 1) ifTrue:[
- "/ for monochrome, there is highly specialized
- "/ monochrome dither code available
-
- ^ Depth1Image
- width:width
- height:height
- fromArray:(
- self
- orderedDitheredMonochromeBitsWithDitherMatrix:dither
- ditherWidth:8)
+ "/ for monochrome, there is highly specialized
+ "/ monochrome dither code available
+
+ ^ Depth1Image
+ width:width
+ height:height
+ fromArray:(
+ self
+ orderedDitheredMonochromeBitsWithDitherMatrix:dither
+ ditherWidth:8)
].
^ (self class implementorForDepth:depth)
- width:width
- height:height
- fromArray:(
- self
- orderedDitheredGrayBitsWithDitherMatrix:dither
- ditherWidth:8
- depth:depth)
+ width:width
+ height:height
+ fromArray:(
+ self
+ orderedDitheredGrayBitsWithDitherMatrix:dither
+ ditherWidth:8
+ depth:depth)
"
|i i1 i2 i4 i8|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
i1 := i asOrderedDitheredGrayImageDepth:1.
i1 inspect.
@@ -4242,7 +4243,7 @@
"
|i i1 i2 i4 i8|
- i := Image fromFile:'bitmaps/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/garfield.gif'.
i1 := i asOrderedDitheredGrayImageDepth:1.
i1 inspect.
@@ -4276,9 +4277,9 @@
"/ 4x4 for small number of colors ...
^ self
- asOrderedDitheredMonochromeFormOn:aDevice
- ditherMatrix:(self class orderedDitherMatrixOfSize:4)
- ditherWidth:4
+ asOrderedDitheredMonochromeFormOn:aDevice
+ ditherMatrix:(self class orderedDitherMatrixOfSize:4)
+ ditherWidth:4
"/ ^ self
"/ asOrderedDitheredMonochromeFormOn:aDevice
@@ -4288,31 +4289,31 @@
"
|i f|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
f := i asOrderedDitheredMonochromeFormOn:Display.
|i f|
- i := (Image fromFile:'bitmaps/winBitmaps/a11.ico') magnifiedBy:10.
+ i := (Image fromFile:'goodies/bitmaps/winBitmaps/a11.ico') magnifiedBy:10.
f := i asOrderedDitheredMonochromeFormOn:Display.
|i f|
- i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
f := i asOrderedDitheredMonochromeFormOn:Display.
|i f|
- i := (Image fromFile:'bitmaps/PasteButton.tiff') magnifiedBy:10.
+ i := (Image fromFile:'goodies/bitmaps/PasteButton.tiff') magnifiedBy:10.
f := i asOrderedDitheredMonochromeFormOn:Display.
|i f|
- i := (Image fromFile:'bitmaps/blue-ball.gif') magnifiedBy:1.
+ i := (Image fromFile:'goodies/bitmaps/blue-ball.gif') magnifiedBy:1.
f := i asOrderedDitheredMonochromeFormOn:Display.
"
@@ -4333,19 +4334,19 @@
"
|i|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
(i asOrderedDitheredMonochromeFormOn:Display) inspect
|i|
- i := Image fromFile:'bitmaps/granite.tiff'.
+ i := Image fromFile:'goodies/bitmaps/granite.tiff'.
(i asOrderedDitheredMonochromeFormOn:Display) inspect
|i|
- i := (Image fromFile:'bitmaps/PasteButton.tiff') magnifiedBy:10.
+ i := (Image fromFile:'goodies/bitmaps/PasteButton.tiff') magnifiedBy:10.
(i asOrderedDitheredMonochromeFormOn:Display) inspect
"
@@ -4366,8 +4367,8 @@
"/ 4x4 for small number of colors ...
^ self
- asOrderedDitheredMonochromeImageWithDitherMatrix:(self class orderedDitherMatrixOfSize:4)
- ditherWidth:4
+ asOrderedDitheredMonochromeImageWithDitherMatrix:(self class orderedDitherMatrixOfSize:4)
+ ditherWidth:4
"/ ^ self
"/ asOrderedDitheredMonochromeImageWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
@@ -4376,7 +4377,7 @@
"
|i|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
i asOrderedDitheredMonochromeImage inspect
@@ -4388,25 +4389,25 @@
|i|
- i := Image fromFile:'bitmaps/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/garfield.gif'.
i asOrderedDitheredMonochromeImage inspect
|i|
- i := (Image fromFile:'bitmaps/PasteButton.tiff') magnifiedBy:10.
+ i := (Image fromFile:'goodies/bitmaps/PasteButton.tiff') magnifiedBy:10.
i asOrderedDitheredMonochromeImage inspect
|i|
- i := (Image fromFile:'bitmaps/blue-ball.gif') magnifiedBy:1.
+ i := (Image fromFile:'goodies/bitmaps/blue-ball.gif') magnifiedBy:1.
i asOrderedDitheredMonochromeImage inspect
|i|
- i := Image fromFile:'bitmaps/granite.tiff'.
+ i := Image fromFile:'goodies/bitmaps/granite.tiff'.
i asOrderedDitheredMonochromeImage inspect
"
@@ -4703,21 +4704,21 @@
|depth|
(depth := aDevice depth) == 1 ifTrue:[
- ^ self asThresholdMonochromeFormOn:aDevice
+ ^ self asThresholdMonochromeFormOn:aDevice
].
^ self
- makeDeviceGrayPixmapOn:aDevice
- depth:depth
- fromArray:(self
- orderedDitheredGrayBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
- ditherWidth:4
- depth:depth)
+ makeDeviceGrayPixmapOn:aDevice
+ depth:depth
+ fromArray:(self
+ orderedDitheredGrayBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+ ditherWidth:4
+ depth:depth)
"
|i|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
(i asThresholdGrayFormOn:Display) inspect.
"
@@ -4729,31 +4730,31 @@
"return a thresholded depth-x grey image from the receiver image."
(depth == 1) ifTrue:[
- "/ for monochrome, there is highly specialized
- "/ monochrome dither code available
-
- ^ Depth1Image
- width:width
- height:height
- fromArray:(
- self
- orderedDitheredMonochromeBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
- ditherWidth:4)
+ "/ for monochrome, there is highly specialized
+ "/ monochrome dither code available
+
+ ^ Depth1Image
+ width:width
+ height:height
+ fromArray:(
+ self
+ orderedDitheredMonochromeBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+ ditherWidth:4)
].
^ (self class implementorForDepth:depth)
- width:width
- height:height
- fromArray:(
- self
- orderedDitheredGrayBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
- ditherWidth:4
- depth:depth)
+ width:width
+ height:height
+ fromArray:(
+ self
+ orderedDitheredGrayBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+ ditherWidth:4
+ depth:depth)
"
|i|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
(i asThresholdGrayImageDepth:1) inspect.
(i asThresholdGrayImageDepth:2) inspect.
(i asThresholdGrayImageDepth:4) inspect.
@@ -4778,35 +4779,35 @@
"return a threshold monochrome form from the image."
^ self
- asOrderedDitheredMonochromeFormOn:aDevice
- ditherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
- ditherWidth:4
+ asOrderedDitheredMonochromeFormOn:aDevice
+ ditherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+ ditherWidth:4
"
|i|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
i inspect.
(i asThresholdMonochromeFormOn:Display) inspect
|i|
- i := (Image fromFile:'bitmaps/a11.ico') magnifiedBy:10.
+ i := (Image fromFile:'goodies/bitmaps/a11.ico') magnifiedBy:10.
i inspect.
(i asThresholdMonochromeFormOn:Display) inspect
|i|
- i := Image fromFile:'bitmaps/granite.tiff'.
+ i := Image fromFile:'goodies/bitmaps/granite.tiff'.
i inspect.
(i asThresholdMonochromeFormOn:Display) inspect
|i|
- i := (Image fromFile:'bitmaps/PasteButton.tiff') magnifiedBy:10.
+ i := (Image fromFile:'goodies/bitmaps/PasteButton.tiff') magnifiedBy:10.
i inspect.
(i asThresholdMonochromeFormOn:Display) inspect
"
@@ -4820,13 +4821,13 @@
Threshold means: brightness < 0.5 -> black / otherwise white"
^ self
- asOrderedDitheredMonochromeImageWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
- ditherWidth:4
+ asOrderedDitheredMonochromeImageWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+ ditherWidth:4
"
|i i2|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
i2 := i asThresholdMonochromeImage
@@ -4838,13 +4839,13 @@
|i i2|
- i := Image fromFile:'bitmaps/granite.tiff'.
+ i := Image fromFile:'goodies/bitmaps/granite.tiff'.
i2 := i asThresholdMonochromeImage
|i i2|
- i := (Image fromFile:'bitmaps/PasteButton.tiff') magnifiedBy:10.
+ i := (Image fromFile:'goodies/bitmaps/PasteButton.tiff') magnifiedBy:10.
i2 := i asThresholdMonochromeImage
"
@@ -4863,17 +4864,17 @@
ditherMatrix := ByteArray new:256 withAll:(value truncated).
^ self
- asOrderedDitheredMonochromeImageWithDitherMatrix:ditherMatrix
- ditherWidth:16
+ asOrderedDitheredMonochromeImageWithDitherMatrix:ditherMatrix
+ ditherWidth:16
"
|i|
i := Image width:4 height:4 depth:4
- fromArray:#[ 16r01 16r23
- 16r45 16r67
- 16r89 16rab
- 16rcd 16ref ].
+ fromArray:#[ 16r01 16r23
+ 16r45 16r67
+ 16r89 16rab
+ 16rcd 16ref ].
i := i magnifiedBy:30.
i inspect.
(i asThresholdMonochromeImage:0.125) inspect.
@@ -4886,7 +4887,7 @@
"
|i|
- i := Image fromFile:'bitmaps/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/claus.gif'.
i inspect.
(i asThresholdMonochromeImage:0.125) inspect.
(i asThresholdMonochromeImage:0.25) inspect.
@@ -5023,49 +5024,49 @@
((self depth = anImage depth)
and:[samePhotometric]) ifTrue:[
- bytes := anImage bits copy.
- ^ self.
+ bytes := anImage bits copy.
+ ^ self.
].
bytes := ByteArray uninitializedNew:(self bytesPerRow * height).
self depth >= anImage depth ifTrue:[
- anImage depth <= 12 ifTrue:[
-
- "/ if my depth is greater, all colors can be represented,
- "/ and the loop can be done over pixel values ...
-
- (colorMap isNil or:[samePhotometric not]) ifTrue:[
- map := Array new:(1 bitShift:anImage depth).
- 1 to:map size do:[:i |
- clr := anImage colorFromValue:(i - 1).
- map at:i put:(self valueFromColor:clr).
- ].
- ].
- mappedRowPixels := self pixelArraySpecies new:width.
- h := height-1.
- w := width.
- 0 to:h do:[:row |
- anImage rowAt:row into:mappedRowPixels startingAt:1.
- map notNil ifTrue:[
- 1 to:w do:[:i |
- mappedRowPixels at:i put:(map at:(mappedRowPixels at:i)+1)
- ].
- ].
- self rowAt:row putAll:mappedRowPixels
- ].
- ^ self
- ].
+ anImage depth <= 12 ifTrue:[
+
+ "/ if my depth is greater, all colors can be represented,
+ "/ and the loop can be done over pixel values ...
+
+ (colorMap isNil or:[samePhotometric not]) ifTrue:[
+ map := Array new:(1 bitShift:anImage depth).
+ 1 to:map size do:[:i |
+ clr := anImage colorFromValue:(i - 1).
+ map at:i put:(self valueFromColor:clr).
+ ].
+ ].
+ mappedRowPixels := self pixelArraySpecies new:width.
+ h := height-1.
+ w := width.
+ 0 to:h do:[:row |
+ anImage rowAt:row into:mappedRowPixels startingAt:1.
+ map notNil ifTrue:[
+ 1 to:w do:[:i |
+ mappedRowPixels at:i put:(map at:(mappedRowPixels at:i)+1)
+ ].
+ ].
+ self rowAt:row putAll:mappedRowPixels
+ ].
+ ^ self
+ ].
].
anImage colorsFromX:0 y:0 toX:(width-1) y:(height-1) do:[:x :y :clr |
- self colorAtX:x y:y put:clr
+ self colorAtX:x y:y put:clr
].
"
|i i2 i4 i8 i16 i24|
- i := Image fromFile:'bitmaps/SBrowser.xbm'.
+ i := Image fromFile:'goodies/bitmaps/SBrowser.xbm'.
i inspect.
i2 := Depth2Image fromImage:i.
i2 inspect.
@@ -5080,20 +5081,20 @@
"
|i i24|
- i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
Transcript showCR:(
- Time millisecondsToRun:[
- i24 := Depth24Image fromImage:i.
- ]
+ Time millisecondsToRun:[
+ i24 := Depth24Image fromImage:i.
+ ]
).
i24 inspect.
"
"
|i i24|
- i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
MessageTally spyOn:[
- i24 := Depth24Image fromImage:i.
+ i24 := Depth24Image fromImage:i.
]
"
@@ -5159,7 +5160,7 @@
"
|i i2 i4 i8 i16 i24|
- i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
i inspect.
i4 := Depth4Image fromSubImage:i in:(300@160 corner:340@200).
i4 inspect.
@@ -8767,8 +8768,8 @@
newImage := self copy.
newImage colorMap isNil ifTrue:[
- self error:'no colormap in image'.
- ^ nil
+ self error:'no colormap in image'.
+ ^ nil
].
"
@@ -8781,40 +8782,40 @@
"
leave red component only:
- (Image fromFile:'bitmaps/gifImages/claus.gif')
- copyWithColorMapProcessing:[:clr | Color red:(clr red) green:0 blue:0]
+ (Image fromFile:'goodies/bitmaps/gifImages/claus.gif')
+ copyWithColorMapProcessing:[:clr | Color red:(clr red) green:0 blue:0]
"
"
make it reddish:
(Image fromFile:'bitmaps/gifImages/claus.gif')
- copyWithColorMapProcessing:[:clr | Color red:((clr red * 2) min:100) green:clr green blue:clr blue]
+ copyWithColorMapProcessing:[:clr | Color red:((clr red * 2) min:100) green:clr green blue:clr blue]
"
"
invert:
(Image fromFile:'bitmaps/gifImages/claus.gif')
- copyWithColorMapProcessing:[:clr | Color red:(100 - clr red) green:(100 - clr green) blue:(100 - clr green)]
+ copyWithColorMapProcessing:[:clr | Color red:(100 - clr red) green:(100 - clr green) blue:(100 - clr green)]
"
"
lighter:
(Image fromFile:'bitmaps/gifImages/claus.gif')
- copyWithColorMapProcessing:[:clr | |r g b|
- r := clr red. g := clr green. b := clr blue.
- Color red:(r + (100-r//2))
- green:(g + (100-g//2))
- blue:(b + (100-b//2))]
+ copyWithColorMapProcessing:[:clr | |r g b|
+ r := clr red. g := clr green. b := clr blue.
+ Color red:(r + (100-r//2))
+ green:(g + (100-g//2))
+ blue:(b + (100-b//2))]
"
"
darker:
(Image fromFile:'bitmaps/gifImages/claus.gif')
- copyWithColorMapProcessing:[:clr | Color red:(clr red//2) green:(clr green // 2) blue:(clr blue // 2)]
+ copyWithColorMapProcessing:[:clr | Color red:(clr red//2) green:(clr green // 2) blue:(clr blue // 2)]
"
"Modified: 24.4.1997 / 18:28:05 / cg"
@@ -8908,20 +8909,20 @@
pixelArray := self pixelArraySpecies new:width.
0 to:h do:[:row |
- self rowAt:row into:pixelArray.
- pixelArray reverse.
- self rowAt:row putAll:pixelArray.
+ self rowAt:row into:pixelArray.
+ pixelArray reverse.
+ self rowAt:row putAll:pixelArray.
].
mask notNil ifTrue:[
- mask flipHorizontal
+ mask flipHorizontal
].
"/ flush device info
self restored
"
- (Image fromFile:'bitmaps/gifImages/garfield.gif') flipHorizontal inspect
+ (Image fromFile:'goodies/bitmaps/gifImages/garfield.gif') flipHorizontal inspect
"
"Modified: 24.4.1997 / 18:29:13 / cg"
@@ -8945,20 +8946,20 @@
indexHi := bytesPerRow * h + 1.
0 to:(h // 2) do:[:row |
- buffer replaceFrom:1 to:bytesPerRow with:bytes startingAt:indexLow.
- bytes replaceFrom:indexLow to:(indexLow + bytesPerRow - 1) with:bytes startingAt:indexHi.
- bytes replaceFrom:indexHi to:(indexHi + bytesPerRow - 1) with:buffer startingAt:1.
- indexLow := indexLow + bytesPerRow.
- indexHi := indexHi - bytesPerRow.
+ buffer replaceFrom:1 to:bytesPerRow with:bytes startingAt:indexLow.
+ bytes replaceFrom:indexLow to:(indexLow + bytesPerRow - 1) with:bytes startingAt:indexHi.
+ bytes replaceFrom:indexHi to:(indexHi + bytesPerRow - 1) with:buffer startingAt:1.
+ indexLow := indexLow + bytesPerRow.
+ indexHi := indexHi - bytesPerRow.
].
mask notNil ifTrue:[
- mask flipVertical
+ mask flipVertical
].
"flush device info"
self restored
"
- (Image fromFile:'bitmaps/gifImages/garfield.gif') flipVertical inspect
+ (Image fromFile:'goodies/bitmaps/gifImages/garfield.gif') flipVertical inspect
"
"Modified: 24.4.1997 / 18:29:36 / cg"
@@ -9004,19 +9005,19 @@
newBits := ByteArray uninitializedNew:(newBytesPerRow * newHeight).
mask notNil ifTrue:[
- newMask := (mask magnifiedBy:scalePoint)
+ newMask := (mask magnifiedBy:scalePoint)
].
newImage := self species new.
newImage
- width:newWidth
- height:newHeight
- photometric:photometric
- samplesPerPixel:samplesPerPixel
- bitsPerSample:bitsPerSample
- colorMap:colorMap copy
- bits:newBits
- mask:newMask.
+ width:newWidth
+ height:newHeight
+ photometric:photometric
+ samplesPerPixel:samplesPerPixel
+ bitsPerSample:bitsPerSample
+ colorMap:colorMap copy
+ bits:newBits
+ mask:newMask.
"walk over destination image fetching pixels from source image"
@@ -9025,21 +9026,21 @@
pixelArray := newImage pixelArraySpecies new:newWidth.
0 to:h do:[:row |
- srcRow := (row // mY).
- 0 to:w do:[:col |
- value := self pixelAtX:(col // mX) y:srcRow.
- pixelArray at:(col+1) put:value.
- ].
- newImage rowAt:row putAll:pixelArray.
+ srcRow := (row // mY).
+ 0 to:w do:[:col |
+ value := self pixelAtX:(col // mX) y:srcRow.
+ pixelArray at:(col+1) put:value.
+ ].
+ newImage rowAt:row putAll:pixelArray.
].
^ newImage
"
|i|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
Time millisecondsToRun:[
- i := i hardMagnifiedBy:0.5@0.5
+ i := i hardMagnifiedBy:0.5@0.5
].
i
"
@@ -9085,36 +9086,36 @@
maxX := minX := p1 x.
(t := p2 x) > maxX ifTrue:[
- maxX := t
+ maxX := t
] ifFalse:[
- t < minX ifTrue:[minX := t].
+ t < minX ifTrue:[minX := t].
].
(t := p3 x) > maxX ifTrue:[
- maxX := t
+ maxX := t
] ifFalse:[
- t < minX ifTrue:[minX := t].
+ t < minX ifTrue:[minX := t].
].
(t := p4 x) > maxX ifTrue:[
- maxX := t
+ maxX := t
] ifFalse:[
- t < minX ifTrue:[minX := t].
+ t < minX ifTrue:[minX := t].
].
maxY := minY := p1 y.
(t := p2 y) > maxY ifTrue:[
- maxY := t
+ maxY := t
] ifFalse:[
- t < minY ifTrue:[minY := t].
+ t < minY ifTrue:[minY := t].
].
(t := p3 y) > maxY ifTrue:[
- maxY := t
+ maxY := t
] ifFalse:[
- t < minY ifTrue:[minY := t].
+ t < minY ifTrue:[minY := t].
].
(t := p4 y) > maxY ifTrue:[
- maxY := t
+ maxY := t
] ifFalse:[
- t < minY ifTrue:[minY := t].
+ t < minY ifTrue:[minY := t].
].
@@ -9133,31 +9134,31 @@
newImage colorMap:colorMap copy.
newImage maskedPixelsAre0:maskedPixelsAre0.
mask notNil ifTrue:[
- newImage mask:(mask rotated:degrees)
+ newImage mask:(mask rotated:degrees)
] ifFalse:[
- self isMask ifFalse:[
- self depth ~~ 1 ifTrue:[
- m := ImageMask width:width height:height.
- m bits:(maskBits := ByteArray new:(m bytesPerRow * height)).
- maskBits atAllPut:16rFF.
- newImage mask:(m rotated:degrees)
- ]
- ]
+ self isMask ifFalse:[
+ self depth ~~ 1 ifTrue:[
+ m := ImageMask width:width height:height.
+ m bits:(maskBits := ByteArray new:(m bytesPerRow * height)).
+ maskBits atAllPut:16rFF.
+ newImage mask:(m rotated:degrees)
+ ]
+ ]
].
maskedPixelsAre0 ifTrue:[
- blackPixel := 0.
+ blackPixel := 0.
] ifFalse:[
- blackPixel := self valueFromColor:Color black.
- blackPixel isNil ifTrue:[
- blackPixel := self valueFromColor:Color white.
- blackPixel isNil ifTrue:[
- blackPixel := 0.
- ]
- ]
+ blackPixel := self valueFromColor:Color black.
+ blackPixel isNil ifTrue:[
+ blackPixel := self valueFromColor:Color white.
+ blackPixel isNil ifTrue:[
+ blackPixel := 0.
+ ]
+ ]
].
self isMask ifTrue:[
- blackPixel := 0.
+ blackPixel := 0.
].
myDepth := self depth.
@@ -9203,583 +9204,583 @@
&& __isFloat(halfH)
&& __isByteArray(newBits)
&& __isByteArray(__INST(bytes))) {
- __srcBytes = __ByteArrayInstPtr(__INST(bytes))->ba_element;
- __dstBytes = __ByteArrayInstPtr(newBits)->ba_element;
- __nSrcBytes = __byteArraySize(__INST(bytes));
- __nDstBytes = __byteArraySize(newBits);
- __blackPixel = __intVal(blackPixel);
-
- __radians = __floatVal(radians);
- __radians = -__radians; /* sigh: clock-wise */
- __sin = sin(__radians);
- __cos = cos(__radians);
- __minX = __floatVal(minX);
- __minY = __floatVal(minY);
- __halfW = __floatVal(halfW);
- __halfH = __floatVal(halfH);
-
- __dstRowPtr = __dstBytes;
- __dstEndPtr = __dstBytes + __nDstBytes;
+ __srcBytes = __ByteArrayInstPtr(__INST(bytes))->ba_element;
+ __dstBytes = __ByteArrayInstPtr(newBits)->ba_element;
+ __nSrcBytes = __byteArraySize(__INST(bytes));
+ __nDstBytes = __byteArraySize(newBits);
+ __blackPixel = __intVal(blackPixel);
+
+ __radians = __floatVal(radians);
+ __radians = -__radians; /* sigh: clock-wise */
+ __sin = sin(__radians);
+ __cos = cos(__radians);
+ __minX = __floatVal(minX);
+ __minY = __floatVal(minY);
+ __halfW = __floatVal(halfW);
+ __halfH = __floatVal(halfH);
+
+ __dstRowPtr = __dstBytes;
+ __dstEndPtr = __dstBytes + __nDstBytes;
# define EARLY_OUT
# define FAST_ADVANCE 5
# define FAST_ADVANCE2
- switch (__depth) {
- case 8:
- for (__dstY = 0; __dstY < __newHeight; __dstY++) {
- double __pY, __sinPY, __cosPY;
+ switch (__depth) {
+ case 8:
+ for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+ double __pY, __sinPY, __cosPY;
#ifdef EARLY_OUT
- int didFetchInRow = 0;
+ int didFetchInRow = 0;
#endif
- __pY = (double)(__dstY + __minY);
-
- __sinPY = __sin * __pY;
- __cosPY = __cos * __pY;
-
- __dstPtr = __dstRowPtr;
- __dstRowPtr += __dstBytesPerRow;
-
- for (__dstX = 0; __dstX < __newWidth; __dstX++) {
- double __pX, __nX;
- unsigned __pix;
-
- /* translate X in destination (center to 0/0) */
- __pX = (double)(__dstX + __minX);
- /* rotate X */
- __nX = (__cos * __pX) - __sinPY;
-
- /* translate X in source (origin to 0/0) */
- __nX = __nX + __halfW + 0.5;
-
- /* inside ? */
- if (__nX < 0) {
+ __pY = (double)(__dstY + __minY);
+
+ __sinPY = __sin * __pY;
+ __cosPY = __cos * __pY;
+
+ __dstPtr = __dstRowPtr;
+ __dstRowPtr += __dstBytesPerRow;
+
+ for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+ double __pX, __nX;
+ unsigned __pix;
+
+ /* translate X in destination (center to 0/0) */
+ __pX = (double)(__dstX + __minX);
+ /* rotate X */
+ __nX = (__cos * __pX) - __sinPY;
+
+ /* translate X in source (origin to 0/0) */
+ __nX = __nX + __halfW + 0.5;
+
+ /* inside ? */
+ if (__nX < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE
- if (__blackPixel == 0) {
- do {
- /* try advance by FAST_ADVANCE pixels ... */
- __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nX = (__cos * __pX) - __sinPY;
- __nX = __nX + __halfW + 0.5;
- } while (__nX < 0);
- __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by FAST_ADVANCE pixels ... */
+ __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nX = (__cos * __pX) - __sinPY;
+ __nX = __nX + __halfW + 0.5;
+ } while (__nX < 0);
+ __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcX;
-
- __srcX = (int)__nX;
- /* inside ? */
- if (__srcX >= __width) {
+ __pix = __blackPixel;
+ } else {
+ int __srcX;
+
+ __srcX = (int)__nX;
+ /* inside ? */
+ if (__srcX >= __width) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE2
- if (__blackPixel == 0) {
- do {
- /* try advance by FAST_ADVANCE pixels ... */
- __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nX = (__cos * __pX) - __sinPY;
- __nX = __nX + __halfW + 0.5;
- __srcX = (int)__nX;
- } while (__srcX >= __width);
- __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by FAST_ADVANCE pixels ... */
+ __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nX = (__cos * __pX) - __sinPY;
+ __nX = __nX + __halfW + 0.5;
+ __srcX = (int)__nX;
+ } while (__srcX >= __width);
+ __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+ }
#endif
- __pix = __blackPixel;
- } else {
- double __nY;
-
- /* rotate Y */
- __nY = (__sin * __pX) + __cosPY;
- /* translate Y in source (origin to 0/0) */
- __nY = __nY + __halfH + 0.5;
-
- /* inside ? */
- if (__nY < 0) {
+ __pix = __blackPixel;
+ } else {
+ double __nY;
+
+ /* rotate Y */
+ __nY = (__sin * __pX) + __cosPY;
+ /* translate Y in source (origin to 0/0) */
+ __nY = __nY + __halfH + 0.5;
+
+ /* inside ? */
+ if (__nY < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE2
- if (__blackPixel == 0) {
- do {
- /* try advance by FAST_ADVANCE pixels ... */
- __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nY = (__sin * __pX) + __cosPY;
- __nY = __nY + __halfH + 0.5;
- } while (__nY < 0);
- __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by FAST_ADVANCE pixels ... */
+ __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nY = (__sin * __pX) + __cosPY;
+ __nY = __nY + __halfH + 0.5;
+ } while (__nY < 0);
+ __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcY;
-
- __srcY = (int)__nY;
- /* inside ? */
- if (__srcY >= __height) {
+ __pix = __blackPixel;
+ } else {
+ int __srcY;
+
+ __srcY = (int)__nY;
+ /* inside ? */
+ if (__srcY >= __height) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE
- if (__blackPixel == 0) {
- do {
- /* try advance by FAST_ADVANCE pixels ... */
- __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nY = (__sin * __pX) + __cosPY;
- __nY = __nY + __halfH + 0.5;
- __srcY = (int)__nY;
- } while (__srcY >= __height);
- __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by FAST_ADVANCE pixels ... */
+ __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nY = (__sin * __pX) + __cosPY;
+ __nY = __nY + __halfH + 0.5;
+ __srcY = (int)__nY;
+ } while (__srcY >= __height);
+ __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+ }
#endif
- __pix = __blackPixel;
- } else {
- /* fetch source pixel */
-
- int idx;
+ __pix = __blackPixel;
+ } else {
+ /* fetch source pixel */
+
+ int idx;
#ifdef EARLY_OUT
- didFetchInRow = 1;
+ didFetchInRow = 1;
#endif
- idx = __srcY * __srcBytesPerRow + __srcX;
- if ((unsigned)idx < __nSrcBytes) {
- __pix = __srcBytes[idx];
- } else {
- __pix = __blackPixel;
- }
- }
- }
- }
- }
-
- if (__pix != 0) {
- *__dstPtr = __pix;
- }
- __dstPtr++;
- }
- }
- break;
-
- case 1:
- for (__dstY = 0; __dstY < __newHeight; __dstY++) {
- double __pY, __sinPY, __cosPY;
+ idx = __srcY * __srcBytesPerRow + __srcX;
+ if ((unsigned)idx < __nSrcBytes) {
+ __pix = __srcBytes[idx];
+ } else {
+ __pix = __blackPixel;
+ }
+ }
+ }
+ }
+ }
+
+ if (__pix != 0) {
+ *__dstPtr = __pix;
+ }
+ __dstPtr++;
+ }
+ }
+ break;
+
+ case 1:
+ for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+ double __pY, __sinPY, __cosPY;
#ifdef EARLY_OUT
- int didFetchInRow = 0;
+ int didFetchInRow = 0;
#endif
- __pY = (double)(__dstY + __minY);
-
- __sinPY = __sin * __pY;
- __cosPY = __cos * __pY;
-
- __dstPtr = __dstRowPtr;
- __dstMask = 0x80;
- __dstRowPtr += __dstBytesPerRow;
-
- for (__dstX = 0; __dstX < __newWidth; __dstX++) {
- double __pX, __nX;
- int __pix;
-
- /* translate X in destination (center to 0/0) */
- __pX = (double)(__dstX + __minX);
- /* rotate X */
- __nX = (__cos * __pX) - __sinPY;
-
- /* translate X in source (origin to 0/0) */
- __nX = __nX + __halfW + 0.5;
-
- /* inside ? */
- if (__nX < 0) {
+ __pY = (double)(__dstY + __minY);
+
+ __sinPY = __sin * __pY;
+ __cosPY = __cos * __pY;
+
+ __dstPtr = __dstRowPtr;
+ __dstMask = 0x80;
+ __dstRowPtr += __dstBytesPerRow;
+
+ for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+ double __pX, __nX;
+ int __pix;
+
+ /* translate X in destination (center to 0/0) */
+ __pX = (double)(__dstX + __minX);
+ /* rotate X */
+ __nX = (__cos * __pX) - __sinPY;
+
+ /* translate X in source (origin to 0/0) */
+ __nX = __nX + __halfW + 0.5;
+
+ /* inside ? */
+ if (__nX < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE
- if (__blackPixel == 0) {
- do {
- /* try advance by 8 pixels ... */
- __dstX += 8; __dstPtr ++;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nX = (__cos * __pX) - __sinPY;
- __nX = __nX + __halfW + 0.5;
- } while (__nX < 0);
- __dstX -= 8; __dstPtr--;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by 8 pixels ... */
+ __dstX += 8; __dstPtr ++;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nX = (__cos * __pX) - __sinPY;
+ __nX = __nX + __halfW + 0.5;
+ } while (__nX < 0);
+ __dstX -= 8; __dstPtr--;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcX;
-
- __srcX = (int)__nX;
- /* inside ? */
- if (__srcX >= __width) {
+ __pix = __blackPixel;
+ } else {
+ int __srcX;
+
+ __srcX = (int)__nX;
+ /* inside ? */
+ if (__srcX >= __width) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE2
- if (__blackPixel == 0) {
- do {
- /* try advance by 8 pixels ... */
- __dstX += 8; __dstPtr++;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nX = (__cos * __pX) - __sinPY;
- __nX = __nX + __halfW + 0.5;
- __srcX = (int)__nX;
- } while (__srcX >= __width);
- __dstX -= 8; __dstPtr--;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by 8 pixels ... */
+ __dstX += 8; __dstPtr++;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nX = (__cos * __pX) - __sinPY;
+ __nX = __nX + __halfW + 0.5;
+ __srcX = (int)__nX;
+ } while (__srcX >= __width);
+ __dstX -= 8; __dstPtr--;
+ }
#endif
- __pix = __blackPixel;
- } else {
- double __nY;
-
- /* rotate Y */
- __nY = (__sin * __pX) + __cosPY;
- /* translate Y in source (origin to 0/0) */
- __nY = __nY + __halfH + 0.5;
-
- /* inside ? */
- if (__nY < 0) {
+ __pix = __blackPixel;
+ } else {
+ double __nY;
+
+ /* rotate Y */
+ __nY = (__sin * __pX) + __cosPY;
+ /* translate Y in source (origin to 0/0) */
+ __nY = __nY + __halfH + 0.5;
+
+ /* inside ? */
+ if (__nY < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE2
- if (__blackPixel == 0) {
- do {
- /* try advance by 8 pixels ... */
- __dstX += 8; __dstPtr++;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nY = (__sin * __pX) + __cosPY;
- __nY = __nY + __halfH + 0.5;
- } while (__nY < 0);
- __dstX -= 8; __dstPtr--;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by 8 pixels ... */
+ __dstX += 8; __dstPtr++;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nY = (__sin * __pX) + __cosPY;
+ __nY = __nY + __halfH + 0.5;
+ } while (__nY < 0);
+ __dstX -= 8; __dstPtr--;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcY;
-
- __srcY = (int)__nY;
- /* inside ? */
- if (__srcY >= __height) {
+ __pix = __blackPixel;
+ } else {
+ int __srcY;
+
+ __srcY = (int)__nY;
+ /* inside ? */
+ if (__srcY >= __height) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
#ifdef FAST_ADVANCE
- if (__blackPixel == 0) {
- do {
- /* try advance by 8 pixels ... */
- __dstX += 8; __dstPtr++;
- if (__dstX >= __newWidth) {
- break;
- }
- __pX = (double)(__dstX + __minX);
- __nY = (__sin * __pX) + __cosPY;
- __nY = __nY + __halfH + 0.5;
- __srcY = (int)__nY;
- } while (__srcY >= __height);
- __dstX -= 8; __dstPtr--;
- }
+ if (__blackPixel == 0) {
+ do {
+ /* try advance by 8 pixels ... */
+ __dstX += 8; __dstPtr++;
+ if (__dstX >= __newWidth) {
+ break;
+ }
+ __pX = (double)(__dstX + __minX);
+ __nY = (__sin * __pX) + __cosPY;
+ __nY = __nY + __halfH + 0.5;
+ __srcY = (int)__nY;
+ } while (__srcY >= __height);
+ __dstX -= 8; __dstPtr--;
+ }
#endif
- __pix = __blackPixel;
- } else {
- /* fetch source pixel */
-
- int idx, pV;
+ __pix = __blackPixel;
+ } else {
+ /* fetch source pixel */
+
+ int idx, pV;
#ifdef EARLY_OUT
- didFetchInRow = 1;
+ didFetchInRow = 1;
#endif
- idx = __srcY * __srcBytesPerRow + (__srcX >> 3);
- if ((unsigned)idx < __nSrcBytes) {
- pV = __srcBytes[idx];
- __pix = (pV & (0x80 >> (__srcX & 7))) ? 1 : 0;
- } else {
- __pix = __blackPixel;
- }
- }
- }
- }
- }
-
- /* store pixel */
- if (__pix != 0) {
- *__dstPtr |= __dstMask;
- }
- __dstMask >>= 1;
- if (__dstMask == 0) {
- __dstMask = 0x80;
- __dstPtr++;
- }
- }
- }
- break;
-
- case 24:
- for (__dstY = 0; __dstY < __newHeight; __dstY++) {
- double __pY, __sinPY, __cosPY;
+ idx = __srcY * __srcBytesPerRow + (__srcX >> 3);
+ if ((unsigned)idx < __nSrcBytes) {
+ pV = __srcBytes[idx];
+ __pix = (pV & (0x80 >> (__srcX & 7))) ? 1 : 0;
+ } else {
+ __pix = __blackPixel;
+ }
+ }
+ }
+ }
+ }
+
+ /* store pixel */
+ if (__pix != 0) {
+ *__dstPtr |= __dstMask;
+ }
+ __dstMask >>= 1;
+ if (__dstMask == 0) {
+ __dstMask = 0x80;
+ __dstPtr++;
+ }
+ }
+ }
+ break;
+
+ case 24:
+ for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+ double __pY, __sinPY, __cosPY;
#ifdef EARLY_OUT
- int didFetchInRow = 0;
+ int didFetchInRow = 0;
#endif
- __pY = (double)(__dstY + __minY);
-
- __sinPY = __sin * __pY;
- __cosPY = __cos * __pY;
-
- __dstPtr = __dstRowPtr;
- __dstRowPtr += __dstBytesPerRow;
-
- for (__dstX = 0; __dstX < __newWidth; __dstX++) {
- double __pX, __nX;
- unsigned __pix;
-
- /* translate X in destination (center to 0/0) */
- __pX = (double)(__dstX + __minX);
- /* rotate X */
- __nX = (__cos * __pX) - __sinPY;
-
- /* translate X in source (origin to 0/0) */
- __nX = __nX + __halfW + 0.5;
-
- /* inside ? */
- if (__nX < 0) {
+ __pY = (double)(__dstY + __minY);
+
+ __sinPY = __sin * __pY;
+ __cosPY = __cos * __pY;
+
+ __dstPtr = __dstRowPtr;
+ __dstRowPtr += __dstBytesPerRow;
+
+ for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+ double __pX, __nX;
+ unsigned __pix;
+
+ /* translate X in destination (center to 0/0) */
+ __pX = (double)(__dstX + __minX);
+ /* rotate X */
+ __nX = (__cos * __pX) - __sinPY;
+
+ /* translate X in source (origin to 0/0) */
+ __nX = __nX + __halfW + 0.5;
+
+ /* inside ? */
+ if (__nX < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcX;
-
- __srcX = (int)__nX;
- /* inside ? */
- if (__srcX >= __width) {
+ __pix = __blackPixel;
+ } else {
+ int __srcX;
+
+ __srcX = (int)__nX;
+ /* inside ? */
+ if (__srcX >= __width) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = __blackPixel;
- } else {
- double __nY;
-
- /* rotate Y */
- __nY = (__sin * __pX) + __cosPY;
- /* translate Y in source (origin to 0/0) */
- __nY = __nY + __halfH + 0.5;
-
- /* inside ? */
- if (__nY < 0) {
+ __pix = __blackPixel;
+ } else {
+ double __nY;
+
+ /* rotate Y */
+ __nY = (__sin * __pX) + __cosPY;
+ /* translate Y in source (origin to 0/0) */
+ __nY = __nY + __halfH + 0.5;
+
+ /* inside ? */
+ if (__nY < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = __blackPixel;
- } else {
- int __srcY;
-
- __srcY = (int)__nY;
- /* inside ? */
- if (__srcY >= __height) {
+ __pix = __blackPixel;
+ } else {
+ int __srcY;
+
+ __srcY = (int)__nY;
+ /* inside ? */
+ if (__srcY >= __height) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = __blackPixel;
- } else {
- /* fetch source pixel */
-
- int idx;
+ __pix = __blackPixel;
+ } else {
+ /* fetch source pixel */
+
+ int idx;
#ifdef EARLY_OUT
- didFetchInRow = 1;
+ didFetchInRow = 1;
#endif
- idx = __srcY * __srcBytesPerRow + __srcX + __srcX + __srcX;
- if ((unsigned)idx < __nSrcBytes) {
- __pix = __srcBytes[idx];
- __pix = (__pix<<8) | __srcBytes[idx+1];
- __pix = (__pix<<8) | __srcBytes[idx+2];
- } else {
- __pix = __blackPixel;
- }
- }
- }
- }
- }
-
- /* store pixel */
- if (__pix != 0) {
- __dstPtr[0] = (__pix >> 16 & 0xFF);
- __dstPtr[1] = (__pix >> 8) & 0xFF;
- __dstPtr[2] = __pix & 0xFF;
- }
- __dstPtr += 3;
- }
- }
- break;
-
- default:
- for (__dstY = 0; __dstY < __newHeight; __dstY++) {
- double __pY, __sinPY, __cosPY;
+ idx = __srcY * __srcBytesPerRow + __srcX + __srcX + __srcX;
+ if ((unsigned)idx < __nSrcBytes) {
+ __pix = __srcBytes[idx];
+ __pix = (__pix<<8) | __srcBytes[idx+1];
+ __pix = (__pix<<8) | __srcBytes[idx+2];
+ } else {
+ __pix = __blackPixel;
+ }
+ }
+ }
+ }
+ }
+
+ /* store pixel */
+ if (__pix != 0) {
+ __dstPtr[0] = (__pix >> 16 & 0xFF);
+ __dstPtr[1] = (__pix >> 8) & 0xFF;
+ __dstPtr[2] = __pix & 0xFF;
+ }
+ __dstPtr += 3;
+ }
+ }
+ break;
+
+ default:
+ for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+ double __pY, __sinPY, __cosPY;
#ifdef EARLY_OUT
- int didFetchInRow = 0;
+ int didFetchInRow = 0;
#endif
- __pY = (double)(__dstY + __minY);
-
- __sinPY = __sin * __pY;
- __cosPY = __cos * __pY;
-
- __dstPtr = __dstRowPtr;
- __dstMask = 0x80;
- __dstRowPtr += __dstBytesPerRow;
-
- for (__dstX = 0; __dstX < __newWidth; __dstX++) {
- double __pX, __nX;
- OBJ __pix;
-
- /* translate X in destination (center to 0/0) */
- __pX = (double)(__dstX + __minX);
- /* rotate X */
- __nX = (__cos * __pX) - __sinPY;
-
- /* translate X in source (origin to 0/0) */
- __nX = __nX + __halfW + 0.5;
-
- /* inside ? */
- if (__nX < 0) {
+ __pY = (double)(__dstY + __minY);
+
+ __sinPY = __sin * __pY;
+ __cosPY = __cos * __pY;
+
+ __dstPtr = __dstRowPtr;
+ __dstMask = 0x80;
+ __dstRowPtr += __dstBytesPerRow;
+
+ for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+ double __pX, __nX;
+ OBJ __pix;
+
+ /* translate X in destination (center to 0/0) */
+ __pX = (double)(__dstX + __minX);
+ /* rotate X */
+ __nX = (__cos * __pX) - __sinPY;
+
+ /* translate X in source (origin to 0/0) */
+ __nX = __nX + __halfW + 0.5;
+
+ /* inside ? */
+ if (__nX < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = blackPixel;
- } else {
- int __srcX;
-
- __srcX = (int)__nX;
- /* inside ? */
- if (__srcX >= __width) {
+ __pix = blackPixel;
+ } else {
+ int __srcX;
+
+ __srcX = (int)__nX;
+ /* inside ? */
+ if (__srcX >= __width) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = blackPixel;
- } else {
- double __nY;
-
- /* rotate Y */
- __nY = (__sin * __pX) + __cosPY;
- /* translate Y in source (origin to 0/0) */
- __nY = __nY + __halfH + 0.5;
-
- /* inside ? */
- if (__nY < 0) {
+ __pix = blackPixel;
+ } else {
+ double __nY;
+
+ /* rotate Y */
+ __nY = (__sin * __pX) + __cosPY;
+ /* translate Y in source (origin to 0/0) */
+ __nY = __nY + __halfH + 0.5;
+
+ /* inside ? */
+ if (__nY < 0) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = blackPixel;
- } else {
- int __srcY;
-
- __srcY = (int)__nY;
- /* inside ? */
- if (__srcY >= __height) {
+ __pix = blackPixel;
+ } else {
+ int __srcY;
+
+ __srcY = (int)__nY;
+ /* inside ? */
+ if (__srcY >= __height) {
#ifdef EARLY_OUT
- if (didFetchInRow) {
- break;
- }
+ if (didFetchInRow) {
+ break;
+ }
#endif
- __pix = blackPixel;
- } else {
- /* fetch source pixel */
-
- static struct inlineCache valAt = _ILC2;
+ __pix = blackPixel;
+ } else {
+ /* fetch source pixel */
+
+ static struct inlineCache valAt = _ILC2;
#ifdef EARLY_OUT
- didFetchInRow = 1;
+ didFetchInRow = 1;
#endif
- __pix = (*valAt.ilc_func)(self,
- @symbol(pixelAtX:y:),
- nil, &valAt,
- __MKSMALLINT(__srcX),
- __MKSMALLINT(__srcY));
- }
- }
- }
- }
-
- /* store pixel */
- {
- static struct inlineCache atPutVal = _ILC3;
-
- if (__pix != __MKSMALLINT(0)) {
- (*atPutVal.ilc_func)(newImage,
- @symbol(pixelAtX:y:put:),
- nil, &atPutVal,
- __MKSMALLINT(__dstX),
- __MKSMALLINT(__dstY),
- __pix
- );
- }
- }
- }
- }
- break;
- }
-
- bad = false;
+ __pix = (*valAt.ilc_func)(self,
+ @symbol(pixelAtX:y:),
+ nil, &valAt,
+ __MKSMALLINT(__srcX),
+ __MKSMALLINT(__srcY));
+ }
+ }
+ }
+ }
+
+ /* store pixel */
+ {
+ static struct inlineCache atPutVal = _ILC3;
+
+ if (__pix != __MKSMALLINT(0)) {
+ (*atPutVal.ilc_func)(newImage,
+ @symbol(pixelAtX:y:put:),
+ nil, &atPutVal,
+ __MKSMALLINT(__dstX),
+ __MKSMALLINT(__dstY),
+ __pix
+ );
+ }
+ }
+ }
+ }
+ break;
+ }
+
+ bad = false;
}
%}.
bad ifTrue:[
- "/ should not happen
- self primitiveFailed
+ "/ should not happen
+ self primitiveFailed
"/ sinRot := radians negated sin.
"/ cosRot := radians negated cos.
@@ -9827,7 +9828,7 @@
"
|i|
- i := Image fromFile:'bitmaps/xpmBitmaps/BOOK.xpm'.
+ i := Image fromFile:'goodies/bitmaps/xpmBitmaps/BOOK.xpm'.
i inspect.
(i rotated:45) inspect.
(i rotated:90) inspect.
@@ -9837,50 +9838,50 @@
"
|i|
- i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
i := Depth24Image fromImage:i.
(i rotated:200) inspect
"
"
|i|
- i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
Transcript showCR:(
- Time millisecondsToRun:[
- i rotated:45.
- ]
+ Time millisecondsToRun:[
+ i rotated:45.
+ ]
).
"
"
|v i rI rot|
- i := Image fromFile:'bitmaps/xpmBitmaps/BOOK.xpm'.
+ i := Image fromFile:'goodies/bitmaps/xpmBitmaps/BOOK.xpm'.
v := View new extent:(i width max:100)@(i height max:100).
v openAndWait.
rot := 0.
[true] whileTrue:[
- rI := i rotated:rot.
- rI := rI on:v device.
- v clear.
- v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
- rot := rot + 5.
- rI close.
+ rI := i rotated:rot.
+ rI := rI on:v device.
+ v clear.
+ v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
+ rot := rot + 5.
+ rI close.
]
"
"
|v i rI rot|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
v := View new extent:400@400.
v openAndWait.
rot := 0.
[true] whileTrue:[
- rI := i rotated:rot.
- rI := rI on:v device.
- v clear.
- v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
- rot := rot + 5.
- rI close.
+ rI := i rotated:rot.
+ rI := rI on:v device.
+ v clear.
+ v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
+ rot := rot + 5.
+ rI close.
]
"
@@ -9929,7 +9930,7 @@
((mX = 1) and:[mY = 1]) ifTrue:[^ self].
((mX isMemberOf:SmallInteger) and:[mY isMemberOf:SmallInteger]) ifFalse:[
- ^ self hardMagnifiedBy:scalePoint
+ ^ self hardMagnifiedBy:scalePoint
].
bitsPerPixel := self depth.
@@ -9946,65 +9947,65 @@
newBits := ByteArray uninitializedNew:(newBytesPerRow * newHeight).
mask notNil ifTrue:[
- newMask := (mask magnifiedBy:scalePoint)
+ newMask := (mask magnifiedBy:scalePoint)
].
newImage := self species new.
newImage
- width:newWidth
- height:newHeight
- photometric:photometric
- samplesPerPixel:samplesPerPixel
- bitsPerSample:bitsPerSample
- colorMap:colorMap copy
- bits:newBits
- mask:newMask.
+ width:newWidth
+ height:newHeight
+ photometric:photometric
+ samplesPerPixel:samplesPerPixel
+ bitsPerSample:bitsPerSample
+ colorMap:colorMap copy
+ bits:newBits
+ mask:newMask.
mX = 1 ifTrue:[
- "expand rows only"
- srcOffset := 1.
- dstOffset := 1.
-
- 1 to:h do:[:row |
- 1 to:magY do:[:i |
- newBits replaceFrom:dstOffset
- to:(dstOffset + oldBytesPerRow - 1)
- with:bytes
- startingAt:srcOffset.
- dstOffset := dstOffset + newBytesPerRow
- ].
- srcOffset := srcOffset + oldBytesPerRow.
- ].
+ "expand rows only"
+ srcOffset := 1.
+ dstOffset := 1.
+
+ 1 to:h do:[:row |
+ 1 to:magY do:[:i |
+ newBits replaceFrom:dstOffset
+ to:(dstOffset + oldBytesPerRow - 1)
+ with:bytes
+ startingAt:srcOffset.
+ dstOffset := dstOffset + newBytesPerRow
+ ].
+ srcOffset := srcOffset + oldBytesPerRow.
+ ].
] ifFalse:[
- "expand cols"
- (mX > 1) ifTrue:[
- dstOffset := 1.
- srcOffset := 1.
- 1 to:h do:[:row |
- self magnifyRowFrom:bytes
- offset:srcOffset
- into:newBits
- offset:dstOffset
- factor:mX.
-
- first := dstOffset.
- dstOffset := dstOffset + newBytesPerRow.
- " and copy for row expansion "
- 2 to:magY do:[:i |
- newBits replaceFrom:dstOffset
- to:(dstOffset + newBytesPerRow - 1)
- with:newBits
- startingAt:first.
- dstOffset := dstOffset + newBytesPerRow
- ].
- srcOffset := srcOffset + oldBytesPerRow.
- ].
- ]
+ "expand cols"
+ (mX > 1) ifTrue:[
+ dstOffset := 1.
+ srcOffset := 1.
+ 1 to:h do:[:row |
+ self magnifyRowFrom:bytes
+ offset:srcOffset
+ into:newBits
+ offset:dstOffset
+ factor:mX.
+
+ first := dstOffset.
+ dstOffset := dstOffset + newBytesPerRow.
+ " and copy for row expansion "
+ 2 to:magY do:[:i |
+ newBits replaceFrom:dstOffset
+ to:(dstOffset + newBytesPerRow - 1)
+ with:newBits
+ startingAt:first.
+ dstOffset := dstOffset + newBytesPerRow
+ ].
+ srcOffset := srcOffset + oldBytesPerRow.
+ ].
+ ]
].
^ newImage
"
- ((Image fromFile:'bitmaps/gifImages/claus.gif') magnifiedBy:1@2)
+ ((Image fromFile:'goodies/bitmaps/gifImages/claus.gif') magnifiedBy:1@2)
"
"Modified: 24.4.1997 / 18:32:04 / cg"
@@ -10023,11 +10024,11 @@
^ self magnifiedBy:(rX min:rY)
"
- ((Image fromFile:'bitmaps/gifImages/garfield.gif') magnifiedPreservingRatioTo:100@100)
+ ((Image fromFile:'goodies/bitmaps/gifImages/garfield.gif') magnifiedPreservingRatioTo:100@100)
in contrast to:
- ((Image fromFile:'bitmaps/gifImages/garfield.gif') magnifiedTo:100@100)
+ ((Image fromFile:'goodies/bitmaps/gifImages/garfield.gif') magnifiedTo:100@100)
"
"Modified: 22.4.1997 / 12:33:46 / cg"
@@ -10041,11 +10042,11 @@
^ self magnifiedBy:(anExtent / self extent)
"
- ((Image fromFile:'bitmaps/garfield.gif') magnifiedTo:100@100)
+ ((Image fromFile:'goodies/bitmaps/garfield.gif') magnifiedTo:100@100)
in contrast to:
- ((Image fromFile:'bitmaps/garfield.gif') magnifiedPreservingRatioTo:100@100)
+ ((Image fromFile:'goodies/bitmaps/garfield.gif') magnifiedPreservingRatioTo:100@100)
"
!
@@ -10081,32 +10082,32 @@
|newImage|
colorMap isNil ifTrue:[
- photometric == #blackIs0 ifTrue:[
- newImage := self copy.
- newImage photometric:#whiteIs0.
- ^ newImage
- ].
- photometric == #whiteIs0 ifTrue:[
- newImage := self copy.
- newImage photometric:#blackIs0.
- ^ newImage
- ].
- ^ nil
+ photometric == #blackIs0 ifTrue:[
+ newImage := self copy.
+ newImage photometric:#whiteIs0.
+ ^ newImage
+ ].
+ photometric == #whiteIs0 ifTrue:[
+ newImage := self copy.
+ newImage photometric:#blackIs0.
+ ^ newImage
+ ].
+ ^ nil
].
^ self
- copyWithColorMapProcessing:[:clr |
- |newColor|
-
- newColor := Color
- redByte:(255 - clr redByte)
- greenByte:(255 - clr greenByte)
- blueByte:(255 - clr blueByte)
- ]
-
- "
- (Image fromFile:'bitmaps/gifImages/claus.gif') inspect
- (Image fromFile:'bitmaps/gifImages/claus.gif') negative inspect
+ copyWithColorMapProcessing:[:clr |
+ |newColor|
+
+ newColor := Color
+ redByte:(255 - clr redByte)
+ greenByte:(255 - clr greenByte)
+ blueByte:(255 - clr blueByte)
+ ]
+
+ "
+ (Image fromFile:'goodies/bitmaps/gifImages/claus.gif') inspect
+ (Image fromFile:'goodies/bitmaps/gifImages/claus.gif') negative inspect
"
"Created: 20.6.1997 / 13:13:41 / cg"
@@ -10129,15 +10130,15 @@
d := d truncated.
d = 0 ifTrue:[^ self].
((d ~= 90) and:[(d ~= 270) and:[d ~= 180]]) ifTrue:[
- ^ self hardRotated:d
+ ^ self hardRotated:d
].
d = 180 ifTrue:[
- nW := width.
- nH := height.
+ nW := width.
+ nH := height.
] ifFalse:[
- nW := height.
- nH := width.
+ nW := height.
+ nH := width.
].
newImage := self species new.
@@ -10151,7 +10152,7 @@
newImage bitsPerSample:bitsPerSample.
newImage colorMap:colorMap copy.
mask notNil ifTrue:[
- newImage mask:(mask rotated:degrees)
+ newImage mask:(mask rotated:degrees)
].
self easyRotateBitsInto:newImage angle:d.
@@ -10161,7 +10162,7 @@
"
|i|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
i inspect.
(i rotated:45) inspect.
(i rotated:90) inspect.
@@ -10171,7 +10172,7 @@
"
|i|
- i := Image fromFile:'bitmaps/xpmBitmaps/BOOK.xpm'.
+ i := Image fromFile:'goodies/bitmaps/xpmBitmaps/BOOK.xpm'.
i inspect.
(i rotated:90) inspect.
(i rotated:180) inspect.
@@ -10188,7 +10189,7 @@
(#withPixelFunctionAppliedToPixels:) or redefine this method in
a concrete subclass.
(read `Behond photography, by Gerard J. Holzmann;
- ISBM 0-13-074410-7)
+ ISBM 0-13-074410-7)
See blurred / oilPointed as examples ...)"
|w "{Class: SmallInteger }"
@@ -10211,13 +10212,13 @@
h := height - 1.
0 to:h do:[:y |
- 0 to:w do:[:x |
- newImage colorAtX:x y:y put:(pixelFunctionBlock
- value:self
- value:(self colorAtX:x y:y)
- value:x
- value:y)
- ]
+ 0 to:w do:[:x |
+ newImage colorAtX:x y:y put:(pixelFunctionBlock
+ value:self
+ value:(self colorAtX:x y:y)
+ value:x
+ value:y)
+ ]
].
^ newImage
@@ -10225,38 +10226,38 @@
|i black|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
i inspect.
black := Color black.
(i withPixelFunctionApplied:[:oldImage :oldColor :x :y |
- ((x between:100 and:200)
- and:[y between:100 and:200]) ifTrue:[
- oldColor
- ] ifFalse:[
- black.
- ]
- ]) inspect.
+ ((x between:100 and:200)
+ and:[y between:100 and:200]) ifTrue:[
+ oldColor
+ ] ifFalse:[
+ black.
+ ]
+ ]) inspect.
"
"brighten a frame:
|i black w h|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
i inspect.
w := i width.
h := i height.
(i withPixelFunctionApplied:[:oldImage :oldColor :x :y |
- ((x between:0 and:10)
- or:[(y between:0 and:10)
- or:[(x between:w-10 and:w)
- or:[y between:h-10 and:h]]]) ifTrue:[
- oldColor lightened nearestIn:i colorMap
- ] ifFalse:[
- oldColor.
- ]
- ]) inspect.
+ ((x between:0 and:10)
+ or:[(y between:0 and:10)
+ or:[(x between:w-10 and:w)
+ or:[y between:h-10 and:h]]]) ifTrue:[
+ oldColor lightened nearestIn:i colorMap
+ ] ifFalse:[
+ oldColor.
+ ]
+ ]) inspect.
"
"Modified: 24.4.1997 / 18:36:59 / cg"
@@ -10266,7 +10267,7 @@
"return a new image from the old one, by applying a pixel processor
on the pixel values.
(read `Behond photography, by Gerard J. Holzmann;
- ISBM 0-13-074410-7)
+ ISBM 0-13-074410-7)
See blurred / oilPointed as examples ...)"
|newImage newBits newBytesPerRow|
@@ -10290,39 +10291,39 @@
|i w h|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
i inspect.
w := i width - 1.
h := i height - 1.
(i withPixelFunctionAppliedToPixels:[:oldImage :oldPixel :x :y |
- |b p max xMin xMax yMin yMax|
-
- b := Bag identityNew:10.
- xMin := x-3 max:0.
- xMax := x+3 min:w.
- yMin := y-3 max:0.
- yMax := y+3 min:h.
- xMin to:xMax do:[:tx|
- yMin to:yMax do:[:ty|
- b add:(oldImage pixelAtX:tx y:ty)
- ]
- ].
- max := 0.
- b contents keysAndValuesDo:[:pixel :n |
- n > max ifTrue:[
- p := pixel.
- max := n
- ]
- ].
- p
- ]) inspect.
+ |b p max xMin xMax yMin yMax|
+
+ b := Bag identityNew:10.
+ xMin := x-3 max:0.
+ xMax := x+3 min:w.
+ yMin := y-3 max:0.
+ yMax := y+3 min:h.
+ xMin to:xMax do:[:tx|
+ yMin to:yMax do:[:ty|
+ b add:(oldImage pixelAtX:tx y:ty)
+ ]
+ ].
+ max := 0.
+ b contents keysAndValuesDo:[:pixel :n |
+ n > max ifTrue:[
+ p := pixel.
+ max := n
+ ]
+ ].
+ p
+ ]) inspect.
"
"fisheye effect:
|i w h w2 h2 R white|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
i inspect.
w := i width - 1.
h := i height - 1.
@@ -10331,31 +10332,31 @@
R := w2.
white := i valueFromColor:Color white.
(i withPixelFunctionAppliedToPixels:[:oldImage :oldPixel :x :y |
- |p r a nR nP nX nY|
-
- p := (x-w2)@(y-h2).
- r := p r.
- a := p theta.
- nR := r * r / R.
- nP := Point r:nR theta:a.
- nX := ((nP x+w2) rounded max:0) min:w.
- nY := ((nP y+h2) rounded max:0) min:h.
- (nX > w or:[nX < 0]) ifTrue:[
- white
- ] ifFalse:[
- (nY > h or:[nY < 0]) ifTrue:[
- white
- ] ifFalse:[
- oldImage pixelAtX:nX y:nY
- ]
- ]
- ]) inspect.
+ |p r a nR nP nX nY|
+
+ p := (x-w2)@(y-h2).
+ r := p r.
+ a := p theta.
+ nR := r * r / R.
+ nP := Point r:nR theta:a.
+ nX := ((nP x+w2) rounded max:0) min:w.
+ nY := ((nP y+h2) rounded max:0) min:h.
+ (nX > w or:[nX < 0]) ifTrue:[
+ white
+ ] ifFalse:[
+ (nY > h or:[nY < 0]) ifTrue:[
+ white
+ ] ifFalse:[
+ oldImage pixelAtX:nX y:nY
+ ]
+ ]
+ ]) inspect.
"
"fisheye effect:
|i w h w2 h2 R white|
- i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+ i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
i inspect.
w := i width - 1.
h := i height - 1.
@@ -10364,25 +10365,25 @@
R := w2.
white := i valueFromColor:Color white.
(i withPixelFunctionAppliedToPixels:[:oldImage :oldPixel :x :y |
- |p r a nR nP nX nY|
-
- p := (x-w2)@(y-h2).
- r := p r.
- a := p theta.
- nR := r * r / R.
- nP := Point r:nR theta:a.
- nX := (nP x+w2) rounded.
- nY := (nP y+h2) rounded.
- (nX > w or:[nX < 0]) ifTrue:[
- white
- ] ifFalse:[
- (nY > h or:[nY < 0]) ifTrue:[
- white
- ] ifFalse:[
- oldImage pixelAtX:nX y:nY
- ]
- ]
- ]) inspect.
+ |p r a nR nP nX nY|
+
+ p := (x-w2)@(y-h2).
+ r := p r.
+ a := p theta.
+ nR := r * r / R.
+ nP := Point r:nR theta:a.
+ nX := (nP x+w2) rounded.
+ nY := (nP y+h2) rounded.
+ (nX > w or:[nX < 0]) ifTrue:[
+ white
+ ] ifFalse:[
+ (nY > h or:[nY < 0]) ifTrue:[
+ white
+ ] ifFalse:[
+ oldImage pixelAtX:nX y:nY
+ ]
+ ]
+ ]) inspect.
"
"Created: 24.4.1997 / 18:37:17 / cg"
@@ -10551,9 +10552,9 @@
"
|i1 i8 i4|
- i8 := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ i8 := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
i8 inspect.
- i1 := Image fromFile:'bitmaps/SBrowser.xbm'.
+ i1 := Image fromFile:'goodies/bitmaps/SBrowser.xbm'.
i1 inspect.
i4 := Depth4Image fromImage:i8.
@@ -10574,7 +10575,7 @@
"
|i|
- i := Image fromFile:'bitmaps/garfield.gif'.
+ i := Image fromFile:'goodies/bitmaps/garfield.gif'.
i inspect.
(i subImageIn:(300@160 corner:340@200)) inspect
"
@@ -11433,16 +11434,16 @@
set := IdentitySet new.
self valuesFromX:0 y:0 toX:(self width-1) y:(self height-1) do:[:x :y :pixel |
- pixel ~~ last ifTrue:[
- set add:pixel.
- last := pixel.
- ]
+ pixel ~~ last ifTrue:[
+ set add:pixel.
+ last := pixel.
+ ]
].
^ set
"
- (Image fromFile:'bitmaps/garfield.gif') usedValues
- (Image fromFile:'bitmaps/SBrowser.xbm') usedValues
+ (Image fromFile:'goodies/bitmaps/garfield.gif') usedValues
+ (Image fromFile:'goodies/bitmaps/SBrowser.xbm') usedValues
(Image fromFile:'ttt.tiff') usedValues
"
@@ -11515,13 +11516,13 @@
colors := self usedColorsMax:4096.
colors isNil ifTrue:[
- self error:'too many colors in image'.
+ self error:'too many colors in image'.
].
^ colors
"
- (Image fromFile:'bitmaps/garfield.gif') usedColors
- (Image fromFile:'bitmaps/SBrowser.xbm') usedColors
+ (Image fromFile:'goodies/bitmaps/garfield.gif') usedColors
+ (Image fromFile:'goodies/bitmaps/SBrowser.xbm') usedColors
(Image fromFile:'ttt.tiff') usedColors
"
@@ -11536,46 +11537,46 @@
|usedValues max colors|
photometric == #rgb ifTrue:[
- usedValues := IdentitySet new.
- self valuesFromX:0 y:0 toX:(width-1) y:(height-1)
- do:[:x :y :pixel |
- usedValues add:pixel.
- usedValues size > nMax ifTrue:[
- "/ too many to be returned here (think of the mass of
- "/ data to be returned by a 24bit image ... ;-)
- ^ nil
- ]
- ].
- "/ code below is slightly faster ...
- "/ colors := usedValues collect:[:pixel | self colorFromValue:pixel].
- colors := usedValues collect:[:pixel | |r g b|
- r := self redBitsOf:pixel.
- g := self greenBitsOf:pixel.
- b := self blueBitsOf:pixel.
- "/ must scale to byte value...
- r := r bitShift:(8 - (bitsPerSample at:1)).
- g := g bitShift:(8 - (bitsPerSample at:2)).
- b := b bitShift:(8 - (bitsPerSample at:3)).
- Color redByte:r greenByte:g blueByte:b
- ].
- ^ colors.
+ usedValues := IdentitySet new.
+ self valuesFromX:0 y:0 toX:(width-1) y:(height-1)
+ do:[:x :y :pixel |
+ usedValues add:pixel.
+ usedValues size > nMax ifTrue:[
+ "/ too many to be returned here (think of the mass of
+ "/ data to be returned by a 24bit image ... ;-)
+ ^ nil
+ ]
+ ].
+ "/ code below is slightly faster ...
+ "/ colors := usedValues collect:[:pixel | self colorFromValue:pixel].
+ colors := usedValues collect:[:pixel | |r g b|
+ r := self redBitsOf:pixel.
+ g := self greenBitsOf:pixel.
+ b := self blueBitsOf:pixel.
+ "/ must scale to byte value...
+ r := r bitShift:(8 - (bitsPerSample at:1)).
+ g := g bitShift:(8 - (bitsPerSample at:2)).
+ b := b bitShift:(8 - (bitsPerSample at:3)).
+ Color redByte:r greenByte:g blueByte:b
+ ].
+ ^ colors.
].
usedValues := self usedValues asArray.
photometric == #palette ifTrue:[
- colors := usedValues collect:[:val | (colorMap at:val+1 ifAbsent:[Color black])].
+ colors := usedValues collect:[:val | (colorMap at:val+1 ifAbsent:[Color black])].
] ifFalse:[
- "/ (photometric == #blackIs0 or:[photometric == #whiteIs0])
-
- max := (1 bitShift:self depth) - 1.
- colors := usedValues collect:[:val | (Color gray:(100 * val / max ))].
+ "/ (photometric == #blackIs0 or:[photometric == #whiteIs0])
+
+ max := (1 bitShift:self depth) - 1.
+ colors := usedValues collect:[:val | (Color gray:(100 * val / max ))].
].
^ colors asSet
"
- (Image fromFile:'bitmaps/garfield.gif') usedColors
- (Image fromFile:'bitmaps/SBrowser.xbm') usedColors
+ (Image fromFile:'goodies/bitmaps/garfield.gif') usedColors
+ (Image fromFile:'goodies/bitmaps/SBrowser.xbm') usedColors
(Image fromFile:'ttt.tiff') usedColors
"
@@ -11593,8 +11594,8 @@
^ self realUsedValues
"
- (Image fromFile:'bitmaps/garfield.gif') usedValues
- (Image fromFile:'bitmaps/SBrowser.xbm') usedValues
+ (Image fromFile:'goodies/bitmaps/garfield.gif') usedValues
+ (Image fromFile:'goodies/bitmaps/SBrowser.xbm') usedValues
(Image fromFile:'ttt.tiff') usedValues
"
@@ -11734,7 +11735,7 @@
suffix := aFileName asFilename suffix.
readerClass := MIMETypes imageReaderForSuffix:suffix.
readerClass notNil ifTrue:[
- ^ self saveOn:aFileName using:readerClass
+ ^ self saveOn:aFileName using:readerClass
].
"/
@@ -11748,7 +11749,7 @@
"
|image|
- image := Image fromFile:'bitmaps/RCube.tiff'.
+ image := Image fromFile:'goodies/bitmaps/RCube.tiff'.
image saveOn:'myImage.tiff'.
image saveOn:'myImage.xbm'.
image saveOn:'myImage.xpm'.
@@ -11759,7 +11760,8 @@
!
saveOn:aFileName using:readerClass
- "save the receiver using the representation class.
+ "save the receiver using the representation class
+ (which is usually a concrete subclasses of ImageReader).
May raise a signal, if the image cannot be written by the
reader."
@@ -11768,39 +11770,39 @@
"
|anImage|
- anImage := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ anImage := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
anImage saveOn:'myImage.tiff' using:TIFFReader.
"
"
|anImage|
- anImage := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ anImage := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
anImage saveOn:'myImage.xbm' using:XBMReader.
"
"
|anImage|
- anImage := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ anImage := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
Image cannotRepresentImageSignal handle:[:ex |
- self warn:'cannot save the image in this format'
+ self warn:'cannot save the image in this format'
] do:[
- anImage saveOn:'myImage.xbm' using:XBMReader.
+ anImage saveOn:'myImage.xbm' using:XBMReader.
]
"
"
|anImage|
- anImage := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ anImage := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
anImage saveOn:'myImage.xpm' using:XPMReader.
"
"
|anImage|
- anImage := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+ anImage := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
anImage saveOn:'myImage.gif' using:GIFReader.
"
@@ -12175,41 +12177,41 @@
(especially True- and DirectColor may be wrong).
Late note: 24bit rgb now also works.
WARNING: with doGrab true, this temporarily grabs the display
- and it may not work from within a buttonMotion
- (use with a false grabArg then)."
+ and it may not work from within a buttonMotion
+ (use with a false grabArg then)."
|curs cid rootView prevGrab|
- doGrab ifTrue:[
- curs := Cursor sourceForm:(Image fromFile:'bitmaps/Camera.xbm')
- maskForm:(Image fromFile:'bitmaps/Camera_m.xbm')
- hotSpot:16@16.
- curs notNil ifTrue:[
- cid := (curs onDevice:aDevice) id
- ].
- ].
+"/ doGrab ifTrue:[
+"/ curs := Cursor sourceForm:(Image fromFile:'bitmaps/Camera.xbm')
+"/ maskForm:(Image fromFile:'bitmaps/Camera_m.xbm')
+"/ hotSpot:16@16.
+"/ curs notNil ifTrue:[
+"/ cid := (curs onDevice:aDevice) id
+"/ ].
+"/ ].
"
actually have to grabServer ... but thats not yet available
"
rootView := aDevice rootView.
doGrab ifTrue:[
- prevGrab := aDevice activePointerGrab.
- aDevice grabPointerInView:rootView withCursor:curs.
+ prevGrab := aDevice activePointerGrab.
+ aDevice grabPointerInView:rootView withCursor:curs.
].
"
get the pixels
"
[
- self from:rootView in:aRectangle.
+ self from:rootView in:aRectangle.
] valueNowOrOnUnwindDo:[
- doGrab ifTrue:[
- aDevice ungrabPointer.
- prevGrab notNil ifTrue:[
- aDevice grabPointerInView:prevGrab.
- ]
- ]
+ doGrab ifTrue:[
+ aDevice ungrabPointer.
+ prevGrab notNil ifTrue:[
+ aDevice grabPointerInView:prevGrab.
+ ]
+ ]
]
"
@@ -12294,6 +12296,6 @@
!Image class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.308 2001-09-04 19:00:20 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.309 2001-09-05 15:38:53 cg Exp $'
! !
Image initialize!