Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075919 Posts in 44152 Topics- by 36120 Members - Latest Member: Royalhandstudios

December 29, 2014, 03:15:33 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)BitmapData question (AS3)
Pages: [1]
Print
Author Topic: BitmapData question (AS3)  (Read 870 times)
ChevyRay
Guest
« on: August 22, 2009, 03:04:35 AM »

What would be the best way to give all pixels of a certain colour full-transparency in a BitmapData object? So, for example, I want the alpha value of all black pixels to be set to 0.

I could just scan through every pixel and check if it's black, but that sounds painfully inefficient, so I have a feeling there's a better way.
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #1 on: August 22, 2009, 04:00:30 AM »

BitmapData.threshold
Logged
ChevyRay
Guest
« Reply #2 on: August 22, 2009, 04:19:03 AM »

Cool, that worked perfectly! Thanks Boris.
Logged
Glaiel-Gamer
Moderator
Level 10
******


Stoleurface!


View Profile WWW Email
« Reply #3 on: August 22, 2009, 09:59:48 AM »

If you ever want to do something more advanced than just turn black to 0, you may want to look into Pixel Bender too
Logged

ChevyRay
Guest
« Reply #4 on: August 22, 2009, 01:40:21 PM »

Yeah, I couldn't even understand the description of Pixel Bender, so I doubt I'll be exploring that kind of territory anytime soon.
Logged
Glaiel-Gamer
Moderator
Level 10
******


Stoleurface!


View Profile WWW Email
« Reply #5 on: August 22, 2009, 02:24:25 PM »

Yeah, I couldn't even understand the description of Pixel Bender, so I doubt I'll be exploring that kind of territory anytime soon.

A simple explanation:

It's a shader. It is a piece of code written (in pixel bender language), that is applied individually to every single pixel on the bitmap (although using parallel processing like a GPU does to do that really really fast). So if you wanted black pixels to take the color of their neighbor with the highest brightness, you could do that.
Logged

ChevyRay
Guest
« Reply #6 on: August 22, 2009, 04:17:11 PM »

Cool. Makes sense. I might end up looking into that when I want to get pixel crazy. Thanks!
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic