- Documentation
- Client functions
- dxDrawImage
Function
dxDrawImage
Draws 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.
Syntax
bool dxDrawImage(float posX, float posY, float width, float height, 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.
imagestring|element- A file path or a material.
rotationfloat, optional = 0- Rotation in degrees.
rotationCenterOffsetXfloat, optional = 0- Rotation centre offset X.
rotationCenterOffsetYfloat, optional = 0- Rotation centre offset Y.
colorint, optional = tocolor(255, 255, 255)- Tint and transparency.
postGUIbool, optional = false- Above GUI.
Returns
true if drawn.
Example
addEventHandler("onClientRender", root, function()
dxDrawImage(20, 20, 128, 128, "img/logo.png", getTickCount() / 20 % 360)
end)
See also
dxDrawImageSectionDraws 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.dxCreateTextureCreates a texture: from a resource image file, from pixels (plain,png,jpeg,dds) or an empty one of a given size. The texture is a material fordxDrawImage,dxDrawMaterial*3Dand shaders.