src/main/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java [1092:1176]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if (encodeParam != null) {
            encodeParam.setPhysicalDimension(xPixelsPerUnit,
                                             yPixelsPerUnit,
                                             unitSpecifier);
        }
        if (emitProperties) {
            properties.put("x_pixels_per_unit", xPixelsPerUnit);
            properties.put("y_pixels_per_unit", yPixelsPerUnit);
            properties.put("pixel_aspect_ratio",
                    (float) xPixelsPerUnit / yPixelsPerUnit);
            if (unitSpecifier == 1) {
                properties.put("pixel_units", "Meters");
            } else if (unitSpecifier != 0) {
                // Error -- unit specifier must be 0 or 1
                String msg = PropertyUtil.getString("PNGImageDecoder12");
                throw new RuntimeException(msg);
            }
        }
    }

    private void parse_sBIT_chunk(PNGChunk chunk) {
        if (colorType == PNG_COLOR_PALETTE) {
            significantBits = new int[3];
        } else {
            significantBits = new int[inputBands];
        }
        for (int i = 0; i < significantBits.length; i++) {
            int bits = chunk.getByte(i);
            int depth = (colorType == PNG_COLOR_PALETTE) ? 8 : bitDepth;
            if (bits <= 0 || bits > depth) {
                // Error -- significant bits must be between 0 and
                // image bit depth.
                String msg = PropertyUtil.getString("PNGImageDecoder13");
                throw new RuntimeException(msg);
            }
            significantBits[i] = bits;
        }

        if (encodeParam != null) {
            encodeParam.setSignificantBits(significantBits);
        }
        if (emitProperties) {
            properties.put("significant_bits", significantBits);
        }
    }

    private void parse_sRGB_chunk(PNGChunk chunk) {
        sRGBRenderingIntent = chunk.getByte(0);

        // The presence of an sRGB chunk implies particular
        // settings for gamma and chroma.
        fileGamma = 45455 / 100000.0F;

        chromaticity = new float[8];
        chromaticity[0] = 31270 / 10000.0F;
        chromaticity[1] = 32900 / 10000.0F;
        chromaticity[2] = 64000 / 10000.0F;
        chromaticity[3] = 33000 / 10000.0F;
        chromaticity[4] = 30000 / 10000.0F;
        chromaticity[5] = 60000 / 10000.0F;
        chromaticity[6] = 15000 / 10000.0F;
        chromaticity[7] =  6000 / 10000.0F;

        if (performGammaCorrection) {
            // File gamma is 1/2.2
            float gamma = fileGamma * (displayExponent / userExponent);
            if (encodeParam != null) {
                encodeParam.setGamma(gamma);
                encodeParam.setChromaticity(chromaticity);
            }
            if (emitProperties) {
                properties.put("gamma", gamma);
                properties.put("white_point_x", chromaticity[0]);
                properties.put("white_point_y", chromaticity[1]);
                properties.put("red_x", chromaticity[2]);
                properties.put("red_y", chromaticity[3]);
                properties.put("green_x", chromaticity[4]);
                properties.put("green_y", chromaticity[5]);
                properties.put("blue_x", chromaticity[6]);
                properties.put("blue_y", chromaticity[7]);
            }
        }
    }

    private void parse_tEXt_chunk(PNGChunk chunk) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/main/java/org/apache/xmlgraphics/image/codec/png/PNGRed.java [1137:1221]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if (encodeParam != null) {
            encodeParam.setPhysicalDimension(xPixelsPerUnit,
                                             yPixelsPerUnit,
                                             unitSpecifier);
        }
        if (emitProperties) {
            properties.put("x_pixels_per_unit", xPixelsPerUnit);
            properties.put("y_pixels_per_unit", yPixelsPerUnit);
            properties.put("pixel_aspect_ratio",
                    (float) xPixelsPerUnit / yPixelsPerUnit);
            if (unitSpecifier == 1) {
                properties.put("pixel_units", "Meters");
            } else if (unitSpecifier != 0) {
                // Error -- unit specifier must be 0 or 1
                String msg = PropertyUtil.getString("PNGImageDecoder12");
                throw new RuntimeException(msg);
            }
        }
    }

    private void parse_sBIT_chunk(PNGChunk chunk) {
        if (colorType == PNG_COLOR_PALETTE) {
            significantBits = new int[3];
        } else {
            significantBits = new int[inputBands];
        }
        for (int i = 0; i < significantBits.length; i++) {
            int bits = chunk.getByte(i);
            int depth = (colorType == PNG_COLOR_PALETTE) ? 8 : bitDepth;
            if (bits <= 0 || bits > depth) {
                // Error -- significant bits must be between 0 and
                // image bit depth.
                String msg = PropertyUtil.getString("PNGImageDecoder13");
                throw new RuntimeException(msg);
            }
            significantBits[i] = bits;
        }

        if (encodeParam != null) {
            encodeParam.setSignificantBits(significantBits);
        }
        if (emitProperties) {
            properties.put("significant_bits", significantBits);
        }
    }

    private void parse_sRGB_chunk(PNGChunk chunk) {
        sRGBRenderingIntent = chunk.getByte(0);

        // The presence of an sRGB chunk implies particular
        // settings for gamma and chroma.
        fileGamma = 45455 / 100000.0F;

        chromaticity = new float[8];
        chromaticity[0] = 31270 / 10000.0F;
        chromaticity[1] = 32900 / 10000.0F;
        chromaticity[2] = 64000 / 10000.0F;
        chromaticity[3] = 33000 / 10000.0F;
        chromaticity[4] = 30000 / 10000.0F;
        chromaticity[5] = 60000 / 10000.0F;
        chromaticity[6] = 15000 / 10000.0F;
        chromaticity[7] =  6000 / 10000.0F;

        if (performGammaCorrection) {
            // File gamma is 1/2.2
            float gamma = fileGamma * (displayExponent / userExponent);
            if (encodeParam != null) {
                encodeParam.setGamma(gamma);
                encodeParam.setChromaticity(chromaticity);
            }
            if (emitProperties) {
                properties.put("gamma", gamma);
                properties.put("white_point_x", chromaticity[0]);
                properties.put("white_point_y", chromaticity[1]);
                properties.put("red_x", chromaticity[2]);
                properties.put("red_y", chromaticity[3]);
                properties.put("green_x", chromaticity[4]);
                properties.put("green_y", chromaticity[5]);
                properties.put("blue_x", chromaticity[6]);
                properties.put("blue_y", chromaticity[7]);
            }
        }
    }

    private void parse_tEXt_chunk(PNGChunk chunk) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



