-
Notifications
You must be signed in to change notification settings - Fork 7
Image
Elysio Martins edited this page Nov 4, 2023
·
1 revision
An image is a UI element used to display graphics or pictures within your user interface.
- Instantiate the image:
$image = Image::create("image_test", "textures/ui/ExampleImage.png");
Set the desired properties:
// Set the UV coordinates
$image->setUV($u, $v);
// Set the UV size
$image->setUVSize($width, $height);
// Set the texture file system source
$image->setTextureFileSystem($fileSystem);
// Specify if the image should tile when resized
$image->setTiled(true); // Tiled image
$image->setTiled("x"); // Tiled horizontally
$image->setTiled("y"); // Tiled vertically
// Set the tile texture scale
$image->setTiledScale($scaleX, $scaleY);
// Set the clip direction
$image->setClipDirection("left"); // Clip from the left
$image->setClipDirection("right"); // Clip from the right
$image->setClipDirection("up"); // Clip from the top
$image->setClipDirection("down"); // Clip from the bottom
$image->setClipDirection("center"); // Clip from the center
// Set the clip ratio
$image->setClipRatio($ratio);
// Enable pixel-perfect clipping
$image->setClipPixelPerfect(true); // Enable pixel-perfect clipping
// Keep the image ratio when resizing
$image->setKeepRatio(true); // Keep image ratio
// Use bilinear interpolation when resizing
$image->setBilinear(true); // Use bilinear interpolation
// Fill the image to the specified size
$image->setFill(true); // Fill the image
// Specify whether to fit the image to the width
$image->setFitToWidth(true); // Fit to width
# Other functions are available for further customization.
- Add the image to my root:
# Add the element to the root instance
$root->addElement($image);