Graphics/Image Update - v3.4.0
Hey all. Pretty big update regarding graphics and rendering with CanvasDraw and lots of bug fixes too.
Well, we have a bit to get through, so lets start from the top!
Two new methods - DrawTexturedTriangle and DrawDistortedImage
That’s right, you heard it. CanvasDraw now officially supports textured triangles and planes with basic transparency support!
These methods can be used for 3D rendering or custom 2D image manipulation!
DrawTexturedTriangle will also take UV coordinates too
These drawing methods also support automatic edge clipping! So don’t worry about script errors or issues from rendering outside the canvas!
Special thanks to @ZestyIsSour for contributing and helping out with this one!
Two new methods for ImageData
ImageData now has two new methods: Tint() and SetPixel()
The Tint() method is useful for shading or changing an image’s colour.
The SetPixel() method allows you to change the ImageData’s pixels directly. SetPixel accepts both a color3 and an alpha/transparency value too!
Automatically clipping for some drawing methods
The following methods have now been updated and will automatically clip with the canvas to avoid causing errors or issues with drawing outside the canvas.
Currently, only the following drawing methods will now have clipping:
- DrawRectangle / DrawRectangleXY
- DrawText / DrawTextXY
- DrawImage / DrawImageXY
- DrawTexturedTriangle / DrawTexturedTriangleXY
- DrawDistortedImage / DrawDistortedImageXY
Rewritten FloodFIll()!
The FloodFill method has had a complete overall and now runs much faster and is now practical!
Special thanks to @Arevoir for this one!
Full change log:
-
Added DrawTexturedTriangle()
-
Added DrawDistortedImage()
-
Added two new ImageData methods:
- ImageData:Tint()
- ImageData:SetPixel()
-
Made text much more reliable and not error. Text will now clip
to the canvas and properly wrap depending on text size and position -
Gave the DrawRectangle method clipping
-
Gave the DrawText method clipping
-
Gave the DrawImage method clipping
-
Redone the API documentation thread and added a table of contents section for quick and easy searching
-
Rewritten FloodFill to be much faster than before (contributed by @Arevoir)
-
Fixed DrawRectangle not drawing correctly when coordinates were flipped for either axis
-
Fixed some wrapping issues with DrawText