简体   繁体   English

您如何告诉libgdx使用特定颜色的透明度?

[英]How do you tell libgdx to use a specific color for transparency?

I use GraphicsGale and it doesn't support transparency. 我使用GraphicsGale,它不支持透明性。 The easy fix for this problem is to just use a really ugly color (#808040 in my case) and use that for transparency. 解决此问题的简单方法是仅使用一种难看的颜色(在我的情况下为#808040)并将其用于透明度。 I haven't been able to find a way how to do this in libgdx though. 我一直没有找到在libgdx中执行此操作的方法。 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. 我当然可以通过GIMP来完成它并填写透明度,但是直接从GraphicsGale中工作将是一件很不错的事情。

So my question is, is there a way to make libgdx treat a color as transparency, and if there is, how? 所以我的问题是,有没有一种方法可以使libgdx将颜色视为透明,如果可以,怎么办?

I modularized my approach at replacing the color with transparency, here's my ImageMagick script: 我模块化了用透明度替换颜色的方法,这是我的ImageMagick脚本:

#!/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. 这不是一个直接的答案,但是效果更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM