src/share/classes/javax/print/attribute/ResolutionSyntax.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  61  * Storing the values internally in common units of dphi lets two resolution
  62  * attributes be compared without regard to the units in which they were
  63  * created; for example, 300 dpcm will compare equal to 762 dpi, as they both
  64  * are stored as 76200 dphi. In particular, a lookup service can
  65  * match resolution attributes based on equality of their serialized
  66  * representations regardless of the units in which they were created. Again,
  67  * using integers for internal storage allows precise equality comparisons to be
  68  * done, which would not be guaranteed if a floating point representation were
  69  * used.
  70  * <P>
  71  * The exported constant {@link #DPI DPI} is actually the
  72  * conversion factor by which to multiply a value in dpi to get the value in
  73  * dphi. Likewise, the exported constant {@link #DPCM DPCM} is the
  74  * conversion factor by which to multiply a value in dpcm to get the value in
  75  * dphi. A client can specify a resolution value in units other than dpi or dpcm
  76  * by supplying its own conversion factor. However, since the internal units of
  77  * dphi was chosen with supporting only the external units of dpi and dpcm in
  78  * mind, there is no guarantee that the conversion factor for the client's units
  79  * will be an exact integer. If the conversion factor isn't an exact integer,
  80  * resolution values in the client's units won't be stored precisely.
  81  * <P>
  82  *
  83  * @author  David Mendenhall
  84  * @author  Alan Kaminsky
  85  */
  86 public abstract class ResolutionSyntax implements Serializable, Cloneable {
  87 
  88     private static final long serialVersionUID = 2706743076526672017L;
  89 
  90     /**
  91      * Cross feed direction resolution in units of dots per 100 inches (dphi).
  92      * @serial
  93      */
  94     private int crossFeedResolution;
  95 
  96     /**
  97      * Feed direction resolution in units of dots per 100 inches (dphi).
  98      * @serial
  99      */
 100     private int feedResolution;
 101 


   1 /*
   2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  61  * Storing the values internally in common units of dphi lets two resolution
  62  * attributes be compared without regard to the units in which they were
  63  * created; for example, 300 dpcm will compare equal to 762 dpi, as they both
  64  * are stored as 76200 dphi. In particular, a lookup service can
  65  * match resolution attributes based on equality of their serialized
  66  * representations regardless of the units in which they were created. Again,
  67  * using integers for internal storage allows precise equality comparisons to be
  68  * done, which would not be guaranteed if a floating point representation were
  69  * used.
  70  * <P>
  71  * The exported constant {@link #DPI DPI} is actually the
  72  * conversion factor by which to multiply a value in dpi to get the value in
  73  * dphi. Likewise, the exported constant {@link #DPCM DPCM} is the
  74  * conversion factor by which to multiply a value in dpcm to get the value in
  75  * dphi. A client can specify a resolution value in units other than dpi or dpcm
  76  * by supplying its own conversion factor. However, since the internal units of
  77  * dphi was chosen with supporting only the external units of dpi and dpcm in
  78  * mind, there is no guarantee that the conversion factor for the client's units
  79  * will be an exact integer. If the conversion factor isn't an exact integer,
  80  * resolution values in the client's units won't be stored precisely.

  81  *
  82  * @author  David Mendenhall
  83  * @author  Alan Kaminsky
  84  */
  85 public abstract class ResolutionSyntax implements Serializable, Cloneable {
  86 
  87     private static final long serialVersionUID = 2706743076526672017L;
  88 
  89     /**
  90      * Cross feed direction resolution in units of dots per 100 inches (dphi).
  91      * @serial
  92      */
  93     private int crossFeedResolution;
  94 
  95     /**
  96      * Feed direction resolution in units of dots per 100 inches (dphi).
  97      * @serial
  98      */
  99     private int feedResolution;
 100