DgsImageSetImage: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Thisdp moved page DgsDxImageLoadImage to DgsDxImageSetImage)
No edit summary
 
(10 intermediate revisions by one other user not shown)
Line 2: Line 2:
__NOTOC__
__NOTOC__
This function allows you to change the image in DGS image element to another one.
This function allows you to change the image in DGS image element to another one.
'''Note:'''
*If you pass '''path''' into this function, path will be converted into '''texture element''' handled by dgs.
*If you want to control the '''texture''' by yourself, please pass a '''texture element''' into this function.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dgsDxImageLoadImage ( element theElement, element texture )
bool dgsImageSetImage ( element theElement, element/string texture )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''theElement:''' The image element to be changed.
*'''theElement:''' The image element to be changed.
*'''texture:''' A texture/shader/render target/screen source element that you want to set.
*'''texture:''' A texture/shader/render target/screen source/image path that you want to set.


===Returns===
===Returns===
Returns ''true'' if the the image in the image element was successfully changed, ''false'' otherwise.
Returns ''true'' if the image in the image element was successfully changed, ''false'' otherwise.


==Example==  
==Example==  
<section name="Client-side script" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
DGS = exports.dgs
DGS = exports.dgs
local texture = dxCreateTexture("text.png")  -- You need to add a texture yourself.
local texture = dxCreateTexture("text.png")  -- You need to add a texture yourself.
local myImage = DGS:dgsDxCreateImage ( 0.45, 0.48, 0.2, 0.5, _, true )
local myImage = DGS:dgsCreateImage ( 0.45, 0.48, 0.2, 0.5, _, true )
setTimer ( DGS:dgsDxImageLoadImage, 10000, 1, myImage, texture )
setTimer ( DGS:dgsImageSetImage, 10000, 1, myImage, texture )
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{DGSFUNCTIONS}}
{{DGSFUNCTIONS}}

Latest revision as of 18:00, 2 December 2024

This function allows you to change the image in DGS image element to another one.

Note:

  • If you pass path into this function, path will be converted into texture element handled by dgs.
  • If you want to control the texture by yourself, please pass a texture element into this function.

Syntax

bool dgsImageSetImage ( element theElement, element/string texture )

Required Arguments

  • theElement: The image element to be changed.
  • texture: A texture/shader/render target/screen source/image path that you want to set.

Returns

Returns true if the image in the image element was successfully changed, false otherwise.

Example

DGS = exports.dgs
local texture = dxCreateTexture("text.png")  -- You need to add a texture yourself.
local myImage = DGS:dgsCreateImage ( 0.45, 0.48, 0.2, 0.5, _, true )
setTimer ( DGS:dgsImageSetImage, 10000, 1, myImage, texture )

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