home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Enigma Amiga Life 106
/
EnigmaAmiga106CD.iso
/
www
/
afc
/
afc-dir
/
afc_examples.lha
/
palette_Examples.lha
/
Examples
/
Palette_Example1.e
< prev
Wrap
Text File
|
1998-01-17
|
1KB
|
83 lines
/*
$VER: Palette Example 1 - (C)Amiga Foundation Classes
Written By: Fabio Rotondo
This source code is public domain.
*/
MODULE 'afc/palette', 'afc/explain_exception',
'intuition/screens', 'intuition/intuition'
PROC main() HANDLE
DEF pal:PTR TO palette
DEF r,g,b, scr=NIL:PTR TO screen
DEF x,y, col=0
NEW pal.palette()
pal.setRGB(0, 0, 0, 0)
pal.setRGB(1, 255, 0, 0)
pal.setRGB(2, 0, 254, 0)
pal.setRGB(3, 0, 0, 255)
r,g,b:=pal.getRGB(2)
WriteF('R:\d G:\d B:\d\n', r,g,b)
WriteF('Grabbing the WB Palette...\n')
pal.grab(LockPubScreen('Workbench'))
IF (scr:=OpenScreenTagList(NIL, [SA_WIDTH, 320,
SA_HEIGHT, 256,
SA_DEPTH, 8,
NIL, NIL]))=NIL THEN Raise("scr")
pal.setPal(scr)
FOR y:=0 TO 239
FOR x:=0 TO 239
SetAPen(scr.rastport, col++)
RectFill(scr.rastport, x, y, x+8, y+8)
x:=x+8
ENDFOR
y:=y+8
ENDFOR
waitMouse()
WriteF('Every color is White...\n')
FOR x:=0 TO 255
pal.loadRGB(scr, x, 255, 255, 255)
ENDFOR
pal.loadRGB(scr, 0, 0,0,0)
waitMouse()
WriteF('And now: a spread!\n')
pal.spread(0, 230)
pal.setPal(scr)
waitMouse()
EXCEPT DO
IF scr THEN CloseScreen(scr)
END pal
explain_exception()
ENDPROC
PROC waitMouse()
REPEAT
Delay(5)
UNTIL Mouse()
REPEAT
UNTIL Mouse()=0
ENDPROC