GameObjectHighlightGraphic.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:MMORPG_Prototype 作者:
private Texture createHighlightingGraphic(TextureRegion textureRegion)
{
    TextureData textureData = textureRegion.getTexture().getTextureData();
    textureData.prepare();
    Pixmap sourcePixmap = textureData.consumePixmap();
    Pixmap destinationPixmap = new Pixmap(textureRegion.getRegionWidth(), textureRegion.getRegionHeight(), Format.RGBA8888);
    Color color = new Color();

    for (int x = 0; x < textureRegion.getRegionWidth(); x++)
    {
        for (int y = 0; y < textureRegion.getRegionHeight(); y++)
        {
            int colorInt = sourcePixmap.getPixel(textureRegion.getRegionX() + x, textureRegion.getRegionY() + y);
            Color.rgba8888ToColor(color, colorInt);
            destinationPixmap.setColor(1.0f, 1f, 1.0f, 1);
            if (color.a > 0.004f)
                destinationPixmap.drawPixel(x, y);
        }
    }
    Texture result = new Texture(destinationPixmap);
    textureData.disposePixmap();
    destinationPixmap.dispose();
    return result;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号