local Q={}local Y=require(script.Parent.CanvasDraw)function Q.Flat(Q,Y,G)local L={}for G=0,G-1,1 do for H=0,Y-1,1 do local j=(G*Y)*4+H*4 L[j+1]=Q L[j+2]=Q L[j+3]=Q L[j+4]=Q end end return L end function Q.Custom2(Q,Y,G,L)local H={}for Y=0,Y,1 do H[Y]={}for G=0,G,1 do H[Y][G]={}if L==nil then H[Y][G]=Q else for L=0,L,1 do H[Y][G][L]=Q end end end end return H end function Q.CDrawToNumpy(Q)local G=Q.ImageResolution local L={}for H=0,G.X-1,1 do local j={}for G=0,G.Y-1,1 do local L=Y.GetPixelFromImageXY(Q,H+1,G+1)j[G]={math.floor(L.R*255),math.floor(L.G*255);math.floor(L.B*255)}end L[H]=j end return L,{G.X;G.Y}end function Q.ColorImage(Q,Y)local G={}for L=0,Y[1]-1,1 do local H={}for Y=0,Y[2]-1,1 do H[Y]=Q end G[L]=H end return G end return Q
--!native
local Numpy = {}
local CanvasDraw = require(script.Parent.CanvasDraw)

function Numpy.Flat(val, width, height)
	local temp = {}
	for y = 0, height - 1 do
		for x = 0, width - 1 do
			local baseIndex = y * width * 4 + x * 4
			temp[baseIndex + 1] = val -- Red channel
			temp[baseIndex + 2] = val -- Green channel
			temp[baseIndex + 3] = val -- Blue channel
			temp[baseIndex + 4] = val -- Alpha channel
		end
	end
	return temp
end

function Numpy.Custom2(val, dim1, dim2, dim3)
	local result = {}
	for i = 0, dim1 do
		result[i] = {}
		for j = 0, dim2 do
			result[i][j] = {}
			if dim3 == nil then
				result[i][j] = val
			else
				for k = 0, dim3 do
					result[i][j][k] = val
				end
			end
		end
	end
	return result
end

function Numpy.CDrawToNumpy(data)
	local Resolution = data.ImageResolution

	local FinalTbl = {}

	for x = 0, Resolution.X - 1 do
		local temp = {}
		for y = 0, Resolution.Y - 1 do
			local PixelColor = CanvasDraw.GetPixelFromImageXY(data, x + 1, y + 1)
			temp[y] = { math.floor(PixelColor.R * 255), math.floor(PixelColor.G * 255), math.floor(PixelColor.B * 255) }
		end
		FinalTbl[x] = temp
	end

	return FinalTbl, { Resolution.X, Resolution.Y }
end

function Numpy.ColorImage(Color, Resolution)
	local FinalTbl = {}

	for x = 0, Resolution[1] - 1 do
		local temp = {}
		for y = 0, Resolution[2] - 1 do
			temp[y] = Color
		end
		FinalTbl[x] = temp
	end

	return FinalTbl
end

return Numpy
