Image.st
changeset 6311 0986d91407d9
parent 6308 6e4008b97f64
child 6370 9e3a18c732ca
equal deleted inserted replaced
6310:612c17181395 6311:0986d91407d9
  1924      self bytesPerRowForWidth:15 depth:1 padding:32
  1924      self bytesPerRowForWidth:15 depth:1 padding:32
  1925     "
  1925     "
  1926 !
  1926 !
  1927 
  1927 
  1928 defaultPhotometric
  1928 defaultPhotometric
  1929     "return the default photometric pixel interpretation"
  1929     "return the default photometric pixel interpretation.
       
  1930      This may be a somewhat old leftover from times, when tiff was the first image file type to be read.
       
  1931      Much better would be to always have some (possibly fake and virtual) colormap around, and ask that one.
       
  1932      However, in the meantime, many other classes depend on that, so that it should be kept as an API 
       
  1933      - even when the internal representation will be replaced by something better in the future."
  1930 
  1934 
  1931     ^ #blackIs0
  1935     ^ #blackIs0
  1932 
  1936 
  1933     "Modified: 20.4.1996 / 23:40:41 / cg"
  1937     "Modified: 20.4.1996 / 23:40:41 / cg"
  1934     "Created: 10.6.1996 / 18:08:12 / cg"
  1938     "Created: 10.6.1996 / 18:08:12 / cg"
  2690     "Created: 1.2.1996 / 15:09:25 / cg"
  2694     "Created: 1.2.1996 / 15:09:25 / cg"
  2691     "Modified: 8.6.1996 / 09:54:02 / cg"
  2695     "Modified: 8.6.1996 / 09:54:02 / cg"
  2692 !
  2696 !
  2693 
  2697 
  2694 photometric
  2698 photometric
  2695     "return the photometric, a symbol such as #palette, #rgb etc."
  2699     "return the photometric, a symbol such as #palette, #rgb etc.
       
  2700      This may be a somewhat old leftover from times, when tiff was the first image file type to be read.
       
  2701      Much better would be to always have some (possibly fake and virtual) colormap around, and ask that one.
       
  2702      However, in the meantime, many other classes depend on that, so that it should be kept as an API 
       
  2703      - even when the internal representation will be replaced by something better in the future."
       
  2704 
  2696 
  2705 
  2697     ^ photometric
  2706     ^ photometric
  2698 !
  2707 !
  2699 
  2708 
  2700 samplesPerPixel
  2709 samplesPerPixel
  6415 
  6424 
  6416 !Image methodsFor:'dither helpers'!
  6425 !Image methodsFor:'dither helpers'!
  6417 
  6426 
  6418 burkesDitheredMonochromeBits
  6427 burkesDitheredMonochromeBits
  6419     "return the bitmap for a dithered monochrome bitmap from the image.
  6428     "return the bitmap for a dithered monochrome bitmap from the image.
  6420      Works for any source depths / photometric"
  6429      Works for any source depths / photometric.
       
  6430      TODO: move to separate dither helper class"
  6421 
  6431 
  6422     |dstIndex        "{Class: SmallInteger }"
  6432     |dstIndex        "{Class: SmallInteger }"
  6423      nextDst         "{Class: SmallInteger }"
  6433      nextDst         "{Class: SmallInteger }"
  6424      bytesPerMonoRow "{Class: SmallInteger }"
  6434      bytesPerMonoRow "{Class: SmallInteger }"
  6425      monoBits greyValues
  6435      monoBits greyValues
  6431      bitCnt          "{Class: SmallInteger }"
  6441      bitCnt          "{Class: SmallInteger }"
  6432      byte            "{Class: SmallInteger }"
  6442      byte            "{Class: SmallInteger }"
  6433      grey|
  6443      grey|
  6434 
  6444 
  6435     self depth > 12 ifTrue:[
  6445     self depth > 12 ifTrue:[
  6436 	^ self floydSteinbergDitheredMonochromeBits
  6446         ^ self floydSteinbergDitheredMonochromeBits
  6437     ].
  6447     ].
  6438 
  6448 
  6439     w := width.
  6449     w := width.
  6440     h := height.
  6450     h := height.
  6441 
  6451 
  6451     "/ use table-value in loop
  6461     "/ use table-value in loop
  6452 
  6462 
  6453     greyValues := self greyMapForRange:(255*1024).
  6463     greyValues := self greyMapForRange:(255*1024).
  6454 
  6464 
  6455     0 to:(h-1) do:[:y |
  6465     0 to:(h-1) do:[:y |
  6456 	nextDst := dstIndex + bytesPerMonoRow.
  6466         nextDst := dstIndex + bytesPerMonoRow.
  6457 	byte := 0.
  6467         byte := 0.
  6458 	bitCnt := 8.
  6468         bitCnt := 8.
  6459 
  6469 
  6460 	t := errorArray.
  6470         t := errorArray.
  6461 	errorArray := errorArray1.
  6471         errorArray := errorArray1.
  6462 	errorArray1 := t.
  6472         errorArray1 := t.
  6463 
  6473 
  6464 	errorArray1 atAllPut:0.
  6474         errorArray1 atAllPut:0.
  6465 
  6475 
  6466 	self valuesAtY:y from:0 to:(w-1) do:[:x :pixel |
  6476         self valuesAtY:y from:0 to:(w-1) do:[:x :pixel |
  6467 	    |eP "{Class: SmallInteger }"
  6477             |eP "{Class: SmallInteger }"
  6468 	     eD
  6478              eD
  6469 	     eI "{Class: SmallInteger }"
  6479              eI "{Class: SmallInteger }"
  6470 	     xE "{Class: SmallInteger }"
  6480              xE "{Class: SmallInteger }"
  6471 	     xN "{Class: SmallInteger }" |
  6481              xN "{Class: SmallInteger }" |
  6472 
  6482 
  6473 	    "/ get the colors grey value [0 .. 1]
  6483             "/ get the colors grey value [0 .. 1]
  6474 	    grey := greyValues at:(pixel + 1).
  6484             grey := greyValues at:(pixel + 1).
  6475 
  6485 
  6476 	    "/ adjust error
  6486             "/ adjust error
  6477 	    xE := x + 2 + 1.
  6487             xE := x + 2 + 1.
  6478 	    grey := (grey + (errorArray at:xE)).
  6488             grey := (grey + (errorArray at:xE)).
  6479 
  6489 
  6480 	    byte := byte bitShift:1.
  6490             byte := byte bitShift:1.
  6481 	    grey > (127*1024) ifTrue:[
  6491             grey > (127*1024) ifTrue:[
  6482 		byte := byte bitOr:1.      "/ white
  6492                 byte := byte bitOr:1.      "/ white
  6483 		e := grey - (255*1024)
  6493                 e := grey - (255*1024)
  6484 	    ] ifFalse:[
  6494             ] ifFalse:[
  6485 		e := grey                  "/ black
  6495                 e := grey                  "/ black
  6486 	    ].
  6496             ].
  6487 
  6497 
  6488 	    e ~= 0 ifTrue:[
  6498             e ~= 0 ifTrue:[
  6489 		"/ distribute the error:
  6499                 "/ distribute the error:
  6490 		"/                  XX  8  4
  6500                 "/                  XX  8  4
  6491 		"/             2  4  8  4  2
  6501                 "/             2  4  8  4  2
  6492 
  6502 
  6493 		eD := e.
  6503                 eD := e.
  6494 		eI := e // 32.
  6504                 eI := e // 32.
  6495 
  6505 
  6496 		eP := eI * 8. eD := eD - eP.
  6506                 eP := eI * 8. eD := eD - eP.
  6497 
  6507 
  6498 		xN := xE + 1.
  6508                 xN := xE + 1.
  6499 		errorArray at:xN put:(errorArray at:xN) + eP.
  6509                 errorArray at:xN put:(errorArray at:xN) + eP.
  6500 
  6510 
  6501 		eD := eD - eP.
  6511                 eD := eD - eP.
  6502 		errorArray1 at:xE put:(errorArray1 at:xE) + eP.
  6512                 errorArray1 at:xE put:(errorArray1 at:xE) + eP.
  6503 
  6513 
  6504 		eP := eI * 4. eD := eD - eP.
  6514                 eP := eI * 4. eD := eD - eP.
  6505 		xN := xE + 2.
  6515                 xN := xE + 2.
  6506 		errorArray at:xN put:(errorArray at:xN) + eP.
  6516                 errorArray at:xN put:(errorArray at:xN) + eP.
  6507 
  6517 
  6508 		eD := eD - eP.
  6518                 eD := eD - eP.
  6509 		xN := xE - 1.
  6519                 xN := xE - 1.
  6510 		errorArray1 at:xN put:(errorArray1 at:xN) + eP.
  6520                 errorArray1 at:xN put:(errorArray1 at:xN) + eP.
  6511 
  6521 
  6512 		eD := eD - eP.
  6522                 eD := eD - eP.
  6513 		xN := xE + 1.
  6523                 xN := xE + 1.
  6514 		errorArray1 at:xN put:(errorArray1 at:xN) + eP.
  6524                 errorArray1 at:xN put:(errorArray1 at:xN) + eP.
  6515 
  6525 
  6516 		eP := eI * 2. eD := eD - eP.
  6526                 eP := eI * 2. eD := eD - eP.
  6517 		xN := xE - 2.
  6527                 xN := xE - 2.
  6518 		errorArray1 at:xN put:(errorArray1 at:xN) + eP.
  6528                 errorArray1 at:xN put:(errorArray1 at:xN) + eP.
  6519 
  6529 
  6520 		"/ eD := eD.
  6530                 "/ eD := eD.
  6521 		xN := xE + 2.
  6531                 xN := xE + 2.
  6522 		errorArray1 at:xN put:(errorArray1 at:xN) + eP.
  6532                 errorArray1 at:xN put:(errorArray1 at:xN) + eP.
  6523 	    ].
  6533             ].
  6524 
  6534 
  6525 	    bitCnt := bitCnt - 1.
  6535             bitCnt := bitCnt - 1.
  6526 	    bitCnt == 0 ifTrue:[
  6536             bitCnt == 0 ifTrue:[
  6527 		monoBits at:dstIndex put:byte.
  6537                 monoBits at:dstIndex put:byte.
  6528 		dstIndex := dstIndex + 1.
  6538                 dstIndex := dstIndex + 1.
  6529 		byte := 0.
  6539                 byte := 0.
  6530 		bitCnt := 8.
  6540                 bitCnt := 8.
  6531 	    ].
  6541             ].
  6532 
  6542 
  6533 	].
  6543         ].
  6534 	bitCnt ~~ 8 ifTrue:[
  6544         bitCnt ~~ 8 ifTrue:[
  6535 	    byte := byte bitShift:bitCnt.
  6545             byte := byte bitShift:bitCnt.
  6536 	    monoBits at:dstIndex put:byte.
  6546             monoBits at:dstIndex put:byte.
  6537 	].
  6547         ].
  6538 
  6548 
  6539 	dstIndex := nextDst.
  6549         dstIndex := nextDst.
  6540     ].
  6550     ].
  6541 
  6551 
  6542     ^ monoBits
  6552     ^ monoBits
  6543 
  6553 
  6544     "Created: 10.6.1996 / 12:18:20 / cg"
  6554     "Created: 10.6.1996 / 12:18:20 / cg"
  8682     ^ monoBits
  8692     ^ monoBits
  8683 !
  8693 !
  8684 
  8694 
  8685 stevensonArceDitheredMonochromeBits
  8695 stevensonArceDitheredMonochromeBits
  8686     "return the bitmap for a dithered monochrome bitmap from the image.
  8696     "return the bitmap for a dithered monochrome bitmap from the image.
  8687      Works for any source depths / photometric"
  8697      Works for any source depths / photometric.
       
  8698      TODO: move to separate dither helper class"
  8688 
  8699 
  8689     |dstIndex        "{Class: SmallInteger }"
  8700     |dstIndex        "{Class: SmallInteger }"
  8690      nextDst         "{Class: SmallInteger }"
  8701      nextDst         "{Class: SmallInteger }"
  8691      bytesPerMonoRow "{Class: SmallInteger }"
  8702      bytesPerMonoRow "{Class: SmallInteger }"
  8692      monoBits greyValues
  8703      monoBits greyValues
  8699      byte            "{Class: SmallInteger }"
  8710      byte            "{Class: SmallInteger }"
  8700      grey
  8711      grey
  8701      xE              "{Class: SmallInteger }" |
  8712      xE              "{Class: SmallInteger }" |
  8702 
  8713 
  8703     self depth > 12 ifTrue:[
  8714     self depth > 12 ifTrue:[
  8704 	^ self floydSteinbergDitheredMonochromeBits
  8715         ^ self floydSteinbergDitheredMonochromeBits
  8705     ].
  8716     ].
  8706 
  8717 
  8707     w := width.
  8718     w := width.
  8708     h := height.
  8719     h := height.
  8709 
  8720 
  8721     "/ use table-value in loop
  8732     "/ use table-value in loop
  8722 
  8733 
  8723     greyValues := self greyMapForRange:(255 * 1024).
  8734     greyValues := self greyMapForRange:(255 * 1024).
  8724 
  8735 
  8725     0 to:(h-1) do:[:y |
  8736     0 to:(h-1) do:[:y |
  8726 	nextDst := dstIndex + bytesPerMonoRow.
  8737         nextDst := dstIndex + bytesPerMonoRow.
  8727 	byte := 0.
  8738         byte := 0.
  8728 	bitCnt := 8.
  8739         bitCnt := 8.
  8729 
  8740 
  8730 	t := errorArray.
  8741         t := errorArray.
  8731 	errorArray := errorArray1.
  8742         errorArray := errorArray1.
  8732 	errorArray1 := errorArray2.
  8743         errorArray1 := errorArray2.
  8733 	errorArray2 := errorArray3.
  8744         errorArray2 := errorArray3.
  8734 	errorArray3 := t.
  8745         errorArray3 := t.
  8735 
  8746 
  8736 	errorArray3 atAllPut:0.
  8747         errorArray3 atAllPut:0.
  8737 
  8748 
  8738 	self valuesAtY:y from:0 to:(w-1) do:[:x :pixel |
  8749         self valuesAtY:y from:0 to:(w-1) do:[:x :pixel |
  8739 	    |eP eD|
  8750             |eP eD|
  8740 
  8751 
  8741 	    "/ get the colors grey value [0 .. 1]
  8752             "/ get the colors grey value [0 .. 1]
  8742 	    grey := greyValues at:(pixel + 1).
  8753             grey := greyValues at:(pixel + 1).
  8743 
  8754 
  8744 	    "/ adjust error
  8755             "/ adjust error
  8745 	    xE := x + 3 + 1.
  8756             xE := x + 3 + 1.
  8746 	    grey := (grey + (errorArray at:xE)).
  8757             grey := (grey + (errorArray at:xE)).
  8747 
  8758 
  8748 	    byte := byte bitShift:1.
  8759             byte := byte bitShift:1.
  8749 	    grey > (127 * 1024) ifTrue:[
  8760             grey > (127 * 1024) ifTrue:[
  8750 		byte := byte bitOr:1.      "/ white
  8761                 byte := byte bitOr:1.      "/ white
  8751 		e := grey - (255 * 1024)
  8762                 e := grey - (255 * 1024)
  8752 	    ] ifFalse:[
  8763             ] ifFalse:[
  8753 		e := grey                  "/ black
  8764                 e := grey                  "/ black
  8754 	    ].
  8765             ].
  8755 
  8766 
  8756 	    e ~= 0 ifTrue:[
  8767             e ~= 0 ifTrue:[
  8757 		"/ distribute the error:
  8768                 "/ distribute the error:
  8758 		"/                  XX    32
  8769                 "/                  XX    32
  8759 		"/         12    26    30    16
  8770                 "/         12    26    30    16
  8760 		"/            12    26    12
  8771                 "/            12    26    12
  8761 		"/          5    12    12     5
  8772                 "/          5    12    12     5
  8762 
  8773 
  8763 		eD := e.
  8774                 eD := e.
  8764 		e := e // 200.
  8775                 e := e // 200.
  8765 
  8776 
  8766 		eP := e * 32. eD := eD - eP.
  8777                 eP := e * 32. eD := eD - eP.
  8767 		errorArray at:xE+2 put:(errorArray at:xE+2) + eP.
  8778                 errorArray at:xE+2 put:(errorArray at:xE+2) + eP.
  8768 
  8779 
  8769 		eP := e * 30. eD := eD - eP.
  8780                 eP := e * 30. eD := eD - eP.
  8770 		errorArray1 at:xE+1 put:(errorArray1 at:xE+1) + eP.
  8781                 errorArray1 at:xE+1 put:(errorArray1 at:xE+1) + eP.
  8771 
  8782 
  8772 		eP := e * 16. eD := eD - eP.
  8783                 eP := e * 16. eD := eD - eP.
  8773 		errorArray1 at:xE+3 put:(errorArray1 at:xE+3) + eP.
  8784                 errorArray1 at:xE+3 put:(errorArray1 at:xE+3) + eP.
  8774 
  8785 
  8775 		eP := e * 26. eD := eD - eP.
  8786                 eP := e * 26. eD := eD - eP.
  8776 		errorArray1 at:xE-1 put:(errorArray1 at:xE-1) + eP.
  8787                 errorArray1 at:xE-1 put:(errorArray1 at:xE-1) + eP.
  8777 
  8788 
  8778 		eD := eD - eP.
  8789                 eD := eD - eP.
  8779 		errorArray2 at:xE put:(errorArray2 at:xE) + eP.
  8790                 errorArray2 at:xE put:(errorArray2 at:xE) + eP.
  8780 
  8791 
  8781 		eP := e * 12. eD := eD - eP.
  8792                 eP := e * 12. eD := eD - eP.
  8782 		errorArray1 at:xE-3 put:(errorArray1 at:xE-3) + eP.
  8793                 errorArray1 at:xE-3 put:(errorArray1 at:xE-3) + eP.
  8783 
  8794 
  8784 		eD := eD - eP.
  8795                 eD := eD - eP.
  8785 		errorArray2 at:xE-2 put:(errorArray2 at:xE-2) + eP.
  8796                 errorArray2 at:xE-2 put:(errorArray2 at:xE-2) + eP.
  8786 
  8797 
  8787 		eD := eD - eP.
  8798                 eD := eD - eP.
  8788 		errorArray2 at:xE+2 put:(errorArray2 at:xE+2) + eP.
  8799                 errorArray2 at:xE+2 put:(errorArray2 at:xE+2) + eP.
  8789 
  8800 
  8790 		eD := eD - eP.
  8801                 eD := eD - eP.
  8791 		errorArray3 at:xE-1 put:(errorArray3 at:xE-1) + eP.
  8802                 errorArray3 at:xE-1 put:(errorArray3 at:xE-1) + eP.
  8792 
  8803 
  8793 		eD := eD - eP.
  8804                 eD := eD - eP.
  8794 		errorArray3 at:xE+1 put:(errorArray3 at:xE+1) + eP.
  8805                 errorArray3 at:xE+1 put:(errorArray3 at:xE+1) + eP.
  8795 
  8806 
  8796 		eP := e * 5. eD := eD - eP.
  8807                 eP := e * 5. eD := eD - eP.
  8797 		errorArray3 at:xE-3 put:(errorArray3 at:xE-3) + eP.
  8808                 errorArray3 at:xE-3 put:(errorArray3 at:xE-3) + eP.
  8798 
  8809 
  8799 		eP := eD.
  8810                 eP := eD.
  8800 		errorArray3 at:xE+3 put:(errorArray3 at:xE+3) + eP.
  8811                 errorArray3 at:xE+3 put:(errorArray3 at:xE+3) + eP.
  8801 	    ].
  8812             ].
  8802 
  8813 
  8803 	    bitCnt := bitCnt - 1.
  8814             bitCnt := bitCnt - 1.
  8804 	    bitCnt == 0 ifTrue:[
  8815             bitCnt == 0 ifTrue:[
  8805 		monoBits at:dstIndex put:byte.
  8816                 monoBits at:dstIndex put:byte.
  8806 		dstIndex := dstIndex + 1.
  8817                 dstIndex := dstIndex + 1.
  8807 		byte := 0.
  8818                 byte := 0.
  8808 		bitCnt := 8.
  8819                 bitCnt := 8.
  8809 	    ].
  8820             ].
  8810 
  8821 
  8811 	].
  8822         ].
  8812 	bitCnt ~~ 8 ifTrue:[
  8823         bitCnt ~~ 8 ifTrue:[
  8813 	    byte := byte bitShift:bitCnt.
  8824             byte := byte bitShift:bitCnt.
  8814 	    monoBits at:dstIndex put:byte.
  8825             monoBits at:dstIndex put:byte.
  8815 	].
  8826         ].
  8816 
  8827 
  8817 	dstIndex := nextDst.
  8828         dstIndex := nextDst.
  8818     ].
  8829     ].
  8819 
  8830 
  8820     ^ monoBits
  8831     ^ monoBits
  8821 
  8832 
  8822     "Created: 10.6.1996 / 12:38:35 / cg"
  8833     "Created: 10.6.1996 / 12:38:35 / cg"
 12176 
 12187 
 12177 storeOn:aStream
 12188 storeOn:aStream
 12178     "append a printed representation of the receiver to aStream,
 12189     "append a printed representation of the receiver to aStream,
 12179      from which a copy of it can be reconstructed."
 12190      from which a copy of it can be reconstructed."
 12180 
 12191 
 12181     |colors usedValues colorMapArray|
 12192     |colors usedValues colorMapArray needBPS|
 12182 
 12193 
 12183     aStream nextPutAll:'(' , self class name , ' new)'.
 12194     aStream nextPutAll:'(' , self class name , ' new)'.
 12184     aStream nextPutAll:' width: '. width storeOn:aStream.
 12195     aStream nextPutAll:' width:'. width storeOn:aStream.
 12185     aStream nextPutAll:'; height: '. height storeOn:aStream.
 12196     aStream nextPutAll:'; height:'. height storeOn:aStream.
 12186     aStream nextPutAll:'; photometric:('. photometric storeOn:aStream.
 12197 
 12187     aStream nextPutAll:'); bitsPerSample:('. bitsPerSample storeOn:aStream.
 12198     "/ avoiding some unneeded stuff here makes object files with many images a bit smaller.
 12188     aStream nextPutAll:'); samplesPerPixel:('. samplesPerPixel storeOn:aStream.
 12199     "/ no need for the photometric, if its the default anyway
       
 12200     photometric ~= self class defaultPhotometric ifTrue:[
       
 12201         (colorMap isNil or:[photometric ~~ #palette]) ifTrue:[
       
 12202             aStream nextPutAll:'; photometric:('. photometric storeOn:aStream. aStream nextPutAll:')'.
       
 12203         ].
       
 12204     ].
       
 12205 
       
 12206     "/ no need to store bitPerSample/samplesPerPixel in all situations
       
 12207     needBPS := true.
       
 12208 
       
 12209     self depth == 1 
       
 12210         ifTrue:[ needBPS := false ]
       
 12211         ifFalse:[
       
 12212             ((photometric == #palette) 
       
 12213                 and:[ (bitsPerSample size == 1)
       
 12214                 and:[ ((bitsPerSample at:1) == self depth)
       
 12215                 and:[ samplesPerPixel == 1 ]]])
       
 12216             ifTrue:[
       
 12217                 needBPS := false.
       
 12218             ].
       
 12219         ].
       
 12220 
       
 12221     needBPS ifTrue:[
       
 12222         aStream nextPutAll:'; bitsPerSample:('. bitsPerSample storeOn:aStream. aStream nextPutAll:')'.
       
 12223         aStream nextPutAll:'; samplesPerPixel:('. samplesPerPixel storeOn:aStream. aStream nextPutAll:')'. 
       
 12224     ].
 12189 
 12225 
 12190     "/ assert that all bits are there...
 12226     "/ assert that all bits are there...
 12191     "/ self assert:(self bits size) >= (self bytesPerRow * height).
 12227     "/ self assert:(self bits size) >= (self bytesPerRow * height).
 12192     "/ self bits:((ByteArray new:self bytesPerRow * height) replaceFrom:1 with:self bits).
 12228     "/ self bits:((ByteArray new:self bytesPerRow * height) replaceFrom:1 with:self bits).
 12193 
 12229 
 12194     aStream nextPutAll:'); bits:(ByteArray fromPackedString:'. self bits asPackedString storeOn:aStream.
 12230     aStream nextPutAll:'; bits:(ByteArray fromPackedString:'. self bits asPackedString storeOn:aStream.
 12195     aStream nextPutAll:') '.
 12231     aStream nextPutAll:') '.
 12196 
 12232 
 12197     colorMap notNil ifTrue:[
 12233     colorMap notNil ifTrue:[
 12198 	self depth <= 8 ifTrue:[
 12234         self depth <= 8 ifTrue:[
 12199 	    "/ cut off unused colors ...
 12235             "/ cut off unused colors ...
 12200 	    usedValues := self usedValues.
 12236             usedValues := self usedValues.
 12201 	    colors := colorMap copyFrom:1 to:((usedValues max+1) min:colorMap size).
 12237             colors := colorMap copyFrom:1 to:((usedValues max+1) min:colorMap size).
 12202 
 12238 
 12203 	    colorMapArray := OrderedCollection new.
 12239             colorMapArray := OrderedCollection new.
 12204 	    colors do:[:clr| colorMapArray add:(clr redByte); add:(clr greenByte); add:(clr blueByte)].
 12240             colors do:[:clr| colorMapArray add:(clr redByte); add:(clr greenByte); add:(clr blueByte)].
 12205 	    aStream nextPutAll:'; colorMapFromArray:'.
 12241             aStream nextPutAll:'; colorMapFromArray:'.
 12206 	    colorMapArray asByteArray storeOn:aStream.
 12242             colorMapArray asByteArray storeOn:aStream.
 12207 	] ifFalse:[
 12243         ] ifFalse:[
 12208 	    aStream nextPutAll:'; colorMap:('.
 12244             aStream nextPutAll:'; colorMap:('.
 12209 	    colorMap storeOn:aStream.
 12245             colorMap storeOn:aStream.
 12210 	    aStream nextPutAll:')'
 12246             aStream nextPutAll:')'
 12211 	]
 12247         ]
 12212     ].
 12248     ].
 12213     mask notNil ifTrue:[
 12249     mask notNil ifTrue:[
 12214 	aStream nextPutAll:'; mask:('.
 12250         aStream nextPutAll:'; mask:('.
 12215 	mask storeOn:aStream.
 12251         mask storeOn:aStream.
 12216 	aStream nextPutAll:')'.
 12252         aStream nextPutAll:')'.
 12217     ].
 12253     ].
 12218     aStream nextPutAll:'; yourself'
 12254     aStream nextPutAll:'; yourself'
 12219 
 12255 
 12220     "Modified: / 22.8.1998 / 12:55:21 / cg"
 12256     "Modified: / 22.8.1998 / 12:55:21 / cg"
 12221 ! !
 12257 ! !
 14385 ! !
 14421 ! !
 14386 
 14422 
 14387 !Image class methodsFor:'documentation'!
 14423 !Image class methodsFor:'documentation'!
 14388 
 14424 
 14389 version
 14425 version
 14390     ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.449 2014-03-04 22:20:41 cg Exp $'
 14426     ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.450 2014-03-05 15:58:09 cg Exp $'
 14391 !
 14427 !
 14392 
 14428 
 14393 version_CVS
 14429 version_CVS
 14394     ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.449 2014-03-04 22:20:41 cg Exp $'
 14430     ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.450 2014-03-05 15:58:09 cg Exp $'
 14395 ! !
 14431 ! !
 14396 
 14432 
 14397 
 14433 
 14398 Image initialize!
 14434 Image initialize!