DxGetMaterialSize: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:
===Returns===
===Returns===
Returns two ''ints'' representing the width and height in pixels of the material, or false if an invalid parameter was passed to the function.  
Returns two ''ints'' representing the width and height in pixels of the material, or false if an invalid parameter was passed to the function.  
{{New feature/item|4.0130|1.3|4021|
If the material is a volume texture, this function will return three ''ints'' representing the width, height and depth.
}}


==Example==  
==Example==  
Line 20: Line 23:
outputChatBox( "man.png is " .. tostring(width) .. " pixels wide and " .. tostring(width) .. " pixels high" )
outputChatBox( "man.png is " .. tostring(width) .. " pixels wide and " .. tostring(width) .. " pixels high" )
</syntaxhighlight>
</syntaxhighlight>
==Changelog==
{{ChangelogHeader}}
{{ChangelogItem|1.3.0-9.04021|Added third return value for volume textures}}


==See Also==
==See Also==
{{Drawing_functions}}
{{Drawing_functions}}

Revision as of 02:57, 22 April 2012

This gets the dimensions of the supplied material element.

Syntax

int, int dxGetMaterialSize ( element material )

Required Arguments

  • material : The material element whose size is to be gotten

Returns

Returns two ints representing the width and height in pixels of the material, or false if an invalid parameter was passed to the function.

ADDED/UPDATED IN VERSION 1.3 r4021:

If the material is a volume texture, this function will return three ints representing the width, height and depth.

Example

myTexture = dxCreateTexture( "man.png" )
int width, height = dxGetMaterialSize( myTexture )
outputChatBox( "man.png is " .. tostring(width) .. " pixels wide and " .. tostring(width) .. " pixels high" )

Changelog

Version Description
1.3.0-9.04021 Added third return value for volume textures

See Also