qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GET, PUT Statements (Graphics)
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
GET captures a graphics screen image. PUT displays an image captured by GET.
 
GET [STEP](x1!,y1!)-[STEP](x2!,y2!), arrayname[(index%)]
PUT [STEP] (x1!,y1!), arrayname[(index%)] [,actionverb]
 
    ■ STEP          Specifies that coordinates are relative to the current
                    graphics cursor position.
    ■ (x1!,y1!)     The upper-left coordinates of the image captured by GET
                    or of the screen location where PUT displays the image.
    ■ (x2!,y2!)     The lower-right coordinates of the captured image.
    ■ arrayname     The name of the array where the image is stored.
                    See Screen Image Arrays and Compatibility to determine
                    the required size of the array.
    ■ index%        The array index at which storage of the image begins.
    ■ actionverb    A keyword indicating how the image is displayed:
 
                    Keyword    Action
                    ═══════    ═════════════════════════════════════════════
                    AND        Merges stored image with an existing image.
                    OR         Superimposes stored image on existing image.
                    PSET       Draws stored image, erasing existing image.
                    PRESET     Draws stored image in reverse colors, erasing
                               existing image.
                    XOR        Draws a stored image or erases a previously
                               drawn image while preserving the background,
                               producing animation effects.
 
    ■ A PUT statement should always be executed in the same screen mode as
      the GET statement used to capture the image, or a compatible mode.
      See Screen Image Arrays and Compatibility.
 
Example:
    'This example requires a color graphics adapter.
    SCREEN 1
    DIM Box%(1 TO 200)
    x1% = 0: x2% = 10: y1% = 0: y2% = 10
    LINE (x1%, y1%)-(x2%, y2%), 2, BF
    GET (x1%, y1%)-(x2%, y2%), Box%
    DO
        PUT (x1%, y1%), Box%, XOR
        x1% = RND * 300
        y1% = RND * 180
        PUT (x1%, y1%), Box%
    LOOP WHILE INKEY$ = ""
 
See Also    SCREEN    Screen Modes