--- a/DeviceWorkstation.st Thu Jul 11 11:54:59 1996 +0200
+++ b/DeviceWorkstation.st Thu Jul 11 18:36:05 1996 +0200
@@ -1626,6 +1626,23 @@
!DeviceWorkstation methodsFor:'color stuff'!
+availableDitherColors
+ "return the table of preallocated emergency ditherColors
+ plus possibly available fixColors."
+
+ |s|
+
+ fixColors notNil ifTrue:[
+ s := IdentitySet new.
+ s addAll:fixColors.
+ s addAll:ditherColors.
+ ^ s asArray
+ ].
+ ^ ditherColors
+
+ "Created: 11.7.1996 / 18:13:30 / cg"
+!
+
blueComponentOfColor:colorId
"get blue component (0..100) of color in map at:index"
@@ -1713,6 +1730,23 @@
^ self subclassResponsibility
!
+ditherColors
+ "return the table of preallocated emergency ditherColors"
+
+ ^ ditherColors
+
+ "Modified: 11.7.1996 / 18:13:37 / cg"
+!
+
+fixColors
+ "return the table of preallocated fix colors (a colorCube),
+ or nil if no colors were preallocated."
+
+ ^ fixColors
+
+ "Created: 11.7.1996 / 17:49:24 / cg"
+!
+
freeColor:colorIndex
"free a color on the display, when its no longer needed"
@@ -1773,16 +1807,83 @@
^ #('red' 'green' 'blue' 'yellow' 'magenta' 'cyan' 'white' 'black')
!
+numFixBlue
+ "return the number of blue shades in the
+ preallocated fix color cube (or 0 if there is none)"
+
+ ^ numFixBlue
+
+ "Created: 11.7.1996 / 17:49:58 / cg"
+!
+
+numFixGreen
+ "return the number of green shades in the
+ preallocated fix color cube (or 0 if there is none)"
+
+ ^ numFixGreen
+
+ "Created: 11.7.1996 / 17:50:12 / cg"
+!
+
+numFixRed
+ "return the number of red shades in the
+ preallocated fix color cube (or 0 if there is none)"
+
+ ^ numFixRed
+
+ "Created: 11.7.1996 / 17:50:20 / cg"
+!
+
redComponentOfColor:colorId
"get red component (0..100) of color in map at:index"
self getRGBFrom:colorId into:[:r :g :b | ^ r]
!
+releaseFixColors
+ "release the fix colorMap"
+
+ fixColors := nil.
+ numFixRed := numFixGreen := numFixBlue := 0.
+
+ "
+ Display releaseFixColors
+ "
+
+ "Created: 11.7.1996 / 18:00:42 / cg"
+!
+
setColor:index red:redVal green:greenVal blue:blueVal
"change color in map at:index to rgb (0..100)"
^ self subclassResponsibility
+!
+
+setDitherColors:colors
+ "set the table of preallocated emergency dither fix colors
+ These preallocated colors
+ (white, black, red, green, blue and a few grayScales) prevent
+ running out of colors later, when images have to be dithered or
+ pen colors must be approximated.
+ ((Although, with such a small number of colors, the result will
+ definitely look poor))"
+
+ ditherColors := colors.
+
+ "Created: 11.7.1996 / 18:11:45 / cg"
+!
+
+setFixColors:colors numRed:nR numGreen:nG numBlue:nB
+ "set the table of preallocated fix colors (a colorCube),
+ and the number of r/g/b entries in each dimension."
+
+ fixColors := colors.
+ numFixRed := nR.
+ numFixGreen := nG.
+ numFixBlue := nB.
+
+ "Created: 11.7.1996 / 17:56:18 / cg"
+ "Modified: 11.7.1996 / 17:57:10 / cg"
! !
!DeviceWorkstation methodsFor:'cursor stuff'!
@@ -3220,9 +3321,12 @@
supportsDeepIcons isNil ifTrue:[
supportsDeepIcons := false.
- ]
-
- "Modified: 18.6.1996 / 10:33:59 / cg"
+ ].
+
+ fixColors := ditherColors := nil.
+ numFixRed := numFixGreen := numFixBlue := 0.
+
+ "Modified: 11.7.1996 / 18:34:45 / cg"
!
invalidateConnection
@@ -4336,6 +4440,6 @@
!DeviceWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.114 1996-07-11 09:03:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.115 1996-07-11 16:36:05 cg Exp $'
! !
DeviceWorkstation initialize!