To Plot Point Pixel on Screen in cpp using computer graphics library.In this code initialize graphics Library  make background to white we find center position in X axis,& Y axis.Now we put pixel in center positions.

Code

#include<graphics.h>
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
void get_driver(){
   int gDriver=DETECT,gMode;  // define variables
   initgraph(&gDriver,&gMode,"c:\\tc\\bgi");  // initialize graphics Library
   setbkcolor(15);  // make background to white
}

void main(){
   get_driver();// To make function of define drivers
   int dx,dy,x,y; //define variables
   x = abs(getmaxx()/2);  // To get center on x axis
   y = abs(getmaxy()/2); // To get center on y axis
   putpixel(x,y,4);  //for put pix
   getch(); // getch used to hold program execution
}

OUTPUT

Point-Pixel-on-Screen
Point-Pixel-on-Screen

 

(Visited 4,054 times, 1 visits today)
Share with Friends :
Written by:

One thought on “To Plot Point Pixel on Screen

  • 18/08/2018 at 8:35 pm
    Permalink

    I spent a lot of time to locate something similar to this

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *