# HG changeset patch # User toni.epple@eppleton.de # Date 1369142109 -7200 # Node ID dbc985f7226e7137872f7b05f59de8483396d708 # Parent b88c003d73e4d0491a4795abd9133a310e94b418 Removed Graphics Environment and moved getImageForPath into GraphicsContext instead diff -r b88c003d73e4 -r dbc985f7226e javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsContext.java --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsContext.java Fri May 17 14:09:38 2013 +0200 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsContext.java Tue May 21 15:15:09 2013 +0200 @@ -414,4 +414,9 @@ @JavaScriptBody(args = {"context", "x0", "y0", "r0", "x1", "y1", "r1"}, body = "return context.createRadialGradient(x0,y0,r0,x1,y1,r1);") private static native Object createRadialGradientImpl(Object context, double x0, double y0, double r0, double x1, double y1, double r1); + + @Override + public Image getImageForPath(String path) { + throw new UnsupportedOperationException("getImageForPath is not yet supported"); + } } diff -r b88c003d73e4 -r dbc985f7226e javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsEnvironment.java --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsEnvironment.java Fri May 17 14:09:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/** - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach - * - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. Look for COPYING file in the top folder. If not, see - * http://opensource.org/licenses/GPL-2.0. - */ -package org.apidesign.bck2brwsr.htmlpage.api; - -import net.java.html.canvas.GraphicsEnvironment; -import net.java.html.canvas.Image; -import net.java.html.canvas.LinearGradient; -import net.java.html.canvas.Pattern; -import net.java.html.canvas.RadialGradient; -import net.java.html.canvas.TextMetrics; -import org.openide.util.lookup.ServiceProvider; - -@ServiceProvider(service=GraphicsEnvironment.class) -public class HTML5GraphicsEnvironment extends GraphicsEnvironment{ - - @Override - public Image getImageForPath(String path) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public LinearGradient createLinearGradient() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public Pattern createPattern() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public RadialGradient createRadialGradient() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public TextMetrics createTextMetrics() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - -} diff -r b88c003d73e4 -r dbc985f7226e javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Fri May 17 14:09:38 2013 +0200 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Tue May 21 15:15:09 2013 +0200 @@ -183,4 +183,6 @@ public Pattern createPattern(Image image, String repeat); public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1); + + public Image getImageForPath(String path); } diff -r b88c003d73e4 -r dbc985f7226e javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java Fri May 17 14:09:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/** - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach - * - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. Look for COPYING file in the top folder. If not, see - * http://opensource.org/licenses/GPL-2.0. - */ -package net.java.html.canvas; - -import java.util.ServiceLoader; - -/** - * - * @author antonepple - */ -public abstract class GraphicsEnvironment { - - private static GraphicsEnvironment DEFAULT; - - public GraphicsEnvironment getDefault() { - if (DEFAULT == null) { - ServiceLoader loader = ServiceLoader.load(GraphicsEnvironment.class); - DEFAULT = loader.iterator().next(); - } - return DEFAULT == null ? getDummyInstance() : DEFAULT; - } - - public abstract Image getImageForPath(String path); - - public abstract LinearGradient createLinearGradient(); - - public abstract Pattern createPattern(); - - public abstract RadialGradient createRadialGradient(); - - public abstract TextMetrics createTextMetrics(); - - private GraphicsEnvironment getDummyInstance() { - - return new GraphicsEnvironment() { - - @Override - public Image getImageForPath(String path) { - return new Image() { - - @Override - public int getHeight() { - return 0; - } - - @Override - public int getWidth() { - return 0; - } - }; - } - - @Override - public LinearGradient createLinearGradient() { - return new LinearGradient() { - - @Override - public void addColorStop(double position, String color) { - - } - }; - } - - @Override - public Pattern createPattern() { - return new Pattern() { -}; - } - - @Override - public RadialGradient createRadialGradient() { - return new RadialGradient() { - - @Override - public void addColorStop(double position, String color) { - - } - }; - } - - @Override - public TextMetrics createTextMetrics() { - return new TextMetrics() { - - @Override - public double getHeight() { - return 0; - } - - @Override - public double getWidth() { - return 0; - } - }; - } - }; - } - - -}