Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_putimage() retrieve and display a screen image</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _putimage()             Retrieve and display a screen image

 #include   <graph.h>

 void far _putimage( x, y, image, action );
  short x, y        Upper-left corner of image
  char far *image;  Memory location of stored image
  short action;     Interaction with existing screen image

    _putimage() displays the screen image stored in the location that
    image points to, putting the upper-left corner of the rectangular
    image at the logical point (x, y).

    The action argument defines the interaction between the stored image
    and the one already on the screen, using one of the following
    manifest constants defined in graph.h:

    Constant     Meaning
    ---------    -------------------------------------------------
    _GAND        Transfers the image over an existing image on the
                 screen. The resulting image is the logical-AND
                 product of the two images: points that had the
                 same color in both the existing image and the
                 new one will remain the same color, while points
                 that have different colors are ANDed together.

    _GOR         Superimposes the image onto an existing image.
                 The new image does not erase the previous screen
                 contents.

    _GPRESET     Transfers the data point-by-point onto the screen.
                 Each point has the inverse of the color attribute
                 it had when it was taken from the screen by
                 _getimage(), producing a negative image.

    _GPSET       Transfers the data point-by-point onto the screen.
                 Each point has the exact color attribute it had
                 when it was taken from the screen by _getimage().

    _GXOR        Causes the points on the screen to be inverted
                 where a point exists in the image buffer. This
                 behavior is exactly like that of the cursor:
                 when an image is put against a complex background
                 twice, the background is restored unchanged. This
                 allows you to move an object around without erasing
                 the background. The _GXOR constant is a special
                 mode often used for animation.

   Portability:     MS-DOS only, true MDPA, CGA, EGA, MCGA, or VGA video
                    compatibles

 -------------------------------- Example ---------------------------------

    This program draws a pie-shape, stores it in memory, retrieves it,
    and displays it in a second location.

           #include <stdio.h>
           #include <graph.h>
           #include <malloc.h>
           #include <conio.h>

           char far *image;

           main()
           {
              int xvar, yvar;

              _setvideomode( _MRES4COLOR );
              _pie( _GFILLINTERIOR, 90, 60, 250, 160, 250, 22, 10, 160 );

              image = (char far *) malloc( (unsigned int)
                                        _imagesize( 90, 60, 250, 160 ) );
              if ( image == (char far *) NULL )
                 exit(-1);
              _getimage( 90, 60, 250, 160, image );
              _putimage( 0, 0, image, _GOR );

              free((char *) image);

              while ( !kbhit() );
              _setvideomode( _DEFAULTMODE );
           }


See Also: _getimage() _imagesize() _getvideoconfig()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson