GetStatic() 공개 정적인 메소드

Returns Bitmap of Static (with Cache)
public static GetStatic ( int index, bool checkmaxid = true ) : Bitmap
index int
checkmaxid bool
리턴 System.Drawing.Bitmap
예제 #1
0
파일: Multis.cs 프로젝트: credzba/Razor
        /// <summary>
        /// Returns Bitmap of Multi to maxheight
        /// </summary>
        /// <param name="maxheight"></param>
        /// <returns></returns>
        public Bitmap GetImage(int maxheight)
        {
            if (m_Width == 0 || m_Height == 0)
            {
                return(null);
            }

            int xMin = 1000, yMin = 1000;
            int xMax = -1000, yMax = -1000;

            for (int x = 0; x < m_Width; ++x)
            {
                for (int y = 0; y < m_Height; ++y)
                {
                    MTile[] tiles = m_Tiles[x][y];

                    for (int i = 0; i < tiles.Length; ++i)
                    {
                        Bitmap bmp = Art.GetStatic(tiles[i].ID);

                        if (bmp == null)
                        {
                            continue;
                        }

                        int px = (x - y) * 22;
                        int py = (x + y) * 22;

                        px -= (bmp.Width / 2);
                        py -= tiles[i].Z << 2;
                        py -= bmp.Height;

                        if (px < xMin)
                        {
                            xMin = px;
                        }

                        if (py < yMin)
                        {
                            yMin = py;
                        }

                        px += bmp.Width;
                        py += bmp.Height;

                        if (px > xMax)
                        {
                            xMax = px;
                        }

                        if (py > yMax)
                        {
                            yMax = py;
                        }
                    }
                }
            }

            Bitmap   canvas = new Bitmap(xMax - xMin, yMax - yMin);
            Graphics gfx    = Graphics.FromImage(canvas);

            gfx.Clear(Color.White);
            for (int x = 0; x < m_Width; ++x)
            {
                for (int y = 0; y < m_Height; ++y)
                {
                    MTile[] tiles = m_Tiles[x][y];

                    for (int i = 0; i < tiles.Length; ++i)
                    {
                        Bitmap bmp = Art.GetStatic(tiles[i].ID);

                        if (bmp == null)
                        {
                            continue;
                        }
                        if ((tiles[i].Z) > maxheight)
                        {
                            continue;
                        }
                        int px = (x - y) * 22;
                        int py = (x + y) * 22;

                        px -= (bmp.Width / 2);
                        py -= tiles[i].Z << 2;
                        py -= bmp.Height;
                        px -= xMin;
                        py -= yMin;

                        gfx.DrawImageUnscaled(bmp, px, py, bmp.Width, bmp.Height);
                    }

                    int tx = (x - y) * 22;
                    int ty = (x + y) * 22;
                    tx -= xMin;
                    ty -= yMin;
                }
            }

            gfx.Dispose();

            return(canvas);
        }
예제 #2
0
        /// <summary>
        /// Returns Bitmap of Multi to maximumHeight
        /// </summary>
        /// <param name="maximumHeight"></param>
        /// <returns></returns>
        public Bitmap GetImage(int maximumHeight = 300)
        {
            if (Width == 0 || Height == 0)
            {
                return(null);
            }

            int xMin = 1000, yMin = 1000;
            int xMax = -1000, yMax = -1000;

            for (int x = 0; x < Width; ++x)
            {
                for (int y = 0; y < Height; ++y)
                {
                    foreach (var mTile in Tiles[x][y])
                    {
                        Bitmap bmp = Art.GetStatic(mTile.Id);

                        if (bmp == null)
                        {
                            continue;
                        }

                        int px = (x - y) * 22;
                        int py = (x + y) * 22;

                        px -= (bmp.Width / 2);
                        py -= mTile.Z << 2;
                        py -= bmp.Height;

                        if (px < xMin)
                        {
                            xMin = px;
                        }

                        if (py < yMin)
                        {
                            yMin = py;
                        }

                        px += bmp.Width;
                        py += bmp.Height;

                        if (px > xMax)
                        {
                            xMax = px;
                        }

                        if (py > yMax)
                        {
                            yMax = py;
                        }
                    }
                }
            }

            var      canvas = new Bitmap(xMax - xMin, yMax - yMin);
            Graphics gfx    = Graphics.FromImage(canvas);

            gfx.Clear(Color.Transparent);

            for (int x = 0; x < Width; ++x)
            {
                for (int y = 0; y < Height; ++y)
                {
                    foreach (var mTile in Tiles[x][y])
                    {
                        Bitmap bmp = Art.GetStatic(mTile.Id);

                        if (bmp == null)
                        {
                            continue;
                        }

                        if (mTile.Z > maximumHeight)
                        {
                            continue;
                        }

                        int px = (x - y) * 22;
                        int py = (x + y) * 22;

                        px -= (bmp.Width / 2);
                        py -= mTile.Z << 2;
                        py -= bmp.Height;
                        px -= xMin;
                        py -= yMin;

                        gfx.DrawImageUnscaled(bmp, px, py, bmp.Width, bmp.Height);
                    }
                }
            }

            gfx.Dispose();

            return(canvas);
        }
