From 4a5eaf324a435d79ba480eadf79339b48f816e3f Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Mon, 8 May 2023 17:31:02 +0200 Subject: [PATCH] - Added shrink docs - Added shrink documentation which is based on pixelbox by 9551Dev --- docs/objects/Image.md | 1 + docs/objects/Image/getShrinkedImage.md | 24 ++++++++++++++++++++++++ docs/objects/Image/shrink.md | 25 +++++++++++++++++-------- 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 docs/objects/Image/getShrinkedImage.md diff --git a/docs/objects/Image.md b/docs/objects/Image.md index c466277..64cbb55 100644 --- a/docs/objects/Image.md +++ b/docs/objects/Image.md @@ -29,6 +29,7 @@ In addition to the Object and VisualObject methods, Progressbar objects have the |[setText](objects/Image/setText.md)|Writes text into the image |[setBg](objects/Image/setBg.md)|Writes background color into the image |[setFg](objects/Image/setFg.md)|Writes text color into the image +|[shrink](objects/Image/shrink.md)|Shrinks the image to a blit version using pixelbox ## About Bimg diff --git a/docs/objects/Image/getShrinkedImage.md b/docs/objects/Image/getShrinkedImage.md new file mode 100644 index 0000000..4cddf2e --- /dev/null +++ b/docs/objects/Image/getShrinkedImage.md @@ -0,0 +1,24 @@ +## getShrinkedImage + +### Description + +The getShrinkedImage method generates a Blit-Image version of a standard Image object and returns it as a table. By using this method, the resulting image will only retain the background (BG) data, and both foreground (FG) and text information will be lost. + +Shrinking the image is calculated by pixelbox, a algorithm created by 9551Dev. You can find his awesome work [here](https://github.com/9551-Dev/apis/blob/main/pixelbox_lite.lua)! + +### Returns + +1. `table` A table representing the Blit-Image version of the Image object, containing only the background data. + +### Usage + +* Creates a default image and loads a test.nfp file + +```lua +local basalt = require("basalt") + +local mainFrame = basalt.createFrame() +local image = mainFrame:addImage:loadImage("path/to/your/image.nfp") + +local blitImage = image:getShrinkedImage() +``` diff --git a/docs/objects/Image/shrink.md b/docs/objects/Image/shrink.md index b2c485a..2811e7d 100644 --- a/docs/objects/Image/shrink.md +++ b/docs/objects/Image/shrink.md @@ -1,15 +1,24 @@ ## shrink -Shrinks the current image into a blittle image. -#### Returns: +### Description + +The shrink method allows you to create a Blit-Image version of a standard Image object. By using this method, the resulting image will only retain the background (BG) data, and both foreground (FG) and text information will be lost. + +Shrinking the image is calculated by pixelbox, a algorithm created by 9551Dev. You can find his awesome work [here](https://github.com/9551-Dev/apis/blob/main/pixelbox_lite.lua)! + +### Returns + 1. `object` The object in use -#### Usage: -* Creates a default image and loads a test.nfp file +### Usage + +* Creates a default image and loads a nfp files and shrinks the image + ```lua +local basalt = require("basalt") + local mainFrame = basalt.createFrame() -local aImage = mainFrame:addImage():loadImage("test.nfp"):shrink() -``` -```xml - +local image = mainFrame:addImage:loadImage("path/to/your/image.nfp") + +image:shrink() ```