@database picFX.guide 2.0 (30.12.99)
@author Maxime Gamboni
@wordwrap
@node main "picFX documentation"
@prev main
@next main
@toc main
http://intelcom.ch/maxime/picfx/

       Welcome to the picFX documentation !

picFX version 1.5

Latest modification: 2nd June 2000


 @{"Legal" link legal} - disclaimer, mui, status, ...

 @{"Requirements" link requirements} - a computer, a mouse are important things..

 @{"Introduction" link intro} - What is that thing
.

 @{"Mathematical Expressions" link math} - the list; & how 2 put 'em into filenames

 @{"Windows" link window} - User interface description
    @{"Settings window" link settings_win} - The central window of picFX
    @{"Message window" link message_win} - listen to picFX talking to you there..
    @{"Preferences window" link preferences_win} - adjust picFX to your own taste with this
    @{"VarList window" link varlist_win} - create variables therein
    @{"Animation window" link animation_win} - lets you create moving pictures

 @{"Multi-threading" link mt} - PicFX has a multi-tasking environnement :-)

 @{"Catalog" link cat} - A small list of functions that outputs some well-known effects
.

 @{"Past" link past} - Come here to see what's new in this version

 @{"Bugs" link bugs} <- Mmrr. The unwelcome guests that live in my software

 @{"Future" link future} - How I intend to improve my software

 @{"Locale+code" link locale} - Translation plus sourcecode included in archive :-)

 @{"Author" link me} - Author of PicFX

 @{"Thanks" link thanks} - People who allowed PicFX to see the light.

@endnode
@node legal "some boring stuff"
@prev legal
@toc main

 @{fg shine}DISCLAIMER@{fg text}

I do not take @{u}any@{uu} responsibility if picFX gives you wrong results, if you lose all your money, if your amiga explodes or anything else.
(Don't blame me if you lose your friends because they saw their heads "transformed" by my program :-)
My program is likely to contain some unknown bugs. Please contact me if you found any.

 @{fg shine}STATUS@{fg text}

Yes, picFX is @{fg shine}postcardware@{fg text} :-), I would be happy to recieve a postcard of the place you live in if you use my program.
(There are no limitation if you do not register.)
The registered users so far are
 * Ron Peterson from Texas.
 * Firmin Lahuit from Italy.
 * Michael Lünse from Germany

Many thanks for them :-))

Please read about @{"the source-code" link locale} about its state, if you feel like using it.

 @{fg shine}MUI@{fg text}

                          This application uses


                        MUI - MagicUserInterface

                (c) Copyright 1993-96 by Stefan Stuntz


MUI is a system to generate and maintain graphical user interfaces. With
the  aid  of  a  preferences program, the user of an application has the
ability to customize the outfit according to his personal taste.

MUI is distributed as shareware. To obtain a complete package containing
lots of examples and more information about registration please look for
a  file  called  "muiXXusr.lha"  (XX means the latest version number) on
your local bulletin boards or on public domain disks.

          If you want to register directly, feel free to send


                         DM 30.-  or  US$ 20.-

                                  to

                             Stefan Stuntz
                        Eduard-Spranger-Straße 7
                             80935 München
                                GERMANY



             Support and online registration is available at

                          http://www.sasg.com/


@endnode
@node requirements "What you need to discover the beauty of picture manipulation"
@toc main

If you want to use picFX, you will need:

An @{u}Amiga computer@{uu}, it would probably not work if ran with a mac or on windoze.

Erm, if you have a 68000, I hope you weren't intending to try picFX :-) It works under @{u}'020@{uu} and better.
The @{u}fast@{uu}er your processor is the happier picFX will be :-)
I personnaly used a 040 @25 Mhz (About same speed than 030 @50 MHz) I think that using picFX on slower processors would be awfully slooow.

A graphic card is recommended; although picFX does work under other displays, the AGA chipset is @{u}much@{uu} slower than graphic cards!

@{u}Memory@{uu}. Much memory. I was quite surprised that, having eighty megs of fast ram, I sometimes went to only forty megs available, which means that picFX can use upto 40mb of fast ram, when you are working on big pictures and having several projects of that size...

@{u}Version 3.0 of AmigaOS@{uu}, for the datatypes (a newer is of course welcome!)

@{u}render.library@{uu} and @{u}guigfx.library@{uu} by Timm S. Müller. Find them in Aminet:dev/misc.

@{u}Magic User Interface version 3.6@{uu} or better.

Mui Custom Class used:

- Lamp.mcc by Maik Schreiber

Get this class from Aminet:Dev/mui/

Some mathematical skills would be nice, if you only use the formulas I gave you as example, using picFX would make you lose your time copying huge formulas instead of clicking on a simple button in a "standard" image maniuplator program.
However, if you manage formula creation well enough, picFX will allow you to get really nice effects and get beyond most image manipulation programs.
@endnode
@node intro "How to make the thing work"
@toc main

 @{fg shine}INTRODUCTION@{fg text}

