AS3 色调位图

发布于 2024-12-26 03:11:42 字数 463 浏览 2 评论 0原文

我有一个正在处理的项目的精灵表,我需要能够更改图像的色调,以便我可以寻找空间。该图像上有一些简单的纹理,但将以 5 种不同的颜色显示。我附加了一张图片来准确了解我在说什么:http://i42.tinypic.com/29443l5。 png

我试图在生成的精灵上使用它来达到我想要的效果:

var c:ColorTransform = new ColorTransform();
c.color = 0xf30909;
transform.colorTransform = c;

但是我把所有东西都变成了红色,而不是我想要的。我正在为 AIR 进行构建,因此无法导入 fl.motion.Color 包(或者至少 Flash Builder 4.5 没有它)。我知道如何才能达到预期的效果吗?谢谢。

I have a spritesheet for a project I am working on and I need to be able to change the tint of the image so I can se space. The image has some simple texture on it but it will be displayed in 5 different colors. I attached an image to see exactly what I am talking about: http://i42.tinypic.com/29443l5.png

I tried to achieve my desired effect using this on the resulting sprite:

var c:ColorTransform = new ColorTransform();
c.color = 0xf30909;
transform.colorTransform = c;

But I get everything red, not as I want. I am building for AIR so the package fl.motion.Color can't be imported (or at least Flash Builder 4.5 does not have it). Any idea on how I can achieve the desired effect? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

感情废物 2025-01-02 03:11:42

只是为了完整性......

public function Tint(display:DisplayObject, color:uint) {
    display.transform.colorTransform = new ColorTransform(color >> 16 & 0x0000FF / 255, color >> 8 & 0x0000FF / 255, color & 0x0000FF / 255);
}

Just for the sake of completeness...

public function Tint(display:DisplayObject, color:uint) {
    display.transform.colorTransform = new ColorTransform(color >> 16 & 0x0000FF / 255, color >> 8 & 0x0000FF / 255, color & 0x0000FF / 255);
}
独自←快乐 2025-01-02 03:11:42

color 属性设置偏移,即它使ColorTransform 将颜色值添加到图像中。您可能想要使用Multiplier 属性。请参阅 ColorTransform 文档

The color property sets the offset, i.e. it makes the ColorTransform add the color value to your image. You probably want to use the Multiplier properties. See ColorTransform documentation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文