Sharpness of Vector based MovieClips

Hi there

I’m loading movieclips that contains vector graphics from af swf exported from Adobe Flash.

However they movieclips are blurred and it get’s even worse when scaled. I would expect though, that their sharpness was preserved, since they are vector based.

Normally I use code like this:

var icon = Assets.getMovieClip("library:MyIcon");
icon.scaleX = icon.scaleY = 2.0;
addChild(icon);

So how do I preserve the sharpness of the my MovieClips that contains vector based graphics.

Best Mikkel

1 Like

Currently, we draw at 1:1 and scale in hardware. Perhaps there’s a better way we can handle assets that are always scaled up in the future, at the moment, you’d have to copy the drawing instructions at a higher resolution. Can you scale up in the SWF? Sorry for the inconvenience

@singmajesty no worries and thanks for you answer. I can scale it up in the swf, since we have the .fla project, however that will only fit a certain target resolution, but that might look ok.

One thing that I don’t understand though, is why my Swf assets are blurry with OpenFL Next but nice and sharp when I switch to legacy?

The older renderer used GL primitives for rendering. You might notice that it has jagged edges, or fails under certain types of shapes. One solution in the SWF library to force “cacheAsBitmap” on certain shapes to try and improve the fidelity, but this falls through to software rendering.

The issue with software rendering is that it may draw over and over if you move, scale, rotate or otherwise use the object. We’re trying to reduce software rendering in the newer codebase as much as possible by caching the initial 1:1 representation and using hardware to manipulate from there, but the older codebase kept drawing again, which could really hurt :slight_smile:

@singmajesty Ah, I see.

So my options are.

  1. Scale up my assets in the SWF Library to match the resolution of let’s say a retina Ipad. That would however not match other resolutions and cause additional scaling with other resolutions, but it would might look ok.

  2. Modify OpenFL by adding a “scale once please” option when instantiating movieclips. That would give me full control at runtime to match the exact resolution of the device. Now, do you have any idea of how difficult a task this would be? And maybe you could point me in direction of were in the codebase to get started?