this script i made does not seem to work that well, what am i doing wrong?
what script? we cannot help unless you at least provide code or an image/video of your problem
i forgot to paste it sorry. here is the script: `
Gui.Save_drawing.MouseButton1Click:Connect(function()
-- Define the region to capture
local PointA = Vector2.new(0, 0)
local PointB = Vector2.new(255, 255)
local ImageData = Canvas:CreateImageDataFromCanvas(PointA, PointB)
local SaveObject = CanvasDraw.CreateSaveObject(ImageData)
SaveObject.Name = "MyDrawing"
SaveObject.Parent = Saves
end)
Gui.Load_drawing.MouseButton1Click:Connect(function()
local LoadImage = Saves.MyDrawing
local ImageData = CanvasDraw.GetImageData(LoadImage)
Canvas:DrawImage(ImageData, Vector2.new(255, 255))
Saves.MyDrawing:Destroy()
end)
`
maybe this is your problem. It looks like you are drawing outside the canvas entirely.
Imageās start at 1, 1 on the canvas. And if you canvas is 255x255, you are drawing your image almost entirely outside the canvas
Also you might wanna refer to API documentation sometimes as it describes the parameters of how the drawing functions work
how do i know the bottom right corner of my canvas? im using. local Canvas = CanvasDraw.new(Frame)
You specify the resolution in the parameters of CanvasDraw.new().
This is mentioned on the API documentation also
local Canvas = CanvasDraw.new(Frame, Vector2.new(255, 255))
without this parameter, it will default to 100x100
is it possible to rotate a image? i need to know if thereās a way to do so without using DrawTexturedTriangle for rotated images
The easiest and most efficient way to rotate an image is to use DrawDistortedImage with sin and cos rotation maths. Itās the simplest and honestly very fast too.
Patch - v3.4.1
- Fixed DrawImage/XY not drawing correctly when aspect ratio wasnāt square
- Fixed some clipping errors with the image-based drawing functions
- Other mild bug fixes and improvements
It would be more than nice if the module includes a way to enable some sort of layer containing a grid so people have an idea of where theyāre placing down pixels (if using the free draw). Right now I have my own code inside the module, but itās quite annoying having to add my changes to every update you make.
Is this something we could see added? Thanks
Hmm. A grid wasnāt ever planned to be in the engine, as overlaying an imagelabel with tiling can be done outside the module. Just requires a bit of math for the resolution and aspect ratio
I might add a grid overlay as a property to the Canvas, thatās easy enough to do
Yeah its a bit far fetched, but for people that want to use the free draw feature for just placing pixels, a grid property could be super helpful.
Creating my own is do-able but quite the hassle when itās being updated a-lot.
Really solid module btw.
Iām having a strange issue with the image importer plugin, roblox studio seems to freeze up and crash entirely when I try to open the plugin (i just left-clicked on itās icon). I waited several minutes but it did nothing, Iām not really sure whatās wrong, am I somehow doing something wrong?
It just freezes simply when you click on the plugin button, without doing anything else? Thatās weirdā¦
All it should do is open the file explorer so you can select an image. This might be a windows or roblox related issue as the plugin works fine for everyone else I believe.
However, Iāll look into it anyways
Hey it seems to work now, Iām still not sure what was causing the issue but I think it was resolved after updating Roblox Studio, which I probably should have tried before making that reply.
The image importer plug in doesnāt seem to support PNGs encoded in 8 bit format. Switching to 24 bit the image works.
Oh, yeah I was aware that the image importer may not work for types like that. The image importer uses @Maximum_ADHDās PNG module, and I have no idea how it works tbh, and im not sure if thereās any other PNG module that may allow 8-bit formatting or not.
What program did you use to download an 8-bit format PNG? I didnāt even know that was thing
I used GIMP because I was rasterizing a image to be more performant
Can Canvas Draw create layers?
As of this current version, no, but in the next update I plan to add a method which lets you create a blank image data, which can be used as a layer