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>_getimage() store a screen image in memory</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _getimage()             Store a screen image in memory

 #include   <graph.h>

 void far _getimage( x1, y1, x2, y2, image );
  short x1, y1;     Upper-left corner of bounding rectangle
  short x2, y2;     Lower-right corner of bounding rectangle
  char far *image;  Memory location for storing screen image

    _getimage() gets the screen image in the bounding rectangle defined
    by the logical coordinates (x1, y1) and (x2, y2) and stores it into
    the memory location that image points to.

         Notes:     The buffer that image points to must be large enough
                    to hold the image. The image size can be determined
                    at run time by calling _imagesize(), or by using the
                    following formula:

                    xwid = abs(x1-x2) + 1;
                    ywid = abs(y1-y2) + 1;
                    size = 4 + ((long) ((xwid*bits-per-pixel + 7) / 8) *
                    (long)ywid);

                    The bits-per-pixel value is returned by
                    _getvideoconfig() as the bitsperpixel member of
                    struct videoconfig.

   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: _putimage() _imagesize() _getvideoconfig()

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