User Tools

Site Tools


notes:c4eng:fall2024:projects:gtf0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:c4eng:fall2024:projects:gtf0 [2024/09/10 12:23] wedgenotes:c4eng:fall2024:projects:gtf0 [2024/09/11 23:38] (current) – [DRAWING AN ELLIPSE] dnayo
Line 12: Line 12:
 Now, a new directory will appear when you use the ls command, called src. Type in "cd src" to get into this new directory. If you use the command "ls" again, you will see two directories, fall2024 and unix. You will want to cd into fall2024, this is where your semester repository is stored. If you don’t have c4eng as an available directory when you use the ls command, type in “mkdir c4eng" (mkdir stands for make directory). The cd into the new c4eng. You will keep all of projects here. Nothing is here yet, so you will have to use the grabit command. Now, a new directory will appear when you use the ls command, called src. Type in "cd src" to get into this new directory. If you use the command "ls" again, you will see two directories, fall2024 and unix. You will want to cd into fall2024, this is where your semester repository is stored. If you don’t have c4eng as an available directory when you use the ls command, type in “mkdir c4eng" (mkdir stands for make directory). The cd into the new c4eng. You will keep all of projects here. Nothing is here yet, so you will have to use the grabit command.
 =====BUILD THE CODE===== =====BUILD THE CODE=====
 +In order to build the code you first need to follow the steps above labeled "grabit" in order to get the gtf0 project file into your repository. After retreiving the gtf0 project file, you should enter the file using the command "cd gtf0". This command will change where you are in your repository to the gtf0 project file. Then if you use the command "ls", you will see that there are two files inside of the gtf0 directory. The files are "Makefile" and "gtf0.c". The "gtf0.c" file is the file that contains the code in which you will be editing and changing in order to complete the project. In order to access the file and to edit the code you use the command "vim gtf0.c" or "nano gtf0.c" depending on which text editor you would like to edit inside of.
 =====RUN THE PROGRAM===== =====RUN THE PROGRAM=====
 +In order to run the program we will run the command "make" while inside of the gtf0 directory. After using the "make" command use "./gtf0" and this command will create a png file for the gtf0.c code inside of the gtf0.c file which can then be moved and viewed.
 =====VIEW THE IMAGE===== =====VIEW THE IMAGE=====
 <WRAP>in Lab46, ensure you are in the directory where you executed " **gtf0** ". Run the " **ls** " command, you should see " **gtf0.png** " in your current directory </WRAP> <WRAP>in Lab46, ensure you are in the directory where you executed " **gtf0** ". Run the " **ls** " command, you should see " **gtf0.png** " in your current directory </WRAP>
Line 26: Line 28:
 ====MIXING A COLOR==== ====MIXING A COLOR====
 ====DRAWING A LINE==== ====DRAWING A LINE====
 +Use Function "gdImageLine (image, starting-X, starting-Y, terminating-X, terminating-Y, color);"
  
 ====DRAWING A RECTANGLE==== ====DRAWING A RECTANGLE====
 +Use function "gdImageRectangle (image, top left-X, top left-Y, bottom right-X, bottom right-Y, outline color);"
 ====FILLING AN ENCLOSED SPACE==== ====FILLING AN ENCLOSED SPACE====
 +Use code, "gdImageFill (image, x-coordinate, y-coordinate, color to fill);"
 ====DRAWING A FILLED RECTANGLE==== ====DRAWING A FILLED RECTANGLE====
 +Use code, "gdImageFilledRectangle (image, x-coordinate, y-coordinate, final x-coordinate, final y-coordinate, color);"
 ====DRAWING A CIRCLE==== ====DRAWING A CIRCLE====
 +Use code, "gdImageArc (image, center x-coordinate, center y-coordinate, diameter x, diameter y, start angle, end angle, color of the outline);"
 ====DRAWING AN ELLIPSE==== ====DRAWING AN ELLIPSE====
 +Use code "gdImageArc (image, center x-coordinate, center y-coordinate, diameter x, diameter y, start angle, end angle, color);" (make sure the x and y diameters do not match - you WILL end up with a circle)
  
notes/c4eng/fall2024/projects/gtf0.1725971035.txt.gz · Last modified: 2024/09/10 12:23 by wedge