Home | History | Annotate | Download | only in wtk
      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  * @author Pavel Dolgov, Alexey A. Petrenko, Oleg V. Khaschansky
     19  * @version $Revision$
     20  */
     21 package org.apache.harmony.awt.wtk;
     22 
     23 import java.awt.Font;
     24 import java.awt.FontMetrics;
     25 import java.awt.Graphics2D;
     26 import java.awt.GraphicsEnvironment;
     27 import java.awt.peer.FontPeer;
     28 import org.apache.harmony.awt.gl.MultiRectArea;
     29 import org.apache.harmony.awt.gl.font.FontManager;
     30 
     31 import android.graphics.Canvas;
     32 import android.graphics.Paint;
     33 
     34 
     35 /**
     36  * GraphicsFactory interface defines methods for Graphics2D
     37  * and font stuff instances factories.
     38  */
     39 public interface GraphicsFactory {
     40     static final FontMetrics cacheFM[] =  new FontMetrics[10];
     41 
     42     /**
     43      * This method creates Graphics2D instance for specified native window.
     44      *
     45      * @param win Native window to draw
     46      * @param translateX Translation along X axis
     47      * @param translateY Translation along Y axis
     48      * @param clip Clipping area for a new Graphics2D instance
     49      * @return New Graphics2D instance for specified native window
     50      * @deprecated
     51      */
     52     @Deprecated
     53     Graphics2D getGraphics2D(NativeWindow win, int translateX, int translateY, MultiRectArea clip);
     54 
     55     /**
     56      * This method creates Graphics2D instance for specified native window.
     57      *
     58      * @param win Native window to draw
     59      * @param translateX Translation along X axis
     60      * @param translateY Translation along Y axis
     61      * @param width Width of drawing area
     62      * @param height Height of drawing area
     63      * @return New Graphics2D instance for specified native window
     64      */
     65     Graphics2D getGraphics2D(NativeWindow win, int translateX, int translateY, int width, int height);
     66     // ???AWT: not standard harmony
     67     Graphics2D getGraphics2D(Canvas c, Paint p);
     68 
     69     /**
     70      * Creates instance of GraphicsEnvironment for specified WindowFactory
     71      *
     72      * @param wf WindowFactory
     73      * @return New instance of GraphicsEnvironment
     74      */
     75     GraphicsEnvironment createGraphicsEnvironment(WindowFactory wf);
     76 
     77     // Font methods
     78     FontMetrics getFontMetrics(Font font);
     79     FontManager getFontManager();
     80     FontPeer getFontPeer(Font font);
     81     Font embedFont(String fontFilePath);
     82 }
     83