picFX is a program that allows you to plot a two dimentional graph, with each pixel having the colour defined by your formulas.

You give three formulas - red green blue - depending of the x and y coordinates, and the program will calulate them for each pixels.
X is the horizonal distance to the left border, in pixels, and Y is from the top.
The interesting thing is that you can read pixels from other projects with the r() g() and b() commands, the syntax is:
r(<project number>,<xcoor to calc>,<ycoor to calc>). For example, r(2,37,44) will return the red component of the pixel at coordinates (37,44) of project number 2.
You can then e.g. mix pictures, like this:
r(2,x,y)=  @{fg shine}(r(0,x,y)+r(1,x,y))/2@{fg text}
g(2,x,y)=  @{fg shine}(g(0,x,y)+g(1,x,y))/2@{fg text}
b(2,x,y)=  @{fg shine}(b(0,x,y)+b(1,x,y))/2@{fg text}
The second and third arguments can be function of x and y, only the first must be a constant number:
r(0,y/2,x/2) will make the picture twice bigger and reversed.

An interesting feature of picFX is that it is multithreaded, each time you start a calculation a new task is created and you can work on other projects without waiting.
@{u}And@{uu}, every time you write an expression in a field, picFX writes some assembly code, which will be evaluated at rendering-time.

Note: you can find a tutorial in picFXdat.lha archive, where I explain how you can use math to make picture manipulation

Important: If you find something that doesn't work or behaves strangely, @{u}mail me@{uu} (See @{"author" link me})!
@endnode
@node math "Mathematical Expressions"

Currently available functions are:

a%b  is a modulo b. For instance a%1 is the fractional part of a and a-(a%1) is the whole part of a.

a+b  outputs the sum of a and b

a-b  outputs the difference between a and b

a*b  outputs the product of a and b

a/b  outputs a divided by b. You are allowed to perform a/0, it will just give some undefinded result.
Division may give some very inaccurate results in integer, in some cases.

a^b  outputs a raised to the power of b. When integer, this does just a*a*a*a..... So avoid having b too big when working in integer mode!
With float values, you are allowed to put non-integer y.


