你如何告诉 libgdx 使用特定颜色来实现透明度? [英] How do you tell libgdx to use a specific color for transparency?

查看:19
本文介绍了你如何告诉 libgdx 使用特定颜色来实现透明度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 GraphicsGale,它不支持透明度.解决这个问题的简单方法是使用一种非常难看的颜色(在我的例子中是#808040)并将其用于透明度.不过,我一直无法找到如何在 libgdx 中执行此操作的方法.我当然可以通过 GIMP 将其拉出并填充透明度,但直接从 GraphicsGale 中工作会很好.

I use GraphicsGale and it doesn't support transparency. The easy fix for this problem is to just use a really ugly color (#808040 in my case) and use that for transparency. I haven't been able to find a way how to do this in libgdx though. I can of course just pull it through GIMP and fill in the transparency, but it would be nice to work straight out of GraphicsGale.

所以我的问题是,有没有办法让 libgdx 将颜色视为透明度,如果有,怎么做?

So my question is, is there a way to make libgdx treat a color as transparency, and if there is, how?

推荐答案

我模块化了用透明度替换颜色的方法,这是我的 ImageMagick 脚本:

I modularized my approach at replacing the color with transparency, here's my ImageMagick script:

#!/bin/bash

rm -rf x-android/assets/*
cp -r assets/* x-android/assets

cd x-android/assets
for f in `find . -name "*.png"`
do
    convert $f -transparent '#808040' $f
done

不是直接的答案,但效果更好.

Not a direct answer, but it works way better.

这篇关于你如何告诉 libgdx 使用特定颜色来实现透明度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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