Ejemplo n.º 1
0
 protected Object clone() {
   ICCMarkerSegment newGuy = (ICCMarkerSegment) super.clone();
   if (profile != null) {
     newGuy.profile = (byte[]) profile.clone();
   }
   return newGuy;
 }
Ejemplo n.º 2
0
 /** Prints out the contents of this object to System.out for debugging. */
 void print() {
   printTag("JFIF");
   System.out.print("Version ");
   System.out.print(majorVersion);
   System.out.println(".0" + Integer.toString(minorVersion));
   System.out.print("Resolution units: ");
   System.out.println(resUnits);
   System.out.print("X density: ");
   System.out.println(Xdensity);
   System.out.print("Y density: ");
   System.out.println(Ydensity);
   System.out.print("Thumbnail Width: ");
   System.out.println(thumbWidth);
   System.out.print("Thumbnail Height: ");
   System.out.println(thumbHeight);
   if (!extSegments.isEmpty()) {
     for (Iterator iter = extSegments.iterator(); iter.hasNext(); ) {
       JFIFExtensionMarkerSegment extSegment = (JFIFExtensionMarkerSegment) iter.next();
       extSegment.print();
     }
   }
   if (iccSegment != null) {
     iccSegment.print();
   }
 }
Ejemplo n.º 3
0
 /** Returns a deep-copy clone of this object. */
 protected Object clone() {
   JFIFMarkerSegment newGuy = (JFIFMarkerSegment) super.clone();
   if (!extSegments.isEmpty()) { // Clone the list with a deep copy
     newGuy.extSegments = new ArrayList();
     for (Iterator iter = extSegments.iterator(); iter.hasNext(); ) {
       JFIFExtensionMarkerSegment jfxx = (JFIFExtensionMarkerSegment) iter.next();
       newGuy.extSegments.add(jfxx.clone());
     }
   }
   if (iccSegment != null) {
     newGuy.iccSegment = (ICCMarkerSegment) iccSegment.clone();
   }
   return newGuy;
 }
Ejemplo n.º 4
0
 /** Adds an ICC Profile APP2 segment from the stream wrapped in the JPEGBuffer. */
 void addICC(JPEGBuffer buffer) throws IOException {
   if (inICC == false) {
     if (iccSegment != null) {
       throw new IIOException("> 1 ICC APP2 Marker Segment not supported");
     }
     tempICCSegment = new ICCMarkerSegment(buffer);
     if (inICC == false) { // Just one chunk
       iccSegment = tempICCSegment;
       tempICCSegment = null;
     }
   } else {
     if (tempICCSegment.addData(buffer) == true) {
       iccSegment = tempICCSegment;
       tempICCSegment = null;
     }
   }
 }
Ejemplo n.º 5
0
  /**
   * Returns a tree of DOM nodes representing this object and any subordinate JFXX extension or ICC
   * Profile segments.
   */
  IIOMetadataNode getNativeNode() {
    IIOMetadataNode node = new IIOMetadataNode("app0JFIF");
    node.setAttribute("majorVersion", Integer.toString(majorVersion));
    node.setAttribute("minorVersion", Integer.toString(minorVersion));
    node.setAttribute("resUnits", Integer.toString(resUnits));
    node.setAttribute("Xdensity", Integer.toString(Xdensity));
    node.setAttribute("Ydensity", Integer.toString(Ydensity));
    node.setAttribute("thumbWidth", Integer.toString(thumbWidth));
    node.setAttribute("thumbHeight", Integer.toString(thumbHeight));
    if (!extSegments.isEmpty()) {
      IIOMetadataNode JFXXnode = new IIOMetadataNode("JFXX");
      node.appendChild(JFXXnode);
      for (Iterator iter = extSegments.iterator(); iter.hasNext(); ) {
        JFIFExtensionMarkerSegment seg = (JFIFExtensionMarkerSegment) iter.next();
        JFXXnode.appendChild(seg.getNativeNode());
      }
    }
    if (iccSegment != null) {
      node.appendChild(iccSegment.getNativeNode());
    }

    return node;
  }