eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'WindowsIconReader':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: WindowsIconReader


Inheritance:

   Object
   |
   +--ImageReader
      |
      +--WindowsIconReader

Package:
stx:libview2
Category:
Graphics-Images-Readers
Version:
rev: 1.97 date: 2017/09/13 16:12:19
user: cg
file: WindowsIconReader.st directory: libview2
module: stx stc-classLibrary: libview2

Description:


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
        


Related information:

    Image
    Form
    Icon
    BlitImageReader
    FaceReader
    GIFReader
    JPEGReader
    PBMReader
    PCXReader
    ST80FormReader
    SunRasterReader
    TargaReader
    TIFFReader
    XBMReader
    XPMReader
    XWDReader
    MacOSXIconReader

Class protocol:

initialization
o  initialize
tell Image-class, that a new fileReader is present
for the '.bmp' and '.ico' extensions.

testing
o  canRepresent: anImage
return true, if anImage can be represented in my file format.
BMP supports depth 1,4,8, 24 and 32.

o  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'


Instance protocol:

accessing
o  image

private
o  bitsPerPixel

o  convertPixels
figure out, how pixels should be processed,

o  loadBMP1From: aStream into: aByteArray
load bmp-1 bit per pixel imagedata.

o  loadBMP2From: aStream into: aByteArray
load bmp-2 bit per pixel imagedata.

o  loadBMP4From: aStream into: aByteArray
load bmp-4 bit per pixel imagedata.

o  loadBMP8From: aStream into: aByteArray
load bmp-8 bit per pixel imagedata.

o  loadBMPWidth: w height: h bytesPerPixel: bpp from: aStream into: aByteArray
load bmp-16/24/32 bit per pixel imagedata.

o  loadBMPWidth: w height: h depth: d from: aStream into: aByteArray
helper: load a BMP image

o  loadRLECompressedBMP4From: aStream into: aByteArray
load bmp-rle-4 pixel imagedata

o  loadRLECompressedBMP8From: aStream into: aByteArray
load bmp-8 bit per pixel imagedata

o  loadUncompressedFrom: aStream into: aByteArray
load bmp-1,2,4 and 8 bit per pixel imagedata.

o  readColorMap: nColors numBytesPerColor: nRawBytesPerColor from: aStream
read the colormap; notice: its in BGR order (sigh).

o  swapBytesFromRGBA_to_BGRA
Depth32Image keeps its data r/g/b/a; BMP has it b/g/r/a (sigh)

o  swapBytesFromRGB_to_BGR
Depth24Image keeps its data r/g/b; BMP has it b/g/r (sigh)

reading
o  fromOS2File: aFilename
read an image from an OS/2 BMP file

o  fromOS2Stream: aStream
read an image from an OS/2 BMP stream

o  fromOS2Stream: aStream alreadyRead: bytesAlreadyRead
read an image from an OS/2 BMP stream

o  fromStream: aStream
figure out which format the stream contains
(there are various different bmp/ico formats around)
and read the image.

o  fromWindowsBMPFile: aFilename
read an image from a windows BMP file

o  fromWindowsBMPStream: aStream
read an image from a windows BMP stream

o  fromWindowsBMPStream: aStream alreadyRead: fileHeaerBytesAlreadyRead
read an image from a windows BMP stream

o  fromWindowsICOFile: aFilename
read an image from a windows ICO file

o  fromWindowsICOStream: aStream
read an image from a windows ICO stream

o  fromWindowsICOStream: aStream alreadyRead: bytesAlreadyRead
read an image from a windows ICO stream

o  old_fromWindowsICOStream: aStream alreadyRead: bytesAlreadyRead
read an image from a windows ICO stream

o  readSingleImageFromWindowsICOStream: aStream
read one image from a windows ICO stream

writing
o  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.

o  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.

o  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.

o  saveICO: image onFile: fileName
save image as ICO file on aFileName



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Mon, 23 Jul 2018 11:34:31 GMT