[prev] [up] [next]

Classes of main interest are:

Image - bitmap images

Smalltalk/X supports black & white, greyscale and color images with resolutions of 1, 2, 4, 8, 16 or 24 bits per pixel. Independent of its depth, any image may have a photometric of greyScale, palette (i.e. uses a color lookup table) or trueColor.

When displayed, images are approximated (i.e. dithered) if the displays capabilities force this. For example, conversion of color images to dithered black & white or greyscale images is done automatically.

Images can be imported (i.e. loaded from a file) in a number of formats; among others, the common formats are supported:

Export of images (i.e. saving to a file) is supported in TIFF, XBM and XPM formats; other formats may be added upon request (or provided by third parties).

Some image manipulation functionality is provided by the Image classes; for example, flip, rotate, shrink and magnify (by arbitrary factors).

Typical uses:

Example:

    (Image fromFile:'bitmaps/gifImages/garfield.gif') inspect
as icon:
    |myView|

    myView := StandardSystemView new.
    myView extent:200@200.
    myView icon:(Image fromFile:'bitmaps/hello_world.icon').
    myView open
as view background:
    |myView|

    myView := View new.
    myView viewBackground:((Image fromFile:'bitmaps/SmalltalkX.xbm') magnifiedBy:1.5).
    myView open
as drawing pens color:
    |myView|

    myView := View new.
    myView extent:200@200.
    myView openAndWait.

    myView paint:((Image fromFile:'bitmaps/SmalltalkX.xbm') magnifiedBy:0.3).
    myView lineWidth:10.
    myView displayLineFrom:10@10 to:100@100.
    myView displayLineFrom:100@10 to:10@100.
another drawing pens color:
    |myView|

    myView := View new.
    myView extent:200@200.
    myView openAndWait.

    myView paint:(Image fromFile:'bitmaps/woodH.tiff') on:(Color yellow).
    myView font:(Font family:'helvetica' face:'bold' size:36).
    myView displayOpaqueString:'hello' at:50@50.
Notice, that it may take some time to load images from a file, and also to allocate colors and convert the image for the display device.
Therefore, images are usually kept in some instance or class variable and reused (cached). The above examples are somewhat unrealistic.


Copyright © 1995 Claus Gittinger Development & Consulting

<cg@exept.de>

Doc $Revision: 1.18 $ $Date: 1999/12/10 17:25:08 $