#FEATURE
authorClaus Gittinger <cg@exept.de>
Mon, 07 Mar 2016 01:55:55 +0100
changeset 7200 a12560d93bdb
parent 7199 d099c8ba4e9d
child 7202 fc488e2907c8
child 7203 86050e7f2580
#FEATURE class: FixedPaletteWithAlpha added: #copyright #size
FixedPaletteWithAlpha.st
--- a/FixedPaletteWithAlpha.st	Mon Mar 07 00:49:52 2016 +0100
+++ b/FixedPaletteWithAlpha.st	Mon Mar 07 01:55:55 2016 +0100
@@ -1,3 +1,14 @@
+"
+ COPYRIGHT (c) 2016 by Claus Gittinger
+              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.
+"
 "{ Package: 'stx:libview' }"
 
 "{ NameSpace: Smalltalk }"
@@ -9,6 +20,21 @@
 	category:'Graphics-Images-Support'
 !
 
+!FixedPaletteWithAlpha class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2016 by Claus Gittinger
+              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.
+"
+! !
 
 !FixedPaletteWithAlpha methodsFor:'accessing'!
 
@@ -19,6 +45,15 @@
 
 !FixedPaletteWithAlpha methodsFor:'printing & storing'!
 
+size
+    "return the number of (simulated) colors in this colormap"
+
+    ^ ((alphaMask bitShift:alphaShift)
+        + (redMask bitShift:redShift)
+        + (greenMask bitShift:greenShift)
+        + (blueMask bitShift:blueShift)) + 1 
+!
+
 storeInstVarsOn:aStream
     super storeInstVarsOn:aStream.
     aStream nextPutAll:' alphaShift:'. alphaShift storeOn:aStream.