Showing posts with label Graphics in C. Show all posts
Showing posts with label Graphics in C. Show all posts

Monday, May 9, 2011

Graphics in C


In a C Program first of all you need to initialize the graphics drivers on the computer. This is done using the initgraph method provided in graphics.h library.

Graphics mode Initialization:
initgraph() function is used to load the graphics drivers and initialize the graphics system. For every function, that uses graphics mode, graphics mode must be initialized before using that function.

void far initgraph(int far *driver, int far *mode, char far *path)

Function detectgraph:
Detectgraph function determines the graphics hardware in the system, if the function finds a graphics adapter then it returns the highest graphics mode that the adapter supports.

void far detectgraph(int far *driver, int far *mode)

Integer that specifies the graphics driver to be used. You can give graphdriver a value using a constant of the graphics_drivers enumeration type.

Graphic Mode:
Integer that specifies the initial graphics mode (unless *graphdriver = DETECT). If *graphdriver = DETECT, initgraph sets *graphmode to the highest resolution available for the detected driver. You can give *graphmode a value using a constant of the graphics_modes enumeration type.


Function closegraph:
This function shutdown the graphics mode and returns to the position it was before the initgraph function was called.
void far closegraph(void)


Example 1:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

void main()
{
    int gd=DETECT, gm;

    initgraph(&gd, &gm, "c:\\turboc\\bgi");
    circle(200,100,150);

    getch();

AngularJS Basics - Part 1

                                                                  AngularJS What is AngularJS ·          Framework by googl...