Submitted by yogesh on Thu, 25/08/2011 - 14:01
Declaration:
void setlinestyle( int linestyle, unsigned upattern, int thickness );
Available line styles:
Submitted by yogesh on Fri, 03/06/2011 - 14:33
Following colors are available for use in c graphics programming.
Colors table
| Color |
Value |
| BLACK |
0 |
| BLUE |
1 |
| GREEN |
2 |
| CYAN |
3 |
| RED |
4 |
| MAGENTA |
5 |
| BROWN |
6 |
| LIGHTGRAY |
7 |
| DARKGRAY |
8 |
| LIGHTBLUE |
9 |
| LIGHTGREEN |
10 |
| LIGHTCYAN |
11 |
Submitted by yogesh on Sat, 19/02/2011 - 10:03
getimage function saves a bit image of specified region into memory, region can be any rectangle.
Declaration:- void getimage(int left, int top, int right, int bottom, void *bitmap);
getimage copies an image from screen to memory. Left, top, right, and bottom define the area of the screen from which the rectangle is to be copied, bitmap points to the area in memory where the bit image is stored.
Smiling face animation program using getimage.
Submitted by yogesh on Sat, 19/02/2011 - 09:43
moverel function moves the current position to a relative distance.
Declaration :- void moverel(int x, int y);
Submitted by yogesh on Sat, 19/02/2011 - 09:11
Linerel function draws a line from the current position(CP) to a point that is a relative distance (x, y) from the CP, then advances the CP by (x, y). You can use getx and gety to find the current position.
C programming code for linerel
#include <graphics.h>
#include <conio.h>
main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
moveto(250, 250);
Submitted by yogesh on Fri, 18/02/2011 - 21:24
Sector function draws and fills an elliptical pie slice.
Declaration :- void sector( int x, int y, int stangle, int endangle, int xradius, int yradius);
Submitted by yogesh on Thu, 17/02/2011 - 21:49
graphdefaults function resets all graphics settings to their defaults.
Declaration :- void graphdefaults();
It resets the following graphics settings :-
- Sets the viewport to the entire screen.
- Moves the current position to (0,0).
- Sets the default palette colors, background color, and drawing color.
- Sets the default fill style and pattern.
- Sets the default text font and justification.
C programming source code for graphdefaults
#include <graphics.h>
#include <conio.h>
main()
{
int gd = DETECT, gm;
Submitted by yogesh on Thu, 17/02/2011 - 16:56
imagesize function returns the number of bytes required to store a bitimage. This function is used when we are using getimage.
Declaration:- unsigned int imagesize(int left, int top, int right, int bottom);
C programming code for imagesize
#include <graphics.h>
#include <conio.h>
main()
{
int gd = DETECT, gm, bytes;
char array[100];
initgraph(&gd, &gm, "C:\\TC\\BGI");
circle(200, 200, 50);
line(150, 200, 250, 200);
line(200, 150, 200, 250);
Submitted by yogesh on Wed, 16/02/2011 - 20:49
getdrivername function returns a pointer to the current graphics driver.
Submitted by yogesh on Tue, 15/02/2011 - 22:24
Fillpoly function draws and fills a polygon. It require same arguments as drawpoly.
Declaration :- void drawpoly( int num, int *polypoints );
For details of arguments see drawpoly.
fillpoly fills using current fill pattern and color which can be changed using setfillstyle.
Pages