[comp.os.msdos.programmer] DOS or MS C Graphics

v117gv8r@ubvmsb.cc.buffalo.edu (Thomas E Burnett) (03/14/91)

Using MS Quick-C to put images on a screen there are 5 modes available:
_GOR, _GXOR, _GAND, _GPSET, _GPRESET. Using some combination of these
 modes I would like to be able to put and move images (using two pages)
so that the image retains its original colors regardless of the background
that it is put on and then recover the background when the image is
moved or removed. For instance the image of an airplane moving over
farmland. 
	Can anyone tell me how to do this using the QC _putimage()
function?
				Thanx,
				Thom

everett@hpcvra.cv.hp.com. (Everett Kaser) (03/19/91)

 v117gv8r@ubvmsb.cc.buffalo.edu (Thomas E Burnett) / 12:17 pm  Mar 13, 1991 /
>Using MS Quick-C to put images on a screen there are 5 modes available:
>_GOR, _GXOR, _GAND, _GPSET, _GPRESET. Using some combination of these
> modes I would like to be able to put and move images (using two pages)
>so that the image retains its original colors regardless of the background
>that it is put on and then recover the background when the image is
>moved or removed. For instance the image of an airplane moving over
>farmland. 
>Can anyone tell me how to do this using the QC _putimage() function?
>	Thom

About the only way to do this on PC display hardware is to read the current
background image (using _getimage()) into a scratch save buffer, then use
_putimage(,,,_GPSET) to force your new image onto the screen.  Then, when
you want to move your image, you first use _putimage(,,,_GPSET) to replace
the previous background image (using the saved image from the scratch buffer)
and then repeating the previous _getimage()/_putimage() at the new location.

Everett Kaser                   Hewlett-Packard Company
...hplabs!hp-pcd!everett        work: (503) 750-3569   Corvallis, Oregon
everett%hpcvra@hplabs.hp.com    home: (503) 928-5259   Albany, Oregon

eversole@acae037.cadence.com (Richard Eversole; x6239) (03/22/91)

In article <31600013@hpcvra.cv.hp.com.>, everett@hpcvra.cv.hp.com. (Everett Kaser) writes:
|> 
|> About the only way to do this on PC display hardware is to read the current
|> background image (using _getimage()) into a scratch save buffer, then use
|> _putimage(,,,_GPSET) to force your new image onto the screen.  Then, when
|> you want to move your image, you first use _putimage(,,,_GPSET) to replace
|> the previous background image (using the saved image from the scratch buffer)
|> and then repeating the previous _getimage()/_putimage() at the new location.

That will only work if the images involved are rectangular. You need to 
use a mask and GPXOR it first then GPAND the real image. You still have to
save the original background. Be careful about moving the image only a small
amount where the next image overlaps the last image. restore background,
get new back ground, xor mask, and the image.


-- 
  
  =====================================================================

    eversole@cadence.com
  
    Live long and prosper !

everett@hpcvra.cv.hp.com. (Everett Kaser) (03/26/91)

 eversole@acae037.cadence.com (Richard Eversole; x6239) writes...
} everett@hpcvra.cv.hp.com. (Everett Kaser) writes:
}|> About the only way to do this on PC display hardware is to read the current
}|> background image (using _getimage()) into a scratch save buffer, then use
}|> _putimage(,,,_GPSET) to force your new image onto the screen.  Then, when
}|> you want to move your image, you first use _putimage(,,,_GPSET) to replace
}|> the previous background image (using saved image from the scratch buffer)
}|> and then repeating the previous _getimage()/_putimage() at new location.
}
}That will only work if the images involved are rectangular. You need to 
}use a mask and GPXOR it first then GPAND the real image. You still have to
}save the original background. Be careful about moving the image only a small
}amount where the next image overlaps the last image. restore background,
}get new back ground, xor mask, and the image.

You're absolutely right, Richard, what I described won't work.  In my haste,
I mistakenly forgot how to do it :-(.  What I actually intended to say was to
save the old region (indeed rectangular), use a NOT mask to with the
_putimage(,,,GPAND) call to erase the non-rectangular area for your image to
be drawn within, then use _putimage(,,,GPOR) to OR your non-rectangular image
into that blank hole.  Then, for motion, proceed in  a loop, replacing the
old screen contents and repeating the _getimage()/_putimage(mask,GPAND)/_put-
image(image,GPOR) at the new location(s).  Sorry for the confusion (mine).

Everett Kaser                   Hewlett-Packard Company
...hplabs!hp-pcd!everett        work: (503) 750-3569   Corvallis, Oregon
everett%hpcvra@hplabs.hp.com    home: (503) 928-5259   Albany, Oregon