Pic.DrawPart of Pic module

Syntax   Pic.Draw (picID, x, y, mode : int)

Description   Pic.Draw is used to draw a picture on the screen. The picture is drawn with the lower left corner at (x, y).

The mode parameter has one of the following values:

picCopy   This draws the picture on top of what was underneath, obscuring it completely.
picXor   This draws the picture XORing it with the background. In DOS, you can use this function to do animation. Drawing an object on top of itself with XOR erases it and restores the background.
picMerge   This draws the picture like picCopy except that any occurrence of the background color in the picture is not drawn to the screen. This allows you to draw an irregularly-shaped object and draw it to the screen.
picUnderMerge   This draws the picture, but only where the background color was displayed underneath it. The effect of this is to make the picture appear to be displayed behind the background.


Details   If the Pic.Draw call fails, Error.Last will return a non-zero value indicating the reason for the failure. Error.LastMsg will return a string which contains the textual version of the error.

Display Modes with Pic.Draw

Example   The program draws a graphic on the screen and then repeats it 50 times in random positions.

        var picID: int
        var x, y : int
        Draw.FillBox (50, 50, 150, 150, red)
        Draw.FillStar (50, 50, 150, 150, green)
        Draw.FillOval (100, 100, 30, 30, blue)
        picID := Pic.New (50, 50, 150, 150)
        for i : 1 .. 50
            x := Rand.Int (0, maxx)     % Random x
            y := Rand.Int (0, maxy)     % Random y
            Pic.Draw (picID, x, y, picCopy)
        end for
        Pic.Free (picID)

Status   Exported qualified.

This means that you can only call the function by calling Pic.Draw, not by calling Draw.

See also   View.Update for information on how to produce smooth animation.

Pic.DrawSpecial for information on how to make pictures appear using special effects such as wipes and slides.

Pic.DrawFrames for information on how to display multiple frame images such as are obtained from GIF files.