FastCopyIntoSprite() public static method

public static FastCopyIntoSprite ( Sprite dest, Bitmap src ) : void
dest Sprite
src System.Drawing.Bitmap
return void
Esempio n. 1
0
        public Sprite Add(Bitmap src)
        {
            var rect = Allocate(src.Size);

            Util.FastCopyIntoSprite(rect, src);
            current.CommitBufferedData();
            return(rect);
        }
Esempio n. 2
0
        public Sprite Add(Png src, float scale = 1f)
        {
            var rect = Allocate(new Size(src.Width, src.Height), scale);

            Util.FastCopyIntoSprite(rect, src);
            current.CommitBufferedData();
            return(rect);
        }
Esempio n. 3
0
        public Sprite Add(Png src)
        {
            var rect = Allocate(new Size(src.Width, src.Height), TextureChannel.RGBA);

            Util.FastCopyIntoSprite(rect, src);
            currentSheet2D.CommitBufferedData();
            return(rect);
        }
Esempio n. 4
0
        /// <summary>
        /// Сделано, только для потоков байтов типа <see cref="Png"/> .
        /// </summary>
        /// <param name="type">тип листа хранящего байты из потока</param>
        /// <param name="stream">поток байтов.</param>
        public Sheet2D(SheetType type, Stream stream)
        {
            var png = new Png(stream);

            Size = new Size(png.Width, png.Height);
            data = new byte[4 * Size.Width * Size.Height];
            Util.FastCopyIntoSprite(new Sprite(this, new Rectangle(0, 0, png.Width, png.Height), TextureChannel.Red), png);

            Type = type;
            ReleaseBuffer();
        }
Esempio n. 5
0
        public Sheet(SheetType type, Stream stream)
        {
            using (var bitmap = (Bitmap)Image.FromStream(stream))
            {
                Size = bitmap.Size;
                data = new byte[4 * Size.Width * Size.Height];

                Util.FastCopyIntoSprite(new Sprite(this, bitmap.Bounds(), TextureChannel.Red), bitmap);
            }

            Type = type;
            ReleaseBuffer();
        }
Esempio n. 6
0
        public Sheet(string filename)
        {
            using (var stream = GlobalFileSystem.Open(filename))
                using (var bitmap = (Bitmap)Image.FromStream(stream))
                {
                    Size = bitmap.Size;
                    data = new byte[4 * Size.Width * Size.Height];

                    Util.FastCopyIntoSprite(new Sprite(this, bitmap.Bounds(), TextureChannel.Red), bitmap);
                }

            ReleaseBuffer();
        }