I have a system where users can draw on a canvas (PixelArt), which is over 200k pixels in total.
Using Frames and Parts to represent a single pixel is terrible for performance.
Is there any way to write individual pixels to an ImageLabel or other GUI Object? (Don’t think there is)
What I’m thinking:
local image = Instance.new("DynamicCanvas")
image.CanvasSize = Vector2.new(500, 500)
image:SetPixel(0, 0, Color3.new(1,0,0)) -- Make the first pixel RED
Another idea:
You have a 500x500 pixel canvas
Every pixel is an individual Frame
Every 100 pixels placed the image gets “compiled” by another program or somehow in Studio
That resets the amount of frames used, and makes the Image look the same as before
No problem. If you need help setting up the system, do let me know. But in a nutshell, it’s very similar to how frames work, but instead you need to use :DrawRectangle. Although, do account for any and all scaling. That may affect the position of the rectangle. You can use:
local MouseLocation = UserInputService:GetMouseLocation()
local relativeLocation = MouseLocation - CanvasTopLeft
local scaledLocation = relativeLocation/CanvasTopLeft
local pixelLocation = scaledLocation * CanvasSize