Removed Graphics Environment and moved getImageForPath into GraphicsContext instead canvas
authortoni.epple@eppleton.de
Tue, 21 May 2013 15:15:09 +0200
branchcanvas
changeset 1121dbc985f7226e
parent 1120 b88c003d73e4
child 1122 f5f15ac48ea8
Removed Graphics Environment and moved getImageForPath into GraphicsContext instead
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsContext.java
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsEnvironment.java
javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java
javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java
     1.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsContext.java	Fri May 17 14:09:38 2013 +0200
     1.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsContext.java	Tue May 21 15:15:09 2013 +0200
     1.3 @@ -414,4 +414,9 @@
     1.4  
     1.5      @JavaScriptBody(args = {"context", "x0", "y0", "r0", "x1", "y1", "r1"}, body = "return context.createRadialGradient(x0,y0,r0,x1,y1,r1);")
     1.6      private static native Object createRadialGradientImpl(Object context, double x0, double y0, double r0, double x1, double y1, double r1);
     1.7 +
     1.8 +    @Override
     1.9 +    public Image getImageForPath(String path) {
    1.10 +        throw new UnsupportedOperationException("getImageForPath is not yet supported");
    1.11 +    }
    1.12  }
     2.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsEnvironment.java	Fri May 17 14:09:38 2013 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,56 +0,0 @@
     2.4 -/**
     2.5 - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     2.6 - * <jaroslav.tulach@apidesign.org>
     2.7 - *
     2.8 - * This program is free software: you can redistribute it and/or modify it under
     2.9 - * the terms of the GNU General Public License as published by the Free Software
    2.10 - * Foundation, version 2 of the License.
    2.11 - *
    2.12 - * This program is distributed in the hope that it will be useful, but WITHOUT
    2.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    2.14 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    2.15 - * details.
    2.16 - *
    2.17 - * You should have received a copy of the GNU General Public License along with
    2.18 - * this program. Look for COPYING file in the top folder. If not, see
    2.19 - * http://opensource.org/licenses/GPL-2.0.
    2.20 - */
    2.21 -package org.apidesign.bck2brwsr.htmlpage.api;
    2.22 -
    2.23 -import net.java.html.canvas.GraphicsEnvironment;
    2.24 -import net.java.html.canvas.Image;
    2.25 -import net.java.html.canvas.LinearGradient;
    2.26 -import net.java.html.canvas.Pattern;
    2.27 -import net.java.html.canvas.RadialGradient;
    2.28 -import net.java.html.canvas.TextMetrics;
    2.29 -import org.openide.util.lookup.ServiceProvider;
    2.30 -
    2.31 -@ServiceProvider(service=GraphicsEnvironment.class)
    2.32 -public class HTML5GraphicsEnvironment extends GraphicsEnvironment{
    2.33 -
    2.34 -    @Override
    2.35 -    public Image getImageForPath(String path) {
    2.36 -        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    2.37 -    }
    2.38 -
    2.39 -    @Override
    2.40 -    public LinearGradient createLinearGradient() {
    2.41 -        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    2.42 -    }
    2.43 -
    2.44 -    @Override
    2.45 -    public Pattern createPattern() {
    2.46 -        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    2.47 -    }
    2.48 -
    2.49 -    @Override
    2.50 -    public RadialGradient createRadialGradient() {
    2.51 -        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    2.52 -    }
    2.53 -
    2.54 -    @Override
    2.55 -    public TextMetrics createTextMetrics() {
    2.56 -        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    2.57 -    }
    2.58 -    
    2.59 -}
     3.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java	Fri May 17 14:09:38 2013 +0200
     3.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java	Tue May 21 15:15:09 2013 +0200
     3.3 @@ -183,4 +183,6 @@
     3.4      public Pattern createPattern(Image image, String repeat);
     3.5  
     3.6      public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
     3.7 +    
     3.8 +    public Image getImageForPath(String path);
     3.9  }
     4.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java	Fri May 17 14:09:38 2013 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,115 +0,0 @@
     4.4 -/**
     4.5 - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     4.6 - * <jaroslav.tulach@apidesign.org>
     4.7 - *
     4.8 - * This program is free software: you can redistribute it and/or modify it under
     4.9 - * the terms of the GNU General Public License as published by the Free Software
    4.10 - * Foundation, version 2 of the License.
    4.11 - *
    4.12 - * This program is distributed in the hope that it will be useful, but WITHOUT
    4.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    4.14 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    4.15 - * details.
    4.16 - *
    4.17 - * You should have received a copy of the GNU General Public License along with
    4.18 - * this program. Look for COPYING file in the top folder. If not, see
    4.19 - * http://opensource.org/licenses/GPL-2.0.
    4.20 - */
    4.21 -package net.java.html.canvas;
    4.22 -
    4.23 -import java.util.ServiceLoader;
    4.24 -
    4.25 -/**
    4.26 - *
    4.27 - * @author antonepple
    4.28 - */
    4.29 -public abstract class GraphicsEnvironment {
    4.30 -
    4.31 -    private static GraphicsEnvironment DEFAULT;
    4.32 -
    4.33 -    public GraphicsEnvironment getDefault() {
    4.34 -        if (DEFAULT == null) {
    4.35 -            ServiceLoader<GraphicsEnvironment> loader = ServiceLoader.load(GraphicsEnvironment.class);
    4.36 -            DEFAULT = loader.iterator().next();
    4.37 -        }
    4.38 -        return DEFAULT == null ? getDummyInstance() : DEFAULT;
    4.39 -    }
    4.40 -
    4.41 -    public abstract Image getImageForPath(String path);
    4.42 -    
    4.43 -    public abstract LinearGradient createLinearGradient();
    4.44 -    
    4.45 -    public abstract Pattern createPattern();
    4.46 -    
    4.47 -    public abstract RadialGradient createRadialGradient();
    4.48 -    
    4.49 -    public abstract TextMetrics createTextMetrics();
    4.50 -    
    4.51 -    private GraphicsEnvironment getDummyInstance() {
    4.52 -        
    4.53 -        return new GraphicsEnvironment() {
    4.54 -
    4.55 -            @Override
    4.56 -            public Image getImageForPath(String path) {
    4.57 -               return new Image() {
    4.58 -
    4.59 -                   @Override
    4.60 -                   public int getHeight() {
    4.61 -                     return 0;
    4.62 -                   }
    4.63 -
    4.64 -                   @Override
    4.65 -                   public int getWidth() {
    4.66 -                       return 0;
    4.67 -                   }
    4.68 -               };
    4.69 -            }
    4.70 -
    4.71 -            @Override
    4.72 -            public LinearGradient createLinearGradient() {
    4.73 -                return new LinearGradient() {
    4.74 -
    4.75 -                    @Override
    4.76 -                    public void addColorStop(double position, String color) {
    4.77 -                      
    4.78 -                    }
    4.79 -                };
    4.80 -            }
    4.81 -
    4.82 -            @Override
    4.83 -            public Pattern createPattern() {
    4.84 -               return new Pattern() {
    4.85 -};
    4.86 -            }
    4.87 -
    4.88 -            @Override
    4.89 -            public RadialGradient createRadialGradient() {
    4.90 -                return new RadialGradient() {
    4.91 -
    4.92 -                    @Override
    4.93 -                    public void addColorStop(double position, String color) {
    4.94 -                        
    4.95 -                    }
    4.96 -                };
    4.97 -            }
    4.98 -
    4.99 -            @Override
   4.100 -            public TextMetrics createTextMetrics() {
   4.101 -                return new TextMetrics() {
   4.102 -
   4.103 -                    @Override
   4.104 -                    public double getHeight() {
   4.105 -                        return 0;
   4.106 -                    }
   4.107 -
   4.108 -                    @Override
   4.109 -                    public double getWidth() {
   4.110 -                        return 0;
   4.111 -                    }
   4.112 -                };
   4.113 -            }
   4.114 -        };
   4.115 -    }
   4.116 -    
   4.117 -    
   4.118 -}