Is it ok to use all Vector assets?



Is it ok to user all Vector assets?
Any downside when using vectors ? specially when targeting Mobile devices .

Currently i am loading assets from swf libraries. but all the things in swf are vectors.

i didn’t noticed any thing myself but for the sack of knowledge i would like to hear from seniors.

do you guys always rasterize everything when getting vector assets from swf ?



Answer to some of my questions are in this reply :

Taken from the reply:

  • Bitmaps perform faster, at the added cost of file size and/or memory use.
  • In OpenFL, we render vectors out to bitmap before they are rendered.

how ever i am still confused about bitmaps and vectors usage in OpenFL because i see allot of people asking questions regarding bitmapData and from that i assume that people are rasterizing the vectors at runtime.

i know Vector vs Bitmaps but i am talking about OpenFL & Flash workflow here using SWF as libs.

  • What are the things i am still missing ?
  • Do i really need to convert all the Movieclips to Bitmapdata before using them, myself ?

[PS. ignore my English i am not a native speaker]


Here’s a simple vector:

var shape = new Shape (); (0xFF0000); (50, 50, 50);

Once you render this (by putting it on the display list) OpenFL will render it using software to its own surface. Although this is only done once (at first), it is possible you could do things that will force it to be re-rendered:

shape.scaleX = 1.5;

Let us say that you wanted to create your own Bitmap:

var shape = new Shape (); (0xFF0000); (50, 50, 50);
var bitmapData = new BitmapData (Math.ceil (shape.width), Math.ceil (shape.height), true, 0);
var bitmap = new Bitmap (bitmapData);

This will cause OpenFL to render the shape, using software, once. Unless you choose to redraw your object, this will no longer be drawn, even if you scale the Bitmap (instead of drawing again as a smooth shape, it will begin to alias).

Ultimately, this depends a little on your workflow. One-time rendering of vector shapes is not necessarily that expensive, and is a one-time cost, but if you accidentally trigger vectors to render again and again, it will severely hurt your performance, because software rendering is not going to help you get high framerates as much as relying on the GPU.

I think everyone knows, but for what it is worth, on all targets (except Flash) we render the resulting images using the GPU, so everything is rendered in hardware with the exception of the initial draw.


So i am good with the current workflow - using SWF libraries - the vectors coming from them is converted to bitmap right ?.


Yep, but be aware how you use transforms (especially) so that you do not trigger a redraw


Got it now , thank you so much @singmajesty i was just horrified :smiley: that i would need to redo things !.