DgsCreateCanvas

From Multi Theft Auto: Wiki
Revision as of 13:33, 6 May 2020 by Thisdp (talk | contribs) (Created page with "__NOTOC__ {{Client function}} This function creates a canvas that is used to draw multiple shaders. ==Syntax== <syntaxhighlight lang="lua"> element dgsCreateCanvas( elemen...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 Element

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

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips