Navigation:  ThinBASIC Modules > UI (User Interface) > Additional Controls and Functions > Canvas Control >

Canvas_BitmapLoad

Previous pageReturn to chapter overviewNext page

 

Description

 

Create a memory bitmap and load an image into it.

 

Syntax

 

hBmp = Canvas_BitmapLoad(FileName, width, height [, Stretch])

 

Returns

 

Number

If the bitmap creation is successful, the bitmap handle is assigned to the variable hBmp.

If not successful, hBmp is set to zero.

 

Parameters

 

Name

Type

Optional

Meaning

FileName

String

No

Full path of the bitmap image to load

Width

Number

No

Bitmap width

The parameters Width and Height specify the width and height of the bitmap, in pixels. If either of the size parameters are zero (0), the bitmap is loaded at its natural size. If either of the size parameters is different from the natural size, the bitmap is stretched or condensed to the requested size

Height

Number

No

Bitmap height

The parameters Width and Height specify the width and height of the bitmap, in pixels. If either of the size parameters are zero (0), the bitmap is loaded at its natural size. If either of the size parameters is different from the natural size, the bitmap is stretched or condensed to the requested size

Stretch

Number

Yes

If present, one of the following equates:

 

%Canvas_BLACKONWHITEThis is the default Windows stretch mode, and is most appropriate for monochrome bitmaps, or those with blocks of color. Performs a boolean OR of eliminated and existing pixels. It preserves black pixels at the expense of white pixels.
%Canvas_WHITEONBLACKPerforms a boolean OR of eliminated and existing pixels.  It preserves white pixels at the expense of black pixels.
%Canvas_COLORONCOLORDeletes eliminated lines of pixels without trying to preserve their information.
%Canvas_HALFTONEThis provides the highest quality for complex color bitmaps.  The average color of the destination pixel block is kept approximately the same as the source pixel block.

 

Remarks

 

Creates a new memory bitmap, which may be manipulated and drawn just as if it were a Canvas Window, except that it is not visible.

 

The parameters Width and Height specify the width and height of the bitmap, in pixels. If either of the size parameters are zero (0), the bitmap is loaded at its natural size. If either of the size parameters is different from the natural size, the bitmap is stretched or condensed to the requested size

 

Restrictions

 

When you are finished using this memory bitmap, you must delete it with Canvas_BitmapEnd.

 

See also

 

Examples