Updated image docs
This commit is contained in:
6
docs/objects/Image/getImageSize.md
Normal file
6
docs/objects/Image/getImageSize.md
Normal file
@@ -0,0 +1,6 @@
|
||||
## getImageSize
|
||||
Returns the current image size
|
||||
|
||||
#### Returns:
|
||||
1. `number` width
|
||||
2. `number` height
|
||||
9
docs/objects/Image/getMetadata.md
Normal file
9
docs/objects/Image/getMetadata.md
Normal file
@@ -0,0 +1,9 @@
|
||||
## getMetadata
|
||||
Returns the metadata set in the image
|
||||
|
||||
#### Parameter:
|
||||
|
||||
1. `string` the metadata key (for example: title, description, author, creator, data, width, height,...)
|
||||
|
||||
#### Returns:
|
||||
1. `any` metadata value
|
||||
@@ -1,18 +1,23 @@
|
||||
## loadImage
|
||||
loads a default .nfp file into the object.
|
||||
This method is used to load an image file into the image object.
|
||||
|
||||
#### Parameters:
|
||||
1. `string` the absolute file path
|
||||
|
||||
1. `path` the absolute file path
|
||||
|
||||
#### Returns:
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
|
||||
* Creates a default image and loads a test.nfp file
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aImage = mainFrame:addImage():loadImage("test.nfp")
|
||||
```
|
||||
|
||||
```xml
|
||||
<image path="test.nfp" />
|
||||
```
|
||||
```
|
||||
|
||||
10
docs/objects/Image/play.md
Normal file
10
docs/objects/Image/play.md
Normal file
@@ -0,0 +1,10 @@
|
||||
## play
|
||||
Plays a bimg animation. This can only work if the bimg has more than 1 frame.
|
||||
|
||||
#### Parameters:
|
||||
|
||||
1. `boolean` If the image animation should play
|
||||
|
||||
#### Returns:
|
||||
|
||||
1. `object` The object in use
|
||||
19
docs/objects/Image/resizeImage.md
Normal file
19
docs/objects/Image/resizeImage.md
Normal file
@@ -0,0 +1,19 @@
|
||||
## resizeImage
|
||||
This method is used to resize a bimg image. It takes two parameters: the new width, and the new height. It is important to note that resizing images can result in a loss of quality, as the original pixel data is being transformed and resampled to fit the new dimensions. This is especially noticeable when increasing the size of an image, as new pixels must be generated to fill in the gaps. As a result, it is generally recommended to use the original image at its full size whenever possible, rather than resizing it.
|
||||
|
||||
#### Parameters:
|
||||
|
||||
1. `number` the new width
|
||||
2. `number` the new height
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
|
||||
* Creates a new image object, loads the image and changes it's size.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aImage = mainFrame:addImage():loadImage("test.bimg"):resizeImage(40, 20)
|
||||
```
|
||||
19
docs/objects/Image/selectFrame.md
Normal file
19
docs/objects/Image/selectFrame.md
Normal file
@@ -0,0 +1,19 @@
|
||||
## selectFrame
|
||||
The selectFrame method allows you to change the current frame of an image object. It takes a single parameter, the index of the frame you want to display.
|
||||
|
||||
#### Parameters:
|
||||
|
||||
1. `number` the frame index
|
||||
|
||||
#### Returns:
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
|
||||
* Creates a default image and loads a test.nfp file
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aImage = mainFrame:addImage():loadImage("test.bimg"):selectFrame(2)
|
||||
```
|
||||
23
docs/objects/Image/setImage.md
Normal file
23
docs/objects/Image/setImage.md
Normal file
@@ -0,0 +1,23 @@
|
||||
## setImage
|
||||
Sets a new image
|
||||
|
||||
#### Parameter:
|
||||
|
||||
1. `table` A table in bimg or nfp format.
|
||||
1. `string` The format in which the image should be loaded (nfp or bimg)
|
||||
|
||||
#### Usage:
|
||||
|
||||
* Creates a default image and loads a test.nfp file
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
|
||||
local bimg = {
|
||||
[1] = {
|
||||
{"Hello", "fffff", "33333"}
|
||||
}
|
||||
}
|
||||
|
||||
local aImage = mainFrame:addImage():setImage(bimg)
|
||||
```
|
||||
11
docs/objects/Image/usePalette.md
Normal file
11
docs/objects/Image/usePalette.md
Normal file
@@ -0,0 +1,11 @@
|
||||
## usePalette
|
||||
|
||||
Changes the palette colors of the image, if the bimg image has palette metadata.
|
||||
|
||||
#### Parameter:
|
||||
|
||||
1. `boolean` if the image should change the palette
|
||||
|
||||
#### Returns:
|
||||
|
||||
1. `object` The object in use
|
||||
Reference in New Issue
Block a user