Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
TheDarkIn1978
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook

Re: Assets Without Anti-Aliasing on Simulator [EDITED]?

i'm curious why this is the case.  maybe vector graphic animations on high quality settings is much slower.  i guess i'll have to write my own rasterize routine for my vectors.  i suppose that should speed up performance so while it's a pain in the **bleep** i suppose it had it's benifits.


jotstudios wrote:

 

I've 2 issues with this :-

 

- if/when the larger screen Playbook comes out, the PNGs in my app will need to scale up and how good will this look ?


 i plan on sizing my graphics as vector for multi-screen portability and then rasterizing them to bitmap objects.  hopefully that will do the trick.


PlayBook Applications:
Drop Swatch
Contributor
friedit
Posts: 32
Registered: ‎12-08-2010
My Device: Not Specified

Re: Assets Without Anti-Aliasing on Simulator [EDITED]?

 


TheDarkIn1978 wrote:

i'm curious why this is the case.  maybe vector graphic animations on high quality settings is much slower.  i guess i'll have to write my own rasterize routine for my vectors.  i suppose that should speed up performance so while it's a pain in the **bleep** i suppose it had it's benifits.


jotstudios wrote:

 

I've 2 issues with this :-

 

- if/when the larger screen Playbook comes out, the PNGs in my app will need to scale up and how good will this look ?


 i plan on sizing my graphics as vector for multi-screen portability and then rasterizing them to bitmap objects.  hopefully that will do the trick.


cacheasbitmap looks also bad - so you have to rasterize your graphics in your authoring software.

 

Developer
studiochris
Posts: 165
Registered: ‎10-26-2010
My Device: BlackBerry® PlayBook™

Re: Assets Without Anti-Aliasing on Simulator [EDITED]?

If I understand correctly, vectors have to be rendered, rasterized and then drawn to the stage on every frame. By skimping on the AA filter, just like in draft quality 3D rendering, the rendering stage is done faster. Of course, it may only save a fraction of a millisecond per object, but for 30FPS, all ActionScript for a frame and the complete frame drawing process has to be finished in 33.3 ms without dropping the frame rate. Every little bit helps.

Bitmaps skip the render and rasterize stage and are just drawn to the stage as appropriate. They don't require the calculation power that vectors do.
Developer
TheDarkIn1978
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook

Re: Assets Without Anti-Aliasing on Simulator [EDITED]?

 


friedit wrote:

 

cacheasbitmap looks also bad - so you have to rasterize your graphics in your authoring software.

 


 

**bleep**, i had assumed there was a difference between caching a vector as a bitmap and manually converting one into a bitmap object, but it appears they are the same - at least they are on the simulator.

 

this is truly awful.  is there strategy behind this rendering on the playbook?  i mean, properly rendered graphics are absolutely fundamental for application design.  i can't see a lot of developers / designers being pleased with this.

 

it would be nice to get an explanation about this from RIM as using only pre rendered bitmap assets is not at all an ideal solution, especially for portable applications.

 

maybe there's a difference on the device?  i don't have a device yet so i can't test this.  here's the code and a screenshot from the simulator is also attached.

 

 

