Copy link to clipboard
Copied
Hi everyone
I'm having a bit of an issue with the AS3 bitmap object. I'm currently developing an 8-bit style pixel game for AIR for Android.
This game is being developed at a very low resolution and is being scaled up to maintain the charm of an old retro game.
One of the methods I'm using is drawing pixels directly to bitmap objects and scaling the object up to create the old look.
When testing on a mobile device, this works beautifully when you set the rendering method to Direct but when you change
the render method to GPU the visuals go all blurry and anti-aliased (it's as if the bitmap is being smoothed out). The mini map
for example is rendered using the setPixel method and then scaled up 9 times. Looks great on my PC but once I export it to my phone
it looks absolutely awful! This is no good as I want to keep the clean, solid pixel look to maintain the the old 8-bit feel and obviously
I'd like to stick to GPU mode due to it's speed.
Like I said, this only happens once you test on a mobile device in GPU mode - it doesn't do it on my main desktop machine or
in Direct mode. I already have the stage quality set to low and I've tried setting the bitmap's smoothing property to false but
it does nothing.
Does anyone have any suggestions as to how I can get around this?
Copy link to clipboard
Copied
Hi,
Did you try setting the stage quality to LOW?
Copy link to clipboard
Copied
I was going to suggest that too, only he did state that he had tried it already.
Copy link to clipboard
Copied
Ha sorry, I had missed that one.
It seems that this thread indicates it's not possible then: http://stackoverflow.com/questions/10979552/flex-mobile-how-to-disable-scale-smoothing-for-sprite-bi...
Copy link to clipboard
Copied
How about first blit your image to a small bitmapData, then draw it on a large bitmapData (9X larger)?
Like,
var small_bmd:BitmapData = new BitmapData(SMALL_WIDTH, SMALL_HEIGHT, false);
var large_bmd:BitmapData = new BitmapData(SMALL_WIDTH * 9, SMALL_HEIGHT * 9, false);
var bm:Bitmap = new Bitmap(large_bmd, PixelSnapping.NEVER, false);
var blitRect:Rectangle = new Rectangle(0, 0, 9, 9);
var i:uint, j:uint, blitColor:uint;
small_bmd.draw(SOURCE_IMAGE);
large_bmd.lock();
for(j = 0; j < SMALL_HEIGHT; j++){
for(i = 0; i < SMALL_WIDTH; i++){
blitColor = small_bmd.getPixel(i, j);
blitRect.x = i * 9;
blitRect.y = j * 9;
large_bmd.fillRect(blitRect, blitColor);
}
}
large_bmd.unlock();
Not sure if the code works or not, but hopefully this helps.
Copy link to clipboard
Copied
Hi Majothi,
Unfortunately the only solution I have found is to use scale 1 and instead draw the graphics on new BitmapDatas with (width*9,height*9)
I wish there was a more optimized solution to avoid the blurry graphics on gpu. Maybe a new feature request could be in order?