@{u}A word about operator priorities:@{uu}
picFX function parser reads the operators from lowest to highest priority (in the same order as above, +-*/^%, and for a given level, it reads from left to right (and NOT from right to left!)
For example, a+b%c is read as (a+b)%c, while a+b*c is read as a+(b*c). However, take care when using non-associative operators ( %, -, /, ^), as a-b-c, for instance, is read as a-(b-c), which means a-b+c!!
When in doubt, put brackets, they do not change render-time.

min(a,b) returns the smallest value between a and b. You have to give exactely two arguments.

max(a,b) returns the biggest value between a and b.

sin(a) (Float only) outputs the sine of a. A is a radian value. You can use the "pi" constant to do a conversion if necessary.

cos(a) (Float only) (see sin)

tan(a) (Float only) (see sin). Evaluating tan(pi) only returns an undefined value.

asin(z), acos(z), atan(z)  (Float only) These are the inverse functions of sin,cos,tan. The output is a radian value.

cosh(a), sinh(a), tanh(a) (Float only. Later maybe in approximation). The hyperbolic functions. The inverses aren't available. I will maybe build them once.

angle(h,v): the angle of vector h,v; returns a number in [-pi;pi[.

ln(a) This outputs the natural logarithm (base e)

log(a,b) This is the logarithm of a in base b

r(c,x',y') outputs the red component of the pixel at coordinates (x';y') of project n°c.
Note well that the pixel is directely @{u}read@{uu} and NOT calculated.

c must be a constant. Things like r(@{u}x/20@{uu},x^2/500,y^2/500) are @{u}absolutely forbidden@{uu}
Look in the project list to get the number of a project.

The project n°c will be @{u}frozen@{uu} during calculation. This means that any attempt to change its bitmap will fail.
However, several projects may reference one single project at the same time without problem.

(See @{"Multi-threading" link mt} for more info about such topics)

When a coordinate is out of the range, its modulo is calculated.
When a coordinate is non-integer, it is rounded (Currently :-). Maybe in a future version interpolation will be used.

g(c,x',y') outputs the green component of the pixel at coordinates (x';y') of project n°c.

b(c,x',y') outputs the blue component of the pixel at coordinates (x';y') of project n°c.

If you want to add functions (a little E-skills are required, though), have a look at the parser.e source code, I explain there how to do.

You can of course access the x and y variable where you want.
Also available are the e (2.71828...) and pi (3.14159...) constants.
They are quite senseless in integer mode, where e=pi=3 :-)

* You can as well put names of any variable you defined. See @{"varlist window" link varlist_win} for more information about variables.

You can put math-expressions in all filenames, surrounding the expression by double quotes ".
You can also specify a minimal size in digits the result should be, like this: "l:e" (with the quotes), where l is the length in digits and e is your expression.

(This is useful for animations)

Example (if a=2, t=3):
ram:pic."3:t+4"         -> ram:pic.007
ram:pic."3:t-4"         -> ram:pic.-01
ram:anim_"a"/frame."t"  -> ram:anim_2/frame.3
ram:pic."2:t*90"        -> ram:pic.270

These expressions are always evaluated in float32 mode and then converted to int32.

@endnode
@node window "User interface"
@next mt

The picFX user-in terface is split into four windows:

There is the central setting window where you will handle your pictures and enter the formulas:
    @{"Settings window" link settings_win}

There is the message window, where all information like rendering time and errors will appear:
    @{"Message window" link message_win}

Then comes the variable list window. This allows you to give values to a few symbols, so that you can for instance make many renderings where just a few parameters vary..
    @{"VarList window" link varlist_win} - create variables therein

And the long awaited animation features:
    @{"Animation window" link animation_win}

And finally comes the preference window where you can adjust a few settings of picFX:
    @{"Preferences window" link preferences_win}

Along with these are the project windows which contain the actual pictures. You can hide and show them with the setting window, zoom in or out on the picture with the space bar...
What happens when you close them (delete the project or just hide the window) is set in the preference window
@endnode
@node settings_win "Settings Window"
@prev settings_win
@toc window

The main window, entitled 'Settings window' is where you will open, manipulate and save your pictures.
It is divided in two parts: The left part is the list of opened projects and the right part is where you edit the @{u}current@{uu} project.
Each line of the opened projects list is formatted like this:

ID: name

When the project is active (either rendering or loading a picture) the ID is followed by an exclamation mark (!).

The ID is a number that allows you to renference this project (e.g. r(3,x,y) references project that has ID #3). Each ID is unique to one project. This ID is not saved.
The name is up to you. The program does absolutely not take care of this name. You are allowed to give several projects the same name but it is better to avoid it so that you can e.g. clearly see in the project list which ID correspond to which project.

Use the '@{fg shine}NEW@{fg text}' button to create a new project. This will open a @{u}project window@{uu}.

The var list button will open @{"the window" link varlist_win} listing the variables you created.

The 'Prefs' button opens the @{"Preference Window" link preferences_win}.

@{u}The right part@{uu}

The topmost gadget contains the name of the project. This name is put in the title of the project's window and in the project list.

Under this gadget is the actual definition of the object.
You can choose between @{u}image@{uu} and @{u}function@{uu} types. Each one has its own settings.

@{fg shine}IMAGE@{fg text}

Path: this is the path of the picture. PicFX uses datatypes to load the pictures, so you can load any file, provided you have the datatype.

You can put a mathematical expression in the filename. Look at the @{"expressions" link math} node.

Note that to load the picture, you have to render the project.

@{fg shine}FUNCTION@{fg text}

This projecttype does the following:

For each pixel of the project, it gets the X and Y coordinates.
These coordinates are the number of pixels from left (x) or top (y).
So in the topleft corner, x=0 and y=0
for the topright corner, x=width and y=0 (so if width is the default one, x=255)

Having these coordinates, it evaluates your r, g and b function.
With these red, green and blue, it creates a colour and draws a pixel of this colour in the window.

Have a look at the @{"Mathematical expressions" link math} for more info about these expressions.

Write the function that will output the red component of pixel (x;y) at the right of "r(#,x,y)=" (# being replaced by the current project number)
"g(#,x,y)=" is the green component and "b(#,x,y)=" is the blue component.

The lights at the left of the function fields get red (or any other user-defined colour, look the mui preferences program) when the function parser routine discovered a mistake. Do not rely on it, it is still very experimental.

Note that you can select a function field pressing the "r", "g" or "b" letter on your keyboard.

@{b}For each function, you may choose OUTPUT mode:@{ub}

@{u}32Bits Integer:@{uu}

This is the fastest and less accurate. It only handles integer numbers, at each step of the calculation. So for example if you have x/5*5 with x=7, it will do the following:
x=7
7/5=2
2*5=   10
However if you write your expression in a smart way, you can often use Integer.
Several functions, like the trigonometric ones, require to have at least 32Bits floating point.

@{u}32Bits Float:@{uu}

This is about half slower than the former but has the advantage to be a lot more accurate.
It saves nine significant digits and features an @{u}exponent@{uu}.
So for instance, 1024 gets 1.024*10³, 0.034567 is 3.4567*10¯²

This mode is the most used; all functions work in this mode.

@{u}64Bits Float:@{uu}

This is quite seldom used. It is the same than 32Bits float, but with twice more data and therefore awfully slow.
If 32Bits float gives inaccurate results then switch to this.
The problem with this is that 64Bits require working with two 32Bits words, so it is about twice slower than 32Bits float.

As a general rule, use the lower precision that give correct results; try to change your functions so that they require less precision.
Following settings @{b}Won't calculate the given function@{ub}, but just take something already calculated

@{u}Old Red:@{uu}

This copies the red component that the pixel had @{u}before@{uu} starting calculation.

@{u}Old Green:@{uu}

This copies the previous green component.

@{u}Old Blue:@{uu}

This copies the previous blue component.

Note that you may mix these components (e.g. set green component to read the previous red), but take care when you're re-rendering the project, you may have to adjust these choices then..

@{u}Copy Red:@{uu}

Only available for green and blue, this copies the newly calculated red component. It is about like g(0,x,y)=r(0,x,y) (or r...), but doesn't recalculate the function.
(note that auto-referencing is not allowed in any other way. You can't access a pixel of the current project in that project with the inter-referencing functions r(),g() and b())

@{u}Copy Green:@{uu}

Only available for blue, this copies the newly calculated green component.


To work on black 'n' white projects, use the red component and set green and blue to "copy red" and "copy red" (or green).


@{b}SIZE:@{ub}

The two string gadgets "Width" and "Height" allow you to set the dimension of the current project, in pixels.

@{b}ACTION:@{ub}

Render: switches to 'pause' when clicked on.
This begins the calculation of the current project (or loads a picture, depending on the type of the current project).
Pause:
This pauses the calculation. The project will still be locked and used projects will remain frozen.
Click on it again to resume calculation (Restart).

Save Func:
This saves the current project. It will save all informations, including precision, size and so on.
The resulting file is an ascii one. You can easily modify a function file.
The format of each line is:
"variable=value"

Load Func:
This loads a function. It will overwrite the current settings.

Save Pic:
This saves the current picture to disk. Currently picFX only saves expensive uncompressed iff24, but this will change :-)

Shown/Hidden:
This switch lets you either hide or show the window containing the picture of the project. Functions like "Save Func" are still working when the window is hidden.

Close:
This closes the project, unless it has been frozen. Check before removing a project that you really want to do it (Do you want to save it before?).

Abort:
If the project is either loading, rendering or paused, this aborts the current rendering.
It does nothing otherwise.

Clear:
This clears the current bitmap to black.

@{b}STATUS AREA:@{ub}
This is divided in two parts, status field and progress gauge.
The status field can contain the following texts:

Idle: The project does not do anything and is not being referenced.

Drawing: The project is either rendering a picture or calculating a graph.
The gauge shows at which state it is.

Paused: The project was active and had been paused. Click on 'Restart' to resume the work.

Loading: The project is loading an image (Either loading from the disk or remapping the picture)
This can't be aborted.

Frozen: The project is not active but another one is reading the bitmap. You are allowed to change the attributes but not render anything.

Updating Drawhandles: You changed a graphic setting and picFX is sending all projects that new setting. picFX is freezed until the work is done.
@endnode
@node message_win "Message Window"
@toc window

This window contains the fifteen latest messages (The window title shows how many messages has been sent, but you can only read the latest fifteen ones).
Everytime a project outputs a message, it is written there.
Between brackets is the ID of the project that sent the message. (-1 is the main program)

Below the list is a field, which contains "c(p,x,y)=[r,g,b]". Click anywhere in a project window and the coordinates you clicked on will replace x and y; the rgb colour definition will be written at the right of it.
Note well that it does display the value that it was @{u}when you clicked on it@{uu}. So if you draw the project again, or even removed it, the displayed values will remain unchanged.

You can hide this window using @{"preferences" link preferences_win} or pressing Escape having it selected.
@endnode
@node varlist_win "Variable List - Window"
@toc window

This window allows you, like its name implies, to handle a list of variables....

This is quite easy to do:
Add and remove variables with the two buttons at the bottom of the window.
You can change the name and the value of a variable with the two fields. Please do not put characters @{u}(,)@{uu} in a name, as well as operator names (+-*/^%) or you won't be able to use your variable. Spaces are allowed but might look strange :-).
You can redefine the x and y variables, but I don't see of what use it would be :-).
If you define several variables with the same name, only the first will be visible.

Something important to understand is that the value of a variable is read when and only when an expression is read, which means when you press enter on a function field.
If you have set the 'recompile on render' switch in the @{"preferences" link preferences_win}, then they will also be evaluated when you click render (as picFX will simulate an acknowledge of all three fields if the switch is on).

@endnode
@node animation_win "Animation window"
@toc window

You can render a series of pictures using this window.

To do an animation, shortly: You create a variable (eg, "t") that will be your "time" parameter.
Then you can use this variable in expressions and filenames to make your projects depend on the time, like you want.
This variable will take the values between 0 and n-1, n being the number of frames of your animation.

Then you choose the projects you want to be render for each frame of the animation.

And finally you choose the basename you want to save to.

Remember that you can load a list of pictures if you put an expression in the filename of the picture to load.
Typically, if you want to do a transition between two animation, you will read the animation putting something like source."3:t" and dest."3:t" for your filenames.

I'll now explain more thoroughly the gadgets of the animation window:

On the first line you can set the name of the variable you want to use as time parameter, as well as the number of frames you want your animation to have.
As said above, the variable will take all whole positive values smaller than the number you gave.

On the left half is the list of projects that will be rendered. They will be rendered in the same order they come in the list.

To add a project, select it in the project list of the main window and click Add below the list.
To remove a project, select it in the list and click Remove...
You can reorder the projects with drag'n'drop. You currently can't add projects with drag'n'drop, but this should come soon :-)
Put in this list all projects that depend somehow on the time, and take care of the order.

The "Save this" gadget shows the project that will be saved after the rendering is over.
To set it, take a project in a project list and drop it over the "Save this" gadget. (It should usually be the last rendered project)...

Below it comes the basename of the file picFX will save the project to. A three-digit extension will be added to it, giving the value of the parameter at that time, similar to ."3:t"  .

And finally there is the button to start the animation. When you click on it, picFX will start the job. If you click again, it will abort the animation.

Note that you can't interact with picFX while an animation is being rendered. This should change in the future.

@endnode
@node preferences_win "Preferences Window"
@toc window
@next preferences_win

Changes to the preferences are immediate, and saved to ENV: when you exit picFX. To make changes permanent, just clik the 'save' button on the bottom.

This window allows you to customize a bit the bahaviour of PicFX.

@{u}Main task priority@{uu}:
Set here the priority of the main task. Usually better to keep it to zero. If you change it, avoid moving it out of [-2,+2]

@{u}Current task priority@{uu}:
Set here the priority of the render task owned by the current project. Default to -1. Moving it to the same value than the main task risks slowing down the latter.

@{u}Render task priorities@{uu}:
Set here the default priorities of the render tasks. Default is -2. If the current project is working, its task will have the priority set above.

(This means that the selected project will be favorised by Exec, unless you set current=render)

@{u}Recompile at Render@{uu}:
When selected, picFX will reread the functions in the three r,g,b fields when you click render. This is useful when you use @{"variables" link varlist_win}, so that it is possible just to change the value of a variable and directely click render instead of pressing enter on each field again..

@{u}Update Delay@{uu}:

Set here the number of lines that will be drawn without refreshing.
If you set it to e.g. 5, the display in the project window (and the gauge) will be updated each five lines.
If you set it to one, the display will be updated as often as possible.
If you set it to 'None', the display won't be updated at all, only when finished.

Default is ten. The smaller it is, the slower the rendering will be, although the difference is quite small.

[This is currently disabled. The picture is displayed only when rendering is over or when you abort.]

@{u}Close@{uu}:
Set here how PicFX must behave when you close a project window.
You can choose between close, which will remove the project (and loose the picture!)
and iconify, which will simply iconify the window, without even stopping the rendering, if any. Open the window again setting the 'Hidden/Shown' switch.

@{u}MUI prefs@{uu}:
This opens the standard MUI preferences window.

@{u}Show Message Window@{uu}:
You can hide or show the message window with this.

@{u}Dither Mode@{uu}:
When displaying a picture under a screen with too few colours, dithering is activated. You can select here the kind of dithering. First is fastest, Last is slowest.
(You'll see that Random is really slow, even under '060/ 8bit CGX, but looks nice)

@{u}Dither Amount@{uu}: This one has an effect only when Random dithering mode is used, and sets the dithering amount.

You may want to have a look at the "prefs" documentation file inside the guigfxlib archive for more settings regarding display.

@{u}Save Preferences@{uu}:

This saves the settings to ENV: and ENVARC:
@endnode
@node mt "Multi-threading"
@prev window


Like said in the introduction, PicFX is multi-threaded. This implies several things:

When you click on the @{b}render@{ub} button, a new task is created. The project is said to be @{u}locked@{uu}.
If this project uses another project (inter-referencing, with r(), g(), b()), the latter is said to be @{u}frozen@{uu}.
To "unlock" a project, simply click on "Abort"; to "unfreeze" a project you have to abort the projects that use it. There is currently no way to directely know what project is using a given project.

When a project is locked, it can't be frozen.
When a project is frozen, it can't be locked, but it can be frozen again. (I.e. several project can reference one single one).

When a project is frozen, each attempt to modify the @{u}image@{uu} (E.g. clearing the bitmap) fails.

You can close locked projects but not frozen projects.

Priorities of the tasks can be set in the @{"preferences" link preferences_win}.

Note however that picFX don't recieve your inputs while loading an image and is partially disabled while rendering an animation...
@endnode
@node cat "Some interesting formulas..."
@prev mt
@next past

Have a look at my tutorial on Aminet (picFXdat.lha), where everything is thoroughly explained.

@{u}Colour effects@{uu}
De/Increase contrast: (Floating point could help :-)
r(1,x,y):=(r(0,x,y)-o)*k+o

o is the origin.
So when the contrast is put very low, all colours will be near o.
When k is bigger than one, contrast is raised (Take care not to get over 255 or below 0!)
When k is between zero and one, there is fewer contrast.

Negative output:
r(1,x,y)=255-r(0,x,y)

Black 'n' White:
r(1,x,y)=(r(0,x,y)+g(0,x,y)+b(0,x,y))/3

Hue extraction:
Divide the colour (each component) by its intensity. Then multiply by a constant, e.g 128.
Maybe better to first create the black'n'white version and then do the division, like this:

Project zero is the picture.
r(1,x,y)=(r(0,x,y)+g(0,x,y)+b(0,x,y))/3

r(2,x,y)=r(0,x,y)/r(1,x,y)*128
g(2,x,y)=g(0,x,y)/r(1,x,y)*128
b(2,x,y)=b(0,x,y)/r(1,x,y)*128

The result is that each pixel has the same hue (i.e. colour) than at the beginning, but the intensity is constant.

@{u}Pythagore@{uu}:
to get the distance from point at coordinates (a;b), do the following (You already knew it, didn't you? ;-):

sqrt((x-a)^2+(y-a)^2)

Remove the square root if having the square of the distance is not a problem.

@{u}Sine waves@{uu}
If you want a colour component to be a sine, do the following right after the sine (or cosine):
sin(...)*127+128
This will output a value within 0 and 255.

@{u}Implicit graphes@{uu}
To "lighten" the places where f(x',y') is near zero:

(h*k)/(f(x',y')^2+k)

The bigger k is, the wider the line will be.
the output will be between 0 and h. (So h is usually 255, to use the full range)

@{u}Colour extraction@{uu}
To extract the pixels of project zero having value (r;g;b):
r(1,x,y)=255/((r(0,x,y)-r)^2+1)
g(1,x,y)=255/((g(0,x,y)-g)^2+1)
b(1,x,y)=255/((b(0,x,y)-b)^2+1)

Following are example of convolution operations.

@{u}Relief@{uu}
k, l and m are usually one, but raise them if the relief can't be well seen. (Contrast)
To take only horizontal relief into account:
r(1,x,y)=128+(r(0,x,y)-r(0,x+1,y))*k
g(1,x,y)=128+(g(0,x,y)-g(0,x+1,y))*l
b(1,x,y)=128+(b(0,x,y)-b(0,x+1,y))*m

To take only vertical relief into account:
r(1,x,y)=128+(r(0,x,y)-r(0,x,y+1))*k
g(1,x,y)=128+(g(0,x,y)-g(0,x,y+1))*l
b(1,x,y)=128+(b(0,x,y)-b(0,x,y+1))*m

To use both dimensions:
r(1,x,y)=128+(2*r(0,x,y)-r(0,x+1,y)-r(0,x,y+1))*k
g(1,x,y)=128+(2*g(0,x,y)-g(0,x+1,y)-g(0,x,y+1))*l
b(1,x,y)=128+(2*b(0,x,y)-b(0,x+1,y)-b(0,x,y+1))*m

@{u}Blurring@{uu}
r(1,x,y)=(r(0,x,y)+r(0,x+1,y)+r(0,x,y+1)+r(0,x+1,y+1))/4
g(1,x,y)=(g(0,x,y)+g(0,x+1,y)+g(0,x,y+1)+g(0,x+1,y+1))/4
b(1,x,y)=(b(0,x,y)+b(0,x+1,y)+b(0,x,y+1)+b(0,x+1,y+1))/4

You can add/remove elements, to de/increase blurring effect.
Also multiply some elements by a constant to give them more importance.

@{u}Mask@{uu}
r(2,x,y)=r(1,x,y)*r(0,x,y)/255
g(2,x,y)=g(1,x,y)*r(0,x,y)/255
b(2,x,y)=b(1,x,y)*r(0,x,y)/255

This will use red component of project zero as a "mask" through which project one will go.
You may have got this mask using colour extraction, see above.

@{u}Alpha@{uu}
If you want to copy a project over another one using something like an alpha channel, try this:
Project zero contains the image to be copied
Project one contains the destination image
Project two contains the mask
Project three is where the result will be rendered

r(3,x,y)=(r(0,x,y)*r(2,x,y)+r(1,x,y)*(255-r(2,x,y)))/255
g(3,x,y)=(g(0,x,y)*r(2,x,y)+g(1,x,y)*(255-r(2,x,y)))/255
b(3,x,y)=(b(0,x,y)*r(2,x,y)+b(1,x,y)*(255-r(2,x,y)))/255

Here only the red component of project two is used. Put g and b if you want to use all colours.
@endnode
@node past "History of PicFX"
@prev cat
@next bugs

Started developement at the beginning of Mai '98

Version 0.80 Alpha: First Public Version (12/07/98)
* Enforcer hits removed; features added; other bugs removed ...
* A little optimisation

Version 0.81 -» 0.82 Alpha: Second Public release (17/08/98)
* Added Picasso96 support
* Added mod,min and max functions.
* Functions using commas (r,g,b,mod,min,max) can now be imbricated.
* A little better error-checking.
* Coordinates+colour component display added in messages-window.
* Increased from ten to fifteen messages the size of the messages-window
* I really can't find out what makes my preferences system crash. I tried to reactivate it, and hasn't crashed anymore since then?!?
* Some bugs removed.

Version 0.83 Alpha: Little bug-fix (22/08/98)
* Bug-fix: Setting-refreshing could be disabled [i.e. selecting new project didn't make the settings updated]. This happened when trying to remove a frozen project.
* Some enforcer hits have been removed
* Loading too small pictures with "change size" mode could crash (the window was not yet resized when rendering started).
* Some mistakes in this guide/catalog have been corrected.
* Removed the tutorial out of this guide

Version 0.84 -» 0.85 Alpha: Some Improvement&optimisation (24/10/98)
* Lots of output possibilities available for each function (r,g,b)
* Huge optimisation for cgx systems

Version 0.86 Alpha: Rewrite of the function parser (10/04/99)
* Complete rewrite of the function parser code. Twice smaller code, faster, MUCH more readable and so on. I opened a door for easy to code pre-compilation ;-)
* Lots of possible crashes are off now :-) (Just try writting '-x' to enjoy it (it made picFX crash in previous versions :-)
* Memory display in title bar

Version 0.87 Alpha: Major update (25/04/98)
* @{fg shine}Expression pre-compilation@{fg text}! Rendering is now between two and three times faster!!
* "Old #?" functions work now
* New angle(h,v) function

Version 0.88 Alpha: optimisations+bug fixes (22/05/99)
* Pre-calculation is available again => more speed.
* Many crash-bugs corrected

Version 0.9 Alpha: new gfx-system (10/09/99)
* Yielding to the numerous requests from AGA users (much more than I expected), I decided to use the gfx libraries of T. S. Müller. AGA is now supported!
* much faster graphic read and write accesses.
* removed many many crash (and other) bugs

Version 0.91 Alpha: bug fixes (14/09/99)
* Many bugs fixed
* Extended preferences for graphic system.
* Updated catalogs
* Untested, but HAM should be ok now.
* Scale pictures using spacebar.

Version 1.00 Beta: Finally picture saving (24/09/99)
* implemented picture saving. iff24 uncompressed only supported
* Scale back picture to 1:1 ratio pressing space a second time
* Bug fixes

New German Catalog (02/10/99)

Version 1.1: Prefs & Variables (31/12/99)
* Working & enhanced preference system
* @{"Global Variable" link varlist_win} Handling
* Bug fixes (picFX crashed when inter-referencing failed)

-- no public versions for a while...

Version 1.5 (02/06/00)
* Render a set of projects many times making some parameter vary, for animations
* Expressions into filenames, to allow dynamically loading pictures
* Some confirmation requesters added
* Menus added
* Pretty "About" window :-)
* a few shortcuts (r,g,b for the fields; menus)

@endnode
@node bugs "Look at those thingies crawling in the source"
@prev past
@next future

Notes:

a. If picFX crashed your system / behaved strangely, please tell me about it. I would much appreciate it.

b. Please note well that there may be (=> there @{u}are@{uu}) unknown bugs, that may (=> will ;-) crash your system/hard disk (although hard-disk crash is quite unlikely ;-). As I already said it, use it at your own risk and do not try to experiment "extreme" situations without having saved, I can do it myself :-).

@{fg shine}UNIMPLEMENTED FEATURES@{fg text}

1) Loading mode is now fixed to ChangeSize.

2) Picture rendering is done in one time; you can't see it before it is finished.

3) 64bits output is not yet done.

