C - GRAPHICS
Dr. Thamba Meshach W
HOD - CSE
GRAPHICS
It refers to any visual representation of data.
Example:
drawings, photographs, line art, graphs, diagrams,
numbers, symbols, geometric designs, maps, and
engineering drawings.
WHAT IS
C
GRAPHICS?
Graphics programming in C used to
• drawing various geometrical
shapes(rectangle, circle eclipse etc.),
• use of mathematical function in
drawing curves, coloring an object
with different colors and patterns
and simple animation programs like
jumping ball and moving cars.
4
SYNTAX
initgraph(int *gd, int *gm, char
*driverDirectoryPath);
The first parameter (gd) is a pointer to the graphics driver,
which is set to DETECT to detect the graphics driver
automatically.
The second parameter (gm) is the graphics mode, which
specifies the resolution and color depth of the screen.
The last parameter is a string that can be used to pass
additional arguments to the graphics driver.
5
APPLICATIONS
• Game development
• Computer-aided design (CAD)
• Visualization and data analysis
• Multimedia applications
• User interfaces
• Animation and special effects
6
ADVANTAGES
• Efficient memory management
• Cross-platform compatibility
• Visually appealing applications
• Availability of graphics libraries
• Low-level control for advanced graphics.
EXAMPLE: DRAW A LINE
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main() {
int gdriver = DETECT, gmode;
int x1 = 200, y1 = 200;
int x2 = 300, y2 = 300;
clrscr();
initgraph(&gdriver, &gmode, "c:turboc3bgi");
line(x1, y1, x2, y2);
getch();
closegraph();
}
THANK YOU
Questions & Answer

Graphics Using C Programming Language to

  • 1.
    C - GRAPHICS Dr.Thamba Meshach W HOD - CSE
  • 2.
    GRAPHICS It refers toany visual representation of data. Example: drawings, photographs, line art, graphs, diagrams, numbers, symbols, geometric designs, maps, and engineering drawings.
  • 3.
    WHAT IS C GRAPHICS? Graphics programmingin C used to • drawing various geometrical shapes(rectangle, circle eclipse etc.), • use of mathematical function in drawing curves, coloring an object with different colors and patterns and simple animation programs like jumping ball and moving cars.
  • 4.
    4 SYNTAX initgraph(int *gd, int*gm, char *driverDirectoryPath); The first parameter (gd) is a pointer to the graphics driver, which is set to DETECT to detect the graphics driver automatically. The second parameter (gm) is the graphics mode, which specifies the resolution and color depth of the screen. The last parameter is a string that can be used to pass additional arguments to the graphics driver.
  • 5.
    5 APPLICATIONS • Game development •Computer-aided design (CAD) • Visualization and data analysis • Multimedia applications • User interfaces • Animation and special effects
  • 6.
    6 ADVANTAGES • Efficient memorymanagement • Cross-platform compatibility • Visually appealing applications • Availability of graphics libraries • Low-level control for advanced graphics.
  • 7.
    EXAMPLE: DRAW ALINE #include<graphics.h> #include<stdio.h> #include<conio.h> void main() { int gdriver = DETECT, gmode; int x1 = 200, y1 = 200; int x2 = 300, y2 = 300; clrscr(); initgraph(&gdriver, &gmode, "c:turboc3bgi"); line(x1, y1, x2, y2); getch(); closegraph(); }
  • 8.