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
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