Example #1
0
        public void Create(int width, int height, int magLevel, WzPixFormat pixFormat)
        {
            Width       = width;
            Height      = height;
            TileWidth   = 0;
            TileHeight  = 0;
            HeightCount = 0;
            WidthCount  = 0;
            canvases    = new WzRawCanvas[0];
            MagLevel    = magLevel;

            if (pixFormat == 0)
            {
                // Initialize main empty canvas
                SetCanvas(0, 0, new WzRawCanvas
                {
                    Width     = Width,
                    Height    = Height,
                    PixFormat = PixFormat,
                    MagLevel  = MagLevel,
                });
            }
            else
            {
                CenterX = Width / 2;
                CenterY = Height / 2;
            }
        }
Example #2
0
 public static int PixelsPerYAxis(this WzPixFormat _this)
 {
     if (_this == WzPixFormat.DXT3 || _this == WzPixFormat.DXT5)
     {
         return(4);
     }
     return(1);
 }
Example #3
0
        public static int BytesPerPixel(this WzPixFormat _this)
        {
            switch ((int)_this & 0xFF)
            {
            case 1: return(2);

            case 2: return(4);

            default: throw new Exception($"Unknow pixformat value: {(int)_this & 0xFF}");
            }
        }
Example #4
0
        private int BytesForFormat(WzPixFormat format)
        {
            switch (format)
            {
            case WzPixFormat.A4R4G4B4: return(2);

            case WzPixFormat.A8R8G8B8: return(4);

            case WzPixFormat.R5G6B5: return(2);

            default: return(-1);
            }
        }