User Tools

Site Tools


notes:unix:fall2023: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:unix:fall2023:projects:gtf0 [2023/09/10 14:35] – [LIBGD FUNCTIONALITY] morcuttnotes:unix:fall2023:projects:gtf0 [2023/09/13 20:13] (current) – [REPOSITORY STEPS] jbernata
Line 3: Line 3:
 =====GRABIT===== =====GRABIT=====
  
 +<blockquote> grabit unix gtf0 </blockquote>
 =====REPOSITORY STEPS===== =====REPOSITORY STEPS=====
 +Use the "hg add" command after you grab the project to add it to the repository.
  
 +Then use the "hg commit -m "(message here)"" command to let yourself know any changes you made before adding it to your repository.
 +
 +Then use the "hg push" command to finalize adding the file with the commit message.
 +
 +On a different system, you can use "hg pull" and "hg update" to update your changes on different systems, allowing you to save and load your work on lab 46 or on your personal system.
 =====RUN THE PROGRAM===== =====RUN THE PROGRAM=====
 To use the gtf0.c program you do not need to compile it. Once you have edited and changed the code with a text editor and saved it, you can run **./gtf0.c** to run it.  To use the gtf0.c program you do not need to compile it. Once you have edited and changed the code with a text editor and saved it, you can run **./gtf0.c** to run it. 
Line 13: Line 20:
 =====VIEW THE IMAGE===== =====VIEW THE IMAGE=====
 To view your picture you go into your file explorer where you put your Unix file and find the "gtf0.png" and then click on it to view your image. To view your picture you go into your file explorer where you put your Unix file and find the "gtf0.png" and then click on it to view your image.
 +
 +You can also view it in a web browser at https://lab46.g7n.org/~username/gtf0.png
 =====LIBGD FUNCTIONALITY===== =====LIBGD FUNCTIONALITY=====
 Documentation:  https://libgd.github.io/manuals/2.3.0/files/preamble-txt.html Documentation:  https://libgd.github.io/manuals/2.3.0/files/preamble-txt.html
Line 18: Line 27:
 API:            https://libgd.github.io/manuals/2.3.0/index/Functions.html API:            https://libgd.github.io/manuals/2.3.0/index/Functions.html
 ====MIXING A COLOR==== ====MIXING A COLOR====
 +You can make a color by declaring a new variable **int colorName = 0;** and then defining it like **colorName = gdImageColor (image, 0x??, 0x??, 0x??);**. The 0x?? is the amount of red, green, and blue (respectively) that is in your color. The 0x?? format is hexidecimal so the highest amount of each color would be 0xFF and the lowest would be 0x00. 
 ====DRAWING A LINE==== ====DRAWING A LINE====
  
Line 24: Line 33:
 ====DRAWING A RECTANGLE==== ====DRAWING A RECTANGLE====
  
 +<blockquote> gdImageRectangle (image, x, y, x2, y2, color); </blockquote>
 ====FILLING AN ENCLOSED SPACE==== ====FILLING AN ENCLOSED SPACE====
  gdImageFill (image, x, y, color);  gdImageFill (image, x, y, color);
 ====DRAWING A FILLED RECTANGLE==== ====DRAWING A FILLED RECTANGLE====
  
 +<blockquote> gdImageFilledRectangle (image, x, y, x2, y2, color); </blockquote>
 ====DRAWING A CIRCLE==== ====DRAWING A CIRCLE====
  
-====DRAWING AN ELLIPSE====+<blockquote> gdImageArc (image, center x, center y, width, height, 360, 360, color); </blockquote>
  
 +In order to make a perfect circle, you should ensure that the width and height are the same. 
 +====DRAWING AN ELLIPSE====
  
 +An ellipse is much like a circle, but the main difference is that where a circle has an equal diameter for both the x and y axis, an ellipse will have different diameters. To draw, use the same function used for drawing circles **gdImageArc (image, center x, center y, x diameter, y diameter, angle start, angle end, color)**. Understand that when the machine is drawing the arc, the line of the arc itself is half the distance of the diameter from the center. In other words, the diameter inputs refer to the measurement from end to end of the arc horizontally and vertically once fully drawn. An easy way to produce an ellipse is to double the integer of just one diameter input. This will stretch it out in the direction you choose in the function.
notes/unix/fall2023/projects/gtf0.1694356529.txt.gz · Last modified: 2023/09/10 14:35 by morcutt