This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:unix:fall2023:projects:gtf0 [2023/09/10 12:10] – [RUN THE PROGRAM] morcutt | notes:unix:fall2023:projects:gtf0 [2023/09/13 20:13] (current) – [REPOSITORY STEPS] jbernata | ||
---|---|---|---|
Line 3: | Line 3: | ||
=====GRABIT===== | =====GRABIT===== | ||
+ | < | ||
=====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 " | ||
+ | |||
+ | 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" | ||
=====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 **./ | 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 **./ | ||
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 " | To view your picture you go into your file explorer where you put your Unix file and find the " | ||
+ | |||
+ | You can also view it in a web browser at https:// | ||
=====LIBGD FUNCTIONALITY===== | =====LIBGD FUNCTIONALITY===== | ||
+ | Documentation: | ||
+ | API: https:// | ||
====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==== | ||
+ | A line can be drawn with the command **gdImageLine (image, x, y, x2, y2, color);**. x and y are the starting x and y positions, x2 and y2 are the ending x and y positions and color is which color you want it to be. | ||
====DRAWING A RECTANGLE==== | ====DRAWING A RECTANGLE==== | ||
+ | < | ||
====FILLING AN ENCLOSED SPACE==== | ====FILLING AN ENCLOSED SPACE==== | ||
| | ||
====DRAWING A FILLED RECTANGLE==== | ====DRAWING A FILLED RECTANGLE==== | ||
+ | < | ||
====DRAWING A CIRCLE==== | ====DRAWING A CIRCLE==== | ||
- | ====DRAWING AN ELLIPSE==== | + | < |
+ | 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. |