eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TranslucentColor':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: TranslucentColor


Inheritance:

   Object
   |
   +--Color
      |
      +--TranslucentColor

Package:
stx:libview
Category:
Graphics-Support
Version:
rev: 1.16 date: 2023/05/20 02:11:29
user: cg
file: TranslucentColor.st directory: libview
module: stx stc-classLibrary: libview

Description:


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)

copyright

COPYRIGHT (c) 1999 by Claus Gittinger / eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

instance creation
o  red: r green: g blue: b alpha: alpha

o  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


Instance protocol:

accessing
o  alpha
return the alpha value (0..1),
where 0 is completely transparent and 1 is completely opaque

o  alpha: alphaFraction
return a (possibly) new color with the same color, but different alpha as the receiver.
The alpha argument's range is 0..1 (0=completely transparent; 1=completely opaque)

o  alphaByte
return the alpha value as byte 0..255,
where 0 is completely transparent and 255 is completely opaque

o  privateAlpha
return the internal alpha value (0..255),
where 0 is completely transparent and 255 is completely opaque

o  scaledAlpha
return the alpha value (0..16rFFFF),
where 0 is completely transparent and 16rFFFF is completely opaque

o  setAlpha: alphaFraction
set the alpha value (0..1),
where 0 is completely transparent and 1 is completely opaque

o  setAlphaByte: aByteValuedInteger
set the alpha value (0..255),
where 0 is completely transparent and 255 is completely opaque

o  setScaledRed: r scaledGreen: g scaledBlue: b
r,g,b must be 0..MAXVALUE

o  setScaledRed: r scaledGreen: g scaledBlue: b alpha: alphaFraction
alphaFraction must be 0..1;
r,g,b must be 0..MAXVALUE

o  setScaledRed: r scaledGreen: g scaledBlue: b alphaByte: a
a must be 0..255;
r,g,b must be 0..MAXVALUE

color operations
o  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
o  = aColor
(comment from inherited method)
two colors are considered equal, if the color components are;
independent of the device, the color is on

o  almostSameAs: aColor
return true, if aColor looks almost the same as the receiver
(i.e. the components differ by a small, invisible amount).
We assume, that the human eye can distinguish roughly 100 grey levels
(which is optimistic ;-);
therefore, allow a 1 percent difference in each component for the colors
to compare as looking the same.

conversion
o  asOpaqueColor

inspecting
o  inspectorValueStringInListFor: anInspector
returns a string to be shown in the inspector's list

printing & storing
o  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
o  isOpaque
return true, if I represent an opaque color

o  isTranslucent
return true, if I represent a translucent color;
that is: not completely opaque

o  isTranslucentColor
return true, if I represent a translucent color;
This means: self isTranslucent, but isTransparent not

o  isTransparent
return true, if I represent a completely transparent color



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 17:03:22 GMT