当前位置: 首页>>代码示例>>C#>>正文


C# Color.AlphaBlend方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Color.AlphaBlend方法的典型用法代码示例。如果您正苦于以下问题:C# Color.AlphaBlend方法的具体用法?C# Color.AlphaBlend怎么用?C# Color.AlphaBlend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Color的用法示例。


在下文中一共展示了Color.AlphaBlend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTileColor

        public static Color GetTileColor(Tile tile, Color background, bool showWall = true, bool showTile = true, bool showLiquid = true, bool showWire = true)
        {
            var c = new Color(0, 0, 0, 0);

            if (tile.Wall > 0 && showWall)
                if (World.WallProperties.Count > tile.Wall)
                    c = c.AlphaBlend(World.WallProperties[tile.Wall].Color);
                else
                    c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors
            else
                c = background;

            if (tile.IsActive && showTile)
            {
                if (World.TileProperties.Count > tile.Type)
                    c = c.AlphaBlend(World.TileProperties[tile.Type].Color);
                else
                    c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors
            }

            if (tile.Liquid > 0 && showLiquid)
                c = c.AlphaBlend(tile.IsLava ? World.GlobalColors["Lava"] : World.GlobalColors["Water"]);

            if (tile.HasWire && showWire)
                c = c.AlphaBlend(World.GlobalColors["Wire"]);

            return c;
        }
开发者ID:nikitikitaki,项目名称:Terraria-Map-Editor,代码行数:28,代码来源:PixelMap.cs

示例2: GetTileColor

        public static Color GetTileColor(Tile tile, Color background, bool showWall = true, bool showTile = true, bool showLiquid = true, bool showRedWire = true, bool showBlueWire = true, bool showGreenWire = true, bool showYellowWire = true)
        {
            var c = new Color(0, 0, 0, 0);

            if (tile.Wall > 0 && showWall)
            {
                if (tile.WallColor > 0 && (!showTile || tile.TileColor == 0))
                    c = c.AlphaBlend(World.PaintProperties[tile.WallColor].Color);
                else if (World.WallProperties.Count > tile.Wall)
                {
                    if (World.WallProperties[tile.Wall].Color.A != 0)
                        c = c.AlphaBlend(World.WallProperties[tile.Wall].Color);
                    else
                        c = background;
                }
                else
                    c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors
            }
            else
                c = background;

            if (tile.IsActive && showTile)
            {
                if (tile.TileColor > 0)
                    c = c.AlphaBlend(World.PaintProperties[tile.TileColor].Color);
                else if (World.TileProperties.Count > tile.Type)
                    c = c.AlphaBlend(World.TileProperties[tile.Type].Color);
                else
                    c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors
            }

            if (tile.LiquidAmount > 0 && showLiquid)
            {
                if (tile.LiquidType == LiquidType.Lava) c = c.AlphaBlend(World.GlobalColors["Lava"]);
                else if (tile.LiquidType == LiquidType.Honey) c = c.AlphaBlend(World.GlobalColors["Honey"]);
                else c = c.AlphaBlend(World.GlobalColors["Water"]);
            }

            if (tile.WireRed && showRedWire)
            {
                c = c.AlphaBlend(World.GlobalColors["Wire"]);
            }
            if (tile.WireGreen && showGreenWire)
            {
                c = c.AlphaBlend(World.GlobalColors["Wire2"]);
            }
            if (tile.WireBlue && showBlueWire)
            {
                c = c.AlphaBlend(World.GlobalColors["Wire1"]);
            }
            if (tile.WireYellow && showYellowWire)
            {
                c = c.AlphaBlend(World.GlobalColors["Wire3"]);
            }

            return c;
        }
开发者ID:TEdit,项目名称:Terraria-Map-Editor,代码行数:57,代码来源:PixelMap.cs


注:本文中的Microsoft.Xna.Framework.Color.AlphaBlend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。