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 public class HtmlGraphicsEnvironment extends GraphicsEnvironment
24 {
25
26 HtmlDevice htmlDevice;
27
28
29 HtmlGraphics2d graphics2D;
30
31
32 HtmlGraphicsConfiguration graphicsConfiguration;
33
34
35
36
37 public HtmlGraphicsEnvironment()
38 {
39 CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.<init>");
40 this.graphics2D = new HtmlGraphics2d();
41 this.graphicsConfiguration = new HtmlGraphicsConfiguration();
42 this.htmlDevice = new HtmlDevice(this.graphicsConfiguration);
43 this.graphicsConfiguration.setDevice(this.htmlDevice);
44 }
45
46
47 @Override
48 public GraphicsDevice[] getScreenDevices() throws HeadlessException
49 {
50 CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.getScreenDevices()");
51 return new GraphicsDevice[] {this.htmlDevice};
52 }
53
54
55 @Override
56 public GraphicsDevice getDefaultScreenDevice() throws HeadlessException
57 {
58 CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.getDefaultScreenDevice()");
59 return this.htmlDevice;
60 }
61
62
63 @Override
64 public Graphics2D createGraphics(BufferedImage img)
65 {
66 CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.createGraphics()");
67 return this.graphics2D;
68 }
69
70
71 @Override
72 public Font[] getAllFonts()
73 {
74 CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.getAllFonts()");
75 return new Font[] {};
76 }
77
78
79 @Override
80 public String[] getAvailableFontFamilyNames()
81 {
82 CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.getAvailableFontFamilyNames()");
83 return new String[] {};
84 }
85
86
87 @Override
88 public String[] getAvailableFontFamilyNames(Locale l)
89 {
90 CategoryLogger.filter(Cat.WEB).trace("HTMLGraphicsEnvironment.getAvailableFontFamilyNames()");
91 return new String[] {};
92 }
93
94 }