1/*
2 * Copyright 2007, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.internal.awt;
18
19import java.awt.Font;
20import java.awt.FontMetrics;
21import java.awt.Graphics2D;
22import java.awt.GraphicsEnvironment;
23import java.awt.peer.FontPeer;
24
25import org.apache.harmony.awt.gl.MultiRectArea;
26import org.apache.harmony.awt.gl.font.AndroidFont;
27import org.apache.harmony.awt.gl.font.FontManager;
28import org.apache.harmony.awt.gl.font.FontMetricsImpl;
29import org.apache.harmony.awt.gl.font.AndroidFontManager;
30import org.apache.harmony.awt.wtk.NativeWindow;
31import org.apache.harmony.awt.wtk.WindowFactory;
32import org.apache.harmony.awt.gl.CommonGraphics2DFactory;
33
34import android.graphics.Canvas;
35import android.graphics.Paint;
36import android.content.Context;
37
38public class AndroidGraphicsFactory extends CommonGraphics2DFactory {
39
40    public GraphicsEnvironment createGraphicsEnvironment(WindowFactory wf) {
41        // TODO Auto-generated method stub
42        return null;
43    }
44
45    public Font embedFont(String fontFilePath) {
46        // TODO Auto-generated method stub
47        return null;
48    }
49
50    public FontManager getFontManager() {
51        return AndroidFontManager.inst;
52    }
53
54    public FontMetrics getFontMetrics(Font font) {
55        return new FontMetricsImpl(font);
56    }
57
58    public FontPeer getFontPeer(Font font) {
59        //return getFontManager().getFontPeer(font.getName(), font.getStyle(), font.getSize());
60        return new AndroidFont(font.getName(), font.getStyle(), font.getSize());
61    }
62
63    public Graphics2D getGraphics2D(NativeWindow win, int translateX,
64            int translateY, MultiRectArea clip) {
65        // TODO Auto-generated method stub
66        return null;
67    }
68
69    public Graphics2D getGraphics2D(NativeWindow win, int translateX,
70            int translateY, int width, int height) {
71        // TODO Auto-generated method stub
72        return null;
73    }
74
75    public Graphics2D getGraphics2D(Context ctx, Canvas c, Paint p) {
76        return AndroidGraphics2D.getInstance(ctx, c, p);
77    }
78
79    public Graphics2D getGraphics2D(Canvas c, Paint p) {
80        throw new RuntimeException("Not supported!");
81    }
82
83    public Graphics2D getGraphics2D() {
84        return AndroidGraphics2D.getInstance();
85    }
86
87}
88