DgsCreateMask

From Multi Theft Auto: Wiki
Revision as of 08:37, 9 February 2020 by Thisdp (talk | contribs) (Created page with "__NOTOC__ {{Client function}} This function creates a DGS mask. ==Syntax== <syntaxhighlight lang="lua"> element dgsCreateMask( texture sourceTexture, texture/shader/string...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function creates a DGS mask.

Syntax

element dgsCreateMask( texture sourceTexture, texture/shader/string mask [, table settings ] )
Example QRCode with background color removed

Required Arguments

  • sourceTexture: A texture you want to be masked.
  • mask: A texture/shader/string(built-in mask) of the mask. Built in masks are as follows:
    • circle: Make source texture a circle. Here is the settings:
offset = { offsetX, offsetY, relative } -- Offsets of the source texture
scale = { scaleX, scaleY, relative } -- Scale of the source texture
radius = radius -- The radius of the mask shader which ranges from 0 to 0.5 (recommended)
    • backgroundFilter: Remove specific color with specific range from the texture. Here is the settings:
filterRGB = {R,G,B} -- The color you want to remove.
filterRange = filterRange -- The color range
isPixelated = isPixelated -- whether the texture should be pixelated like MineCraft or smooth scaled.

Optional Arguments

  • settings: A table of the settings of mask (specified by mask type).

Returns

Returns a dgs-dxmask element (DGS Plugin Type)[ shader (Element Type) ] if succeed, false otherwise

Example

This example shows a QRCode without background .

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

local QRCode = DGS:dgsRequestQRCode("https://wiki.multitheftauto.com/wiki/Resource:Dgs")
local mask = DGS:dgsCreateMask(QRCode,"backgroundFilter",{
	filterRGB={255,255,255},
	filterRange=0.01,
	isPixelated=true,
})
local image = DGS:dgsCreateImage(300,300,128,128,mask,false)

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