In theory yes, if implemented better
Adobes ColorMatrixFilter is a pig and that is being nice lolâŚ
But same logic applies yes.
In theory yes, if implemented better
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
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
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:
The âsetâ color:
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.
+1, was thinking of using a feature like this to dynamically be able to set the color of the statusbar
I would use the getPixel() and setPixel() in ActionScript to create custom avatars very easily. Â Would love to have that feature again.Â
Please use the feedback site to vote this up:
Done. Â Thanks Rob.
Can you guys give me more context into your use case?
The reason I ask is b/c with a GPU pipeline, you have to do things differently than you might in a pure CPU pipeline (e.g. Flash). So in a modern GPU pipeline, you do almost all pixel manipulation in a shader.Â
Classically, i.e. CPU-based renderers, you could just manipulate bitmaps, read or write, and then just flush those changes to the framebuffer. Or you could just read the framebuffer directly. With GPUs, those operations are very costly, but that loss of control was outweighed by the benefits.
So depending on what you want to do, thereâs probably a GPU-way of doing it, but I need to understand what you want to do.
For example:
* a color picker use case (i.e. sample an individual color from the screen) could probably be done via some async mechanism. Itâs not going to be in real-time, so just be aware of that. Weâd have to implement that, but itâs not clear who wants this.
* another use case would be that you relax the real-time constraint. In particular, you are okay with manipulating the image *offscreen* and then when youâre done, handing the image to Corona. In this case, you would want to do this in native C code for performance reasons, as Lua would probably be too slow to manipulate images on a per-pixel basis.
* yet another would be that you want to draw into your own texture and use that to fill other objects. This is on the roadmap, and what you would ultimately use here are snapshot objects.
* or maybe you want to do a canvas style effect where you can âdrawâ onto a texture. Snapshot objects have the ability to let you do this:Â https://blog.coronalabs.com/blog/2013/11/01/snapshot-canvas-paint-brushes-trailing-object-effects-etc/
* Etc
* Etc
* Etc
My point is there are a lot of use cases and they may require new techniques, ones that are appropriate to Coronaâs GPU pipeline.
For example, there were some Mode7-like techniques, and on a SNES youâd do it one way to achieve the effect, but in Corona, youâd use snapshot objects:Â http://forums.coronalabs.com/topic/40443-mode-7-demo-full-source/
So if you can give me use cases, we can make sure weâre targeting them as we continue to push G2.0 forward!
Hi Walter,
In my case, it would not need to be real-time. Â In AS3 you can get the color under the mouse pointer, as well as replace a color in a bitmap.
So, it seems like itâs 2 different needs. Â One would be the ability to find and replace a color on a bitmap. Â The other would be the ability to get the color value from a finger tap. Â But, the more I think about it, itâs probably going to be difficult to do something like that since the precision of a mouse pointer is lost on a touch device. Â Of course if it was a large enough area of color, it could still be useful.
Hope that helps.
Yes.
Letâs say I have a simple 2D avatar, mostly solid colors for skin, shirt, pants, etc. and I want the user to be able to adjust some of the colors to add some variation, especially in a multi-player setting.
Instead of having to create the multitude of avatar options, I could present a panel with some color options. Â Once a color was tapped on the color panel ( getPixel() ) then I could apply that to the chosen piece for the avatar â pants for example â which would require a color âfind and replaceâ ( setPixel() ) and letâs assume the starting pants color is a value I know in advance. Â I could then replace that color with the user selected color, save that out, and have the users avatar.
It could also be used in a variety of other cases, but thatâs a simple one.
So I suppose it would look something like:
local colorTbl = getColorAt( x, y ) replaceColor( colorToFind, colorToReplace )
Thanks for adressing this Walter. In my case I would use the feature similar to Develephant, to get the color of a specific pixel on the screen, ie. âgetPixelColorAt(x, y)â and then use the color returned to fill a newRect that is placed behind the statusbar with. This way I could check whether the toolbar in a certain scene contains âxâ color, i could fill the statusbar with a matching color dynamically without having to know what the colors will be before hand.