11311 |
11311 |
11312 "Created: 11.7.1996 / 20:20:35 / cg" |
11312 "Created: 11.7.1996 / 20:20:35 / cg" |
11313 "Modified: 11.7.1996 / 20:49:21 / cg" |
11313 "Modified: 11.7.1996 / 20:49:21 / cg" |
11314 ! |
11314 ! |
11315 |
11315 |
|
11316 realUsedColors |
|
11317 "return a collection of colors which are really used in the receiver." |
|
11318 |
|
11319 |values| |
|
11320 |
|
11321 values := self realUsedValues asArray. |
|
11322 ^ values collect:[:pixel | self colorFromValue:pixel] |
|
11323 |
|
11324 ! |
|
11325 |
|
11326 realUsedValues |
|
11327 "return a collection of color values used in the receiver. |
|
11328 Notice, that the interpretation of the pixels depends on the photometric |
|
11329 of the image. |
|
11330 This is a general and therefore slow implementation; subclasses |
|
11331 may want to redefine this method for more performance." |
|
11332 |
|
11333 |set last| |
|
11334 |
|
11335 set := IdentitySet new. |
|
11336 self valuesFromX:0 y:0 toX:(self width-1) y:(self height-1) do:[:x :y :pixel | |
|
11337 pixel ~~ last ifTrue:[ |
|
11338 set add:pixel. |
|
11339 last := pixel. |
|
11340 ] |
|
11341 ]. |
|
11342 ^ set |
|
11343 |
|
11344 " |
|
11345 (Image fromFile:'bitmaps/garfield.gif') usedValues |
|
11346 (Image fromFile:'bitmaps/SBrowser.xbm') usedValues |
|
11347 (Image fromFile:'ttt.tiff') usedValues |
|
11348 " |
|
11349 |
|
11350 "Modified: / 29.7.1998 / 21:29:44 / cg" |
|
11351 ! |
|
11352 |
11316 redBitsOf:pixel |
11353 redBitsOf:pixel |
11317 "if the receiver is an rgb-image: |
11354 "if the receiver is an rgb-image: |
11318 return the red component of a pixelValue as integer 0..maxRedValue. |
11355 return the red component of a pixelValue as integer 0..maxRedValue. |
11319 MaxRedValue is of course the largest integer representable by the number |
11356 MaxRedValue is of course the largest integer representable by the number |
11320 of red bits i.e. (1 bitShift:bitsRed)-1. |
11357 of red bits i.e. (1 bitShift:bitsRed)-1. |
11448 Notice, that the interpretation of the pixels depends on the photometric |
11485 Notice, that the interpretation of the pixels depends on the photometric |
11449 of the image. |
11486 of the image. |
11450 This is a general and therefore slow implementation; subclasses |
11487 This is a general and therefore slow implementation; subclasses |
11451 may want to redefine this method for more performance." |
11488 may want to redefine this method for more performance." |
11452 |
11489 |
11453 |set last| |
11490 ^ self realUsedValues |
11454 |
|
11455 set := IdentitySet new. |
|
11456 self valuesFromX:0 y:0 toX:(self width-1) y:(self height-1) do:[:x :y :pixel | |
|
11457 pixel ~~ last ifTrue:[ |
|
11458 set add:pixel. |
|
11459 last := pixel. |
|
11460 ] |
|
11461 ]. |
|
11462 ^ set |
|
11463 |
11491 |
11464 " |
11492 " |
11465 (Image fromFile:'bitmaps/garfield.gif') usedValues |
11493 (Image fromFile:'bitmaps/garfield.gif') usedValues |
11466 (Image fromFile:'bitmaps/SBrowser.xbm') usedValues |
11494 (Image fromFile:'bitmaps/SBrowser.xbm') usedValues |
11467 (Image fromFile:'ttt.tiff') usedValues |
11495 (Image fromFile:'ttt.tiff') usedValues |