Classes you should know about are:
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:
aColor := Color red:redPercent green:greenPercent blue:bluePercent
aColor := Color hue:hueValue light:lightPercent saturation:saturationPercent
aColor := Color variableColorOn:aDevice
aColor := ColorValue red:redFractiongreen:greenFraction blue:blueFraction
redPercentage := aColor red
hueValue := aColor hue
someView paint:aColor.
someView displayLineFrom:point1 to:point2.
someView viewBackground:aColor.
aButton backgroundColor:aColor.
aButton foregroundColor:aColor.
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
Press here for more details about:
Color
.
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:
aCursor := Cursor normal
aCursor := Cursor wait
aCursor := Cursor extent:extent fromArray:bytes offset:hotSpot
aCursor := Cursor extent:extent sourceArray:bytes maskArray:maskBytes offset:hotSpot
A standard cursor:
|someView|
someView := View new.
someView cursor:(Cursor wait).
someView open
a bitmap cursor:
a bitmap cursor with a mask:
|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
|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>