在框架中的哪个地方传递Graphics对象来实现绘图? [英] Where in the framework is the Graphics object passed around to achieve drawing?

查看:149
本文介绍了在框架中的哪个地方传递Graphics对象来实现绘图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解Flex框架如何绘制对象(按钮,标签,图像等)。 Button类似乎通过addChild()编写了它的ProgrammaticSkin。但是,框架中的图形对象在层次结构中传递以实现绘图。我想要达到2D API的水平。

解决方案

在flash / flex中没有单个全局图形对象。每个Shape和Sprite(UIComponent是一个Sprite)都有一个类型为图形对象。 flash / display / Graphics.htmlrel =nofollow noreferrer>可以绘制的图形。在flex应用程序中,应该在覆盖中执行程序化绘图 updateDisplayList 方法的组件。您应该在绘制时使用组件的 unscaledWidth unscaledHeight 作为边界。


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.

解决方案

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