1   package nl.tudelft.simulation.dsol.web.animation;
2   
3   import java.awt.Font;
4   import java.awt.Graphics2D;
5   import java.awt.GraphicsDevice;
6   import java.awt.GraphicsEnvironment;
7   import java.awt.HeadlessException;
8   import java.awt.image.BufferedImage;
9   import java.util.Locale;
10  
11  import org.djutils.logger.CategoryLogger;
12  
13  import nl.tudelft.simulation.dsol.logger.Cat;
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  public class HTMLGraphicsEnvironment extends GraphicsEnvironment
25  {
26      
27      HTMLDevice htmlDevice;
28  
29      
30      HTMLGraphics2D graphics2D;
31  
32      
33      HTMLGraphicsConfiguration graphicsConfiguration;
34  
35      
36  
37  
38      public HTMLGraphicsEnvironment()
39      {
40          CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.<init>");
41          this.graphics2D = new HTMLGraphics2D();
42          this.graphicsConfiguration = new HTMLGraphicsConfiguration();
43          this.htmlDevice = new HTMLDevice(this.graphicsConfiguration);
44          this.graphicsConfiguration.setDevice(this.htmlDevice);
45      }
46  
47      
48      @Override
49      public GraphicsDevice[] getScreenDevices() throws HeadlessException
50      {
51          CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.getScreenDevices()");
52          return new GraphicsDevice[] {this.htmlDevice};
53      }
54  
55      
56      @Override
57      public GraphicsDevice getDefaultScreenDevice() throws HeadlessException
58      {
59          CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.getDefaultScreenDevice()");
60          return this.htmlDevice;
61      }
62  
63      
64      @Override
65      public Graphics2D createGraphics(BufferedImage img)
66      {
67          CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.createGraphics()");
68          return this.graphics2D;
69      }
70  
71      
72      @Override
73      public Font[] getAllFonts()
74      {
75          CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.getAllFonts()");
76          return new Font[] {};
77      }
78  
79      
80      @Override
81      public String[] getAvailableFontFamilyNames()
82      {
83          CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.getAvailableFontFamilyNames()");
84          return new String[] {};
85      }
86  
87      
88      @Override
89      public String[] getAvailableFontFamilyNames(Locale l)
90      {
91          CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.getAvailableFontFamilyNames()");
92          return new String[] {};
93      }
94  
95  }