summaryrefslogtreecommitdiffstats
path: root/awt/org/apache/harmony/awt/wtk/GraphicsFactory.java
blob: 0d7c84f7b771bbeb3bc8981a1fa93de428e9c98a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
/**
 * @author Pavel Dolgov, Alexey A. Petrenko, Oleg V. Khaschansky
 * @version $Revision$
 */
package org.apache.harmony.awt.wtk;

import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.peer.FontPeer;
import org.apache.harmony.awt.gl.MultiRectArea;
import org.apache.harmony.awt.gl.font.FontManager;

import android.graphics.Canvas;
import android.graphics.Paint;


/**
 * GraphicsFactory interface defines methods for Graphics2D 
 * and font stuff instances factories.
 */
public interface GraphicsFactory {
    static final FontMetrics cacheFM[] =  new FontMetrics[10];
    
    /**
     * This method creates Graphics2D instance for specified native window.
     *  
     * @param win Native window to draw
     * @param translateX Translation along X axis
     * @param translateY Translation along Y axis
     * @param clip Clipping area for a new Graphics2D instance
     * @return New Graphics2D instance for specified native window
     * @deprecated
     */
    @Deprecated
    Graphics2D getGraphics2D(NativeWindow win, int translateX, int translateY, MultiRectArea clip);

    /**
     * This method creates Graphics2D instance for specified native window.
     *  
     * @param win Native window to draw
     * @param translateX Translation along X axis
     * @param translateY Translation along Y axis
     * @param width Width of drawing area
     * @param height Height of drawing area
     * @return New Graphics2D instance for specified native window
     */
    Graphics2D getGraphics2D(NativeWindow win, int translateX, int translateY, int width, int height);
    // ???AWT: not standard harmony
    Graphics2D getGraphics2D(Canvas c, Paint p);
    
    /**
     * Creates instance of GraphicsEnvironment for specified WindowFactory
     *  
     * @param wf WindowFactory
     * @return New instance of GraphicsEnvironment
     */
    GraphicsEnvironment createGraphicsEnvironment(WindowFactory wf);
    
    // Font methods
    FontMetrics getFontMetrics(Font font);
    FontManager getFontManager();
    FontPeer getFontPeer(Font font);
    Font embedFont(String fontFilePath);
}