User Tools

Site Tools


notes:cprog: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:cprog:fall2024:projects:gtf0 [2024/09/10 14:05] – [DRAWING A CIRCLE] tkastne1notes:cprog:fall2024:projects:gtf0 [2024/09/11 21:30] (current) – [MIXING A COLOR] tkastne1
Line 1: Line 1:
 ======GTF0====== ======GTF0======
  
 +The goal for this project is to observe the skeleton code and understand the functions well enough to meet the project objectives listed at the top of this page. Look at the different functions to divulge information about how this graphics library works and revise the code to meet expectations. 
 =====GRABIT===== =====GRABIT=====
 +
 +Once you are in your class folder you can make a directory for this project using: 
 +<code>
 +mkdir gtf0
 +</code> 
 +
 +After entering the directory you can retrieve the project files like so: 
 +<code>
 +grabit DESIG gtf0
 +</code>
 +Where DESIG is your class designation (e.g. cprog). 
 =====REPOSITORY STEPS===== =====REPOSITORY STEPS=====
   * Create a public html directory with the following command   * Create a public html directory with the following command
Line 15: Line 27:
   * While in your gtf0 directory use the make command to build the code   * While in your gtf0 directory use the make command to build the code
 <code> <code>
-make+make gtf0
 </code> </code>
 +
 +It is also possible to compile manually as such: 
 +<code>
 +gcc -Wall --std=gnu18 -o gtf0 gtf0.c -lgd
 +</code>
 +
 +<wrap hi>gcc</wrap> is the name of the compiler or collection of compilers used to compile C/C++ code. It can be invoked with the gcc command with flags such as what is shown above. 
 =====RUN THE PROGRAM===== =====RUN THE PROGRAM=====
 +
 +To run the program you've modified/created, simply invoke it on the command line while in its directory like so: 
 +<code>
 +./gtf0
 +</code>
 +
 +You should now notice gtf0.png in the directory that you ran the program.
 +
 +From here, you can move it to your public_html directory for viewing.
 =====VIEW THE IMAGE===== =====VIEW THE IMAGE=====
   * Using the mv command, move the resulting image from your gtf0 dir to your public html dir   * Using the mv command, move the resulting image from your gtf0 dir to your public html dir
Line 38: Line 66:
 int r, int g, and int b are the red, green, and blue components of the color. Typically represented as hex values between 0x00 and 0xFF int r, int g, and int b are the red, green, and blue components of the color. Typically represented as hex values between 0x00 and 0xFF
  
-There are many ways to find a colors hex value, including [[https://g.co/kgs/jbxvqkT|googles]]+There are many ways to find a colors hex value, including [[https://g.co/kgs/jbxvqkT|google's]]
  
 [[https://libgd.github.io/manuals/2.2.5/files/gd-c.html#gdImageColorAllocate|Official gdImageColorAllocate wiki page]] [[https://libgd.github.io/manuals/2.2.5/files/gd-c.html#gdImageColorAllocate|Official gdImageColorAllocate wiki page]]
Line 109: Line 137:
  
 [[https://libgd.github.io/manuals/2.2.5/files/gd-c.html#gdImageEllipse|Official gdImageEllipse wiki page]] [[https://libgd.github.io/manuals/2.2.5/files/gd-c.html#gdImageEllipse|Official gdImageEllipse wiki page]]
-====DRAWING AN ELLIPSE====+====DRAWING A Ellipse==== 
 +<code> 
 +gdImageEllipse (gdImagePtr im, int mx, int my, int w, int h, int color); 
 +</code> 
 +[[https://libgd.github.io/manuals/2.1.1/files/gd-h.html#gdImagePtr|gdImagePtr]] im is the image the function edits
  
 +int mx and int my is the coordinates of the ellipse center
 +
 +int w is the horizontal diameter of the ellipse
 +
 +int h is the vertical diameter of the ellipse
 +
 +int color is the color the ellipse is drawn as
 +
 +[[https://libgd.github.io/manuals/2.2.5/files/gd-c.html#gdImageEllipse|Official gdImageEllipse wiki page]]
notes/cprog/fall2024/projects/gtf0.1725977117.txt.gz · Last modified: 2024/09/10 14:05 by tkastne1