graphic function ttg_rectangle()

ttg_rectangle draws a rectangle with the current pen, 1 pixel wide ttg_pen and fills it with the current brush ttg_brush. The possibility to add round corners was deprecated. If your source still contains calls of the function with 6 parametrs, you get as message and the function preoceeds. I you do not want a frame line, just set the color of pen ttg_pencolor() to the color of brush ttg_brushcolor().
ttg_rectangle can be executed in ttg_createbmp()
Parameters:
1: x coordinate upper left corner2: y coordinate upper left corner
3: x coordinate lower right corner
4: y coordinate lower right corner
***************************** | |
* Tool&Task example program * | |
* ttg_rectangle() * | |
* last compile: 13.07.2022 * | |
***************************** |
gTTG_Pixset = "" |
&& to be sure |
gTTG_Width = 147 |
&& to check coordinates |
gTTG_Height = 147 |
&& of the rectangles |
x0 = 1 |
&& the upper left pixel has |
y0 = 1 |
&& x0 = 0, y0 = 0! |
xe = 145 |
&& the lower left pixel has x0 = width-1 |
ye = 145 |
&& y0 = height - 1 |
ttg_new() |
&& clear TTG gloabals |
ttg_pen(0, 1, RED) | |
ttg_brushcolor(LIGHTRED) | |
ttg_rectangle(x0, y0, xe, ye) |
&& the complete area |
x0 = 3 | |
y0 = 3 | |
xe = xe - 2 | |
ye = ye - 2 | |
xm = 73 | |
ym = 73 | |
ttg_pen(0, 4, GREEN) | |
ttg_brushcolor(LIGHTGREEN) | |
ttg_rectangle(x0, y0, xm-1, ym-1) | |
ttg_rectangle(xm+1, y0, xe, ym-1) | |
ttg_rectangle(x0, ym+1, xm-1, ye) | |
ttg_rectangle(xm+1, ym+1, xe, ye) | |
ttg_createbmp(gTTG_Width, gTTG_height, FORMCOLOR) | |
ttg_pencolor(BLACK) |
&& the 'old' gTTG_Pixset was erased! |
ttg_pixel(73, 73) |
&& hence color needs to be set |
ttg_pen() |
&& reset the pen to solid, 1 pixel width and BLACK |
ttg_execute() |
&& execute all graphic commands |
ttg_display() |
&& and show the image |