#TUNING by cg
class: Depth24Image
added:
#valueFromColor:
#valueFromRGB:
changed: #valueFromRedBits:greenBits:blueBits:
--- a/Depth24Image.st Sat Jul 20 08:27:52 2019 +0200
+++ b/Depth24Image.st Mon Jul 22 13:56:23 2019 +0200
@@ -3501,15 +3501,45 @@
"Modified: 10.6.1996 / 18:03:09 / cg"
!
+valueFromColor:aColor
+ "get a color's pixel value."
+
+ |r g b|
+
+ photometric == #rgb ifTrue:[
+ r := aColor redByte.
+ g := aColor greenByte.
+ b := aColor blueByte.
+ ^ (((r bitShift:8) bitOr:g) bitShift:8) bitOr:b
+ ].
+ ^ super valueFromColor:aColor.
+
+ "Created: / 22-07-2019 / 13:50:11 / Claus Gittinger"
+!
+
+valueFromRGB:anRGBValue
+ "get the pixel value corresponding to an RGB value."
+
+ photometric == #rgb ifTrue:[
+ ^ anRGBValue
+ ].
+ ^ super valueFromRGB:anRGBValue.
+
+ "Created: / 22-07-2019 / 13:48:56 / Claus Gittinger"
+!
+
valueFromRedBits:redBits greenBits:greenBits blueBits:blueBits
- (photometric == #rgb) ifTrue:[
+ "given the rgb bits, each in 0..maxXXXValue (i.e. according to
+ r/g/b channels number of bits, return the corresponding pixel value.
+ For now, only useful with RGB images"
+
+ (photometric == #rgb) ifTrue:[
^ (((redBits bitShift:8) bitOr:greenBits) bitShift:8) bitOr:blueBits
].
- self halt:'photometric?'.
- ^ (((redBits bitShift:8) bitOr:greenBits) bitShift:8) bitOr:blueBits
+ ^ super valueFromRedBits:redBits greenBits:greenBits blueBits:blueBits
"Modified: / 22-08-2017 / 18:34:07 / cg"
- "Modified: / 06-08-2018 / 01:05:23 / Claus Gittinger"
+ "Modified (comment): / 22-07-2019 / 13:51:18 / Claus Gittinger"
! !
!Depth24Image class methodsFor:'documentation'!