Пример #1
0
 /**
  * Updates the metadata information based on the parameters to this writer.
  *
  * @param meta the metadata
  * @param params the parameters
  * @return the updated metadata
  */
 protected IIOMetadata updateMetadata(IIOMetadata meta, ImageWriterParams params) {
   final String stdmeta = "javax_imageio_1.0";
   if (meta.isStandardMetadataFormatSupported()) {
     IIOMetadataNode root = (IIOMetadataNode) meta.getAsTree(stdmeta);
     IIOMetadataNode dim = getChildNode(root, "Dimension");
     IIOMetadataNode child;
     if (params.getResolution() != null) {
       child = getChildNode(dim, "HorizontalPixelSize");
       if (child == null) {
         child = new IIOMetadataNode("HorizontalPixelSize");
         dim.appendChild(child);
       }
       child.setAttribute("value", Double.toString(params.getResolution().doubleValue() / 25.4));
       child = getChildNode(dim, "VerticalPixelSize");
       if (child == null) {
         child = new IIOMetadataNode("VerticalPixelSize");
         dim.appendChild(child);
       }
       child.setAttribute("value", Double.toString(params.getResolution().doubleValue() / 25.4));
     }
     try {
       meta.mergeTree(stdmeta, root);
     } catch (IIOInvalidTreeException e) {
       throw new RuntimeException("Cannot update image metadata: " + e.getMessage());
     }
   }
   return meta;
 }
Пример #2
0
 /*     */ MarkerSegment(Node paramNode) /*     */ throws IIOInvalidTreeException /*     */ {
   /*  84 */ this.tag = getAttributeValue(paramNode, null, "MarkerTag", 0, 255, true);
   /*     */
   /*  89 */ this.length = 0;
   /*     */
   /*  91 */ if ((paramNode instanceof IIOMetadataNode)) {
     /*  92 */ IIOMetadataNode localIIOMetadataNode = (IIOMetadataNode) paramNode;
     /*     */ try {
       /*  94 */ this.data = ((byte[]) localIIOMetadataNode.getUserObject());
       /*     */ } catch (Exception localException) {
       /*  96 */ IIOInvalidTreeException localIIOInvalidTreeException =
           new IIOInvalidTreeException("Can't get User Object", paramNode);
       /*     */
       /*  99 */ localIIOInvalidTreeException.initCause(localException);
       /* 100 */ throw localIIOInvalidTreeException;
       /*     */ }
     /*     */ } else {
     /* 103 */ throw new IIOInvalidTreeException("Node must have User Object", paramNode);
     /*     */ }
   /*     */ }