GRAPHIC STRETCH statement  

Purpose

Copy and resize a bitmap to the selected graphic target.

Syntax

GRAPHIC STRETCH hbmpSource???, id&, (x1!, y1!)-(x2!, y2!) TO (x3!, y3!)-(x4!,y4!) [, mix&, stretch&]

Remarks

You can copy a complete bitmap, or a portion of it, to the selected graphic target, while resizing it to a larger or smaller size.  The expression hbmpSource??? specifies the handle of the source bitmap, control, or window.  The expression id& is the unique control identifier in the range 1 to 65535, as assigned with the CONTROL ADD GRAPHIC statement.  id& must be 0 for a GRAPHIC WINDOW or a GRAPHIC BITMAP.  The destination of the copy operation is the target specified by GRAPHIC ATTACH.  The bitmap is automatically resized to fit the destination parameters.  You must use care that your parameters are valid for the specified bitmaps, or results of the operation are undefined.

If the mix& parameter is included, it is one of the values in the following table.  If not included, a default of %mix_CopySrc is presumed.  There are 8 mix modes available to use for mixing drawing colors with the colors which already exist at the at the drawing location.  The mix mode equates are predefined in PowerBASIC.

The 8 mix modes are:

%MIX_NOTMERGESRC

Pixel is the inverse of the MergeSrc color.

%MIX_NOTCOPYSRC

Pixel is the inverse of the source color.

%MIX_MASKSRCNOT

Pixel is a combination of the colors common to both the source and the inverse of the pixel.

%MIX_XORSRC

Pixel is a combination of the colors in the source and the pixel, but not in both.

%MIX_MASKSRC

Pixel is a combination of the colors common to both the source and the pixel.

%MIX_MERGENOTSRC

Pixel is a combination of the pixel color and the and the inverse of the source color.

%MIX_COPYSRC

Pixel is the source color (Default Mode).

%MIX_MERGESRC

Pixel is a combination of the source color and the pixel color.

If the stretch& parameter is included, it is one of the values in the following table.  If not included, or it is the value zero (0), the stretch mode is unchanged.  An appropriate choice of stretch mode can substantially enhance the quality of bitmaps which are changed in size. The stretch mode equates are predefined in PowerBASIC.

The 4 stretch modes are:

%BLACKONWHITE

This 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.

%WHITEONBLACK

Performs a boolean OR of eliminated and existing pixels.  It preserves white pixels at the expense of black pixels.

%COLORONCOLOR

Deletes eliminated lines of pixels without trying to preserve their information.

%HALFTONE

This 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.

See also

GRAPHIC ATTACH, GRAPHIC COPY, GRAPHIC IMAGELIST, GRAPHIC RENDER