javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java
branchcanvas
changeset 1121 dbc985f7226e
parent 1120 b88c003d73e4
child 1122 f5f15ac48ea8
     1.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java	Fri May 17 14:09:38 2013 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,115 +0,0 @@
     1.4 -/**
     1.5 - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     1.6 - * <jaroslav.tulach@apidesign.org>
     1.7 - *
     1.8 - * This program is free software: you can redistribute it and/or modify it under
     1.9 - * the terms of the GNU General Public License as published by the Free Software
    1.10 - * Foundation, version 2 of the License.
    1.11 - *
    1.12 - * This program is distributed in the hope that it will be useful, but WITHOUT
    1.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.14 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1.15 - * details.
    1.16 - *
    1.17 - * You should have received a copy of the GNU General Public License along with
    1.18 - * this program. Look for COPYING file in the top folder. If not, see
    1.19 - * http://opensource.org/licenses/GPL-2.0.
    1.20 - */
    1.21 -package net.java.html.canvas;
    1.22 -
    1.23 -import java.util.ServiceLoader;
    1.24 -
    1.25 -/**
    1.26 - *
    1.27 - * @author antonepple
    1.28 - */
    1.29 -public abstract class GraphicsEnvironment {
    1.30 -
    1.31 -    private static GraphicsEnvironment DEFAULT;
    1.32 -
    1.33 -    public GraphicsEnvironment getDefault() {
    1.34 -        if (DEFAULT == null) {
    1.35 -            ServiceLoader<GraphicsEnvironment> loader = ServiceLoader.load(GraphicsEnvironment.class);
    1.36 -            DEFAULT = loader.iterator().next();
    1.37 -        }
    1.38 -        return DEFAULT == null ? getDummyInstance() : DEFAULT;
    1.39 -    }
    1.40 -
    1.41 -    public abstract Image getImageForPath(String path);
    1.42 -    
    1.43 -    public abstract LinearGradient createLinearGradient();
    1.44 -    
    1.45 -    public abstract Pattern createPattern();
    1.46 -    
    1.47 -    public abstract RadialGradient createRadialGradient();
    1.48 -    
    1.49 -    public abstract TextMetrics createTextMetrics();
    1.50 -    
    1.51 -    private GraphicsEnvironment getDummyInstance() {
    1.52 -        
    1.53 -        return new GraphicsEnvironment() {
    1.54 -
    1.55 -            @Override
    1.56 -            public Image getImageForPath(String path) {
    1.57 -               return new Image() {
    1.58 -
    1.59 -                   @Override
    1.60 -                   public int getHeight() {
    1.61 -                     return 0;
    1.62 -                   }
    1.63 -
    1.64 -                   @Override
    1.65 -                   public int getWidth() {
    1.66 -                       return 0;
    1.67 -                   }
    1.68 -               };
    1.69 -            }
    1.70 -
    1.71 -            @Override
    1.72 -            public LinearGradient createLinearGradient() {
    1.73 -                return new LinearGradient() {
    1.74 -
    1.75 -                    @Override
    1.76 -                    public void addColorStop(double position, String color) {
    1.77 -                      
    1.78 -                    }
    1.79 -                };
    1.80 -            }
    1.81 -
    1.82 -            @Override
    1.83 -            public Pattern createPattern() {
    1.84 -               return new Pattern() {
    1.85 -};
    1.86 -            }
    1.87 -
    1.88 -            @Override
    1.89 -            public RadialGradient createRadialGradient() {
    1.90 -                return new RadialGradient() {
    1.91 -
    1.92 -                    @Override
    1.93 -                    public void addColorStop(double position, String color) {
    1.94 -                        
    1.95 -                    }
    1.96 -                };
    1.97 -            }
    1.98 -
    1.99 -            @Override
   1.100 -            public TextMetrics createTextMetrics() {
   1.101 -                return new TextMetrics() {
   1.102 -
   1.103 -                    @Override
   1.104 -                    public double getHeight() {
   1.105 -                        return 0;
   1.106 -                    }
   1.107 -
   1.108 -                    @Override
   1.109 -                    public double getWidth() {
   1.110 -                        return 0;
   1.111 -                    }
   1.112 -                };
   1.113 -            }
   1.114 -        };
   1.115 -    }
   1.116 -    
   1.117 -    
   1.118 -}