Canvas
- Function OpenCanvas(w, h, viewport_x, viewport_y, viewport_w, viewport_h, mode)
Returns a canvas for 2D drawing and text rendering.
- w, h - The full size of the canvas.
- viewport_x, viewport_y - Where to show the canvas in the window.
- viewport_w, viewport_h - The size of the viewport. For example, a 100 x 100 viewport means that no matter how big the canvas is, only an area of 100 x 100 pixels is displayed.
- mode - Set this to 0 for a solid canvas and 1 for a color keyed canvas.
See also
- Sub CloseCanvas(c_num)
Closes a canvas.
See also
- Function OpenCanvas3D(viewport_x, viewport_y, viewport_w, viewport_h, mode)
Returns a 3D Canvas for viewing the scene.
Returns -1 if canvas could not be created.
Note: Each 3D canvas has its own camera so you need to make sure you have the canvas active before doing anything with the camera.
Note: 2D drawing commands do not work on 3D canvases. You need to open a 2D canvas for drawing images.
See also
- Sub SetCanvasVisible(c_num, flag)
Sets whether a canvas is shown or not.
See also
- Function CanvasIsVisible(c_num)
Returns true if a canvas is shown in the Window.
See also
- Sub SetCanvasViewport(cnum, x, y, w, h)
Sets the position and size of a canvas viewport.
See also
- Sub GetCanvasViewport(c_num, byref x, byref y, byref w, byref h)
Gets the position and size of a canvas viewport.
See also
- Sub Canvas(c_num)
Sets the active canvas for drawing commands to use.
- Sub SetCanvasOffset(c_num, x, y)
Sets the offset of a canvas.
The canvas offset is what part of the canvas is visible during rendering.
See also
- Sub GetCanvasOffset(c_num, byref x, byref y)
Returns view offset of a canvas.
See also
- Sub GetCanvasSize(c_num, byref w, byref h)
Gets the size of a canvas.
- Sub ClearCanvas()
Clears the active drawing canvas.
NOTE: This is only for drawing canvases (ie. Those opened with OpenCanvas()).
- Sub SetCanvasAlpha(c_num, a)
Sets the alpha blending value for a canvas.
- Function GetCanvasAlpha(c_num)
Returns the alpha blend value of a canvas.
See also
- Sub SetCanvasColorMod(c_num, c)
Sets the color modulation value for a canvas.
- Function GetCanvasColorMod(c_num)
Returns the color modulation of a canvas.
See also
- Function CloneCanvas(c_num, mode)
Returns a clone of a canvas. Clone canvases are mirrors of the original canvas so when you draw to one it will also be on the other. This is useful for a splitscreen 2d game.
Mode is a canvas render mode like the one passed to OpenCanvas().
See also
- Sub SetCanvasZ(c_num, z)
Sets the Canvas Z Order.
Note: Canvases with a higher Z order are drawn first and those with lower values will be drawn on top.
See also
- Function CanvasZ(c_num)
Returns the Canvas Z Order.
Note: Canvases with a higher Z order are drawn first and those with lower values will be drawn on top.
See also
- Function CanvasClip(x, y, w, h)
Returns an image id with a selected portion of the active drawing canvas saved.
See also
- Function ActiveCanvas()
Returns the canvas that drawing commands are currently applied to.
c1 = OpenCanvas(640, 480, 0, 0, 640, 480, 0)
c2 = OpenCanvas(640, 480, 0, 0, 640, 480, 0)
Canvas(c1)
If ActiveCanvas() = c1 Then
Print "Active canvas is c1"
End If
Canvas(c2)
If ActiveCanvas() = c2 Then
Print "Active canvas is now c2"
End If
- Sub SetCanvasPhysics2D(c_num, state)
- Function OpenCanvasSpriteLayer(viewport_x, viewport_y, viewport_w, viewport_h)
Returns a sprite layer. These canvases are used for rendering sprites with the integrated physics engine.
Returns -1 if canvas could not be created.
Note: Sprite Layer must be active when creating sprites.
See also
- Sub SetSpriteCanvasBlendMode(c_num, blend_mode)
Sets the blend mode used to render sprites on the given sprite canvas.
Possible Blend Modes:
- BLEND_MODE_NONE
- BLEND_MODE_ADD
- BLEND_MODE_SUBTRACT
- BLEND_MODE_REVSUBTRACT
- BLEND_MODE_MIN
- BLEND_MODE_MAX
- BLEND_MODE_MIN_FACTOR
- BLEND_MODE_MAX_FACTOR
- BLEND_MODE_MIN_ALPHA
- BLEND_MODE_MAX_ALPHA
See also
SetCanvasBlendMode(),GetSpriteCanvasBlendMode()
- Function GetSpriteCanvasBlendMode(c_num)
Returns the blend mode used to render sprites on the sprite canvas.
Possible Blend Modes:
- BLEND_MODE_NONE
- BLEND_MODE_ADD
- BLEND_MODE_SUBTRACT
- BLEND_MODE_REVSUBTRACT
- BLEND_MODE_MIN
- BLEND_MODE_MAX
- BLEND_MODE_MIN_FACTOR
- BLEND_MODE_MAX_FACTOR
- BLEND_MODE_MIN_ALPHA
- BLEND_MODE_MAX_ALPHA
See also
- Sub SetSpriteCanvasAntiAliasMode(c_num, aa_mode)
Sets the anti-alias mode for a sprite canvas.
Possible modes:
- AA_MODE_OFF
- AA_MODE_SIMPLE
- AA_MODE_QUALITY
- AA_MODE_LINE_SMOOTH
- AA_MODE_POINT_SMOOTH
- AA_MODE_FULL_BASIC
- AA_MODE_ALPHA_TO_COVERAGE
See also
- Function GetSpriteCanvasAntiAliasMode(c_num)
Returns the anti-alias mode for a sprite canvas.
Possible modes:
- AA_MODE_OFF
- AA_MODE_SIMPLE
- AA_MODE_QUALITY
- AA_MODE_LINE_SMOOTH
- AA_MODE_POINT_SMOOTH
- AA_MODE_FULL_BASIC
- AA_MODE_ALPHA_TO_COVERAGE
See also
- Sub SetSpriteCanvasBilinearFilter(c_num, flag)
Enables or disables bi-linear filter for the sprite canvas.
See also
- Function GetSpriteCanvasBilinearFilter(c_num)
Returns the bi-linear filter flag for the sprite canvas.
See also
- Function SetSpriteCanvasRenderPriority(c_num, priority, order)
Sets the order sprites are rendered on a sprite canvas.
Returns False if canvas is not a valid canvas.
Possible priority values:
- SPRITE_PRIORITY_NONE - Sprites are rendered in the order they are added.
- SPRITE_PRIORITY_LEAST_X - Sprites are rendered based on the X position.
- SPRITE_PRIORITY_GREATEST_X - Sprites are rendered based on the X position plus the width. NOTE: Width is adjusted by Scale when calculating the position.
- SPRITE_PRIORITY_LEAST_Y - Sprites are rendered based on the Y position.
- SPRITE_PRIORITY_GREATEST_Y - Sprites are rendered based on the Y position plus the height. NOTE: Height is adjusted by Scale when calculating the position.
Possible order values:
- SPRITE_ORDER_ASCENDING - Sprites are ordered from lowest in priority to highest when rendered.
- SPRITE_ORDER_DESCENDING - Sprites are ordered from highest in priority to lowest when rendered.
See also
- Sub GetSpriteCanvasRenderPriority(c_num, ByRef priority, ByRef order)
Gets the order sprites are rendered on a sprite canvas.
Returns False if canvas is not a valid canvas.
Possible priority values:
- SPRITE_PRIORITY_NONE - Sprites are rendered in the order they are added.
- SPRITE_PRIORITY_LEAST_X - Sprites are rendered based on the X position.
- SPRITE_PRIORITY_GREATEST_X - Sprites are rendered based on the X position plus the width. NOTE: Width is adjusted by Scale when calculating the position.
- SPRITE_PRIORITY_LEAST_Y - Sprites are rendered based on the Y position.
- SPRITE_PRIORITY_GREATEST_Y - Sprites are rendered based on the Y position plus the height. NOTE: Height is adjusted by Scale when calculating the position.
Possible order values:
- SPRITE_ORDER_ASCENDING - Sprites are ordered from lowest in priority to highest when rendered.
- SPRITE_ORDER_DESCENDING - Sprites are ordered from highest in priority to lowest when rendered.
See also
- Sub SetCanvasBackgroundRender(c_num, flag)
- Function SetPostEffect(c_num, effect_type)
Sets a post effect on an canvas.
Returns TRUE if successful and FALSE if not.
NOTE: Post Effects only apply to 3D canvases.
Possible Effects and there properties:
- POST_EFFECT_TYPE_BLOOM:
- POST_EFFECT_PROPERTY_STRENGTH
- POST_EFFECT_PROPERTY_DISTANCE
- POST_EFFECT_PROPERTY_MULTIPLIER
- POST_EFFECT_TYPE_BLUR:
- POST_EFFECT_PROPERTY_DISTANCE
- POST_EFFECT_TYPE_MOTION_BLUR:
- POST_EFFECT_PROPERTY_STRENGTH
- POST_EFFECT_TYPE_RADIAL_BLUR:
- POST_EFFECT_PROPERTY_STRENGTH
- POST_EFFECT_PROPERTY_DISTANCE
- POST_EFFECT_TYPE_COLORIZE:
- POST_EFFECT_PROPERTY_STRENGTH
- POST_EFFECT_PROPERTY_SATURATION
- POST_EFFECT_PROPERTY_COLOR
- POST_EFFECT_TYPE_INVERT:
- NONE
- POST_EFFECT_TYPE_MINERAL:
- POST_EFFECT_PROPERTY_STRENGTH
See also
- Sub ClearPostEffect(c_num)
Removes the current post effect from the canvas.
- Sub SetPostEffectProperty(c_num, property, property_value)
Sets the value of a post effect property for a canvas.
Possible Properties:
- POST_EFFECT_PROPERTY_STRENGTH
- POST_EFFECT_PROPERTY_DISTANCE
- POST_EFFECT_PROPERTY_MULTIPLIER
- POST_EFFECT_PROPERTY_SATURATION
- POST_EFFECT_PROPERTY_COLOR
Reference SetPostEffect() for which properties apply to each effect.
See also
- Function GetPostEffectProperty(c_num, property)
Returns the value of the property on the current canvas post effect.
- Sub SetPostEffectActive(c_num, flag)
Enables or Disables currently set effect.
See also
- Function PostEffectIsActive(c_num)
Returns TRUE if an effect is active on the canvas and FALSE if not.
See also
- Function GetPostEffectType(c_num)
Returns the type of post effect set on the given canvas.
Possible Effect Types:
- POST_EFFECT_TYPE_BLOOM
- POST_EFFECT_TYPE_BLUR
- POST_EFFECT_TYPE_MOTION_BLUR
- POST_EFFECT_TYPE_RADIAL_BLUR
- POST_EFFECT_TYPE_COLORIZE
- POST_EFFECT_TYPE_INVERT
- POST_EFFECT_TYPE_MINERAL
See also