GET Statement (Graphics) ---------------------------------------------------------------------------- Action Stores graphic images from the screen. Syntax GET STEP( x1!, y1!) - STEP( x2!, y2!), arrayname( indexes%) Remarks The list below describes the parts of the GET statement. ----------------------------------------------------------------------------- Part Description ---------------------------------------------------------------------------- ( x1!, y1!),( x2!, y2!) Coordinates that mark a Part Description ---------------------------------------------------------------------------- ( x1!, y1!),( x2!, y2!) Coordinates that mark a rectangular area on the screen; an image within this rectangle will be stored. The x1!, y1!, x2!, and y2! are numeric expressions. The coordinates ( x1!, y1!) and ( x2!, y2!) are the coordinates of diagonally opposite corners of the rectangle. STEP Keyword indicating that coordinates are relative to the most recently plotted point. For example, if the last point plotted were (10,10), the actual coordinates referred to by STEP (5,10) would be (5+10,10+10) or (15,20). If the second coordinate pair in a GET statement has a Part Description ---------------------------------------------------------------------------- pair in a GET statement has a STEP argument, it is relative to the first coordinate pair in the statement. arrayname Name assigned to the array that holds the image. This array can be of any numeric type; its dimensions must be large enough to hold the entire image. indexes% Numeric constants or variables indicating the element of the array where the saved image starts. The GET statement transfers a screen image into the array specified by arrayname. The PUT statement, associated with GET, transfers the image stored in the array onto the screen. The following formula gives the required size of the array in bytes. size = 4 + INT((( x2! - x1! + 1) * ( bits-per-pixel-per-plane) + 7)-8) * planes * (( y2! - y1!) + 1) The bits-per-pixel-per-plane and planes values depend on the screen mode set by the SCREEN statement. The following table shows the number of bits-per-pixel-per-plane and the number of planes for each screen mode. ----------------------------------------------------------------------------- Screen mode Bits per pixel per plane Planes ---------------------------------------------------------------------------- 1 2 1 2 1 1 7 1 4 8 1 4 9 (64K of EGA memory) 1 2 9 (> 64K of EGA memory) 1 4 Screen mode Bits per pixel per plane Planes ---------------------------------------------------------------------------- 9 (> 64K of EGA memory) 1 4 10 1 2 11 1 1 12 1 4 13 8 1 The bytes per element of an array are as follows. - Two bytes for an integer array element. - Four bytes for a long-integer array element. - Four bytes for a single-precision array element. - Eight bytes for a double-precision array element. - Eight bytes for a currency array element. For example, suppose you wanted to use the GET statement to store an image in high resolution (SCREEN 2). If the coordinates of the upper-left corner of the image are (0,0), and the coordinates of the lower-right corner are (32,32), then the required size of the array in bytes is 4 + INT((33 * 1 + 7)-8) * 1 * (33), or 169. This means an integer array with 85 elements would be large enough to hold the image. Unless the array type is integer or long, the contents of an array after a GET operation appear meaningless when inspected directly. Examining or manipulating noninteger arrays containing graphics images may cause run-time errors. GET and PUT statements operating on the same image should be executed in matching screen modes. These modes can be either the same screen mode or any screen modes with the same values for planes and bits-per-pixel-per-plane. One of the most useful things that can be done with GET and PUT statements is animation. See Chapter 5, "Graphics" in the Programmer's Guide for a discussion of animation. See Also PUT (Graphics) Example See the BSAVE statement programming example, which uses the GET statement.