[up] [next]

Classes you should know about are:

Color

This class implements a machine independent represenation of colors. Your application will run unchanged, independent of the type of display (b & w, greyscale or color) and resolution (4bit, 8bit etc).
On systems with lower color resolution, colors are automatically represented as dithered patterns to approximate the desired look.
All resource management is done automatically - colors are freed in the display when no longer needed (you don't have to manually keep track of which colors are still in use).

In most places, patterns can be used instead of pure colors for drawing.

Colors can be defined by name, by R/G/B components or by H/L/S values.
For ST-80 compatibility, a subclass of Color exists (named ColorValue) which expects its r/g/b components in fractions of 1 instead of percentage values.
Some typical messages used with Color are:

uses of color instances (typically with views):

For example, setting the foreground color of a button is as simple as:

    |someButton|

    someButton := Button label:'hello'.
    someButton foregroundColor:(Color red:100 green:0 blue:0).
    someButton open
Notice, you can execute the above code example by clicking on it ...

Press here for more details about: Color.

Cursor

Instances of this class represent cursors; both a number of standard cursors (such as hourglass, arrow, textCursor etc.) and user defined cursors are supported.
Typical uses cursors are:


Examples:

A standard cursor:

    |someView|

    someView := View new.
    someView cursor:(Cursor wait).
    someView open

a bitmap cursor:

    |someView|

    someView := View new.
    someView cursor:(Cursor
			extent:16@16
			fromArray:#(2r11111111 2r11111111
				    2r11000000 2r00000011
				    2r10100000 2r00000101
				    2r10010000 2r00001001
				    2r10001000 2r00010001
				    2r10000100 2r00100001
				    2r10000010 2r01000001
				    2r10000001 2r10000001
				    2r10000001 2r10000001
				    2r10000010 2r01000001
				    2r10000100 2r00100001
				    2r10001000 2r00010001
				    2r10010000 2r00001001
				    2r10100000 2r00000101
				    2r11000000 2r00000011
				    2r11111111 2r11111111)
			offset:-8 @ -8).
    someView open
a bitmap cursor with a mask:
    |someView|

    someView := View new.
    someView cursor:(Cursor
			extent:16@16
		      sourceArray:#(2r11111111 2r11111111
				    2r11000000 2r00000011
				    2r10100000 2r00000101
				    2r10010000 2r00001001
				    2r10001000 2r00010001
				    2r10000100 2r00100001
				    2r10000010 2r01000001
				    2r10000001 2r10000001
				    2r10000001 2r10000001
				    2r10000010 2r01000001
				    2r10000100 2r00100001
				    2r10001000 2r00010001
				    2r10010000 2r00001001
				    2r10100000 2r00000101
				    2r11000000 2r00000011
				    2r11111111 2r11111111)

			maskArray:#(2r11111111 2r11111111
				    2r11111111 2r11111111
				    2r11110000 2r00000111
				    2r11111000 2r00011111
				    2r11011100 2r00111011
				    2r11001110 2r01110011
				    2r11000111 2r11100011
				    2r11000011 2r11000011
				    2r11000011 2r11000011
				    2r11000111 2r11100011
				    2r11001110 2r01110011
				    2r11011100 2r00111011
				    2r11111000 2r00011111
				    2r11110000 2r00001111
				    2r11111111 2r11111111
				    2r11111111 2r11111111)
			offset:-8 @ -8).
    someView open

Press here for more details about: Cursor.


Copyright © 1995 Claus Gittinger Development & Consulting

<cg at exept.de>

Doc $Revision: 1.21 $ $Date: 2021/03/13 18:24:50 $