Explanation of gtProg programming
Eric2 m' a envoyé un lien vers un site japonais sur la programmation Gonta
Voici une traduction faite avec Systran . ( C' est gratos si les pages sont pas trop longues .)
Pour des petites traductions ici
ATTENTION AUX MAJUSCULES !
If est incorrect alors que if est bon .
De meme Add , Xs ,Int(n) sont a remplacer par add , xs , int(n) ...
Toutefois , R G B sont valides ( invalide : r, g, b )
Invalide aussi VTplane a remplacer par vTplane
Un post un peu rapide a corriger ...
>
========================================
Explanation of gtProg programming
======================================== ver0.08
* This explanation has used the contents which are attached to the filter of Gonta as the data that way.
The opportunities which are seen as other than were few or, original thinking UP you could point.
[ Program development procedure ] ========================================
Group is rammed down
Title is rammed down
Initialize the program is rammed down
Transform the program is rammed down
[ Check ] pushing the button, it makes error checks
[ Save ] pushing the button, it retains the program
(It is retained in the gtProg.ini file)
[ Internal operation ] ==================================================
The
program has divided two (Initialize and Transform). When internal
operation is written simply in C language, it has become like below.
Parameter in 'Initialize' (? Line) processing
If (the execution button was pushed) {
Program part processing in 'Initialize' (? The line as a comment skip)
For (y=0; Y size of y< picture; Y++) {
For (x=0; X size of x< picture; X++) {
Processing of 'Transform' program
}
}
}
As for 'Initialize' only one time before sending image processing in scanning line direction, it is executed.
'Transform' is executed vis-a-vis each pixel.
[ Initialize program ] ======================================
To be large separately there are two parts.
1) '? ' With the line which has started (definition of parameter for the slider)
2) Other lines (initialization processing)
1) Format
'? Message, minimum, maximum and the default value which ' continue and parameter name, they indicate;
This is defined with 1 line.
Ex) ? Param and message,0,100,50;
For
example, this line using parameter param, minimum 0, maximum 100,
defines the slider bar which designates default value as 50. The filter
execution picture (side of the slider) 'message' it is indicated.
You can describe parameter line up to 12. When above that you describe, it becomes error.
2) Format
'? ' Line other than is executed as the program. You describe this part and the Transform program with the same type.
Initialize in initial line program coord=? Please make sure to define.
[ Transform program ] =======================================
Vis-a-vis each pixel is done the processing which is described to this part.
Before this program is called, r and t, x, the parameter of y, R, G and B is set.
After this program ends,
If coord=1 (r and t) pixel value is designated as present pixel value.
If coord=2 (x, y) pixel value is designated as present pixel value.
If coord=0 the value of R, G and B is designated as present pixel value.
If coord=-1 it does not do at all.
(R and t) R θ system of coordinates, (x, y) it is XY system of coordinates.
[ Language specification ] ==================================================
The
shape which is close to C language is taken. Because of omission of
processing, you cannot use several sentence structures. Generally
specification is described below. As for detailed thing please refer to
the sample program.
You cannot describe the arithmetic expression of a++ and --b etc.. Please describe to the wind, a=a+1, b=b-1.
+= and -= etc. you cannot use either operator.
! &, |, you cannot use either the operator of the ^ for the present.
Three section you cannot use operators.
It handles variable with double type excluding file name.
After % operator converting variable to integer, remainder is requested.
To define the variable it is not necessary. Initial value is 0.
Variable is processed to 256 bytes in length.
As for the program also Initialize and Transform are to 4096 letters.
If (a= (b==c)).. The description the way is not possible.
As for substitution it is necessary to describe to another line.
It cannot define the function and the like.
You cannot use either the pointer and the like of course.
You can use the if sentence and the while sentence as a control structure.
(As for check of the infinite loop being not to have done please note)
[ System variable ] ==============================================
Coord
It
defines in the first line of 'Initialize'. It decides it substitutes
which value to present pixel after the program execution 'Transform'.
R, G and B are used with 0. At 1 (r and t) value is copied in present
pixel. This time interpolation (Interpolation) with the calculation
method of being appointed is taken. (X, y) pixel is copied with 2. When
other values (-1 and the like) it substitutes, it does not substitute
every value to present pixel after the program execution. It is
possible also to change processing dynamically, by modifying during
'Transform' programming.
VTplane
It
is parameter for the preview. By the fact that 1 is set, transparency
is made to reflect on the preview. The transparent part is indicated
with black. Usually, transparency ignoring, has indicated the preview,
but, with the kind of filter which modifies transparency 1 is set.
VScale
It
is parameter for the preview. When 1 is set, without indicating the
reduction of all picture in, the left upper amount of the picture is
indicated with the identical scale. With the kind of filter which at
the dot unit parameter is appointed, when it reduces, because the
processing result differs, 1 is set.
Xs and ys
It
is size of the picture. Of course as for value it has become small at
the time of preview indication. Read-only. Writing, there is no actual
damage, but it is the cause of confusion.
Cx, cy
Center of picture. X, y, r and t are calculated on the basis of this value. With default it has become xs/2, ys/2.
X, y, r and t
(X, y) coordinate (r and t) coordinate.
R=sqrt (x*x+y*y), t=atan2 (y, x) with it is the expectation which becomes the relationship which is said.
Before Transform is called, 0,0,0,0. In Transform coordinate of pixel is substituted.
R, G, B and T
Pixel value, 255 or less of 0 or more. As for T with 0 complete transparency, with 255 opacity.
As for default value 0,0,0,255. In Transform presently the color of pixel is substituted.
Pi
3.14159 . In order to use well, it is registered with default.
It can substitute, but the origin of confusion.
H, L and S
When HLS () function is used, the result is substituted. As for default 0,0,0.
Loop
Default
1 is. When numerical value is set in 'Initialize', just the frequency
the loop which includes 'Transform' is turned. Dividing into the plural
times, when it processes and the like, it can utilize.
KeepImage
It
adds with ver0.08. Default 0. With keepImage=0, modifying loop, when it
processes, with processing after second it copies the contents of the
output buffer in the input buffer. When it makes keepImage=1, it does
not copy even with processing after second.
[ Function ] ======================================================
Sin (n), cos (n), tan (n), exp (n), log (n), pow (n, m), abs (n)
Sqrt (n), acos (n), asin (n), atan2 (y, x)
It is the same as the function of C standard library of math.h.
Rand (min and max)
Random number under max above min is generated.
Srand (n)
Kind of random number is initialized.
Int (n)
The
integer part is returned. When n is minus, to be closest the integer
which is smaller than n is returned. In case of n=-1.5 -2 is.
Min (a and b), max (a and b)
The inside smallest of a and b, it returns maximum.
Sgn (n)
The mark of n is returned. When non- is, when 0, it is correct with -1,0, 1.
R (x, y), G (x, y), B (x, y), T (x, y)
(X, y) the color in coordinate is returned. Presently it can refer to the color other than coordinate.
Exit (n)
N
0 being correct, the interpreter it ends instantaneously. When the
program becomes long, in operation time rise and deep nesting
prevention. When negative number is appointed, image processing it ends
instantaneously. Before being processed, pixel value becomes
uncertainty.
Get (x, y)
(X,
y) the color is developed in R, G and B variable. R (x, y), G (x, y)..
Rather than with many degrees doing coordinate calculation, you think
that operation time is fast.
Add (x, y and n)
R=R+R (x, y) *n; G=G+G (x, y) *n; B=B+B (x, y) *n; With it is the same.
HLS (r, g and b)
R, it calculates h, l and s from the value of g and b, substitutes to variable H, L and S.
The respective value is real number up to 0 - 255.
RGB (h, l and s)
H, it calculates r, g and b from the value of l and s, substitutes to variable R, G and B.
The respective value is real number up to 0 - 255.
SetMatrix3 (n,9 variable, factor)
9
variables and factor are set to the 3x3 matrix of the n turn eye. You
use for the calculation of コンボルーション. N, can have the matrix 8 from 0 up
to 7.
Example) SetMatrix3 (0, 1,1,1,1,1,1,1,1,1, 1/9); Low-pass filter
SetMatrix5 (n,25 variable, factor)
25
variables and factor are set to the 5x5 matrix of the n turn eye. You
use for the calculation of コンボルーション. Being common to the 3x3 matrix
from 0 up to 7, to have the matrix 8 it is possible n.
Conv (n, x, y)
Using the matrix of the n turn eye, (x, y) it calculates コンボルーション in coordinate, the result sets to R, G, B and T.
...
With, it is the function which calculates output image vis-a-vis input
image to here. Processing such as usual picture deformation and color
adjustment is possible with function above. Vis-a-vis this, using the
pen, and the like because when it draws actively in output image
function below is prepared.
LoadBmp (n and str)
The
bit map file is read. ... /filter/Gonta is designated as the current
directory. N appoints the number of the bit map which up to with 7, is
set from 0. Another territory from Matrix is taken. Str the extension
bmp is the file name which is excluded.
Example) LoadBmp (0, "Pen/MyPen"); Pen/MyPen.bmp is read.
LoadBmpNum (n, str and num)
It reads those which mark number to the pen in file name.
Example) LoadBmp (0, "Pen/MyPen",3); Pen/MyPen03.bmp is read.
Xs (n), ys (n)
Picture size of bit map of the n turn eye can be acquired.
Getb (n, x, y)
(X, y) the color of bit map of the n turn eye is developed in R, G and B variable.
_R (x, y), _G (x, y), _B (x, y), _T (x, y)
It
reads out the color which is set to the image for output. Before
writing, the data is uncertainty. The function which has started from
the under bar has meant the processing in regard to output image.
_get (x, y), _add (x, y and n), _Conv (n, x, y)
Get (x, y), add (x, y and n), Conv (n, x, y) with it is the same, but using the output buffer, it processes.
_Pset (x, y)
R, value of the variable of G and B (x of output image, y) is written to coordinate.
_Tset (x, y)
Transparency T (x of output image, y) is written to coordinate.
_Draw (n, x, y)
Using
pen n, output image (x, y) it draws. The color is used R, G and B
parameter. In addition density of the pen can be adjusted with T.
_DrawT (n, x, y)
Using
pen n, the addition and subtraction it does (x, y) in transparency of
output image. T when parameter is modified, equal to the parameter
amount is added transparency plainly. If minus is appointed,
subtraction it is possible.
_Fill (r, g and b)
Output image is painted (r, g and b) with. Density can be adjusted with T.
Before
drawing with the pen, when liking to set the white paper to output
image and the like, you can use. It is the function which is used
normally during Initialize programming.
_FillT (t)
Transparency of output image is painted with t. It is the function which is used normally during Initialize programming.
_Copy (n)
With n=0 input image is copied in output image.
With n=1 addition synthesis.
With n=2 subtraction synthesis.
With n=3 opposite subtraction synthesis.
With n=4 multiplication synthesis.
Replacing output image and input image with n=-1.
When
with the pen liking to draw in regard to original image and the like,
you can use. It is the function which is used normally during
Initialize programming.
Clean (n)
Being
in connection with コンボルーション to become necessary, it added with v0.08.
Value of transparent pixel is designated completely as n, (R=G=B=n).
With Pixia being the place where the eraser was used completely, it
retains pixel value. When pixel of pixel and the transparent part which
with that is next door of the transparent part is calculated, that way
when value becomes unstable it came out. When this function is used,
because it can designate the complete transparent part as black or
white, the operational result stabilizes.
Ex) Clean (0) it designates the complete transparent part as black.
When
R, G and B are calculated as coord=0, calculating with X-Y system of
coordinates as coord=2, lastly, get of the Transform program (x,
y); With with those where you write it becomes same as processing.
However, interpolation processing is not done.
Similarly when it
processes, as coord=-1 as coord=0, lastly, _Pset of the Transform
program (x, y); _Tset (x, y); With with those where you write
it becomes same as processing. However many degrees coordinate being to
calculate, it becomes slow.
2002/11/26
Gonta