Flash: why 9 slice scaling for vectors?
If flash is a vector format why do you need 9 slice scaling like with bitmaps? Can't you just access the anchors 开发者_开发知识库and do with them what you will, or tag which segments of a path should scale? And if not, does this mean that flash renders vectors as bitmaps and therefore they pixelate when scaled up.
To make it clear I'm not asking what... I'm asking why. I know what 9 slice scaling is, and realise its perks. But also I see its shortcomings especially with complex shapes, not everything can fit easily into a rectangle. Vectors don't just give you scalable graphics without pixelation, they give you nodes and anchors and angles and besier curves. I want to know if this information is accessible, because it makes sense from a usability standpoint that it should. If it isn't accessible, is this because of how the flash format stores or renders this information.
I ask this because 9 slice scaling doesn't care about vectors, it treats vectors and bitmaps the same, when really you have much richer information with vector graphics for things like manipulation, or at least it would stand to reason that you do.
The idea behind 9 slice scaling is that the corners are not scaled, and the edges are only scaled on a specific axis. The top/bottom sections are scaled on the x-axis and the left/right sections are scaled on the y-axis. The middle section is scaled on both axis.
This article about 9 slice scaling might be helpful.
Flash also does have an option to render vector graphics as bitmaps for performance reasons.
The idea behind 9 slicing a vector is that you could make a button that matches the visual style of all the other buttons while being a completely different ratio/size.
You could design your button square, set-up 9 slicing and use it all over your flash app regardless of the size it needs to be.
If you do not 9 slice a vector it will scale proportionality to it's container. This would result in a thicker line on bigger buttons the smaller buttons.
I just found the answer in Chapter 9 of the in the AS3 dev guide under 'Caching display objects'...
The display object is a surface, essentially a bitmap version of the instance’s vector data
and then goes on to state...
Note: You can update the vector data, at which time the surface is recreated.
Although I haven't yet found a way of accessing individual vectors... and I'm not sure I'm going to find one.
精彩评论