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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read pixel color (DOS)? ATI adapter

Status
Not open for further replies.

GuyZana

Programmer
Jan 14, 2002
11
0
0
IL
hi all, it's me again, i thought that after i posted my first message i will be fulled with answers from you and than i will solve my problem, well it didn't happen so i will describe again my problem, this time in details:

well,
i'm doing a software (17,000 lines untill now) that works in SVGA 800x600 256 colors mode (using banks) and i need to save the background and than drawing it back again, i made the algorithem for saving the background (if you want it notify me) anyway, my problem is this:

i need to read a pixel color from the screen at specified coord (x,y) to do so i build this function (2 ways):

(1)
int get_pixel(int x, int y)
/* Function reads a pixel from the screen *
* from coordinates x,y (the offset) *
* and returning the pixel color */
{
int color;
int bits_per_pixel = 8; // 2^8 = 256 colors
long offset = ((long)y*SCREEN_WIDTH+(long)x)*(bits_per_pixel>>3);
setbank(offset>>16);
color=(*(video_buffer+offset))*(bits_per_pixel>>3);
return(color);
}


(2)
int get_pixel(int x, int y)
{
asm {
mov ah, 0dh
mov bh, 0
mov cx, x
mov dx, y
int 10h
}

return(_AL);
}


in both ways the function works but only at non-ati adapters, if i'm calling the function at a computer that has an ati adapter i'm getting colors only from the first segment at screen.

i have checked these function at home (i've got voodoo) and it works.

if you know other ways to read a pixel color please tell me or if you have any suggestion for how to solve this problem please replay.

thanks from advanced,
Guy Zana
 
Just a thought. Is the ATI an interlaced card??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top