You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by flexcf <fl...@yahoo.com> on 2015/09/22 17:59:02 UTC
Color an Image
What is the best API calls to use to say change the color of a picture(image)
of a car?
Thanks all!
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Color-an-Image-tp11211.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: Color an Image
Posted by "pkumar.flex" <pr...@gmail.com>.
Use bitmapData & Matrix class for any type of image editing related work.
These are lower level api so you have to do struggle.
On 22-Sep-2015 9:37 pm, "flexcf [via Apache Flex Users]" <
ml-node+s2333346n11211h26@n4.nabble.com> wrote:
> What is the best API calls to use to say change the color of a
> picture(image) of a car?
>
> Thanks all!
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-flex-users.2333346.n4.nabble.com/Color-an-Image-tp11211.html
> To unsubscribe from Apache Flex Users, click here
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=cHJhc2hha3VtYXJAZ21haWwuY29tfDF8LTU0MTcyMzE2NA==>
> .
> NAML
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Color-an-Image-tp11211p11212.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: Color an Image
Posted by megharajdeepak <me...@gmail.com>.
Not quite sure if the color is same across entire image. If yes, then this is
what you can do:
Let's say you have an image which if fully red in color(which may be an
outline or content) and on some action if you want to turn that to green,
you can use this method:
changeImageColor(yourBitmapImage, 0xff0000(your image's color : red),
0x00ff00(green color));
private var colorTransform:ColorTransform;
private function changeImageColor(image:BitmapImage,
originalColor:uint, newColorToBeApplied:uint):void
{
if(!colorTransform)
{
colorTransform = new ColorTransform();
}
colorTransform.redOffset = ((newColorToBeApplied & (0xFF <<
16)) >> 16) - ((originalColor & (0xFF << 16)) >> 16);
colorTransform.greenOffset = ((newColorToBeApplied & (0xFF
<< 8)) >> 8) - ((originalColor & (0xFF << 8)) >> 8);
colorTransform.blueOffset = (newColorToBeApplied & 0xFF) -
(originalColor & 0xFF);
colorTransform.alphaMultiplier = 1;
displayObject.transform.colorTransform = colorTransform;
}
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Color-an-Image-tp11211p11213.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.