Files
Basalt/docs/objects/Image.md
Robert Jelic bb1b1beb79 Basalt 1.7 Update
- New Objects (Flexbox, Graph, Treeview)
- Pluginsystem to add/remove functionality
- Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject
- Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox
- Removed the Animation Object, and added a animation plugin instead
- Removed the Graphic Object and merged it's functionality with the image object
- Updated currently existing objects
2023-04-30 17:05:34 +02:00

3.0 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

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.