AMCAF Extension V1.40 Manual  Index

Colour Commands


Playing with colour was often linked with complex formulas. But now there is a series of helping commands - only AMCAF makes it possible!


RAIN FADE
instruction: fade out a rainbow to another rainbow
Rain Fade rainbow number,$RGB
Rain Fade rainbow number To target rainbow

Using this powerful instruction you can fade out the numbered rainbow to other colours. With the first version of Rain Fade you may specify the target colour '$RGB' to which all colours of the rainbow will be faded.
The other version fades exactly to the colours of the target rainbow.

Rain Fade works step by step only. Therefore you need a maximum of 16 calls to reach the new colour values.


SET RAIN COLOUR
instruction: change the colour index of a rainbow
Set Rain Colour rainbow number,new colour

With the help of this command you can change the colour index of a rainbow which has been set previously by Set Rainbow to a new value.
This means that you can remove the irritating limit to the first 16 colours and are now able to access all 32 colours. But there are even more possibilities!

A colour index of -63 enables you to alter the hardware scrolling register, so you can create fancy water and wobble effects.
For more effects you need to install the SetRainPatch.


PAL SPREAD
instruction: spread the colour index from one to another
Pal Spread colour 1,rgb1 To colour 2,rgb2

Creates a smooth blend between the two colours rgb1 and rgb2. The resulting colour set will be stored between colour 1 and colour 2.


PAL GET SCREEN
function: save the palette of a screen
Pal Get Screen palnr,screen number

This function stores the complete palette of a screen in the internal palette memory number 'palnr'.
'palnr' must be a value between 0 and 7.
This command is used to quickly store a specific palette of a screen in a buffer. To restore the old palette, you can call the Pal Set Screen command.


PAL SET SCREEN
instruction: set the palette of a screen
Pal Set Screen palnr,screen number

This command restores the previously stored colour palette 'palnr' to the numbered screen.


PAL SET
instruction: change an entry of a saved palette
Pal Set palette number,index,colour

This command changes the colour entry numbered 'index' in the selected palette to the colour value 'colour'.
palette number must be a value between 0 to 7.


AMCAF AGA NOTATION ON/OFF
instruction: toggle aga amiga colour format
Amcaf Aga Notation On
Amcaf Aga Notation Off

Normally, AMCAF commands, which take colour values as parameter, use a normal 12 bit colour value in the format $RGB.
Since machines like the A4000/A1200 there are 24 bit colour values in the Format $RRGGBB.

After calling Amcaf Aga Notation On, all AMCAF commands and functions take 24 bit values, except Rrggbb To Rgb and Rgb To Rrggbb.
The default setting is 12 bit.


Functions

PAL GET
function: read a saved palette entry
colour=Pal Get(palette number,index)

This function reads the value of the colour with the number index 'index' from the internal stored palette buffer.
palette number must be a value between 0 to 7.


RED VAL
function: return the red value of a colour
r=Red Val(rgb)

This function acquires the red value of a colour. Together with the other Val functions, you can separate the colour into its three contents.


GREEN VAL
function: return the green value of a colour
g=Green Val(rgb)

This function acquires the green value of a colour. Together with the other Val functions, you can separate the colour into its three contents.


BLUE VAL
function: return the blue value of a colour
b=Blue Val(rgb)

This function acquires the blue value of a colour. Together with the other Val functions, you can separate the colour into its three contents.


GLUE COLOUR
function: return a colour using the three colour values
colour=Glue Colour(r,g,b)

Combines red, green and blue value of a colour to a normal colour value.


MIX COLOUR
function: return a colour my mixing colours
colour=Mix Colour(colour 1,colour 2)
colour=Mix Colour(oldrgb,addrgb,lower rgb To upper rgb)

The first version of the function mixes the two colours colour 1 and colour 2 and returns the resulting colour value.

The second version behaves a little bit differently: The colour 'addrgb' is added to the colour value 'oldrgb', if 'addrgb' is a positive value or subtracted, if the value is negative.
'lower rgb' defines the lower and 'upper rgb' the upper boundary of the allowed resulting colours.


BEST PEN
function: return the nearest pen for $RGB
pen=Best Pen($RGB)
pen=Best Pen($RGB,colour 1 To colour 2)

This function acquires the pen which is nearest to the colour $RGB. Optionally, you can give the range to search for the best colour.
The Best Pen function can be used to recolour pictures with limited palette.


HAM POINT
function: return the rgb value of a ham pixel
rgb=Ham Point(x,y)

This function simplifies the process of finding the right colour of a point at the coordinates x,y on a HAM screen.
There's no need to proceed from the left to the right until the right pixel value is found, although the Ham Colour method is a little bit faster when processing a picture from left to the right.
Ham Point can access any point on the screen individually without preprocessing.

If the point x,y is not on the screen, rgb will contain -1 instead of the red-green-blue value of a pixel.


HAM COLOUR
function: return a colour in ham mode
rgb=Ham Colour(c,oldrgb)

This function calculates the new colour value, that is created, when plotting a pixel in colour 'c' directly behind the last point.


HAM BEST
function: return the best colour in ham mode
colour=Ham Best(newrgb,oldrgb)

As you cannot achieve the desired colour by plotting only one pixel in HAM mode, you can use the Ham Best function to search the best colour for the next dot.
'newrgb' holds the target colour and 'oldrgb' the colour of the pixel exactly before the current dot.
Note: the current screen must be a HAM screen.


RGB TO RRGGBB
function: return an aga colour from an ecs colour
rrggbb=Rgb To Rrggbb(rgb)

This function calculates a 12 bit colour value into a 24 bit AGA value. The missing bits are set to zeros.
Using this colour format you can assign 256 different colour values each to the red, green or blue part, that is 16777216 different values in total.


RRGGBB TO RGB
function: return an ecs colour from an aga colour
rgb=Rrggbb To Rgb(rrggbb)

This function converts a 24 bit AGA colour value into a 12 bit ECS colour value.
The other 12 bits will be discarded.