Releases: tryforge/ForgeCanvas
Releases · tryforge/ForgeCanvas
1.3.0
ForgeCanvas v1.3.0
Changelog
-
$drawText Improvements:
- Better Text Wrapping:
- Now, the text can be automatically split by lines if it exceeds the
maxWidth, bycharacter,word, or thesmartway, just like Discord does it.- Note: Makes
maxWidthact differently.
- Note: Makes
- Now, the text can be automatically split by lines if it exceeds the
- Custom Emoji Support:
- You can draw Discord emojis by simply setting the
allowEmojisargument totrue.- Note: The emojis get cached in the global image manager, by the following name format:
cache_emoji_{id}.
- Note: The emojis get cached in the global image manager, by the following name format:
- You can draw Discord emojis by simply setting the
- Both
multilineandwrapcan now handle new lines better too.. - Added the possibility change the alignment of the new lines.
- Better Text Wrapping:
-
Image Function Changes:
- Introducing
$preloadImage: You can now load an image globally, this reduces the amount of work your bot has to do per command.- They can be accessed using
preload://{name}. - Has the same usage as
$loadImage.
- They can be accessed using
- Also added
$loadImageOptions[global?: boolean;alt?: string;maxRedirects: number?;requestOptions?: json]so you can now set the request options, such as headers, for example. - Added
$drawImageAreato draw specific areas of the image on the canvas instead the whole. $imageBuffernow stores the buffer instead of just returning it.
- Introducing
-
Better Structure:
- Reorganized some of the functions.
- Cleaner project structure.
- Even better error messages.
-
Lottie Animations:
- Load a lottie animation using
$loadLottieAnimation[name: string;data: path or the json of the animation;resourcePath?: base path of the external resources]. - Select the frame of the animation you want using
$lottieSeek[name: string;type: frame/time;position: number]. - Render it on the canvas using
$lottieRender[lottie: string;canvas?: string;x?: number;y?: number;width?: number;height?: number].
- Load a lottie animation using
-
Components:
- These are basically custom functions but they can access your command ForgeCanvas environment directly.
- They act the same as the code inside
$createCanvas: You don't have to pass the name inside component's code, only the$renderCanvasComponent. - These work for any canvas, you don't have to change the component's code.
- The examples can be found in the src/_tests_/ folder in the repo.
-
Deprecated Functions Removal:
- It's finally time to say goodbye to
$setCanvasSizeand$setEncoderOptions! - The new syntax no longer requires an extra function, just use
$createCanvasdirectly.
- It's finally time to say goodbye to
-
Performance & Other:
- Updated the dependencies..
- Again optimized the canvas functions to add as least overhead of the ForgeCanvas logic as possible.
- Switched to a slightly more efficient way of running functions inside
$createCanvasand other. $canvasTrimnow has arguments to enable/disable trimming from different sides and is way faster.$canvasVersionhas an option to return the @napi-rs/canvas version instead.- Added
$clearCanvasCache. - Updated aliases and descriptions across functions.
- And more...