Page 1 of 1

Avatar pixelation

Posted: 05 Jun 2010, 19:20
by warhell
Hi, I'm creating an avatar from bitmapdata and inputting it into openspace. Everything works out great, except that when the user zooms in or out from the default zoom, the avatar gets destorted/pixelated. Is there an easy workaround for this? Because of the way our app is structured we have to use bitmaps for performance reasons.

Posted: 07 Jun 2010, 08:07
by Bax
Of course if you use bitmap avatars, when zooming they will pixellate. I don't think there's a workaround to this. It is the way Flash works.

Posted: 07 Jun 2010, 08:28
by laxersaz
Enable smoothing in the properties of the avatar images in flash.

Posted: 07 Jun 2010, 18:19
by warhell
How does resizing work when you load a bitmap into OpenSpace? By what factor is the bitmap resized?

Posted: 07 Jun 2010, 21:12
by Bax
When you use the OpenSpace.zoomView method, you choose the resizing factor. This is applied to the whole map container, which is scaled (using DisplayObjects scaleX and scaleY properties) accordingly.
Bitmaps on the map follow the scaling of their container.

Posted: 08 Jun 2010, 20:15
by warhell
Is there anyway to not apply scaling to the avatar? We would like to just change the avatar to a different bitmap (which is scaled before runtime). We are trying to avoid scaling the avatar (since it's a bitmap) so we avoid pixelation all together.

Posted: 08 Jun 2010, 20:18
by Bax
warhell wrote:Is there anyway to not apply scaling to the avatar? We would like to just change the avatar to a different bitmap (which is scaled before runtime). We are trying to avoid scaling the avatar (since it's a bitmap) so we avoid pixelation all together.
No, this is not possible. Avatars are nested sprites inside the map container, which is being scaled.

Posted: 08 Jun 2010, 20:37
by warhell
Is the scaling applied via setting the scale properties or multiplying the existing scale properties?

e.g.

obj.scaleX = newScale;
obj.scaleY = newScale;

or

obj.scaleX *= newScale;
obj.scaleY *= newScale;

I'm assuming it's applied the first way, I'm asking because if it's done the second way I can modify the scaling factor in the constructor, such that the scaleX and scaleY properties are 1.

Posted: 09 Jun 2010, 07:22
by Bax
The scaling is applied in the first way. Also, the scaling is not applied to each movieclip (tiles, avatars, etc) independently, but to the overall container.

Posted: 10 Jun 2010, 00:59
by warhell
bax wrote:The scaling is applied in the first way. Also, the scaling is not applied to each movieclip (tiles, avatars, etc) independently, but to the overall container.
Ahh, so I guess a nice hack would be to stick my avatar bitmap inside a movieclip, and scale that movieclip by a factor such that when openspace scales (when zooming) the scaling of the bitmap is 1?

Posted: 10 Jun 2010, 07:16
by Bax
Not sure I've understood... anyway yo can give it a try.

Posted: 14 Jun 2010, 18:04
by warhell
For example, say that I set the zoom value of openspace to be .5. This means that every object's xscale and yscale property (that is located inside openspace) will be changed to .5. So, if I stick my bitmap in a movieclip who's xscale and yscale is 2, once openspace resizes everything, the original bitmaps scale will be the equivalent of 1.

Posted: 14 Jun 2010, 21:57
by Bax
Yes, but when zooming we don't set the xScale/yScale properties on all the movieclips, but only on the main container.