createImage()
Purpose
Create an image
Description
Create an image of the specified size and type which can then be drawn onto
Syntax
handle = createImage( width, height, filter, type )
Arguments
handle Variable which stores the desired image file
width Desired on-screen width in pixels
height Desired on-screen height in pixels
filter Sets filtering on (true) or off (false) - generally on for real images and off for pixel art
type The type of the image: image_rgb for 24 bits per pixel, image_rgba for 32bpp with alpha channel, image_rgb_hdr for 48bpp, image_rgba_hdr for 64 bpp with alpha channel
Example
w = 200
// Create a tile
img = createImage( w, w, true, image_rgb )
setDrawTarget( img )
box( 0, 0, w, w, red, 0 )
box( 0, w/2, w - 1, w / 2, white, 1 )
line( { w / 2 }, { w / 2, w / 2 }, white )
// draw tiles on the screen
setDrawTarget( frameBuffer )
for y = 1 to gHeight() step w loop
for x = 1 to gWidth() step w loop
drawImage( img, x, y, 1 )
update()
sleep( 0.2 )
repeat
repeat
sleep( 3 )
Associated Commands
clear(), drawImage(), drawImageEx(), drawQuad(), drawSheet(), loadImage(), update(), uploadImage()