GRAPHIC RENDER statement  

Purpose

Render an image on the selected graphic target.

Syntax

GRAPHIC RENDER [BITMAP | ICON] ImgName, (x1!, y1!)-(x2!, y2!)

Remarks

Renders an image (bitmap or icon), loaded from a resource or a disk file, on the selected graphic target.  The optional director word identifies whether the source is a Bitmap or an Icon.  If not specified, Bitmap is the default.

The parameter ImgName tells the name of the image.  If ImgName is a numeric resource ID, it can be given as a numeric expression or the string equivalent with a leading pound sign (e.g. "#10023"). Otherwise, the string resource ID or the file name is given as a string expression.  If the string name contains a period, it's presumed to be the name of a disk file.  Otherwise, an attempt is made to load it as a resource; if not found, it's presumed to be a disk file.

The parameters x1!, y1! define the upper left corner of the target rectangle, while x2!, y2! define the lower right corner of that rectangle.  If the target rectangle is larger or smaller than the original, the image is stretched or condensed to the requested size.

The following code will retrieve the natural size of an image in a bitmap file, in pixels:

nFile& = FREEFILE

OPEN "myimage.bmp" FOR BINARY AS nFile&

GET #nFile&, 19, nWidth&

GET #nFile&, 23, nHeight&

CLOSE nFile&

See also

GRAPHIC COPY, GRAPHIC GET STRETCHMODE, GRAPHIC SET STRETCHMODE, GRAPHIC STRETCH