This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:cprog:fall2024:projects:gtf0 [2024/09/10 14:05] – [DRAWING A CIRCLE] tkastne1 | notes: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: | ||
+ | < | ||
+ | mkdir gtf0 | ||
+ | </ | ||
+ | |||
+ | After entering the directory you can retrieve the project files like so: | ||
+ | < | ||
+ | grabit DESIG gtf0 | ||
+ | </ | ||
+ | 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 | ||
< | < | ||
- | make | + | make gtf0 |
</ | </ | ||
+ | |||
+ | It is also possible to compile manually as such: | ||
+ | < | ||
+ | gcc -Wall --std=gnu18 -o gtf0 gtf0.c -lgd | ||
+ | </ | ||
+ | |||
+ | <wrap hi> | ||
=====RUN THE PROGRAM===== | =====RUN THE PROGRAM===== | ||
+ | |||
+ | To run the program you've modified/ | ||
+ | < | ||
+ | ./gtf0 | ||
+ | </ | ||
+ | |||
+ | 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:// | + | There are many ways to find a colors hex value, including [[https:// |
[[https:// | [[https:// | ||
Line 109: | Line 137: | ||
[[https:// | [[https:// | ||
- | ====DRAWING | + | ====DRAWING |
+ | < | ||
+ | gdImageEllipse (gdImagePtr im, int mx, int my, int w, int h, int color); | ||
+ | </ | ||
+ | [[https:// | ||
+ | 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:// |