graphic function ttg_gradient()
This function changes the color within a rectangle in equal steps form a start color to an end color. The first four parameters define the upper left and lower right corner of the rectangle. The 5th parameter sets the direction within the rectangle to let the color change either horizontally, vertically or diagonally (2 directions). The next 6 parameters set the RGB of start and end color. The last parameter defines the treatment of a 'transparent color' which is set by ttg_transcolor(). This 'transparent color' is either ignored, it is the only color to be exchanged by the gradient or it is the only color which is not exchanged by the gradient color.Parameters:
1: X coord upper left corner of rectangle2: Y coord upper left corner of rectangle
3: X coord lower right corner of rectangle
4: Y coord lower right corner of rectangle
5: 'H' Horizontal (left to right)
'V' Vertical (top down)
'C' Cross (upper left to lower right)
'D' Diacross (upper right to lower left)
6: red intesity of start color (0-255)
7: green intesity of start color (0-255)
8: blue intesity of start color (0-255)
9: red intesity of end color (0-255)
10: green intesity of end color (0-255)
11: blue intesity of end color (0-255)
12: how to tread color 'transparent'
'I' = Ignore (overwrite as any other color)
'O' = Only (only paint transparent pixels)
'N' = NOT (do not touch transparent pixels)
***************************** | |
* Tool&Task example program * | |
* ttg_gradient() * | |
* last compile: 12.07.2022 * | |
***************************** |
ttg_new() | |
ttg_createbmp(148, 148, FORMCOLOR) | |
* the area is divided in 4 rectangles | |
lx = 3 |
&& upper left x coordinate |
ly = 3 |
&& upper left y coordinate |
lh = 74 |
&& half the original space |
lw = 74 - 6 |
&& width and height of subareas |
* upper left rectangle | |
ttg_gradient(lx, ly, lx+lw, ly+lw, 'V', BLACK, WHITE, 'I') | |
* lower left rectangle | |
ttg_gradient(lx, ly+lh, lx+lw, ly+lh+lw, 'H', WHITE, BLACK, 'I') | |
lx = lx + lh |
&& 2 subareas on the right side |
* upper right rectangle | |
ttg_gradient(lx, ly, lx+lw, ly+lw, 'C', BLACK, WHITE, 'I') | |
* lower right rectanlge | |
ttg_gradient(lx, ly+lh, lx+lw, ly+lh+lw, 'D', WHITE, BLACK, 'I') | |
ttg_execute() | |
ttg_display() |