Exemple #1
0
        public void AddMipMap(int mipMap, string fileName)
        {
            int mipMapWidth;
            int mipMapHeight;

            this.premultiplied = true;
            byte[] mipMapBitmap   = Window.LoadImage(fileName, premultiplied, out mipMapWidth, out mipMapHeight);
            int    expectedWidth  = this.width / (int)Math.Pow(2, mipMap);
            int    expectedHeight = this.height / (int)Math.Pow(2, mipMap);

            if (width != expectedWidth || height != expectedHeight)
            {
                throw new Exception("invalid mipmap size");
            }

            this.Update(mipMapBitmap, mipMap);
        }
Exemple #2
0
 public Texture(string fileName, bool nearest = false, bool repeatX = false, bool repeatY = false, bool mipMap = false) : this(nearest, repeatX, repeatY, mipMap)
 {
     this.premultiplied = true;
     this.bitmap        = Window.LoadImage(fileName, premultiplied, out this.width, out this.height);
     this.Update();
 }