help with coloring book

Hello
I want to make something like coloring book. I made image from coordinates pixels. This is my code to help you understand my problem.
piksele={}
local tablica={(there are numbers of pixels)}
local counterX=1    
local counterY=1
local wysokosc=444
local szerokosc=276
local rozmiarx = 1
local rozmiary = 1
local d=0
for j=1, wysokosc do
    pixels[counterY]={}
    counterX=1
        for i=1, szerokosc do
            d=(j*szerokosc)-(szerokosc-1)
             local pixelColor = tablica[i+d]
             if tablica[i+d] == 0 then
            pixels[counterY][counterX] = display.newRect(0, 0, rozmiarx, rozmiary)
             pixels[counterY][counterX]:setFillColor(pixelColor)
             pixels[counterY][counterX].x = i+20
             pixels[counterY][counterX].y = j+30
             counterX=counterX+1
             end
end
counterY=counterY+1
end
Now i want to flood fill with colors. I found this code( https://gist.github.com/GymbylCoding/8fc95e1e8d1ce2c152ef) , but i m only begginer and I dont understand how to get my table to drawn pixels. Could anyone help me with some code?

up

I have a couple of suggestions for you. First, when you post code, it needs to be formatted in an easy to read manner. For this forum software there is a blue <> button in bar with Bold and Italics. In the window that pops up, paste your code into it. It will make it much easier for the community to figure out what you’re doing.

Secondly, we don’t really support flood filling. It looks to me like Caleb has worked out a way to make it work with a bunch of small rectangles. I don’t know how efficient this will be. You’re best bet if you have questions about Caleb’s code is to ask him in his Gymble Coding forum. I’ll move this topic there.

Rob

Hi @patrikes! The Gist I posted a while ago is just a POC. It’s not meant to be used for actual production stuff, and it’s definitely not efficient at all. I suggest you try a different route for sort-of-advanced graphics editing code. The code you link to is just kind of an interesting thing I came up with to see if doing rectangle pixels was even possible.

  • Caleb

up

@patrikes Something I posted in a related thread might interest you (though with regard to per-pixel rects rather than flood fill).

I have a couple of suggestions for you. First, when you post code, it needs to be formatted in an easy to read manner. For this forum software there is a blue <> button in bar with Bold and Italics. In the window that pops up, paste your code into it. It will make it much easier for the community to figure out what you’re doing.

Secondly, we don’t really support flood filling. It looks to me like Caleb has worked out a way to make it work with a bunch of small rectangles. I don’t know how efficient this will be. You’re best bet if you have questions about Caleb’s code is to ask him in his Gymble Coding forum. I’ll move this topic there.

Rob

Hi @patrikes! The Gist I posted a while ago is just a POC. It’s not meant to be used for actual production stuff, and it’s definitely not efficient at all. I suggest you try a different route for sort-of-advanced graphics editing code. The code you link to is just kind of an interesting thing I came up with to see if doing rectangle pixels was even possible.

  • Caleb

@patrikes Something I posted in a related thread might interest you (though with regard to per-pixel rects rather than flood fill).