package
{
//Imports
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.GradientType;
import flash.display.PixelSnapping;
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.geom.Matrix;

//SWF Metadata Tag
[SWF (backgroundColor = "#444444")]

//Class
public class PlayBookTest extends Sprite
{	
	//Constructor
	public function PlayBookTest()
	{
		stage.align = StageAlign.TOP_LEFT;
		stage.scaleMode = StageScaleMode.NO_SCALE;
		stage.frameRate = 60;
		
		init();
	}
	
	//Initialize
	private function init():void
	{	
		//Draw Vector Graphic
		var vectors:Shape = new Shape();
		
		vectors.graphics.lineStyle(5.0, 0xFFFFFF, 1.0, true);
		vectors.graphics.lineTo(0, 0);
		vectors.graphics.curveTo(40, 150, 200, 10);
		vectors.graphics.lineTo(340, 120);
		vectors.graphics.curveTo(100, 100, 125, 200);
		vectors.graphics.curveTo(0, 200, 0, 0);
		
		//Convert Vector Graphic to Bitmap Object
		var vectorsData:BitmapData = new BitmapData(vectors.width, vectors.height, true, 0x00FFFFFF);
		vectorsData.draw(vectors, null, null, null, null, true);
		
		var vectorsBitmap:Bitmap = new Bitmap(vectorsData, PixelSnapping.AUTO, true);
		
		//Add Vectors and Bitmap to Display List
		vectors.x = ((stage.stageWidth / 2) - vectors.width) / 2;
		vectorsBitmap.x = stage.stageWidth / 2 + vectors.x;
		vectors.y = vectorsBitmap.y = stage.stageHeight / 2 - vectors.height / 2;
		
		addChild(vectors);
		addChild(vectorsBitmap);
	}
}
}

 

 


PlayBook Applications:
Drop Swatch
Developer
shawnblais
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

Re: Assets Without Anti-Aliasing on Simulator [EDITED]?

This is more an AIR 2.5 issue then it is Playbook, it is the same way on Android as well, medium rendering is used and stage.quality is ignored.
Developer
TheDarkIn1978
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook

Re: Assets Without Anti-Aliasing on Simulator [EDITED]?

[ Edited ]

 


shawnblais wrote:
This is more an AIR 2.5 issue then it is Playbook, it is the same way on Android as well, medium rendering is used and stage.quality is ignored.

you've run this code on android and the results are similar?  so the issues is Mobile AIR?  that's shocking, depressing.   Android has AIR 2.6 available now so did you run it with 2.5 or 2.6?  perhaps this "feature" has been depreciated in AIR 2.6.

 


PlayBook Applications:
Drop Swatch
Developer
shawnblais
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

Re: Assets Without Anti-Aliasing on Simulator [EDITED]?

[ Edited ]

Yep. it's across the board on AIR for Mobile.

Smoothing for bitmaps is completely disabled, and you can only set stageQuality to LOW or MEDIUM. With medium render quality any vector objects are only going to come out so-so.

I think you can get decent results by manually bitmap caching your assets yourself. For example, you could have a hi-res version of each icon, and then bitmapData.draw() that, with smoothing, and it should look good.... but it might just be easier to have two versions of the icon :smileytongue:

Developer
shawnblais
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

Re: Assets Without Anti-Aliasing on Simulator [EDITED]?

[ Edited ]

Roughly speaking, this is the technique:

 

matrix.scale(ratio,ratio);
bd.draw(original.bitmapData,matrix,color,null,rect,true);

final = new Bitmap(bd);
final.smoothing = true;

Developer
miroslav
Posts: 29
Registered: ‎11-14-2010
My Device: Playbook

Re: Assets Without Anti-Aliasing on Simulator [EDITED]?

You cannot set stage quality higher than MEDIUM for AIR Mobile profile which is used for PlayBook, Android and every other mobile platform. To make things worse, you can't set stage quality for desktop profile below HIGH (that also means ADT) so you cannot see how graphic will look on device unless you are testing on simulator or device it self.
New Developer
jotstudios
Posts: 10
Registered: ‎04-21-2011
My Device: PlayBook Developer

Re: Assets Without Anti-Aliasing on Simulator [EDITED]?

Hi all.

 

I ended up using the "Export as bitmap" option in Flash Pro 5.5 which is good for a known screen size/ resolution. But I'm thinking that I'm going to have to do something to dynamically size as suggested (if another size PlayBook ever came out or to port to another tablet).

 

Anyone got any good suggestions/opinions/preferences about using Spritesheets vs pre-prepared MovieClips (with bitmaps not vectors) or other good techniques for animation ?

 

I saw this recently - had some good tips :-

 

http://sierakowski.eu/list-of-tips/86-building-mobile-games-in-adobe-air-optimization-techniques-use...

 

All the best guys

 

J