示例#1
0
        public Sheet(SheetT type, Stream stream)
        {
            using (var bitmap = BitmapFactory.DecodeStream(stream, null,
                                                           new BitmapFactory.Options
            {
                InScaled = false,
                InDither = false,
                InJustDecodeBounds = false,
                InPurgeable = true,
                InInputShareable = true,
            }))
            {
                var width  = bitmap.Width;
                var height = bitmap.Height;
                Size = new Size(width, height);
                data = new byte[4 * Size.Width * Size.Height];
                //int[] pixels = new int[width * height];
                //if((width != bitmap.Width ) || (height != bitmap.Height))
                //{

                //}
                //else
                //{
                //    bitmap.GetPixels(pixels, 0, width, 0, 0, width, height);

                //}

                //Util.FastCopyIntoChannel(new Sprite(this, bitmap.Bounds(), TextureChannel.Red), pixels.ToBytes());
                Util.FastCopyIntoSprite(new Sprite(this, bitmap.Bounds(), TextureChannel.Red), bitmap);
                bitmap.Recycle();
            }

            Type = type;
            ReleaseBuffer();
        }
示例#2
0
 public SheetBuilder(SheetT t, Func <Sheet> allocateSheet)
 {
     channel = TextureChannel.Red;
     Type    = t;
     current = allocateSheet();
     sheets.Add(current);
     this.allocateSheet = allocateSheet;
 }
示例#3
0
 public SheetBuilder(SheetT t, int sheetSize) : this(t, () => AllocateSheet(t, sheetSize))
 {
 }
示例#4
0
 public SheetBuilder(SheetT t) : this(t, WarGame.Settings.Graphics.SheetSize)
 {
 }
示例#5
0
 public static Sheet AllocateSheet(SheetT type, int sheetSize)
 {
     return(new Sheet(type, new Size(sheetSize, sheetSize)));
 }
示例#6
0
 public Sheet(SheetT type, ITexture texture)
 {
     Type         = type;
     this.texture = texture;
     Size         = texture.Size;
 }
示例#7
0
 public Sheet(SheetT type, Size size)
 {
     Type = type;
     Size = size;
 }