Files
Basalt/docs/objects/Image.md
Robert Jelic 4a5eaf324a - Added shrink docs
- Added shrink documentation which is based on pixelbox by 9551Dev
2023-05-08 17:31:02 +02:00

3.1 KiB

The Image object is designed for adding more advanced backgrounds to your interface. It supports the loading of .nfp and .bimg images, allowing for greater customization of your interface's appearance.

In addition to the Object and VisualObject methods, Progressbar objects have the following methods:

loadImage Loads an image from the specified file path
setImage Set's a new image
usePalette Changes the used palette to the image preferred palette
play Plays an animated image
selectFrame Selects a specific frame in an animated image
getMetadata Returns the metadata of the image
setImageSize Sets the size of the image
getImageSize Returns the width and height of the image
resizeImage Resizes the image to the specified dimensions
setOffset Sets the offset of the image
getOffset Returns the offset of the image
addFrame Adds a new frame to the image
getFrame Returns the specified frame
getFrameObject Returns the Frame object of the specified frame
removeFrame Removes the specified frame
moveFrame Moves a frame to a new position
getFrames Returns all frames of the image
getFrameCount Returns the number of frames in the image
getActiveFrame Returns the currently active frame
clear Clears the image
getImage Returns the image's data
blit Writes text, foreground and background into the image
setText Writes text into the image
setBg Writes background color into the image
setFg Writes text color into the image
shrink Shrinks the image to a blit version using pixelbox

About Bimg

Bimg is a custom image format that can be used as an alternative to .nfp. It is a table that can store multiple frames and metadata. The frames can store text, background, and foreground colors, enabling the creation of a wide variety of images. The Bimg format was developed by members of the Minecraft Computercraft Mods Discord community. For more information on the Bimg format, visit the GitHub page: bimg

Example

Here's an example of how to create and use an Image object:

-- Create a new Image object
local main = basalt.createFrame()
local myImage = main:addImage()

-- Load an image from a file
myImage:loadImage("/path/to/your/image.nfp")

This example demonstrates how to create an Image object, load an image from a file, and display the image on the interface.