ARCed.Controls.IconCache.Passage4Dir C# (CSharp) Метод

Passage4Dir() публичный статический Метод

Caches and returns an icon used for Passage 4-Dir.
public static Passage4Dir ( int passage ) : Microsoft.Xna.Framework.Graphics.Texture2D
passage int Passage value
Результат Microsoft.Xna.Framework.Graphics.Texture2D
        public static Texture2D Passage4Dir(int passage)
        {
            passage &= ~BUSH;
            passage &= ~COUNTER;
            string key = String.Format("passage{0}", passage);
            if (_cache.ContainsKey(key))
                return _cache[key];
            if (passage == 0)
                return CacheTexture("passageall");
            if ((passage & ALL) == ALL)
                return CacheTexture("passagenone");
            {
                Bitmap b = GetBitmap("passagenone");
                using (Graphics g = Graphics.FromImage(b))
                {
                    if ((passage & DOWN) != DOWN)
                        g.DrawImage(GetBitmap("passagedown"), PointF.Empty);
                    if ((passage & LEFT) != LEFT)
                        g.DrawImage(GetBitmap("passageleft"), PointF.Empty);
                    if ((passage & RIGHT) != RIGHT)
                        g.DrawImage(GetBitmap("passageright"), PointF.Empty);
                    if ((passage & UP) != UP)
                        g.DrawImage(GetBitmap("passageup"), PointF.Empty);
                }
                _cache[key] = b.ToTexture(GraphicsDevice);
                return _cache[key];
            }
        }