예제 #3
0
파일: ArtExt.cs 프로젝트: zerodowned/Core
 public static Bitmap GetStatic(int index, out bool patched, bool checkMaxID = true)
 {
     return(Art.GetStatic(index, out patched, checkMaxID));
 }
예제 #4
0
/*
 * // TODO: unused method
 *      /// <summary>
 *      /// Returns Bitmap of Multi
 *      /// </summary>
 *      /// <returns></returns>
 *      public Bitmap GetImage()
 *      {
 *          return GetImage(300);
 *      }
 */

        /// <summary>
        /// Returns Bitmap of Multi to maximumHeight
        /// </summary>
        /// <param name="maximumHeight"></param>
        /// <returns></returns>
        public Bitmap GetImage(int maximumHeight)
        {
            if (Width == 0 || Height == 0)
            {
                return(null);
            }

            int xMin = 1000, yMin = 1000;
            int xMax = -1000, yMax = -1000;

            for (int x = 0; x < Width; ++x)
            {
                for (int y = 0; y < Height; ++y)
                {
                    MTile[] tiles = Tiles[x][y];

                    for (int i = 0; i < tiles.Length; ++i)
                    {
                        Bitmap bmp = Art.GetStatic(tiles[i].ID);

                        if (bmp == null)
                        {
                            continue;
                        }

                        int px = (x - y) * 22;
                        int py = (x + y) * 22;

                        px -= (bmp.Width / 2);
                        py -= tiles[i].Z << 2;
                        py -= bmp.Height;

                        if (px < xMin)
                        {
                            xMin = px;
                        }

                        if (py < yMin)
                        {
                            yMin = py;
                        }

                        px += bmp.Width;
                        py += bmp.Height;

                        if (px > xMax)
                        {
                            xMax = px;
                        }

                        if (py > yMax)
                        {
                            yMax = py;
                        }
                    }
                }
            }

            var      canvas = new Bitmap(xMax - xMin, yMax - yMin);
            Graphics gfx    = Graphics.FromImage(canvas);

            gfx.Clear(Color.Transparent);

            for (int x = 0; x < Width; ++x)
            {
                for (int y = 0; y < Height; ++y)
                {
                    MTile[] tiles = Tiles[x][y];

                    for (int i = 0; i < tiles.Length; ++i)
                    {
                        Bitmap bmp = Art.GetStatic(tiles[i].ID);

                        if (bmp == null)
                        {
                            continue;
                        }

                        if (tiles[i].Z > maximumHeight)
                        {
                            continue;
                        }

                        int px = (x - y) * 22;
                        int py = (x + y) * 22;

                        px -= (bmp.Width / 2);
                        py -= tiles[i].Z << 2;
                        py -= bmp.Height;
                        px -= xMin;
                        py -= yMin;

                        gfx.DrawImageUnscaled(bmp, px, py, bmp.Width, bmp.Height);
                    }

                    // TODO: check what this was for. It looks unused/unfinished.
                    //int tx = (x - y) * 22;
                    //int ty = (x + y) * 22;
                    //tx -= xMin;
                    //ty -= yMin;
                }
            }

            gfx.Dispose();

            return(canvas);
        }
