graphic function ttg_line()
The Tool&Task graphic function ttg_line() draws a line between two points into the target bitmap (gTTG_Target:ttg_common). It uses the current definition of ttg_pen() and receives 4 numeric parameters.
The command ttg_line(0, 0, 0, 0) will set one pixel into the upper left corner.
Parameters:
1: X coord point 12: Y coord point 1
3: X coord point 2
4: Y coord point 2
***************************** | |
* Tool&Task example program * | |
* ttg_line() * | |
* last compile: 13.07.2022 * | |
***************************** |
local lw, lh, lxupl, lyupl, lxlor, lylor, ldist | |
lw = 148 |
&& width of the background bitmap |
lh = 148 |
&& height of the background bitmap |
ldist = lw / 10 |
&& x-distance of line endpoints |
lyupl = ldist |
&& y coordinate of upper left endpoint |
lylor = lh - ldist |
&& y of lower right endpoint |
lxupl = ldist |
&& x coordinate of upper left endpoint |
lxlor = lw - ldist |
&& x of lower right endpoint |
ttg_new() | |
ttg_createbmp(lw, lh, FORMCOLOR) | |
ttg_pen(0, 1, RGB(0, 0, 200)) | |
for ln = 1 to 9 |
&& draw 9 lines |
ttg_line(lxupl, lyupl, lxlor, lylor) | |
lxupl = lxupl + ldist |
&& recon coordinates for next line |
lxlor = lxlor - ldist |
&& only the x-coordinates change |
endfor | |
ttg_pen() |
&& reset the pen to solid, 1 Pixel width and BLACK |
&& create bitmap {gTTG_Target:ttg_common} | |
&& open in T&T {M_BMPVIEW} |