It is a console application used to draw simple geometric figures into a TGA image. The user draws shapes into the image using functions with parameters.
- move in the console to the directory where the files main.c, drawing.h, drawing.c, Makefile are stored
- using the make command, all necessary files are translated into an executable file "drawing" (assuming you have the gcc compiler installed)
- use the command ./kresleni to run the program
- these parameters must be specified when starting the program
--output "output.tga"
enter the name of your output TGA file instead of "output.tga".
--width "width"
enter the desired width of the image in pixels instead of "sirka".
--height "height"
enter the width of the image in pixels instead of "height".
project
example of running the program with parameters:
./kresleni --output output.tga --width 400 --height 400
- All commands, except for "save", "exit" and "clear" have the same 4 parameters r, g, b, a.
- r,g,b determine the color of the rendered image in RGB format and the a parameter determines the transparency
these 4 parameters range from 0 to 255 - all parameters must be separated by commas
saves the image to a file
saves the image to a file and exits the program
cleans the canvas
Draws a line from x1, y1 to x2, y2
Order of parameters: x1,y1,x2,y2,r,g,b,a
Draws a rectangle with the upper left corner at point x, y with width width and height height
Order of parameters: x,y,width,height,r,g,b,a
Draws a circle centered at x, y with radius radius
Parameter order: x,y,radius,r,g,b,a
Draws an equilateral triangle centered at x, y with a radius of width
Parameter order: x,y,width,r,g,b,a
Draws a rotated rectangle centered at x, y with width, height and rotation angle
Order of parameters: angle,x,y,width,height,r,g,b,a
./kresleni --output out.tga --width 900 --height 450
line 10,10,50,40,255,255,0,255
clear
rectangle 10,10,100,100,255,0,0,255
save
circle 20,20,40,120,120,120,128
triangle 50,50,20,0,255,0,255
rotated-rectangle 45,80,80,50,50,255,0,255,128
exit
- ./kresleni run the program, a file with a width of 900 and a height of 450 will be saved in the out.tga file
- line draws a line from point 10,10 to point 50,40 with color 255,255.0 and alpha value 255
- cleans the canvas (with black paint)
- rectangle renders a rectangle with the upper left corner at point 10,10, width 100, height 100, color 255,0,0 and alpha value 255
- save saves the image on disk to a file at the address specified when the program is started
- circle will draw a circle centered at point 20,20 with a radius of 40 with a color of 120,120,120 and an alpha value of 128
- triangle renders an equilateral triangle centered at 50.50, side length 20, color 0.255.0, and alpha 255
- rotated-rectangle renders a rectangle centered at position 80,80 rotated 45 degrees with width 50, height 50, color 255,0,255 and alpha 128
- exit saves the image on disk to a file at the address specified when the program is started and exits program