@{fg shine}KNOWN BUGS@{fg text}

Fortunately, most serious bugs are off now, crashes are less frequent :-)

1) This vertical scroller in the right border of each project window is simply ugly.
Quite serious refreshing problems (MUI bug :-( ) appear if I try to put the right scroller like the bottom one, in the border.
I will not correct this, as I do not think it is possible.

2) Still a few mysterious crashes
@endnode
@node future "I will make picFX approach the perfection as much as possible"

Here is what how I intend to improve PicFX, most important at beginning and least important at the end:

* Implement all missing features (see @{"bugs" link bugs})

* Put the (0;0) origin somewhere else than on the top left (I almost always need to write stuff like (x-128) instead of x :-). Possibly also set a different unit than the pixel (Sort of zooming)

* Give more possibilities for a formula, handling of complex numbers, conditions & loops. I'd use the Amiga-E syntax (DEF, IF-ELSEIF-ELSE-ENDIF, LOOP/WHILE/REPEAT-ENDLOOP/ENDWHILE/UNTIL)

* Expression Macros instead of only numerical variables, if a same expression is evaluated lots of times in one project, a macro could be created for it, to gain some rendering time. Typical macro: '(x-128)^2+(y-128)^2'..

* Possibility to select a rectangular part of a project where rendering will be done (instead of the whole project)

