getPixel() again & again

I could use the same as develephant’s suggestion for the most part fillColor works good with the exception of when you want “white” lol, for example:

A candy can is white with red stripes if you want to change just red you have to either create another image that you can overlay and change that fill color or you use fill color and get blue + red, or orange + red instead of white + blue, white + orange etc. and so forth.

at the moment i handle this with “layers” which works just fine and is still less than having multiple different colored pants etc.

so for example on pants i might have 1 layer for the pants background, one for the belt, etc. then allow color change on both layers… it isn’t ideal but works just fine when you slam everything into an image sheet :slight_smile:

For creating multiple versions of a single image, is this the kind of thing you are trying to achieve?

http://www.emanueleferonato.com/2009/04/28/understanding-as3-colormatrixfilter-class/

I’m personally interested in the ability to perform different custom interventions on individual pixels and generate different photo effects that way. I already have a photo editing/sharing app in App Store developed in Corona but lacking any kind of original filters/effects because I can not access pixels.

Walter, I am heading out at the moment but your link is close, I will take some screenshots tonight and post them so you can see what I am talking about pretty sure develephant is talking about the exact same thing.

Thanks

Walter,

See attached… and just focus on the t-shirt (as one of many t-shirts)…

So currently because of the way fillColor works with white the only way to achieve the shirt in the picture is to either (a) make 20 different variations of it and show those or ( B) create 2 different “white” images one is the shirt and the other is the skull on the front of the shirt and the combine them into a group and that becomes your t-shirt then from there you can easily say tshirt->fillcolor->rgb(0,0,0) and skull->fillcolor->(1,1,1) etc. and so forth…

What this does is allow you to customize a character or avatar or really anything else.

But… if I was able to just have 1 image with say black tshirt and white skull and say something to the effect of fillcolor(getPixel(0,0,0), setPixel(1,0,0)) and it knows to change the color of black to red that would make life a whole lot easier.

I realize the back end openGL side of this is ummm well brutal as you are not dealing with a model and simply swapping out a texture on geometry but hey if we are all asking for something lol…

The way I currently do it actually gives me a lot of lead way and even with over 500 parts I am still only pushing about 5mb in texture memory so not a big deal but a nice to have :slight_smile:

Chris

@cbishop0, isn’t the link I posted exactly what you want then? With a color matrix, you can map initial rgba values to alternate rgba values.

In theory yes, if implemented better :slight_smile:

Adobes ColorMatrixFilter is a pig and that is being nice lol…

But same logic applies yes.

like i said a nice to have, but at the moment i am just happy being able to apply fillcolors on masks :) 

a pig? in terms of performance? or in terms of usage? what would make it better?

Performance mostly but that could have been just flash as I am not a big fan :slight_smile:

personally I think something as simple as the fill color option would be nice just add find color replace color and it would be super simple to use so long as it didn’t hammer the texture memory.

But man would it be nice for sprites lol

One thing of note - changing the pixel colour is not the same as tinting an image.

In the example image posted above you aren’t going to have much success converting all black of the t-shirt to another colour as it isn’t going to handle anti-aliasing at all (except where it is only a result of alpha channel, but that itself implies overlaying various images).

Laying the images one over the other would be the best way for this, or possibly even using polygon shapes.

If you need to use the ‘final’ image a lot, you might be able combine it all into a snapshot and work with that, depending on the specifics of the case.

The way I do it is pretty simple and provides the best output at the moment and since everything is in an image sheet I just really keep and index like shirt=1 etc and color index = 3 and what not.

It would just be nice to have white on something and have it not effected by fill color etc. lol

Actually come to think about it, if there was an option to exclude solid white on set fill color I would be ecstatic :slight_smile:

If you don’t want to change white and black, the hue filter might do what you want.  

Thanks Rob, I will give it a try and see what happens, just now getting into the 2.0 effects etc. so haven’t really pushed it to see what I could do as I just got done with the port up to 2.0 for this particular project but thinking about it now the hue filter would be PERFECT for eyeballs lol…

Here is a visual breakdown with pseudo-code that might help illustrate the two different features.  I’m using a hex color just as an example.

The “get” color:

11c9m41.png

The “set” color:

2f0bw4y.png

It’s not a tint as noted earlier, nor a regular fill, it’s a find and replace.

With this functionality I can easily replace or add color choices without creating a new avatar image for each one.  I can also use one base icon for possibly limitless combinations.

Hope that helps.

@Rob, I just had some time to play around with using a hue filter and unlike Photoshop and other paint programs etc. the hue filter in 2.0 hues white as well so hueing something orange causes the white areas to go light peach color where if i were to change the hue on the same thing in photoshop it only changes anything that is off white etc.

CoronaLabs, thank you very much for adding this feature! http://coronalabs.com/blog/2014/01/30/introducing-the-color-sample-function/

Hello everybody. I’m considering the development of a set of new apps that must go on ios, android and w-phone (when??).

What absolutely I need is a way to exchange information (ID) between two devices, like “bump” used to do. But I need to do it with some kind of barcode scanner or qrcode scanner. I can also use a simplified algorithm for this, because I will have a max of 100 devices contermprary exchanging data. Of course in this case I would need all pairs to be online…

Hi @a.laciura.  Is there a reason you replied to a thread on getPixel() with this request?  It seems to be un-related.  I would suggest starting a new thread with your information request as to not hijack this thread.  There are two reasons why this is important.  First people who might know your answers are not going to look in a thread about getPixel() to help you.  Secondly, if someone searchs for  your question looking for the same answers, they will be greatly confused about why a thread about getPixel() showed up.

Thank you for your cooperation.

Rob