Is there a way to tint an image?

Hi folks,

is there a way to tint an image that was loaded via display.newImage? I think when I use object:setFillColor, the image disappears.

Michael

http://www.whiteskygames.com
http://twitter.com/mhartlef [import]uid: 5712 topic_id: 1168 reply_id: 301168[/import]

Bitmap manipulation is not supported yet in current betas. [import]uid: 6066 topic_id: 1168 reply_id: 3399[/import]

It’s not bitmap manipulation I am after but more to set the vertex color for an image. Easy in Opengl to do. [import]uid: 5712 topic_id: 1168 reply_id: 3402[/import]

Could you overlay the image with a newRect object and tweak the alpha value to get the color effect you want?

Tom [import]uid: 6119 topic_id: 1168 reply_id: 3408[/import]

Sure Tom, that would be a workaround for a few images and these have to be images that use the full rectangle, means no alpha values. Then you can do that.

I use tinting a lot with particles in another language.

Anyway, your workaround is not really a solution for something like corona when you have a lot of objects performance wise or when the underlaying image has alpha values. [import]uid: 5712 topic_id: 1168 reply_id: 3411[/import]

I would also required a solution for this situation - perhaps it would be more of a “feature request” post, since there doesn’t seem to be any workaround.

I’m working on a sport game, and I want players to be able to customize their team, so unless I split up every image in layers of the parts I want customize, create an image in each color I want them to use, and then layer them all up… which is a completely idiotic solution, I can’t do it.

If I could use a Rectangle to tint the image (the old alpha trick), but with image masking, or if I could apply a tint to only the non-transparent part of an image, it could work. But right now that’s not an option.

Of course the best solution would be complete palette control. But that’s a long shot. [import]uid: 4920 topic_id: 1168 reply_id: 3463[/import]

I just jump in here to say that I would need that too badly… together with real masking support. [import]uid: 6928 topic_id: 1168 reply_id: 3465[/import]

Bumping this as it is also very important for a project. This has been available in Appcelerator’s Titanium, but the performance is poor. [import]uid: 4661 topic_id: 1168 reply_id: 4684[/import]

Bumping this, too. I am working with Corona for a short time now, and although I really like it, the features I missed immediately from the beginning is really basic stuff like

  • Tinting images
  • Blend modes

It’s really hard to create a decent looking game without these features, so I hope there will be an official statement soon if this is planned to be added at least. My trial period ends in two weeks, and I’ll have to take the lack of these features into account then :frowning: [import]uid: 9644 topic_id: 1168 reply_id: 8132[/import]

Tinting is essential for me too…

I am going to use many sprites of the same shape - different color in my game. Without tinting it is going to be a huge waste of texture memory. [import]uid: 7356 topic_id: 1168 reply_id: 8138[/import]

I shall bump this. Could we please have this added? It would be very helpful to lots of people. [import]uid: 22824 topic_id: 1168 reply_id: 37672[/import]

Once more unto the “bump” dear friends - given that it’s such core feature I’d like to see it added as well - it’d be really great to be able to use this to recolour bitmap fonts as well.

Jon…
[import]uid: 7901 topic_id: 1168 reply_id: 38036[/import]

Bump on this. I really really need this as well. [import]uid: 8192 topic_id: 1168 reply_id: 38037[/import]

Bumping too. I want to make a character that changes color based on the powers he has. Using multiple sprites is wasting lots of memory. [import]uid: 41957 topic_id: 1168 reply_id: 75827[/import]

http://developer.anscamobile.com/reference/index/objectsetfillcolor [import]uid: 7911 topic_id: 1168 reply_id: 75831[/import]

@jstrahan,

They aren’t looking to set the fill color or alpha on a primitive, they want to add color tinting to a sprite (image). [import]uid: 16734 topic_id: 1168 reply_id: 75928[/import]

copied from link above
Starting with build 2011.612, tinting can be added to display.newImage and display.newImageRect objects, but not if they have a bitmap mask applied to them (known limitation at the moment)

Setting tint for image objects:
image:setFillColor( gray )
image:setFillColor( gray, alpha )
image:setFillColor( red, green, blue )
image:setFillColor( red, green, blue, alpha ) [import]uid: 7911 topic_id: 1168 reply_id: 75930[/import]

Ah, very nice! Thanks @jstrahan! [import]uid: 16734 topic_id: 1168 reply_id: 75932[/import]

welcome [import]uid: 7911 topic_id: 1168 reply_id: 75933[/import]

Thank you @jstrahan! Forgot to check on the documentation and went straight to the forums. :stuck_out_tongue: [import]uid: 41957 topic_id: 1168 reply_id: 75936[/import]