static DdsPixelFormat read(final LittleEndianDataInput in) throws IOException { final DdsPixelFormat format = new DdsPixelFormat(); format.dwSize = in.readInt(); if (format.dwSize != 32) { throw new Error("invalid pixel format size: " + format.dwSize); } format.dwFlags = in.readInt(); format.dwFourCC = in.readInt(); format.dwRGBBitCount = in.readInt(); format.dwRBitMask = in.readInt(); format.dwGBitMask = in.readInt(); format.dwBBitMask = in.readInt(); format.dwABitMask = in.readInt(); return format; } }
static DdsPixelFormat read(final LittleEndianDataInput in) throws IOException { final DdsPixelFormat format = new DdsPixelFormat(); format.dwSize = in.readInt(); if (format.dwSize != 32) { throw new Error("invalid pixel format size: " + format.dwSize); } format.dwFlags = in.readInt(); format.dwFourCC = in.readInt(); format.dwRGBBitCount = in.readInt(); format.dwRBitMask = in.readInt(); format.dwGBitMask = in.readInt(); format.dwBBitMask = in.readInt(); format.dwABitMask = in.readInt(); return format; } }
public final float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); }
public final float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); }
static DdsHeaderDX10 read(final LittleEndianDataInput in) throws IOException { final DdsHeaderDX10 header = new DdsHeaderDX10(); header.dxgiFormat = DxgiFormat.forInt(in.readInt()); header.resourceDimension = D3d10ResourceDimension.forInt(in.readInt()); header.miscFlag = in.readInt(); header.arraySize = in.readInt(); header.reserved = in.readInt(); return header; } }
static DdsHeaderDX10 read(final LittleEndianDataInput in) throws IOException { final DdsHeaderDX10 header = new DdsHeaderDX10(); header.dxgiFormat = DxgiFormat.forInt(in.readInt()); header.resourceDimension = D3d10ResourceDimension.forInt(in.readInt()); header.miscFlag = in.readInt(); header.arraySize = in.readInt(); header.reserved = in.readInt(); return header; } }
static DdsHeader read(final LittleEndianDataInput in) throws IOException { final DdsHeader header = new DdsHeader(); header.dwSize = in.readInt(); if (header.dwSize != 124) { throw new Error("invalid dds header size: " + header.dwSize); header.dwFlags = in.readInt(); header.dwHeight = in.readInt(); header.dwWidth = in.readInt(); header.dwLinearSize = in.readInt(); header.dwDepth = in.readInt(); header.dwMipMapCount = in.readInt(); header.dwAlphaBitDepth = in.readInt(); for (int i = 0; i < header.dwReserved1.length; i++) { header.dwReserved1[i] = in.readInt(); header.dwCaps = in.readInt(); header.dwCaps2 = in.readInt(); header.dwCaps3 = in.readInt(); header.dwCaps4 = in.readInt(); header.dwTextureStage = in.readInt();
static DdsHeader read(final LittleEndianDataInput in) throws IOException { final DdsHeader header = new DdsHeader(); header.dwSize = in.readInt(); if (header.dwSize != 124) { throw new Error("invalid dds header size: " + header.dwSize); header.dwFlags = in.readInt(); header.dwHeight = in.readInt(); header.dwWidth = in.readInt(); header.dwLinearSize = in.readInt(); header.dwDepth = in.readInt(); header.dwMipMapCount = in.readInt(); header.dwAlphaBitDepth = in.readInt(); for (int i = 0; i < header.dwReserved1.length; i++) { header.dwReserved1[i] = in.readInt(); header.dwCaps = in.readInt(); header.dwCaps2 = in.readInt(); header.dwCaps3 = in.readInt(); header.dwCaps4 = in.readInt(); header.dwTextureStage = in.readInt();
public Image load(final InputStream is, final boolean flipVertically) throws IOException { final LittleEndianDataInput in = new LittleEndianDataInput(is); // Read and check magic word... final int dwMagic = in.readInt(); if (dwMagic != getInt("DDS ")) { throw new Error("Not a dds file."); } logger.finest("Reading DDS file."); // Create our data store; final DdsImageInfo info = new DdsImageInfo(); info.flipVertically = flipVertically; // Read standard dds header info.header = DdsHeader.read(in); // if applicable, read DX10 header info.headerDX10 = info.header.ddpf.dwFourCC == getInt("DX10") ? DdsHeaderDX10.read(in) : null; // Create our new image final Image image = new Image(); image.setWidth(info.header.dwWidth); image.setHeight(info.header.dwHeight); // update depth based on flags / header updateDepth(image, info); // add our format and image data. populateImage(image, info, in); // return the loaded image return image; }
public Image load(final InputStream is, final boolean flipVertically) throws IOException { final LittleEndianDataInput in = new LittleEndianDataInput(is); // Read and check magic word... final int dwMagic = in.readInt(); if (dwMagic != getInt("DDS ")) { throw new Error("Not a dds file."); } logger.finest("Reading DDS file."); // Create our data store; final DdsImageInfo info = new DdsImageInfo(); info.flipVertically = flipVertically; // Read standard dds header info.header = DdsHeader.read(in); // if applicable, read DX10 header info.headerDX10 = info.header.ddpf.dwFourCC == getInt("DX10") ? DdsHeaderDX10.read(in) : null; // Create our new image final Image image = new Image(); image.setWidth(info.header.dwWidth); image.setHeight(info.header.dwHeight); // update depth based on flags / header updateDepth(image, info); // add our format and image data. populateImage(image, info, in); // return the loaded image return image; }