示例#1
0
        /// <summary> Reads a bitmap from the given stream. </summary>
        /// <returns> Bitmap with pixel depth of 32 bits. </returns>
        public static Bitmap ReadBmp32Bpp(IDrawer2D drawer, Stream src)
        {
            Bitmap bmp = ReadBmp(src);

            if (!Is32Bpp(bmp))
            {
                drawer.ConvertTo32Bpp(ref bmp);
            }
            return(bmp);
        }
示例#2
0
        /// <summary> Updates the underlying atlas bitmap, fields, and texture. </summary>
        public void UpdateState(BlockInfo info, Bitmap bmp)
        {
            if (!Platform.Is32Bpp(bmp))
            {
                Utils.LogDebug("Converting terrain atlas to 32bpp image");
                drawer.ConvertTo32Bpp(ref bmp);
            }

            AtlasBitmap = bmp;
            elementSize = bmp.Width / ElementsPerRow;
            using (FastBitmap fastBmp = new FastBitmap(bmp, true, true))
                info.RecalculateSpriteBB(fastBmp);
        }
        /// <summary> Updates the underlying atlas bitmap, fields, and texture. </summary>
        public void UpdateState(BlockInfo info, Bitmap bmp)
        {
            if (!FastBitmap.CheckFormat(bmp.PixelFormat))
            {
                Utils.LogDebug("Converting terrain atlas to 32bpp image");
                drawer.ConvertTo32Bpp(ref bmp);
            }

            AtlasBitmap = bmp;
            elementSize = bmp.Width >> 4;
            using (FastBitmap fastBmp = new FastBitmap(bmp, true, true))
                info.RecalculateSpriteBB(fastBmp);
        }
示例#4
0
        public static Bitmap ReadBmp(IDrawer2D drawer, Stream src)
        {
                        #if !ANDROID
            Bitmap bmp = new Bitmap(src);
                        #else
            Bitmap bmp = BitmapFactory.DecodeStream(src);
                        #endif

            if (!ValidBitmap(bmp))
            {
                return(null);
            }
            if (!Is32Bpp(bmp))
            {
                drawer.ConvertTo32Bpp(ref bmp);
            }
            return(bmp);
        }