Ejemplo n.º 1
0
        public static byte[] GetImage(P3D.Chunk image)
        {
            int offset    = 0;
            int imageSize = Utility.Byte4ToInt(Utility.GetRange(image.Data, offset, 4), 0);

            offset += 4;
            byte[] imageB = Utility.GetRange(image.Data, offset, imageSize);
            return(imageB);
        }
Ejemplo n.º 2
0
        public static ImageDataStruct GetImageData(P3D.Chunk imageDataChunk)
        {
            ImageDataStruct imageData  = new ImageDataStruct();
            int             offset     = 0;
            int             nameLength = imageDataChunk.Data[offset++];

            imageData.Name       = System.Text.Encoding.UTF8.GetString(Utility.GetRange(imageDataChunk.Data, offset, nameLength));
            offset              += nameLength;
            imageData.version    = Utility.Byte4ToInt(imageDataChunk.Data, offset); offset += 4;
            imageData.width      = Utility.Byte4ToInt(imageDataChunk.Data, offset); offset += 4;
            imageData.height     = Utility.Byte4ToInt(imageDataChunk.Data, offset); offset += 4;
            imageData.bitDepth   = Utility.Byte4ToInt(imageDataChunk.Data, offset); offset += 4;
            imageData.palaetised = Utility.Byte4ToInt(imageDataChunk.Data, offset); offset += 4;
            imageData.hasAlpha   = Utility.Byte4ToInt(imageDataChunk.Data, offset); offset += 4;
            imageData.format     = Utility.Byte4ToInt(imageDataChunk.Data, offset);
            return(imageData);
        }
Ejemplo n.º 3
0
        public static TextureDataStruct GetTextureData(P3D.Chunk texture)
        {
            TextureDataStruct textureData = new TextureDataStruct();
            int offset     = 0;
            int nameLength = texture.Data[offset++];

            textureData.Name        = System.Text.Encoding.UTF8.GetString(Utility.GetRange(texture.Data, offset, nameLength));
            offset                 += nameLength;
            textureData.version     = Utility.Byte4ToInt(texture.Data, offset); offset += 4;
            textureData.width       = Utility.Byte4ToInt(texture.Data, offset); offset += 4;
            textureData.height      = Utility.Byte4ToInt(texture.Data, offset); offset += 4;
            textureData.bitDepth    = Utility.Byte4ToInt(texture.Data, offset); offset += 4;
            textureData.alphaDepth  = Utility.Byte4ToInt(texture.Data, offset); offset += 4;
            textureData.mipMapCount = Utility.Byte4ToInt(texture.Data, offset); offset += 4;
            textureData.textureType = Utility.Byte4ToInt(texture.Data, offset); offset += 4;
            textureData.usage       = Utility.Byte4ToInt(texture.Data, offset); offset += 4;
            textureData.priority    = Utility.Byte4ToInt(texture.Data, offset);
            return(textureData);
        }