Exemplo n.º 1
0
 public Codec(PicaDataType dataType, PicaPixelFormat pixelFormat, TileDecoderDelegate decoder, TileEncoderDelegate encoder)
 {
     DataType    = dataType;
     PixelFormat = pixelFormat;
     Decoder     = decoder;
     Encoder     = encoder;
 }
Exemplo n.º 2
0
        public static Texture2D ToTexture2D(PicaDataTypes dataType, PicaPixelFormats pixelFormat, int width, int height, BinaryReader reader)
        {
            TileDecoderDelegate decoder = TileCodecs.GetDecoder(dataType, pixelFormat);
            Texture2D           tex     = new Texture2D(width, height, TextureFormat.BGRA32, false);

            byte[] targetData = new byte[height * width * 4];

            for (int y = 0; y < height; y += 8)
            {
                for (int x = 0; x < width; x += 8)
                {
                    decoder(reader, targetData, x, y, (int)width, (int)height);
                }
            }

            tex.LoadRawTextureData(targetData);
            tex.Apply();

            return(tex);
        }
Exemplo n.º 3
0
 public Codec(PicaDataTypes dataType, PicaPixelFormats pixelFormat, TileDecoderDelegate decoder)
 {
     DataType    = dataType;
     PixelFormat = pixelFormat;
     Decoder     = decoder;
 }