Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hot to read a pixel color from screen (banks)?

Status
Not open for further replies.

GuyZana

Programmer
Jan 14, 2002
11
IL
Please let me know
i defined 800x600 Svga 256 colors mode.

Thanks,
Guy Zana
 
May be you should post some more details about the environment. Any way, this is how u do it on DOS. Take a char far pointer, put the base address of the display buffer and you are all set! for SVGA cards, the starting address is 0xA000000l; (mind u, its 'L' in lower case at the end, not 1 (one))
Code:
char far *scrPtr=(char far*)0xA0000000l;
long scrIdx=0;

printf("\nColor of the TOP LEFT pixel is %d",*scrPtr);

//filling the screen blue.

for(scrIdx=0;scrIdx<480000;scrIdx++)
       scrPtr[scrIdx]=(char)55;

similar approach would be there for other OS. Its also possible that functions are available for doing this job. I hope it was helpful.

have fun coding... ;-)

Roy
user.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top