- Documentation
- Client functions
- dxDrawImageSection
Function
dxDrawImageSection
Draws a section of an image (u, v, section width and height in image pixels) in a screen rectangle. Useful for icon sheets and progress bars.
Syntax
bool dxDrawImageSection(float posX, float posY, float width, float height, float u, float v, float usize, float vsize, string|element image [, float rotation = 0, float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0, int color = tocolor(255, 255, 255), bool postGUI = false])Arguments
posXfloat- Left edge.
posYfloat- Top edge.
widthfloat- Width.
heightfloat- Height.
ufloat- Section X in the image.
vfloat- Section Y in the image.
usizefloat- Section width.
vsizefloat- Section height.
imagestring|element- A path or a material.
rotationfloat, optional = 0- Rotation.
rotationCenterOffsetXfloat, optional = 0- Rotation centre X.
rotationCenterOffsetYfloat, optional = 0- Rotation centre Y.
colorint, optional = tocolor(255, 255, 255)- Tint.
postGUIbool, optional = false- Above GUI.
Returns
true if drawn.
Example
A sheet of four 64 px icons; we draw the third.
addEventHandler("onClientRender", root, function()
dxDrawImageSection(20, 200, 64, 64, 128, 0, 64, 64, "img/ikony.png")
end)
See also
dxDrawImageDraws an image (a resource PNG/JPG file, a texture, a render target, a browser or a camera) in a screen rectangle, with optional rotation and tint.dxSetTextureEdgeSets what a texture shows outside its image in sections (dxDrawImageSection): repeat (wrap), mirror (mirror), stretched edge (clamp) or a border colour (border).