private boolean checkSwf() throws IOException { // get rid of the last byte of the signature, the byte of the version and 4 bytes of the size byte[] a = new byte[6]; if (read(a) != a.length) { return false; } format = FORMAT_SWF; int bitSize = (int) readUBits(5); int maxX = readSBits(bitSize); int maxY = readSBits(bitSize); width = maxX / 20; // cause we're in twips height = maxY / 20; // cause we're in twips setPhysicalWidthDpi(72); setPhysicalHeightDpi(72); return (width > 0 && height > 0); }
private boolean checkSwf() throws IOException { // get rid of the last byte of the signature, the byte of the version and 4 bytes of the size byte[] a = new byte[6]; if (read(a) != a.length) { return false; } format = FORMAT_SWF; int bitSize = (int) readUBits(5); int maxX = readSBits(bitSize); int maxY = readSBits(bitSize); width = maxX / 20; // cause we're in twips height = maxY / 20; // cause we're in twips setPhysicalWidthDpi(72); setPhysicalHeightDpi(72); return (width > 0 && height > 0); }
private boolean checkBmp() throws IOException { byte[] a = new byte[44]; if (read(a) != a.length) { return false; } width = getIntLittleEndian(a, 16); height = getIntLittleEndian(a, 20); if (width < 1 || height < 1) { return false; } bitsPerPixel = getShortLittleEndian(a, 26); if (bitsPerPixel != 1 && bitsPerPixel != 4 && bitsPerPixel != 8 && bitsPerPixel != 16 && bitsPerPixel != 24 && bitsPerPixel != 32) { return false; } int x = (int) (getIntLittleEndian(a, 36) * 0.0254); if (x > 0) { setPhysicalWidthDpi(x); } int y = (int) (getIntLittleEndian(a, 40) * 0.0254); if (y > 0) { setPhysicalHeightDpi(y); } format = FORMAT_BMP; return true; }
if (data[7] == 1) { setPhysicalWidthDpi(getShortBigEndian(data, 8)); setPhysicalHeightDpi(getShortBigEndian(data, 10)); } else if (data[7] == 2) { int x = getShortBigEndian(data, 8); int y = getShortBigEndian(data, 10); setPhysicalWidthDpi((int) (x * 2.54f)); setPhysicalHeightDpi((int) (y * 2.54f));
setPhysicalHeightDpi(getShortLittleEndian(a, 10)); format = FORMAT_PCX; return true;
setPhysicalHeightDpi(getShortBigEndian(data, 10)); int y = getShortBigEndian(data, 10); setPhysicalWidthDpi((int) (x * 2.54f)); setPhysicalHeightDpi((int) (y * 2.54f));
setPhysicalHeightDpi(getShortLittleEndian(a, 10)); format = FORMAT_PCX; return true;