dxDrawImageSection
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
Differing from dxDrawImage, this function only draws a part of an image on the screen for a single frame. In order for the image to stay visible continuously, you need to call this function with the same parameters on each frame update (see onClientRender).
Use a texture created with dxCreateTexture to speed up drawing .
To help prevent edge artifacts when drawing textures, set textureEdge to "clamp" when calling dxCreateTexture
Syntax
bool dxDrawImageSection ( float posX, float posY, float width, float height, float u, float v, float usize, float vsize, mixed image, [ float rotation = 0, float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0, int color = white, bool postGUI = false ] )Required Arguments
- posX: the absolute X coordinate of the top left corner of the image
- posY: the absolute Y coordinate of the top left corner of the image
- width: the absolute width of the image
- height: the absolute height of the image
- u: the absolute X coordinate of the top left corner of the section which should be drawn from image
- v: the absolute Y coordinate of the top left corner of the section which should be drawn from image
- usize: the absolute width of the image section
- vsize: the absolute height of the image section
- image: Either a material element or a filepath of the image which is going to be drawn. (.dds images are also supported). Image files should ideally have dimensions that are a power of two, to prevent possible blurring. Use a texture created with dxCreateTexture to speed up drawing .
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- rotation (default: 0): the rotation, in degrees for the image.
- rotationCenterOffsetX (default: 0): the absolute X offset from the image center for which to rotate the image from.
- rotationCenterOffsetY (default: 0): the absolute Y offset from the image center for which to rotate the image from.
- color (default: white): the color of the image, a value produced by tocolor or hexadecimal number in format: 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).
- postGUI (default: false): MISSING_PARAM_DESC
Returns
- bool: value
Returns true if successful, false otherwise.
Code Examples
Example 1The example draws a section of an image. (You can usethisimage to test.)
addEventHandler("onClientRender", root, function() local sectionStartX, sectionStartY = 202, 65 local sectionWidth, sectionHeight = 150, 150
dxDrawImageSection(500, 500, 256, 256, sectionStartX, sectionStartY, sectionWidth, sectionHeight, "example.jpg")end)See Also
Drawing Functions
- dxConvertPixels
- dxCreateFont
- dxCreateRenderTarget
- dxCreateScreenSource
- dxCreateShader
- dxCreateTexture
- dxDrawCircle
- dxDrawImage
- dxDrawImageSection
- dxDrawLine
- dxDrawLine3D
- dxDrawMaterialLine3D
- dxDrawMaterialPrimitive
- dxDrawMaterialPrimitive3D
- dxDrawMaterialSectionLine3D
- dxDrawModel3D
- dxDrawPrimitive
- dxDrawPrimitive3D
- dxDrawRectangle
- dxDrawText
- dxDrawWiredSphere
- dxGetBlendMode
- dxGetFontHeight
- dxGetMaterialSize
- dxGetPixelColor
- dxGetPixelsFormat
- dxGetPixelsSize
- dxGetStatus
- dxGetTextSize
- dxGetTexturePixels
- dxGetTextWidth
- dxIsAspectRatioAdjustmentEnabled
- dxSetAspectRatioAdjustmentEnabled
- dxSetBlendMode
- dxSetPixelColor
- dxSetRenderTarget
- dxSetShaderTessellation
- dxSetShaderTransform
- dxSetShaderValue
- dxSetTestMode
- dxSetTextureEdge
- dxSetTexturePixels
- dxUpdateScreenSource