Astrath:createImage: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== DxImage:new | = DxImage:new = | ||
{{Client function}} | |||
{{FuncDef|element DxImage:new ( string path, float posX, float posY, float width, float height, element parent, boolean relative )}} | |||
'''Description:''' | '''Description:''' | ||
Creates a new | 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). | |||
parent | |||
''' | '''Returns:''' | ||
: Returns the newly created DxImage element. | |||
'''Methods:''' | '''Methods:''' | ||
{| class="wikitable" style="width:100%; border:none;" | |||
! Method !! Description | |||
Ath:destroy() | |||
- | |||
Ath:setVisible(boolean) | |||
- | |||
Ath:setEnabled(boolean) | |||
- | |||
Ath:setAlpha(int) | |||
- | |||
Ath:setPath(string) | |||
- | |||
Ath:draw() | |||
} | |||
'''Example:''' | '''Example:''' | ||
< | <syntaxhighlight lang="lua"> | ||
local | -- 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() | |||
</syntaxhighlight> | |||
'''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 | |||
Revision as of 20:03, 22 October 2025
DxImage:new
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 |
---|