GRAPHIC STRETCH statement  

Purpose

Copy and resize a bitmap to the selected graphic target.

Syntax

GRAPHIC STRETCH hBmp, ID, (x1,y1)-(x2,y2) TO (x3,y3)-(x4,y4) [, Mix, Stretch]

GRAPHIC STRETCH PAGE hBmp, ID [, 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 handle variable hBmp specifies the handle of the source bitmap, control, or window.  The parameter ID is the control identifier (1 to 65535) assigned with the CONTROL ADD GRAPHIC.  ID must be zero (0) for a GRAPHIC WINDOW or a GRAPHIC BITMAP.  The destination of the stretch operation is always the attached graphic target.  The bitmap is automatically resized to fit the destination parameters. You must use care that your parameters are valid for the specified bitmap, or the result of the operation is undefined.

The second form, GRAPHIC STRETCH PAGE, is a shortcut for copying a complete bitmap to the clip or client area of the selected graphic target.  The image is automatically stretched or condensed to fit the target appropriately.

Mix

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

%mix_Blackness

Pixel is always 0 (black).

%mix_NotMergeSrc

Pixel is the inverse of the MergeSrc color.

%mix_MaskNotSrc

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

%mix_NotCopySrc

Pixel is the inverse of the pen color.

%mix_MaskSrcNot

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

%mix_Not

Pixel is the inverse of the pixel color.

%mix_XorSrc

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

%mix_NotMaskSrc

Pixel is the inverse of the MaskSrc color.

%mix_MaskSrc

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

%mix_NotXorSrc

Pixel is the inverse of the XorSrc color.

%mix_Nop

Pixel remains unchanged.

%mix_MergeNotSrc

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

%mix_CopySrc

Pixel is the source color (default).

%mix_MergeSrcNot

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

%mix_MergeSrc

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

%mix_Whiteness

Pixel is always 1 (white).

Stretch

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.

Equate

Value

Description

%BLACKONWHITE

1

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

2

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

%COLORONCOLOR

3

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

%HALFTONE

4

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 COPY, GRAPHIC IMAGELIST, GRAPHIC RENDER, GRAPHIC SET STRETCHMODE