User Tools

Site Tools


notes:unix:fall2023:projects:gtf0

This is an old revision of the document!


GTF0

GRABIT

grabit unix gtf0

REPOSITORY STEPS

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.

Afterwards you can use the mv command to move it to public_html.

It can be helpful to have a second terminal and a window showing your gtf0.png picture so that you can see your changes more quickly. Have your open .c file on one terminal, use the other terminal to run your .c file and to move the resulting .png file to public_html, and the window showing your picture so you can refresh it to see changes.

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.

LIBGD FUNCTIONALITY

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

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

gdImageRectangle (image, x, y, x2, y2, color);

FILLING AN ENCLOSED SPACE

gdImageFill (image, x, y, color);

DRAWING A FILLED RECTANGLE

DRAWING A CIRCLE

DRAWING AN ELLIPSE

notes/unix/fall2023/projects/gtf0.1694366752.txt.gz · Last modified: 2023/09/10 17:25 by abowes2