1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /* $Id: Java2DRenderingContext.java 746664 2009-02-22 12:40:44Z jeremias $ */ 19 20 package org.apache.fop.render.java2d; 21 22 import java.awt.Graphics2D; 23 24 import org.apache.fop.apps.FOUserAgent; 25 import org.apache.fop.fonts.FontInfo; 26 import org.apache.fop.render.AbstractRenderingContext; 27 28 /** 29 * Rendering context for Java2D painting. 30 */ 31 public class Java2DRenderingContext extends AbstractRenderingContext { 32 33 private FontInfo fontInfo; 34 private Graphics2D g2d; 35 36 /** 37 * Main constructor. 38 * @param userAgent the user agent 39 * @param g2d the target Graphics2D instance 40 * @param fontInfo the font list 41 */ Java2DRenderingContext(FOUserAgent userAgent, Graphics2D g2d, FontInfo fontInfo)42 public Java2DRenderingContext(FOUserAgent userAgent, Graphics2D g2d, FontInfo fontInfo) { 43 super(userAgent); 44 this.g2d = g2d; 45 this.fontInfo = fontInfo; 46 } 47 48 /** {@inheritDoc} */ getMimeType()49 public String getMimeType() { 50 return null; //not applicable 51 } 52 53 /** 54 * Returns the target Graphics2D object. 55 * @return the Graphics2D object 56 */ getGraphics2D()57 public Graphics2D getGraphics2D() { 58 return this.g2d; 59 } 60 61 } 62