Skip to content

Releases: tryforge/ForgeCanvas

1.3.0

24 Mar 12:35
032305a

Choose a tag to compare

ForgeCanvas v1.3.0

Changelog

  • $drawText Improvements:

    • Better Text Wrapping:
      • Now, the text can be automatically split by lines if it exceeds the maxWidth, by character, word, or the smart way, just like Discord does it.
        • Note: Makes maxWidth act differently.
    • Custom Emoji Support:
      • You can draw Discord emojis by simply setting the allowEmojis argument to true.
        • Note: The emojis get cached in the global image manager, by the following name format: cache_emoji_{id}.
    • Both multiline and wrap can now handle new lines better too..
    • Added the possibility change the alignment of the new lines.
  • 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.
    • 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 $drawImageArea to draw specific areas of the image on the canvas instead the whole.
    • $imageBuffer now stores the buffer instead of just returning it.
  • 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].
  • 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 $setCanvasSize and $setEncoderOptions!
    • The new syntax no longer requires an extra function, just use $createCanvas directly.
  • 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 $createCanvas and other.
    • $canvasTrim now has arguments to enable/disable trimming from different sides and is way faster.
    • $canvasVersion has an option to return the @napi-rs/canvas version instead.
    • Added $clearCanvasCache.
    • Updated aliases and descriptions across functions.
    • And more...