Computer Graphics Point
Computer Graphics Point
Lecture 03
Point
Pixel
Higher resolution:
– sharper, clearer picture, with less pronounced
‘staircase’ effect on lines drawn diagonally and better
looking text characters
– more memory requirement for the display
Text and Graphics Modes
Video BIOS
Writing Pixel Using Video BIOS
asm {
MOV AH,0
MOV AL,13h;;mode number from 0-19
INT 10h
}
Description of Source Code
Accessing Video
Memory directly
Writing pixel by accessing Video
Memory directly
So far we used BIOS to draw pixel.
Now we will draw pixel by accessing direct pointer to the
video memory and write color value
Writing pixel by accessing Video
Memory directly
Steps to write pixel directly (without using BIOS):
Set video mode by using video BIOS routine as discussed
earlier
Set any pointer to the video graphics memory address
0x0A000
Now write any color value in the video memory address
Direct Graphics Memory Access
Example:
Mov ax,0a000h ;starting address of memory
Work to do:
Write pixel at 12th row and 15th column
Hint: use formula (row * 320 + column) in si register
Writing Character Directly on Screen
Library Functions
Using Library Functions
if (errorcode != grOk)
/* an error occurred */
{
}
Using Library Functions
/* draw a pixel on 10th row and 10 column */
putpixel(10, 10, BLUE);
/* clean up */
closegraph();
Steps, Example in C language
First call Initgraph() function
then call putpixel() function to draw pixel on screen
then use closegraph() function
Discussion on Pixel drawing Methods