* Maybe some user definable-toolbars that contain function definition, to quickly create an often used function. Unlikely.

× I want picFX to be able to draw a MandelBrot fractal. Once it can, I will be satisfied ;-)

Any suggestion is welcome!

@endnode
@node locale "Catalog and source code"

@{fg shine}LOCALE@{fg text}
In directory "Translation" are the catalog description and translations.
If you want to translate picFX in your language, do the following:
Let's say you want to translate into martian.

Choose either an existing language (#?.ct) or the description (picFX.cd)
and copy it to martian.ct
Now edit martian.ct in your favorite ascii editor.
The first lines (preceeding the first descriptions) must be like this:

##version $VER: picFX.catalog 0.0 (46/02/54)
##language martian
##codeset 0

(You may put the correct date in the version information)


If you used the catalog description (.cd), remove each "(//)" at the end of the names.

The rest of the file is structured like this:

variable1
contents1
variable2
contents2
  ...

Each variable starts with "msg"

When you translate, do not modify the variable names but only the contents !!!

Lines beginning with ";" will be ignored. You can either let the original comments, remove them, or add yours. Please only put comments at the beginning of a line.

"\\n" means new-line.

You can split a content over several lines putting a "\\" at the end of it:

Hello \\
World.

Is the same than

Hello World.

And

Hello\\nWorld.

is the same than
Hello\\n\\
World.

IMPORTANT:
If you translated a .ct file, @{u}send it to me@{uu} and I will send you the catalog as soon as possible (usually the next day or two days after). I won't support translation that are not sent to me.
If you translated my program using a catalog editor (e.g. CatEdit) then please generate a .ct file for it before sending it to me, whenever possible.
I have seen catalog editors that generate variable names themselves. I do not want anything like this, because like I said above variable names are the identificators of the strings!

@{fg shine}SOURCE CODE@{fg text}

Included in "E-source" directory is the full source code of PicFX.

Here are some explanations:

classes.m is just a list of constant-definitions

parser.m is a module that converts string functions in a function structure, and creates two assembly procs (precalc and code; precalc is evaluated once on each line and precalculates the y subexpressions that do not depend on x)
You can quite easily add/change functions. Look comments in source.

Not that I have designed it especially for my program. It would probably result in memory and speed waste to use it in another program, although Convertor has a "light" version of it, without the variables, pre-compilation and pre-calculation. But please tell me then if you want to use it.
(I will maybe change parser.m to get a more general expression parser/evaluator, handling a list of variables.)

picFXlocale.m is the catalog manager, generated by FlexCat. Look for that program on Aminet is you feel like recompiling my program.

IMPORTANT:
I allow you to pump some code out of my program but @{u}@{fg shine}please mention my name@{fg text}@{uu} in the documentation of the program you wrote then and if possible tell me about it.
Of course I do not take any responsibility if you copied a part of my code that was completely buggy. Copy the code at your own risk ;-)
Please do not recompile the code and spread it out saying it is your work, as a [free/share]ware or commercial!

