[comp.lang.pascal] Saving screen images to disk, can y

mccaugh@s.cs.uiuc.edu (08/22/89)

It would seem that the built-in Procedures:

             GetImage (x1,y1, x2,y2: word;  VAR bit_map: untyped)
                where:
                       x1,y1 and x2,y2 define the rectangle of screen to save
                  and: bit_map is any heap-storage for holding the image

                example: VAR  p: pointer;
                       BEGIN
                          (* size of image = height*width + 4 *)
                          (* (area(rectangle) + two words for ht, wdth *)
                          GetMem(p, (x2-x1+1)*(y2-y1+1) + 4);
                          GetImage(x1,y1, x2,y2, p^)
                       END; (* now, p ==> block holding image *)


               PutImage (x,y: integer;  VAR bit_map: untyped;  bit_blt: word)

                  where: x,y are upper-left corner on screen where image goes
                    and: bit_map is our stored image
                         bit_blt is the pattern of how to display it
                                           (default: NormalPut)

                example: PutImage(x,y, p^, NormalPut)

                other values for bit_blt are:  XORPut
                                                ORPut
                                               ANDPut
                                               NOTPut
                                               

             

abcscnuk@csuna.csun.edu (Naoto Kimura) (08/26/89)

In article <208300009@s.cs.uiuc.edu> mccaugh@s.cs.uiuc.edu writes:
>
>It would seem that the built-in Procedures:
>
>	GetImage (x1,y1, x2,y2: word;  VAR bit_map: untyped)
>
> ... (text deleted) ...
>
>	PutImage (x,y: integer;  VAR bit_map: untyped;  bit_blt: word)
>

Make sure that you use the ImageSize function for finding out the
number of bytes to allocate for the buffer.  This way if you are using
a different mode or a different display, you won't have to allocate
more memory than necessary.  For those who want to know, the function
header is as follows:

	FUNCTION ImageSize( x1,y1, x2,y2 : Word ) : Word;

Be careful when you're some of the high resolution modes of some
displays because the amount of memory can exceed the 64K-15 byte limit.
In such cases, you'll have to save the graphics screen into several
smaller pieces.

                //-n-\\			 Naoto Kimura
        _____---=======---_____		 (abcscnuk@csuna.csun.edu)
    ====____\   /.. ..\   /____====
  //         ---\__O__/---         \\	Enterprise... Surrender or we'll
  \_\                             /_/	send back your *&^$% tribbles !!