Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

SANJIVANI K. B. P.

POLYTECHNIC, KOPARGAON
With NBA ACCREDIATED programs , Approved by AICTE, New Delhi,
Recognized by Govt. of Maharashtra, Affiliated to Maharashtra State Board of Technical Education, Mumbai,
ISO 9001:2015 Certified Institute

Department:- Computer Technology Class:- SY CO

Name of Subject:- Computer Graphics MSBTE Subject Code:-


22318
Graphics Mode and Text mode

• There are basically two types of


graphics modes namely, Text mode,
and Graphics mode.
• There are different graphics
functions available in these two
modes useful for drawing different
effective texts and different types of
geometric shapes.

Sanjivani K.B.P. Polytechnic, Kopargaon Department of Computer Engg A. L. Deokate


4.2. Text Mode

• In text mode, a display screen is divided into rows and columns of


boxes. Each can contain one character. Text mode is also called
character mode.
• All video standards support a text mode that divides the screen into
25 rows and 80 columns.
• Text mode is also known as Character mode or Alphanumeric mode.

Sanjivani K.B.P. Polytechnic, Kopargaon Department


of Computer Engg A. L. Deokate
4.1.1. Text mode graphics function

1) Window( ):- This function specifies a window on screen. The four integer co-
ordinates of the window are passed as parameters to this function.
Syntax- window(left, top, right, bottom);
2) putch( ): It displays a single character at cursor position.
Syntax – putch( char);
Example- putch(‘A’);
Displays character A at specified cursor position.
3) clrscr( ): It clears the entire screen and locates the cursor in top left corner of
screen i.e(1,1).
Syntax – clrscr( );
Sanjivani K.B.P. Polytechnic, Kopargaon Department
of Computer Engg A. L. Deokate
• 4) gotoxy( ): It positions the cursor to the specified location on screen, where
location is specified by x, y co-ordinates of the point.
• Syntax – gotoxy(x, y);
• Where x, y are co-ordinates of a point where cursor is to be positioned.
• Example: gotoxy(3, 4);
• It positions cursor to 3rd row, 4th column.
• 5) puts( ): It display string at cursor position.
• Syntax – puts(s1);
• Where, s1 is string to be displayed at specified cursor position. For puts( ) and
putch( ) functions, gotoxy( ) can be used.
Sanjivani K.B.P. Polytechnic, Kopargaon Department
of Computer Engg A. L. Deokate
• Example: gotoxy(3, 4);
• puts(“Hello”);
• gotoxy(10,10);
• putch(‘A’)
• Here, Hello is displayed starting from the position 3,4 and ‘A’ is
displayed at 10,10.
• 6) textcolor( ): It sets the colour for the text. Any text displayed after
this command will be displayed in a colour specified by this
command. The supported colours are numbered from 0 to 15.
Sanjivani K.B.P. Polytechnic, Kopargaon Department
of Computer Engg A. L. Deokate
Colour constant Colour name
0 BLACK
1 BLUE
2 GREEN
3 CYAN
4 RED
5 MAGENTA
6 BROWN
7 LIGHT GRAY
8 DARK GRAY
9 LIGHT BLUE
10 LIGHT GREEN
11 LIGHT CYAN
12 LIGHT RED
13 LIGHT MAGNETA
14 YELLOW
15 WHITE
128 BLINK

Sanjivani K.B.P. Polytechnic, Kopargaon Department


of Computer Engg A. L. Deokate
 Syntax: textcolor (color);
 Example: textcolor(‘GREEN’);
 Is equivalent to
 int col= 2;
 textcolor(col);
 Above both codes displays subsequent texts in green colour.
 7) deline( ): It delets a line specified by cursor position. After deletion, all subsequent lines will be
pushed up by one line.
 Syntax: deline( );
 Example: gotoxy(8, 4);
 delline( );
 Above statement delets 8th line.
Sanjivani K.B.P. Polytechnic, Kopargaon Department
of Computer Engg A. L. Deokate
• 8) inline( ): It inserts a blank line at current cursor position.
• Syntax: inline( );
• Example : gotoxy(8, 4);
• inline( );
• It inserts a line at 8th row.
• 9) textbackgroud( ): It changes background colour of text. The valid
colour for CGA(Color Graphics Adapter) are from 0 to 6. They are:

Sanjivani K.B.P. Polytechnic, Kopargaon Department


of Computer Engg A. L. Deokate

Constant Colour Name
0 BLACK
1 BLUE
2 GREEN
3 CYAN
4 RED
5 MAGENTA
6 BROWN

Sanjivani K.B.P. Polytechnic, Kopargaon Department


of Computer Engg A. L. Deokate
Syntax: textbackground(color);
Example : int col = 4
textbackground(col);
It sets text’s background colour to red
10) moveto( ): It moves cursor to the location specified by int(x, y) co- ordinates.
Syntax: moveto(x, y);
11) outtextxy( ): (“sentence”)
OR
Outtextxy(x, y, “sentence”)
Where, x, y gives co-ordinates of a point where from to display text.
It displays text within quotation mark at specified position and with latest setcolour style.

Sanjivani K.B.P. Polytechnic, Kopargaon Department of Computer Engg A. L. Deokate

You might also like