# dxDrawImageSection (Client)

> Draws part of an image on the screen for one frame.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Screen drawing
- **URL**: https://wiki.mymp.gg/en/dxDrawImageSection

## Syntax

```lua
bool dxDrawImageSection(float x, y, float width, height, float u, v, float usize, vsize, texture|dui|string image [, float rotation = 0, float rotationCenterOffsetX, rotationCenterOffsetY = 0, 0, color color = tocolor(255, 255, 255), bool postGUI = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `x, y` | `float` | Top-left corner on the screen, in pixels. A vec2 also works. |
| `width, height` | `float` | Size on the screen, in pixels. A vec2 also works. |
| `u, v` | `float` | Top-left corner of the part, in the image's pixels. A vec2 also works. |
| `usize, vsize` | `float` | Size of the part, in the image's pixels. A vec2 also works. |
| `image` | `texture\|dui\|string` | The image (a texture, render target, screen source or dui) or the path of an image file in the resource. |
| `rotation` | `float` | Rotation in degrees, clockwise. *(default: `0`)* |
| `rotationCenterOffsetX, rotationCenterOffsetY` | `float` | Offset of the rotation centre from the image's centre, in pixels. A vec2 also works. *(default: `0, 0`)* |
| `color` | `color` | Colour multiplied with the image, a `tocolor` value. *(default: `tocolor(255, 255, 255)`)* |
| `postGUI` | `bool` | Draw on top of the interface. *(default: `false`)* |

## Returns

`true` once the drawing is queued, `false` when the image could not be loaded.

A path is loaded once and kept for later calls. While the file is still loading, nothing is drawn.

## Example

```lua
local icons = engineCreateTexture("images/icons.png")

addEventHandler("onClientRender", root, function()
    dxDrawImageSection(20, 20, 32, 32, 64, 0, 32, 32, icons)
end)
```

## See also

- [dxDrawImage (Client)](https://wiki.mymp.gg/en/dxDrawImage.md): Draws an image on the screen for one frame.
- [dxGetMaterialSize (Client)](https://wiki.mymp.gg/en/dxGetMaterialSize.md): Returns the size of an image in pixels.
- [dxDrawMaterialSectionLine3D (Client)](https://wiki.mymp.gg/en/dxDrawMaterialSectionLine3D.md): Draws part of an image stretched along a line in the 3D world for one frame.
