Actionscript 3.0 颜色插值问题
在 Actionscript 3.0 中,Color 类有一个名为 interpolateColor 的方法。这对我来说似乎很奇怪,但该方法采用两个无符号整数作为颜色,而不是两个 Color 实例。此外,它还为结果颜色返回一个无符号整数。无论如何,我在 API 中没有看到任何用于将 Color 转换为无符号整数或简单地在两个 Color 实例之间进行插值的内容。是否可以在两个 Color 实例之间进行插值,而无需自己编写代码将它们转换为无符号整数?
In Actionscript 3.0, the Color class has a method called interpolateColor. It seems strange to me, but the method takes two unsigned integers for the colors as opposed to two instances of Color. Additionally, it returns an unsigned integer for the resultant color. Anyhow, I don't see anything in the API for converting a Color to an unsigned integer or for simply interpolating between two instances of Color. Is it possible to interpolate between two instances of Color without writing the code to convert them to unsigned integers myself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这有点不方便,但看起来将其转换为数字是唯一的方法。 这里是一篇关于它的帖子,其中包含以下代码:
That is somewhat inconvenient, but it looks like converting it to a number is the only way. Here is a post about it, with this code:
Flash 播放器中的所有颜色都被视为无符号整数。 Color 类特定于 Flash IDE,并扩展了 ColorTransform。 http://livedocs.adobe.com/flash/ 9.0/ActionScriptLangRefV3/fl/motion/Color.html#propertySummary
因此,在您的情况下,您需要做的就是使用 Color 类的“.color”属性。例如,要获取实际颜色,或者仅使用“interpolateTransform”函数,该函数确实从 ColorTransform 转到 ColorTranform。
All colors in the flash player are treated as an unsigned ints. The Color class is specific to the Flash IDE and extends ColorTransform. http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/motion/Color.html#propertySummary
So in your case, all you need to do is use the ".color" property of your Color classes. eg., to get the actual color, or just use the "interpolateTransform" function instead which does go from ColorTransform to ColorTranform.
也许有点晚了,我只是偶然到达此页面,但是,在调整图像大小时,我遇到了类似的插值颜色问题,最后我发现的最佳解决方案是使用 Bicubic 进行 2D 变换,使用 Hermite 进行 1D 变换。看一下http://www.yoambulante.com/en/labs/interpolation。 php 干杯!
maybe it is a bit late, I just arrived here in this page by chance but, I was facing a similar problem with the interpolation colour when resizing images and at the end the best solution I found was using Bicubic for 2D transformations and Hermite for 1D. take a look on it http://www.yoambulante.com/en/labs/interpolation.php cheers!
不能使用 ColorTransform 实例吗?
您从 instanceMovieClip.transform.colorTransorm 获取 colorTransfrom 然后用 Color.interpolateTransform 插入 colorTransofrm ?
我认为我不明白您想要实现的目标(为什么需要插入两个颜色实例?而不是颜色(ints)或 colorTransforms)?
Can you not use ColorTransform instances ?
You get the colorTransfrom from instanceMovieClip.transform.colorTransorm then interpolate the colorTransofrm with Color.interpolateTransform ?
I don't think I understand what you're trying to achieve (why do you need to interpolate two Color Instances ? and not colors(ints) or colorTransforms) ?