|
Class: TranslucentColor
Object
|
+--Color
|
+--TranslucentColor
- Package:
- stx:libview
- Category:
- Graphics-Support
- Version:
- rev:
1.13
date: 2019/06/28 07:22:42
- user: cg
- file: TranslucentColor.st directory: libview
- module: stx stc-classLibrary: libview
TranslucentColor represents colors with an alpha (transparency) channel.
This is experimental and not yet used by the system.
[Instance variables:]
alpha <Integer> the internal alpha value (0..255)
instance creation
-
red: r green: g blue: b alpha: alpha
-
-
scaledRed: r scaledGreen: g scaledBlue: b alpha: alpha
-
TranslucentColor scaledRed:0 scaledGreen:0 scaledBlue:0
TranslucentColor scaledRed:0 scaledGreen:0 scaledBlue:0 alpha:1
TranslucentColor scaledRed:0 scaledGreen:0 scaledBlue:0 alpha:0.5
(TranslucentColor scaledRed:0 scaledGreen:0 scaledBlue:0 alpha:0.5) lightened
accessing
-
alpha
-
return the alpha value (0..1),
where 0 is completely transparent and 1 is completely opaque
-
alpha: alphaFraction
-
set the alpha value (0..1),
where 0 is completely transparent and 1 is completely opaque
-
alphaByte
-
return the alpha value as byte 0..255,
where 0 is completely transparent and 255 is completely opaque
-
privateAlpha
-
return the internal alpha value (0..255),
where 0 is completely transparent and 255 is completely opaque
-
scaledAlpha
-
return the alpha value (0..16rFFFF),
where 0 is completely transparent and 16rFFFF is completely opaque
-
setAlphaByte: aByteValuedInteger
-
set the alpha value (0..255),
where 0 is completely transparent and 255 is completely opaque
-
setScaledRed: r scaledGreen: g scaledBlue: b
-
r,g,b must be 0..MAXVALUE
-
setScaledRed: r scaledGreen: g scaledBlue: b alpha: alphaFraction
-
alphaFraction must be 0..1;
r,g,b must be 0..MAXVALUE
-
setScaledRed: r scaledGreen: g scaledBlue: b alphaByte: a
-
a must be 0..255;
r,g,b must be 0..MAXVALUE
color operations
-
mixed: amount with: aColor
-
create a new color from mixing amount of the receiver
with the argument, aColor.
Mixing is done by adding components (i.e. additive mixing)
(which is different from mixing colors on paper, which is subtractive).
With an amount of 1, this is the same as blendWith.
comparing
-
= aColor
-
(comment from inherited method)
two colors are considered equal, if the color components are;
independent of the device, the color is on
-
almostSameAs: aColor
-
inspecting
-
inspectorValueStringInListFor: anInspector
-
returns a string to be shown in the inspector's list
printing & storing
-
storeOn: aStream
-
append a string representing an expression to reconstruct the receiver
to the argument, aStream
usage example(s):
(self red:100 green:100 blue:0 alpha:1) storeOn:Transcript
|
queries
-
isOpaque
-
return true, if I represent an opaque color
-
isTranslucent
-
return true, if I represent a translucent color;
that is: not completely opaque
-
isTranslucentColor
-
return true, if I represent a translucent color;
This means: self isTranslucent, but isTransparent not
-
isTransparent
-
return true, if I represent a completely transparent color
|