Depth4Image.st
changeset 6897 7af3b0859ba5
parent 6827 68d52c024d4d
child 7189 4cfe895d6532
equal deleted inserted replaced
6896:6dde273a9c0b 6897:7af3b0859ba5
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 1993 by Claus Gittinger
     2  COPYRIGHT (c) 1993 by Claus Gittinger
     5 	      All Rights Reserved
     3 	      All Rights Reserved
     6 
     4 
     7  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
  1024 !
  1022 !
  1025 
  1023 
  1026 usedValues
  1024 usedValues
  1027     "return a collection of color values used in the receiver."
  1025     "return a collection of color values used in the receiver."
  1028 
  1026 
  1029     |useFlags usedValues|
  1027     |useFlags usedValues 
       
  1028      h "{ Class: SmallInteger }"
       
  1029      w "{ Class: SmallInteger }" |
  1030 
  1030 
  1031     useFlags := Array new:16 withAll:false.
  1031     useFlags := Array new:16 withAll:false.
  1032     width even ifFalse:[
  1032     w := width.
  1033 	0 to:self height - 1 do:[:y |
  1033     h := height.
  1034 	    self valuesAtY:y from:0 to:self width - 1 do:[:x :pixel |
  1034 
  1035 		useFlags at:(pixel + 1) put:true
  1035     w even ifFalse:[
  1036 	    ]
  1036         0 to:h-1 do:[:y |
  1037 	].
  1037             self valuesAtY:y from:0 to:w-1 do:[:x :pixel |
       
  1038                 useFlags at:(pixel + 1) put:true
       
  1039             ]
       
  1040         ].
  1038     ] ifTrue:[
  1041     ] ifTrue:[
  1039 	self bits usedValues do:[:byte |
  1042         self bits usedValues do:[:byte |
  1040 	    useFlags at:(byte bitShift:-4)+1 put:true.
  1043             useFlags at:(byte bitShift:-4)+1 put:true.
  1041 	    useFlags at:(byte bitAnd:2r1111)+1 put:true.
  1044             useFlags at:(byte bitAnd:2r1111)+1 put:true.
  1042 	].
  1045         ].
  1043     ].
  1046     ].
  1044     ^ (0 to:15) select:[:i | useFlags at:(i+1)].
  1047     ^ (0 to:15) select:[:i | useFlags at:(i+1)].
  1045 
  1048 
  1046 "/    usedValues := OrderedCollection new.
  1049 "/    usedValues := OrderedCollection new.
  1047 "/    1 to:16 do:[:i | (useFlags at:i) ifTrue:[usedValues add:(i-1)]].
  1050 "/    1 to:16 do:[:i | (useFlags at:i) ifTrue:[usedValues add:(i-1)]].
  1051 ! !
  1054 ! !
  1052 
  1055 
  1053 !Depth4Image class methodsFor:'documentation'!
  1056 !Depth4Image class methodsFor:'documentation'!
  1054 
  1057 
  1055 version
  1058 version
  1056     ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.54 2015-03-18 18:12:22 cg Exp $'
  1059     ^ '$Header$'
  1057 !
  1060 !
  1058 
  1061 
  1059 version_CVS
  1062 version_CVS
  1060     ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.54 2015-03-18 18:12:22 cg Exp $'
  1063     ^ '$Header$'
  1061 ! !
  1064 ! !
  1062 
  1065