예제 #5
0
        public Bitmap GetImage()
        {
            if (this.m_Width == 0 || this.m_Height == 0)
            {
                return(null);
            }
            int num  = 1000;
            int num1 = 1000;
            int num2 = -1000;
            int num3 = -1000;

            for (int i = 0; i < this.m_Width; i++)
            {
                for (int j = 0; j < this.m_Height; j++)
                {
                    Tile[] mTiles = this.m_Tiles[i][j];
                    for (int k = 0; k < (int)mTiles.Length; k++)
                    {
                        Bitmap @static = Art.GetStatic(mTiles[k].ID - 16384);
                        if (@static != null)
                        {
                            int width = (i - j) * 22;
                            int z     = (i + j) * 22;
                            width = width - @static.Width / 2;
                            z     = z - mTiles[k].Z * 4;
                            z     = z - @static.Height;
                            if (width < num)
                            {
                                num = width;
                            }
                            if (z < num1)
                            {
                                num1 = z;
                            }
                            width = width + @static.Width;
                            z     = z + @static.Height;
                            if (width > num2)
                            {
                                num2 = width;
                            }
                            if (z > num3)
                            {
                                num3 = z;
                            }
                        }
                    }
                }
            }
            Bitmap   bitmap  = new Bitmap(num2 - num, num3 - num1);
            Graphics graphic = Graphics.FromImage(bitmap);

            for (int l = 0; l < this.m_Width; l++)
            {
                for (int m = 0; m < this.m_Height; m++)
                {
                    Tile[] tileArray = this.m_Tiles[l][m];
                    for (int n = 0; n < (int)tileArray.Length; n++)
                    {
                        Bitmap static1 = Art.GetStatic(tileArray[n].ID - 16384);
                        if (static1 != null)
                        {
                            int width1 = (l - m) * 22;
                            int height = (l + m) * 22;
                            width1 = width1 - static1.Width / 2;
                            height = height - tileArray[n].Z * 4;
                            height = height - static1.Height;
                            width1 = width1 - num;
                            height = height - num1;
                            graphic.DrawImageUnscaled(static1, width1, height, static1.Width, static1.Height);
                        }
                    }
                    int num4 = (l - m) * 22;
                    int num5 = (l + m) * 22;
                    num4 = num4 - num;
                    num5 = num5 - num1;
                }
            }
            graphic.Dispose();
            return(bitmap);
        }
예제 #6
0
        public Bitmap GetImage()
        {
            if (this.m_Width == 0 || this.m_Height == 0)
            {
                return((Bitmap)null);
            }
            int num1 = 1000;
            int num2 = 1000;
            int num3 = -1000;
            int num4 = -1000;

            for (int index1 = 0; index1 < this.m_Width; ++index1)
            {
                for (int index2 = 0; index2 < this.m_Height; ++index2)
                {
                    Tile[] tileArray = this.m_Tiles[index1][index2];
                    for (int index3 = 0; index3 < tileArray.Length; ++index3)
                    {
                        Bitmap @static = Art.GetStatic(tileArray[index3].ID - 16384);
                        if (@static != null)
                        {
                            int num5 = (index1 - index2) * 22;
                            int num6 = (index1 + index2) * 22;
                            int num7 = num5 - @static.Width / 2;
                            int num8 = num6 - tileArray[index3].Z * 4 - @static.Height;
                            if (num7 < num1)
                            {
                                num1 = num7;
                            }
                            if (num8 < num2)
                            {
                                num2 = num8;
                            }
                            int num9  = num7 + @static.Width;
                            int num10 = num8 + @static.Height;
                            if (num9 > num3)
                            {
                                num3 = num9;
                            }
                            if (num10 > num4)
                            {
                                num4 = num10;
                            }
                        }
                    }
                }
            }
            Bitmap   bitmap   = new Bitmap(num3 - num1, num4 - num2);
            Graphics graphics = Graphics.FromImage((Image)bitmap);

            for (int index1 = 0; index1 < this.m_Width; ++index1)
            {
                for (int index2 = 0; index2 < this.m_Height; ++index2)
                {
                    Tile[] tileArray = this.m_Tiles[index1][index2];
                    for (int index3 = 0; index3 < tileArray.Length; ++index3)
                    {
                        Bitmap @static = Art.GetStatic(tileArray[index3].ID - 16384);
                        if (@static != null)
                        {
                            int num5 = (index1 - index2) * 22;
                            int num6 = (index1 + index2) * 22;
                            int num7 = num5 - @static.Width / 2;
                            int num8 = num6 - tileArray[index3].Z * 4 - @static.Height;
                            int x    = num7 - num1;
                            int y    = num8 - num2;
                            graphics.DrawImageUnscaled((Image)@static, x, y, @static.Width, @static.Height);
                        }
                    }
                    int num9  = (index1 - index2) * 22;
                    int num10 = (index1 + index2) * 22;
                    int num11 = num9 - num1;
                    int num12 = num10 - num2;
                }
            }
            graphics.Dispose();
            return(bitmap);
        }