Graphics 对象在框架中的什么地方被传递来实现绘图? [英] Where in the framework is the Graphics object passed around to achieve drawing?
问题描述
我试图了解 Flex 框架如何绘制对象(按钮、标签、图像等).Button 类似乎通过 addChild() 对其 ProgrammaticSkin 进行绘制.但是,在框架中的哪个位置是在层次结构中传递的 Graphics 对象以实现绘图.我想达到 2D API 的水平.
I'm trying to understand how the Flex framework draws objects (Button, Label, Image, etc.). The Button class seems to draw itself by addChild()ing its ProgrammaticSkin. However, where in the framework is the Graphics object being passed around in the hierarchy to achieve the drawing. I want to get to the level of 2D API.
推荐答案
flash/flex 中没有单一的全局图形对象.每个 Shape 和 Sprite(UIComponent 是 Sprite)都有一个 graphics
对象,类型为 可以在其上绘制的图形.在 flex 应用程序中,程序化绘图应该在重写的 updateDisplayList 方法.你应该使用组件的 unscaledWidth
和 unscaledHeight
作为它的边界.
There is no single global graphics object in flash/flex. Every Shape and Sprite (UIComponent is a Sprite) has a graphics
object of type Graphics that can be drawn on. In a flex app, programmatic drawing should be done in the overriden updateDisplayList method of the component. You should use the component's unscaledWidth
and unscaledHeight
as its bounds while drawing on it.
这篇关于Graphics 对象在框架中的什么地方被传递来实现绘图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!