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:21:33 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Blurring bitmaps in Flash targeting Mobile
Pages: [1]
Print
Author Topic: Blurring bitmaps in Flash targeting Mobile  (Read 678 times)
electrolyte
Level 2
**



View Profile
« on: November 16, 2012, 03:11:21 AM »

Hi there

I'm trying to blur a bitmap data object but the target platform is Android / Mobile which doesn't support (as far as I'm aware) filters.

Has anyone got any ideas how a blur effect can be achieved? I have a bitmap, 256 X 256 that needs blurring, it’s not in a game loop so could loop through the bitmap data but not sure where to start …
Logged

st33d
Guest
« Reply #1 on: November 16, 2012, 03:47:09 AM »

Can you not blur the assets before they're imported?

I've not seen blur disabled before unless you're running Stage3D.
Logged
electrolyte
Level 2
**



View Profile
« Reply #2 on: November 16, 2012, 04:17:25 AM »

The asset bitmap is dynamic,

I sorted it after discovering this:

import fl.motion.Color;
Color.interpolateColor(colour1,colour2,ratio)

Then wrote a cheeky function that goes through the pixels, every other one, and plots a new colour half way between, if that makes sense :D

<edit>





This is after a few minutes code, so will mess around with it some more to stop that right edge messing up. I quite like the lo-fi blur effect!



« Last Edit: November 16, 2012, 04:29:14 AM by electrolyte » Logged

st33d
Guest
« Reply #3 on: November 16, 2012, 05:34:21 AM »

You should be searching for a Gaussian Blur algorithm.

This one should be fast:

http://incubator.quasimondo.com/processing/superfast_blur.php

It's written in Processing: http://incubator.quasimondo.com/processing/superfastblur.pde

All you really have to know to port it is that the "pixels" property of img is a one dimensional array describing a list of the pixels in the image.

You just need to convert references to that array to calls to getPixel.
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #4 on: November 16, 2012, 02:44:10 PM »

You can also do a blur, even guassian, without any pixel manipulations by just drawing the same image multiple times at different offsets - on some platforms this can be much faster than doing it manually.

I actually quite like your lo-fi effect though.
Logged
st33d
Guest
« Reply #5 on: November 16, 2012, 07:15:57 PM »

fair point

pixel art and blur are not bed fellows

that always pissed me off about swords and sworcery
Logged
X-Tender
Level 1
*



View Profile WWW
« Reply #6 on: November 25, 2012, 10:57:07 PM »

Sorry for the little OffTopic question but, did you use RAW Flash + AIR to make it run on Mobile or run on a stage3D and a framework like Starling?
Logged

goshki
Level 3
***



View Profile WWW
« Reply #7 on: November 26, 2012, 12:02:36 AM »

I actually quite like your lo-fi effect though.

Yeah, the mobile version looks better and more consistent.
Logged

electrolyte
Level 2
**



View Profile
« Reply #8 on: July 30, 2013, 01:20:03 AM »

Sorry for the little OffTopic question but, did you use RAW Flash + AIR to make it run on Mobile or run on a stage3D and a framework like Starling?

Yeah, it's just pure flash published to AIR / Android / iOS. I've not used a framework ... but should really but for this type of game having my own bitmap blitter seems to be ok. Starling is the way forward tho :D
Logged

GroZZleR
Level 0
***



View Profile WWW
« Reply #9 on: July 30, 2013, 09:18:54 AM »

BitmapData.applyFilter() should be a lot faster than looping through every pixel if it gives you the same effect.
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic