001package com.hfg.graphics; 002 003 004 005import com.hfg.graphics.units.GfxSize2D; 006import com.hfg.graphics.units.Inches; 007 008//------------------------------------------------------------------------------ 009/** 010 * Paper size definition. 011 * 012 * @author J. Alex Taylor, hairyfatguy.com 013 */ 014//------------------------------------------------------------------------------ 015// com.hfg XML/HTML Coding Library 016// 017// This library is free software; you can redistribute it and/or 018// modify it under the terms of the GNU Lesser General Public 019// License as published by the Free Software Foundation; either 020// version 2.1 of the License, or (at your option) any later version. 021// 022// This library is distributed in the hope that it will be useful, 023// but WITHOUT ANY WARRANTY; without even the implied warranty of 024// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 025// Lesser General Public License for more details. 026// 027// You should have received a copy of the GNU Lesser General Public 028// License along with this library; if not, write to the Free Software 029// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 030// 031// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 032// jataylor@hairyfatguy.com 033//------------------------------------------------------------------------------ 034// See http://en.wikipedia.org/wiki/Paper_size 035 036public class PaperSize 037{ 038 039 public static final PaperSize US_LETTER = new PaperSize("US Letter", new GfxSize2D().setWidth(new Inches(8.5f)).setHeight(new Inches(11))); 040 public static final PaperSize US_LEGAL = new PaperSize("US Legal", new GfxSize2D().setWidth(new Inches(8.5f)).setHeight(new Inches(14))); 041 public static final PaperSize US_LEDGER = new PaperSize("US Ledger", new GfxSize2D().setWidth(new Inches(17)).setHeight(new Inches(11))); 042 public static final PaperSize US_TABLOID = new PaperSize("US Tabloid", new GfxSize2D().setWidth(new Inches(11)).setHeight(new Inches(171))); 043 public static final PaperSize A4 = new PaperSize("A4", new GfxSize2D().setWidth(new Inches(8.27f)).setHeight(new Inches(11.69f))); 044 045 private String mName; 046 private GfxSize2D mSize; 047 048 //########################################################################## 049 // CONSTRUCTORS 050 //########################################################################## 051 052 //-------------------------------------------------------------------------- 053 public PaperSize(String inName, GfxSize2D inSize) 054 { 055 mName = inName; 056 mSize = inSize; 057 } 058 059 //########################################################################## 060 // PUBLIC METHODS 061 //########################################################################## 062 063 //-------------------------------------------------------------------------- 064 public String getName() 065 { 066 return mName; 067 } 068 069 //-------------------------------------------------------------------------- 070 public GfxSize2D getDimensions() 071 { 072 return mSize; 073 } 074}