If you find a bug or optimisation possibility, I will be delighted to know about it.
@endnode
@node me "Who wrote this nice piece of software?"


My Addresses:

E-Mail: gamboni@fastnet.ch (avoid maxime@intelcom.ch)
Another possible one: maxime.gamboni@epfl.ch

S-Mail:
    Maxime Gamboni
    Chemin de Rouvenne 8
    1800 Vevey, Switzerland

www: http://intelcom.ch/maxime/

Send all your flames, suggestions, thanks, bug-reports, questions (and postcards :-) to this address. I am always happy to recieve some feed-back from the users of my programs.

I already wrote three other programs, all on Aminet:

1) Convertor (misc/math/convertor.lha)
    This is a (postcardware) unit converter, very powerful, fast, complete (and so on :-)

2) Birdie Prefs (util/misc/bprefs.lha)
    If you are a user of Birdie, rush on this archive, easy-to-use preferences program for that wonderful patch. (freeware)

3) Circuit (misc/sci/circuit.lha)
    Logic circuit simulator, put NAND, OR, XOR and many other doors together. Macro creation feature. (public domain)

All my programs include the full source-code.
@endnode
@node thanks "Acknowledgements"
@prev me
Here are peoples I'd like to thank (In alphabetical order):

* All members of the AmigaE/MUI mailing lists, who answered quickly all questions I posted.

* Nick Clover and Kresimir Farkas, who tested my program while I was writting picasso96 compatibility.

* Firmin Lahuit, who sent me a nice alpine postcard

* Michael Lünse, who wrote the German translation of picFX.

* Timm S. Müller, authour of the graphic libraries that allowed me to include AGA support.

* Wouter van Oortmerssen, author of the AmigaE language

* Ron Peterson, who sent me a texan-postcard for picFX

* Fabio Rotondo (I use his Amiga Foundation Classes for picture loading)

* Maik Schreiber, the developer of lamp.mcc

* Stefan Stuntz, author of Magic User Interface. Several parts of my program are directely copied from his example programs :-)

* Ingo Weinhold, for SettingsWindow.mcc I used in previous versions.

* Some other peoples I forgot. (Even if most are members of the mailing lists cited above :-)
@endnode
