This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:cprog:spring2024:projects:gtf0 [2024/02/08 03:10] – [DRAWING A RECTANGLE] hcopp1 | notes:cprog:spring2024:projects:gtf0 [2024/02/08 04:20] (current) – [VIEW THE IMAGE] hcopp1 | ||
---|---|---|---|
Line 8: | Line 8: | ||
=====REPOSITORY STEPS===== | =====REPOSITORY STEPS===== | ||
=====BUILD THE CODE===== | =====BUILD THE CODE===== | ||
+ | |||
+ | Edit the provided skeletal code from the grabit using a txt editor like nano. edit this code to fit the criteria for the project | ||
+ | |||
+ | | ||
+ | |||
+ | |||
=====RUN THE PROGRAM===== | =====RUN THE PROGRAM===== | ||
+ | |||
+ | To be able to run the gtf0.c file use the following command in the grabit file: | ||
+ | < | ||
+ | Issue the command '' | ||
+ | |||
+ | If you execute this command it should produce a .png image | ||
=====VIEW THE IMAGE===== | =====VIEW THE IMAGE===== | ||
+ | |||
+ | The image can either be viewed, if on a Pi, from the GUI file explorer | ||
+ | |||
+ | Or if in lab46: | ||
+ | 1. Copy the file to ~/ | ||
+ | |||
+ | < | ||
+ | |||
+ | 2. Change current directory to ~/ | ||
+ | |||
+ | < | ||
+ | |||
+ | 3. Change permissions to be able to be read by all | ||
+ | |||
+ | < | ||
+ | |||
+ | 4.view image from web browser | ||
+ | |||
+ | < | ||
=====LIBGD FUNCTIONALITY===== | =====LIBGD FUNCTIONALITY===== | ||
Line 19: | Line 50: | ||
< | < | ||
black = gdColorAllocate (image, 0x00, 0x00, 0x00);</ | black = gdColorAllocate (image, 0x00, 0x00, 0x00);</ | ||
+ | |||
+ | '' | ||
+ | |||
+ | so if <color # | ||
+ | |||
+ | and <color # | ||
+ | |||
+ | you will get <color # | ||
+ | |||
+ | |||
====DRAWING A LINE==== | ====DRAWING A LINE==== | ||
Line 31: | Line 72: | ||
====FILLING AN ENCLOSED SPACE==== | ====FILLING AN ENCLOSED SPACE==== | ||
+ | Basically the Fill bucket from any drawing software. | ||
+ | You specify where the coordinates of the fill is (another way of thinking is that the coordinates is specifying where the " | ||
+ | |||
+ | < | ||
====DRAWING A FILLED RECTANGLE==== | ====DRAWING A FILLED RECTANGLE==== | ||
+ | |||
+ | Syntax for drawing a graphics line | ||
+ | |||
+ | < | ||
+ | |||
+ | This will draw a solid rectangle of color | ||
====DRAWING A CIRCLE==== | ====DRAWING A CIRCLE==== | ||
+ | |||
+ | Syntax for a circle uses an arc command but the start angle is 0° and the end is 360° | ||
+ | (also the diameters are equal) | ||
+ | |||
+ | Arc syntax: | ||
+ | < | ||
+ | |||
+ | Circle Ex: | ||
+ | < | ||
====DRAWING AN ELLIPSE==== | ====DRAWING AN ELLIPSE==== | ||
+ | Syntax for an Ellipse | ||
+ | < | ||
+ | (could also be used for a circle) | ||
+ | |||
+ | Syntax for an Filled Ellipse | ||
+ | < |