--- a/Image.st Tue Aug 15 16:51:36 2000 +0200
+++ b/Image.st Tue Aug 15 21:15:23 2000 +0200
@@ -10,6 +10,8 @@
hereby transferred.
"
+"{ Package: 'stx:libview' }"
+
Object subclass:#Image
instanceVariableNames:'bytes width height bitsPerPixel depth colorMap maxPixelValue
rowByteSize bitsPerSample samplesPerPixel photometric device
@@ -8601,6 +8603,25 @@
"Modified: 24.4.1997 / 16:18:31 / cg"
!
+blendWith:aColor
+ "return a new image which is blended with some color.
+ The receiver must be a palette image (currently).
+ CAVEAT: this only works with palette images (i.e. not for rgb or greyScale).
+ CAVEAT: Need an argument, which specifies by how much it should be lighter."
+
+ ^ self
+ copyWithColorMapProcessing:[:clr | clr blendWith:aColor]
+
+ "
+ (Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') inspect
+ ((Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') blendWith:Color red) inspect
+ ((Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') blendWith:Color white) inspect
+ ((Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') blendWith:Color black) inspect
+ "
+
+ "Modified: 24.4.1997 / 18:31:23 / cg"
+!
+
colorMapProcessing:aBlock
"a helper for all kinds of colormap manipulations.
The argument, aBlock is called for every colormap entry,
@@ -8702,8 +8723,8 @@
copyWithColorMapProcessing:[:clr | clr darkened]
"
- (Image fromFile:'bitmaps/gifImages/claus.gif') inspect
- (Image fromFile:'bitmaps/gifImages/claus.gif') darkened inspect
+ (Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') inspect
+ (Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') darkened inspect
"
"Modified: 24.4.1997 / 18:28:31 / cg"
@@ -9759,10 +9780,10 @@
copyWithColorMapProcessing:[:clr | clr lightened]
"
- (Image fromFile:'bitmaps/gifImages/claus.gif') inspect
- (Image fromFile:'bitmaps/gifImages/claus.gif') lightened inspect
- (Image fromFile:'bitmaps/gifImages/claus.gif') darkened inspect
- (Image fromFile:'bitmaps/gifImages/claus.gif') darkened darkened inspect
+ (Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') inspect
+ (Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') lightened inspect
+ (Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') darkened inspect
+ (Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') darkened darkened inspect
"
"Modified: 24.4.1997 / 18:31:23 / cg"
@@ -9911,6 +9932,31 @@
"
!
+mixed:amount with:aColor
+ "return a new image which is blended with some color;
+ amount determines how much of the blending color is applied (0..)
+ where 0 means: blending color pure.
+ The receiver must be a palette image (currently).
+ CAVEAT: this only works with palette images (i.e. not for rgb or greyScale).
+ CAVEAT: Need an argument, which specifies by how much it should be lighter."
+
+ ^ self
+ copyWithColorMapProcessing:[:clr | clr mixed:amount with:aColor]
+
+ "
+ (Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') inspect
+ ((Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') mixed:0.0 with:Color red) inspect
+ ((Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') mixed:0.1 with:Color red) inspect
+ ((Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') mixed:0.25 with:Color red) inspect
+ ((Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') mixed:0.5 with:Color red) inspect
+ ((Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') mixed:1 with:Color red) inspect
+ ((Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') mixed:2 with:Color red) inspect
+ ((Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') mixed:10 with:Color red) inspect
+ "
+
+ "Modified: 24.4.1997 / 18:31:23 / cg"
+!
+
negative
"return a new image which is a negative of the receiver.
The receiver must be a palette image (currently)."
@@ -12053,6 +12099,6 @@
!Image class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.294 2000-01-26 15:36:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.295 2000-08-15 19:15:23 cg Exp $'
! !
Image initialize!