PUTIMAGE

From QB64 Wiki
Revision as of 02:00, 11 November 2009 by imported>Cyperium (Created page with '_PUTIMAGE puts an area of a source image to an area of a destination image. ''Syntax:'' _PUTIMAGE [(srcx,srcy)][-(srcx2,srcy2)],[srchandle][,desthandle][,(destx,desty)][-(destx…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

_PUTIMAGE puts an area of a source image to an area of a destination image.


Syntax: _PUTIMAGE [(srcx,srcy)][-(srcx2,srcy2)],[srchandle][,desthandle][,(destx,desty)][-(destx2,desty2)]


srcx = the x coordinate of the leftmost pixel to include of the source.

srcy = the y coordinate of the uppermost pixel to include of the source.

srcx2 = the x coordinate of the rightmost pixel to include of the source.

srcy = the y coordinate of the downmost pixel to include of the source.

srchandle = the handle of the source image (may be created with _NEWIMAGE).

desthandle = the handle of the destination image (may be created with _NEWIMAGE).

destx = the x coordinate of the leftmost pixel to begin the insertion of the source image.

desty = the y coordinate of the uppermost pixel to begin the insertion of the source image.

destx2 = the x coordinate at which the insertion will end - rightmost pixel.

desty2 = the y coordinate at which the insertion will end - downmost pixel.


If the area of the source is bigger or smaller than the area of the destination then the image is stretched to fit the area.



Example:

SCREEN 13
a = _NEWIMAGE(640,200,13) 'creates a 640*200 image with handle a
_DEST a 'makes image a the default drawing output.
LINE(10, 10)-(20, 20), 15, BF 'draws a filled box (BF) into destination
_PUTIMAGE (0, 0)-(320, 200), a, 0, (0, 0)-(320, 200)


Explanation:

A graphics mode is set by using SCREEN 13
A new image is created that is 640*200 big and uses the palette compatible with screen 13 (256 colours)
_DEST a makes the image with handle 'a' the default image to draw on instead of the screen (which is 0)
Next a filled box (BF) is drawn from 10,10 to 20,20 with white colour (15) to the destination image (set by _DEST a)
Now we put the image from 0,0 to 320,200 from the image with the handle 'a' to the screen (always handle 0) and puts this image into the coordinates 0,0 to 320,200. If we want to stretch the image we can alter these coordinates (do try this!)


Note: All arguments are optional. If you want to simply put the whole image of the source to the whole image of the destination then you omit the area (x,y)-(x2,y2) on both sides.



See also: _NEWIMAGE, _DEST, _SOURCE, _COPYIMAGE


Navigation:

Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage