Trying to figure out how to code up a coloring book where you could fill an area with color. I see a recent update has added display.colorSample to tell what color a specific pixel is, which is helpful, but I also need something that would let me change the color of that pixel. Does this function exist? It looks like it was requested in Feature Request here: http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/3574788-bitmap-manipulation and split into 3 requests (all of which look to be marked as completed), but I can’t find anything regarding changing a pixel’s color.
Yeah, they all have been, but none of them are quite what I want! The OP for the first request that got split up mentioned using it for coloring books, but this specific feature I can’t seem to find. It’s not listed in the 3 items split up.
Reading pixel color- helpful but I need writing pixel color too
Filters- not really what i’m looking for. i need something to just change part of an image, not the whole image itself.
For example, on this beautifully drawn coloring page, i’d want to be able to touch the cat head, read that it’s white, then turn that pixel and every adjacent white pixel into a different color. Recoloring the entire image wouldn’t work.
Also helpful but not quite what I’m looking for. This appears to just save the objects on the screen to a file. I’ve used this for other projects but it’s not quite what I need.
Thanks for taking the time to reply. If you know of any way to change the pixel color, I’d really appreciate it!
thanks for clearification, now I understand your problem better.
Currently there is no way to recolor specific pixels of an image as far as I know.
I’ve got an idea in mind that I want to share with you, but I don’t know if this works.
Let’s say you want to paint a certain area. You use a snapshot to create a single image from several strokes.
Now you take your original image (the cute kitten) and use that as a fill on the snapshot. After that you add another fill, which could be any kind of filter. After that you need to merge all the different images into a single one.
You are looking for a technique called “Flood Fill” where you can fill all the pixels with a color until you hit a boundary color that stops the fill. There are two problems with this in the Corona world. First it’s prone to errors. If the person drawing your cat doesn’t completely close the black border, your paint color will leak out and fill the outside too. Secondly, we don’t support settings pixels.
Thanks for your help Rob! Hmm, I knew about the closed-area thing, but I was afraid there just wouldn’t be the setting in Corona. I’m going to add it to the feature request- any particular way I should phrase it/keywords I should use so it’s clear?
Thanks Torbin - it sounds like an interesting method, although I’m looking for something as low-key as possible, ideally this thing that turns out is impossible XD Appreciate the help tho!
I would title it: Bitmap manipulation - Set pixel color (e.g. for filling a portion of the image with color)
Then for the description: I would like to arbitrarily fill an area of an image using a technique like flood fill. I need to be able to set the pixel color as well as get the pixel color to determine if I should change it.
Yeah, they all have been, but none of them are quite what I want! The OP for the first request that got split up mentioned using it for coloring books, but this specific feature I can’t seem to find. It’s not listed in the 3 items split up.
Reading pixel color- helpful but I need writing pixel color too
Filters- not really what i’m looking for. i need something to just change part of an image, not the whole image itself.
For example, on this beautifully drawn coloring page, i’d want to be able to touch the cat head, read that it’s white, then turn that pixel and every adjacent white pixel into a different color. Recoloring the entire image wouldn’t work.
Also helpful but not quite what I’m looking for. This appears to just save the objects on the screen to a file. I’ve used this for other projects but it’s not quite what I need.
Thanks for taking the time to reply. If you know of any way to change the pixel color, I’d really appreciate it!
thanks for clearification, now I understand your problem better.
Currently there is no way to recolor specific pixels of an image as far as I know.
I’ve got an idea in mind that I want to share with you, but I don’t know if this works.
Let’s say you want to paint a certain area. You use a snapshot to create a single image from several strokes.
Now you take your original image (the cute kitten) and use that as a fill on the snapshot. After that you add another fill, which could be any kind of filter. After that you need to merge all the different images into a single one.
You are looking for a technique called “Flood Fill” where you can fill all the pixels with a color until you hit a boundary color that stops the fill. There are two problems with this in the Corona world. First it’s prone to errors. If the person drawing your cat doesn’t completely close the black border, your paint color will leak out and fill the outside too. Secondly, we don’t support settings pixels.
Thanks for your help Rob! Hmm, I knew about the closed-area thing, but I was afraid there just wouldn’t be the setting in Corona. I’m going to add it to the feature request- any particular way I should phrase it/keywords I should use so it’s clear?
Thanks Torbin - it sounds like an interesting method, although I’m looking for something as low-key as possible, ideally this thing that turns out is impossible XD Appreciate the help tho!
I would title it: Bitmap manipulation - Set pixel color (e.g. for filling a portion of the image with color)
Then for the description: I would like to arbitrarily fill an area of an image using a technique like flood fill. I need to be able to set the pixel color as well as get the pixel color to determine if I should change it.