--- a/Image.st Thu Jul 07 20:21:22 2016 +0200
+++ b/Image.st Thu Jul 07 20:21:24 2016 +0200
@@ -63,14 +63,14 @@
This gives you a device independent image.
For display, a device representation is required, which can be
- aquired by sending the 'onDevice:aDevice' message to the image.
+ acquired by sending the 'onDevice:aDevice' message to the image.
This creates a (possibly dithered) device-form,
representing the image using the currently available colors.
In rare cases, an explicit monochrome representation of the image is needed
(some older X servers take monochrome icons only), this can be created by sending
it the message
- 'monochromeOn:aDevice'.
+ 'monochromeOn:aDevice'.
As this class is very old and originated at times when typical graphic diplays only
supported a limited number of colors (16 or 256), you will find a lot of code which deals
@@ -114,153 +114,153 @@
DitherAlgorithm:
nil a simple threshold algorithm
- (i.e. for mono, p<0.5 -> black, p>=0.5 -> white)
+ (i.e. for mono, p<0.5 -> black, p>=0.5 -> white)
#pattern patterned dither
- (for p, take dithered color to fill pixel;
- uses dithering in color-class)
+ (for p, take dithered color to fill pixel;
+ uses dithering in color-class)
#error error diffusion dither (Floyd-Steinberg)
- planned - not yet implemented.
+ planned - not yet implemented.
Notice:
- the set of attributes and the way they are stored originated initially
- from the need to represent tiff images. These turned out to use a relatively
- large set of atributes, of which many are unused in other image formats.
- (so it was sufficient).
- Later, some VisualWorks compatibility protocol was added (mapped palettes, for
- example), and some stuff could well be redefined in simpler ways.
- We may do that, if we are bored and there is nothing else to improve... ;-)
+ the set of attributes and the way they are stored originated initially
+ from the need to represent tiff images. These turned out to use a relatively
+ large set of atributes, of which many are unused in other image formats.
+ (so it was sufficient).
+ Later, some VisualWorks compatibility protocol was added (mapped palettes, for
+ example), and some stuff could well be redefined in simpler ways.
+ We may do that, if we are bored and there is nothing else to improve... ;-)
[instance variables:]
- width <Integer> the width in pixels
- height <Integer> the height in pixels
- bytes <ByteArray> the full image information
- photometric <Symbol> #rgb, #palette, #blackIs0 or #whiteIs0
- samplesPerPixel <Integer> the number of planes
- bitsPerSample <Array> the number of bits per plane
-
- colorMap <Array> only if photometric is #palette;
- maps pixel values to r/g/b values.
-
- device <Workstation> the device on which deviceForm,
- monoDeviceForm and lowResDeviceForm are
-
- deviceForm <Form> the device form which gives the best
- possible aproximation of the image on
- device using standard colors.
-
- monoDeviceForm <Form> the device form which gives a monochrome
- aproximation of the image on device.
-
- fullColorDeviceForm <Form> the device form which gives the best
- possible aproximation of the image on
- device using private colors.
- (not yet implemented)
-
- mask <ImageMask> an optional mask;
- if non-nil, only pixels for which the
- corresponding mask bit is non-zero
- are drawn.
-
- maskedPixelsAre0 <Boolean> a hint for image processors and drawers
- if true, masked pixels are known to be
- zero in the pixel bytes.
-
- fileName <String> the name of the file from which the
- image was loaded - nil otherwise.
- Useful for image save functions
- and for the UIPainter utility.
-
- imageSequence the imageSequence, of which the
- instance is a frame or nil,
- if its not part of a sequence.
-
- bitsPerPixel obsolete - not used in ST/X (kept for a while for subclasses)
- depth - these have been added in instVar-slots
- maxPixelValue - according to the ST-80's image class.
- rowByteSize - to allow loading of st-80 images
- - (which are stored as instVarAt:put: expressions)
+ width <Integer> the width in pixels
+ height <Integer> the height in pixels
+ bytes <ByteArray> the full image information
+ photometric <Symbol> #rgb, #palette, #blackIs0 or #whiteIs0
+ samplesPerPixel <Integer> the number of planes
+ bitsPerSample <Array> the number of bits per plane
+
+ colorMap <Array> only if photometric is #palette;
+ maps pixel values to r/g/b values.
+
+ device <Workstation> the device on which deviceForm,
+ monoDeviceForm and lowResDeviceForm are
+
+ deviceForm <Form> the device form which gives the best
+ possible aproximation of the image on
+ device using standard colors.
+
+ monoDeviceForm <Form> the device form which gives a monochrome
+ aproximation of the image on device.
+
+ fullColorDeviceForm <Form> the device form which gives the best
+ possible aproximation of the image on
+ device using private colors.
+ (not yet implemented)
+
+ mask <ImageMask> an optional mask;
+ if non-nil, only pixels for which the
+ corresponding mask bit is non-zero
+ are drawn.
+
+ maskedPixelsAre0 <Boolean> a hint for image processors and drawers
+ if true, masked pixels are known to be
+ zero in the pixel bytes.
+
+ fileName <String> the name of the file from which the
+ image was loaded - nil otherwise.
+ Useful for image save functions
+ and for the UIPainter utility.
+
+ imageSequence the imageSequence, of which the
+ instance is a frame or nil,
+ if its not part of a sequence.
+
+ bitsPerPixel obsolete - not used in ST/X (kept for a while for subclasses)
+ depth - these have been added in instVar-slots
+ maxPixelValue - according to the ST-80's image class.
+ rowByteSize - to allow loading of st-80 images
+ - (which are stored as instVarAt:put: expressions)
[class variables:]
- Lobby <Registry> keeps track of known images
- (for resource freeing with garbage collector)
-
- DitherAlgorithm <Symbol> defines how to dither
-
- NumberOfDitherColors <Integer> defines, how many dither colors to use
-
- FileFormats <Dictionary> associates filename extensions to
- image reader classes (now set-up in startup-file)
-
- CollectGarbageWhenRunningOutOfColors
- <Boolean> if true, and we run out of available
- device colors during creation of a
- device image, collect garbage for
- possible image reclamation.
- If false, proceed immediately.
- Default is true.
-
- ImageNotFoundQuerySignal
- <QuerySignal> raised, if an image could not be loaded
- from a file. The parameter is the images
- fileName.
- A handler may return a replacement
- image or proceed with nil.
- If unhandled, a nil is returned from the
- image creation.
-
- BadImageFormatQuerySignal
- <QuerySignal> raised, if an image could not be loaded
- from a file due to a file error or
- unsupported format.
- A handler may return a replacement
- image or proceed with nil.
- If unhandled, a nil is returned from the
- image creation.
-
- ImageSaveErrorSignal
- <Signal> parent of errors below.
-
- FileCreationErrorSignal
- <Signal> file could not be created when saving an
- image.
-
- CannotRepresentImageSignal
- <Signal> the specified ImageReader cannot represent
- the given image.
-
- InformationLostQuerySignal
- <Signal> the specified ImageReader can represent
- the given image, but some information
- (typically color resolution) is lost.
- If unhandled, the save proceeds as usual.
+ Lobby <Registry> keeps track of known images
+ (for resource freeing with garbage collector)
+
+ DitherAlgorithm <Symbol> defines how to dither
+
+ NumberOfDitherColors <Integer> defines, how many dither colors to use
+
+ FileFormats <Dictionary> associates filename extensions to
+ image reader classes (now set-up in startup-file)
+
+ CollectGarbageWhenRunningOutOfColors
+ <Boolean> if true, and we run out of available
+ device colors during creation of a
+ device image, collect garbage for
+ possible image reclamation.
+ If false, proceed immediately.
+ Default is true.
+
+ ImageNotFoundQuerySignal
+ <QuerySignal> raised, if an image could not be loaded
+ from a file. The parameter is the images
+ fileName.
+ A handler may return a replacement
+ image or proceed with nil.
+ If unhandled, a nil is returned from the
+ image creation.
+
+ BadImageFormatQuerySignal
+ <QuerySignal> raised, if an image could not be loaded
+ from a file due to a file error or
+ unsupported format.
+ A handler may return a replacement
+ image or proceed with nil.
+ If unhandled, a nil is returned from the
+ image creation.
+
+ ImageSaveErrorSignal
+ <Signal> parent of errors below.
+
+ FileCreationErrorSignal
+ <Signal> file could not be created when saving an
+ image.
+
+ CannotRepresentImageSignal
+ <Signal> the specified ImageReader cannot represent
+ the given image.
+
+ InformationLostQuerySignal
+ <Signal> the specified ImageReader can represent
+ the given image, but some information
+ (typically color resolution) is lost.
+ If unhandled, the save proceeds as usual.
caveat:
- the information in
- photometric, bitsPerPixel, bitsPerSample, samplesPerPixel, depth , colorMap and maxPixelValue
- is partially redundant and its handling stupid (not to say: braindamaged ;-).
- The only excuse is that it grew over time, had to incorporate various alien/older schemes for
- compatibility reasons (mostly coming from tiff format, which was the very first supported format).
- All of the above belongs into the single colorMap which must migrate from
- a stupid seqColl to a color-aware real colorMap.
- (we are in the process of doing so...)
+ the information in
+ photometric, bitsPerPixel, bitsPerSample, samplesPerPixel, depth , colorMap and maxPixelValue
+ is partially redundant and its handling stupid (not to say: braindamaged ;-).
+ The only excuse is that it grew over time, had to incorporate various alien/older schemes for
+ compatibility reasons (mostly coming from tiff format, which was the very first supported format).
+ All of the above belongs into the single colorMap which must migrate from
+ a stupid seqColl to a color-aware real colorMap.
+ (we are in the process of doing so...)
todo:
- support alpha masks
- cleanup the dithering & conversion code
- cleanup the color/photometric mess
+ support alpha masks
+ cleanup the dithering & conversion code
+ cleanup the color/photometric mess
[See also:]
- Form Icon ImageReader
+ Form Icon ImageReader
[author:]
- Claus Gittinger
+ Claus Gittinger
"
!