Beispiel #1
0
            // Reads in the header, fills in this struct, and reads in all of the pixels.
            public void Load(BinaryReader reader)
            {
                //ms-help://MS.VSCC.v80/MS.VSIPCC.v80/MS.DirectX9.1033.2007.August/DirectX_SDK/dx9_graphics_reference_dds_file.htm

                byte[] header = reader.ReadBytes(4);
                if (header[0] != 'D' || header[1] != 'D' || header[2] != 'S' || header[3] != ' ')
                {
                    throw new InvalidDataException("Not a DDS file");
                }

                m_dwSize = reader.ReadInt32();
                if (m_dwSize != 124)
                {
                    throw new InvalidDataException("DDSURFACEDESC2 must be 124 bytes in DDS file specification");
                }

                // assign all the fields
                m_dwFlags           = reader.ReadInt32();
                m_dwHeight          = reader.ReadInt32();
                m_dwWidth           = reader.ReadInt32();
                m_dwLinearSize      = reader.ReadInt32();
                m_dwBackBufferCount = reader.ReadInt32();
                m_dwMipMapCount     = reader.ReadInt32();
                m_dwAlphaBitDepth   = reader.ReadInt32();
                m_dwReserved        = reader.ReadInt32();
                m_lpSurface         = reader.ReadInt32();
                m_ddckCKDestOverlay.dwColorSpaceLowValue  = reader.ReadInt32();
                m_ddckCKDestOverlay.dwColorSpaceHighValue = reader.ReadInt32();
                m_ddckCKDestBlt.dwColorSpaceLowValue      = reader.ReadInt32();
                m_ddckCKDestBlt.dwColorSpaceHighValue     = reader.ReadInt32();
                m_ddckCKSrcOverlay.dwColorSpaceLowValue   = reader.ReadInt32();
                m_ddckCKSrcOverlay.dwColorSpaceHighValue  = reader.ReadInt32();
                m_ddckCKSrcBlt.dwColorSpaceLowValue       = reader.ReadInt32();
                m_ddckCKSrcBlt.dwColorSpaceHighValue      = reader.ReadInt32();

                m_ddpfPixelFormat.Load(reader);

                m_ddsCaps.Load(reader);

                m_dwTextureStage = reader.ReadInt32();
            }
Beispiel #2
0
            // Reads in the header, fills in this struct, and reads in all of the pixels.
            public void Load(BinaryReader reader)
            {
                byte[] header = reader.ReadBytes(4);
                if (header[0] != 'D' || header[1] != 'D' || header[2] != 'S' || header[3] != ' ')
                {
                    throw new InvalidDataException("Not a DDS file");
                }

                m_dwSize = reader.ReadInt32();
                if (m_dwSize != 124)
                {
                    throw new InvalidDataException("DDSURFACEDESC2 must be 124 bytes in DDS file specification");
                }

                // assign all the fields
                m_dwFlags           = reader.ReadInt32();
                m_dwHeight          = reader.ReadInt32();
                m_dwWidth           = reader.ReadInt32();
                m_dwLinearSize      = reader.ReadInt32();
                m_dwBackBufferCount = reader.ReadInt32();
                m_dwMipMapCount     = reader.ReadInt32();
                m_dwAlphaBitDepth   = reader.ReadInt32();
                m_dwReserved        = reader.ReadInt32();
                m_lpSurface         = (IntPtr)reader.ReadInt32();
                m_ddckCKDestOverlay.dwColorSpaceLowValue  = reader.ReadInt32();
                m_ddckCKDestOverlay.dwColorSpaceHighValue = reader.ReadInt32();
                m_ddckCKDestBlt.dwColorSpaceLowValue      = reader.ReadInt32();
                m_ddckCKDestBlt.dwColorSpaceHighValue     = reader.ReadInt32();
                m_ddckCKSrcOverlay.dwColorSpaceLowValue   = reader.ReadInt32();
                m_ddckCKSrcOverlay.dwColorSpaceHighValue  = reader.ReadInt32();
                m_ddckCKSrcBlt.dwColorSpaceLowValue       = reader.ReadInt32();
                m_ddckCKSrcBlt.dwColorSpaceHighValue      = reader.ReadInt32();

                m_ddpfPixelFormat.Load(reader);

                m_ddsCaps.Load(reader);

                m_dwTextureStage = reader.ReadInt32();
            }