Astrath:createImage

From Multi Theft Auto: Wiki
Revision as of 20:03, 22 October 2025 by Sybellex (talk | contribs)
Jump to navigation Jump to search

DxImage:new

Template:FuncDef

Description: Creates a new DX-based image element. Images can be attached to parent elements, support transparency, and custom styles. Each image instance is automatically registered in the DX library.

Parameters:

path (string) – Path to the image file. Must exist.

posX, posY (float) – Position on screen.

width, height (float) – Size of the image.

parent (element) – Parent DX element to attach this image to (optional).

relative (boolean) – Position relative to parent (optional).

Returns:

Returns the newly created DxImage element.

Methods:

Method Description

Ath:destroy() - Ath:setVisible(boolean) - Ath:setEnabled(boolean) - Ath:setAlpha(int) - Ath:setPath(string) - Ath:draw() }

Example:

-- Create an image at position 100x100 with size 200x150
local myImage = DxImage:new("images/logo.png", 100, 100, 200, 150)

-- Show the image and set transparency
myImage:setVisible(true)
myImage:setAlpha(200)

-- Change the image path
myImage:setPath("images/new_logo.png")

-- Draw the image
myImage:draw()

See also:

Astrath – Main library page

DxWindow:new – Page for window element reference

DxLabel:new – Page for label element reference

onClientRender – Event used to render DX elements