--- a/DeviceWorkstation.st Thu Mar 21 19:21:51 2019 +0100
+++ b/DeviceWorkstation.st Fri Mar 22 13:23:21 2019 +0100
@@ -3233,58 +3233,59 @@
this means converting it to a format (typically: monochrome) which I support.
Return a compatible version of the icon."
- |deviceIcon d toMono toDeep icon|
+ |deviceIcon myDepth iconIsImage iconsDepth toMono toDeep icon|
icon := iconArg value.
icon isNil ifTrue:[^ nil].
toMono := toDeep := false.
- d := icon depth.
+ myDepth := self depth.
+ iconsDepth := icon depth.
+ iconIsImage := icon isImage. "/ could also be a pixmap (i.e. allocated inside the device)
+
self supportsDeepIcons ifFalse:[
- (d ~~ 1 or:[icon isImage]) ifTrue:[
- "
- dither to monochrome
- "
- toMono := true.
- ]
+ (iconsDepth ~~ 1 or:[iconIsImage]) ifTrue:[
+ "/ dither to monochrome
+ toMono := true.
+ ]
] ifTrue:[
- d == 1 ifTrue:[
- icon colorMap notNil ifTrue:[
- icon isImage ifFalse:[
- toMono := true.
- ] ifTrue:[
- toDeep := true.
- ]
- ]
- ] ifFalse:[
- d ~~ self depth ifTrue:[
- icon isImage ifFalse:[
- toMono := true.
- ] ifTrue:[
- toDeep := true.
- ]
- ]
- ]
+ iconsDepth == 1 ifTrue:[
+ icon colorMap notNil ifTrue:[
+ iconIsImage ifFalse:[
+ toMono := true.
+ ] ifTrue:[
+ toDeep := true.
+ ]
+ ]
+ ] ifFalse:[
+ iconsDepth ~~ myDepth ifTrue:[
+ iconIsImage ifFalse:[
+ toMono := true.
+ ] ifTrue:[
+ toDeep := true.
+ ]
+ ]
+ ]
].
deviceIcon := icon.
- toMono ifTrue:[
- deviceIcon := icon asMonochromeFormOn:self.
- ].
toDeep ifTrue:[
- deviceIcon := (Image implementorForDepth:self depth) fromImage:icon.
+ deviceIcon := (Image implementorForDepth:myDepth) fromImage:icon.
+ ] ifFalse:[
+ toMono ifTrue:[
+ deviceIcon := icon asMonochromeFormOn:self.
+ ].
].
deviceIcon notNil ifTrue:[
- "
- get device pixmap (i.e. allocate colors & resource)
- "
- deviceIcon := deviceIcon onDevice:self
+ "/ get a device pixmap (i.e. allocate colors & resource)
+ deviceIcon := deviceIcon onDevice:self
].
^ deviceIcon
"Created: / 30-10-2007 / 16:37:10 / cg"
+ "Modified: / 22-03-2019 / 09:05:36 / Claus Gittinger"
!
convertedIconMask:aMask