|
Class: WindowsIconReader
Object
|
+--ImageReader
|
+--WindowsIconReader
- Package:
- stx:libview2
- Category:
- Graphics-Images-Readers
- Version:
- rev:
1.99
date: 2019/05/01 09:38:53
- user: cg
- file: WindowsIconReader.st directory: libview2
- module: stx stc-classLibrary: libview2
this class provides methods for loading Windows and OS2 icon and bmp files.
The class name *IconReader is a bad, historic choice - it was originally
written to read icons only, but evolved over time and is now also
capable of reading/writing bmp and cursor files.
The reader should support allmost all formats: Win2, Win3, Win4, Win5, WINCE and OS2.
(incl. PNG and JPG compression, and WINCE depth2 images)
Image writing is only supported for BMP format with depth 1,4,8 and 24 bit images.
The reader tries to figure out which version of BMP/ICO is used.
It seems to be able to load most formats, but who knows ...
[notice:]
when reading an ICO/CUR file with multiple icons in it,
the first image is returned as such, holding on the other images via its
imageFrames instvar.
Thus, the imageEditor will usually present the first of the images,
and offer a next-in-sequence button to step through them.
To get a collection of all images, collect the images from the sequence, as in:
someIcoImage imageFrames collect:#image
Image
Form
Icon
BlitImageReader
FaceReader
GIFReader
JPEGReader
MacOSXIconReader
PBMReader
PCXReader
PNGReader
ST80FormReader
SunRasterReader
TargaReader
TIFFReader
XBMReader
XPMReader
XWDReader
MacOSXIconReader
initialization
-
initialize
-
tell Image-class, that a new fileReader is present
for the '.bmp' and '.ico' extensions.
testing
-
canRepresent: anImage
-
return true, if anImage can be represented in my file format.
BMP supports depth 1,4,8, 24 and 32.
-
isValidImageFile: aFileName
-
return true, if aFileName contains a valid windows bitmap-file image
usage example(s):
WindowsIconReader isValidImageFile:'/phys/clam2/LocalLibrary/Images/OS2_icons/dos.ico'
|
accessing
-
image
-
private
-
bitsPerPixel
-
-
convertPixels
-
figure out, how pixels should be processed,
-
loadBMP1From: aStream into: aByteArray
-
load bmp-1 bit per pixel imagedata.
-
loadBMP2From: aStream into: aByteArray
-
load bmp-2 bit per pixel imagedata.
-
loadBMP4From: aStream into: aByteArray
-
load bmp-4 bit per pixel imagedata.
-
loadBMP8From: aStream into: aByteArray
-
load bmp-8 bit per pixel imagedata.
-
loadBMPWidth: w height: h bytesPerPixel: bpp from: aStream into: aByteArray
-
load bmp-16/24/32 bit per pixel imagedata.
-
loadBMPWidth: w height: h depth: d from: aStream into: aByteArray
-
helper: load a BMP image
-
loadRLECompressedBMP4From: aStream into: aByteArray
-
load bmp-rle-4 pixel imagedata
-
loadRLECompressedBMP8From: aStream into: aByteArray
-
load bmp-8 bit per pixel imagedata
-
loadUncompressedFrom: aStream into: aByteArray
-
load bmp-1,2,4 and 8 bit per pixel imagedata.
-
readColorMap: nColors numBytesPerColor: nRawBytesPerColor from: aStream
-
read the colormap; notice: its in BGR order (sigh).
-
swapBytesFromRGBA_to_BGRA
-
Depth32Image keeps its data r/g/b/a; BMP has it b/g/r/a (sigh)
-
swapBytesFromRGB_to_BGR
-
Depth24Image keeps its data r/g/b; BMP has it b/g/r (sigh)
reading
-
fromOS2File: aFilename
-
read an image from an OS/2 BMP file
-
fromOS2Stream: aStream
-
read an image from an OS/2 BMP stream
-
fromOS2Stream: aStream alreadyRead: bytesAlreadyRead
-
read an image from an OS/2 BMP stream
-
fromStream: aStream
-
figure out which format the stream contains
(there are various different bmp/ico formats around)
and read the image.
-
fromWindowsBMPFile: aFilename
-
read an image from a windows BMP file
-
fromWindowsBMPStream: aStream
-
read an image from a windows BMP stream
-
fromWindowsBMPStream: aStream alreadyRead: fileHeaerBytesAlreadyRead
-
read an image from a windows BMP stream
-
fromWindowsICOFile: aFilename
-
read an image from a windows ICO file
-
fromWindowsICOStream: aStream
-
read an image from a windows ICO stream
-
fromWindowsICOStream: aStream alreadyRead: bytesAlreadyRead
-
read an image from a windows ICO stream
-
old_fromWindowsICOStream: aStream alreadyRead: bytesAlreadyRead
-
read an image from a windows ICO stream
-
readSingleImageFromWindowsICOStream: aStream
-
read one image from a windows ICO stream
writing
-
save: image onFile: aFileName
-
save image as BMP file on aFileName.
Only depth 1,4,8 and 24 images can be represented in this format.
-
saveBMP: image onFile: fileName
-
save image as BMP file on aFileName.
Only depth 1,4,8 and 24 images can be represented in this format.
-
saveBMP: imageArg withFileHeader: withFileHeaderBoolean onStream: aStream
-
save image as BMP file on aFileName.
If withFileHeaderBoolean is false, no bitmapFileHeader is written (used when saving ICO files).
Only depth 1,4,8 and 24 images can be represented in this format.
-
saveICO: image onFile: fileName
-
save image as ICO file on aFileName
|