DgsCreateCanvas

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function creates a canvas that is used to draw multiple shaders.

Syntax

element dgsCreateCanvas( element renderSource, int width, int height [, int color ] )

Required Arguments

  • renderSource: The source to draw on the canvas, can be material such as texture, render target, shader etc.
  • width: An integer indicates the width of canvas.
  • height: An integer indicates the height of canvas.

Optional Arguments

  • color: A integer of the color of the canvas.

Returns

Returns a dgs-dxcanvas element (DGS Plugin Type)[ render target (Element Type) ] if succeed, false otherwise

Example 1

DGS = exports.dgs --get exported functions from dgs

local QRCode = DGS:dgsRequestQRCode("https://wiki.multitheftauto.com/wiki/Resource:Dgs") --Source Texture
local mask1 = DGS:dgsCreateMask(QRCode,"circle") --Apply Source Texture to Mask 1
local canvas = DGS:dgsCreateCanvas(mask1,200,200) --Draw Mask 1 in Canvas
local mask2 = DGS:dgsCreateMask(canvas ,"backgroundFilter") --Apply Canvas to Mask 2
local image = DGS:dgsCreateImage(300,300,200,200,mask2 ,false) --Draw Mask 2

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Label

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Plugin

Blur Box

Color Picker

Canvas

Circle

Effect 3D

Gradient

Media Browser

Mask

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Rounded Rectangle

Screen Source