6594 The code here provides a generic and slow implementation, and |
6594 The code here provides a generic and slow implementation, and |
6595 should be redefined in concrete subclasses, to avoid some processing |
6595 should be redefined in concrete subclasses, to avoid some processing |
6596 when going from pixel to pixel (i.e. the byte-index and mask computations, |
6596 when going from pixel to pixel (i.e. the byte-index and mask computations, |
6597 and especially, the color allocations)." |
6597 and especially, the color allocations)." |
6598 |
6598 |
6599 |xS "{Class: SmallInteger }" |
6599 |yS "{Class: SmallInteger }" |
6600 xE "{Class: SmallInteger }"| |
6600 yE "{Class: SmallInteger }"| |
6601 |
6601 |
6602 xS := xStart. |
6602 yS := xStart. |
6603 xE := xEnd. |
6603 yE := xEnd. |
6604 yStart to:yEnd do:[:yRun | |
6604 |
|
6605 yS to:yE do:[:yRun | |
6605 self colorsAtY:yRun from:xStart to:xEnd do:[:xRun :color | |
6606 self colorsAtY:yRun from:xStart to:xEnd do:[:xRun :color | |
6606 aBlock value:xRun value:yRun value:color |
6607 aBlock value:xRun value:yRun value:color |
6607 ] |
6608 ] |
6608 ] |
6609 ] |
6609 |
6610 |
6610 "Modified: 7.6.1996 / 19:11:39 / cg" |
6611 "Modified: 11.7.1996 / 19:50:47 / cg" |
6611 ! |
6612 ! |
6612 |
6613 |
6613 valueAtY:y from:x1 to:x2 do:aBlock |
6614 valueAtY:y from:x1 to:x2 do:aBlock |
6614 "perform aBlock for each pixelValue from x1 to x2 in row y. |
6615 "perform aBlock for each pixelValue from x1 to x2 in row y. |
6615 Obsolete - remains for backward compatibility." |
6616 Obsolete - remains for backward compatibility." |
7881 isImageOrForm |
7882 isImageOrForm |
7882 "return true, if the receiver is some kind of image or form; |
7883 "return true, if the receiver is some kind of image or form; |
7883 true is returned here - the method is redefined from Object." |
7884 true is returned here - the method is redefined from Object." |
7884 |
7885 |
7885 ^ true |
7886 ^ true |
|
7887 ! |
|
7888 |
|
7889 realColorMap |
|
7890 "return a collection usable as a real colormap of the image. |
|
7891 For palette images, this is the internal colormap; |
|
7892 for other photometrics (which do not have a real colormap), synthesize one. |
|
7893 This is different from #colorMap, which returns nil for non palette images." |
|
7894 |
|
7895 |d nEntries "{ Class: SmallInteger }" |
|
7896 colorArray| |
|
7897 |
|
7898 photometric == #palette ifTrue:[ |
|
7899 ^ colorMap asArray |
|
7900 ]. |
|
7901 |
|
7902 d := self depth. |
|
7903 d > 12 ifTrue:[ |
|
7904 self error:'deep palette images not supported'. |
|
7905 ^ nil. |
|
7906 ]. |
|
7907 |
|
7908 nEntries := 1 bitShift:d. |
|
7909 |
|
7910 colorArray := Array new:nEntries. |
|
7911 1 to:nEntries do:[:idx | |
|
7912 colorArray at:idx put:(self colorFromValue:(idx-1)). |
|
7913 ]. |
|
7914 |
|
7915 ^ colorArray |
|
7916 |
|
7917 "Created: 11.7.1996 / 20:20:35 / cg" |
|
7918 "Modified: 11.7.1996 / 20:49:21 / cg" |
7886 ! |
7919 ! |
7887 |
7920 |
7888 redBitsOf:pixel |
7921 redBitsOf:pixel |
7889 "if the receiver is an rgb-image: |
7922 "if the receiver is an rgb-image: |
7890 return the red component of a pixelValue. |
7923 return the red component of a pixelValue. |