-\r
-\r
- /**\r
- * Appends a line to the EpsDocument. A new line character is added\r
- * to the end of the line when it is added.\r
- */\r
- public synchronized void append(EpsGraphics2D g, String line) {\r
- if (_lastG == null) {\r
- _lastG = g;\r
- }\r
- else if (g != _lastG) {\r
- EpsGraphics2D lastG = _lastG;\r
- _lastG = g;\r
- // We are being drawn on with a different EpsGraphics2D context.\r
- // We may need to update the clip, etc from this new context.\r
- if (g.getClip() != lastG.getClip()) {\r
- g.setClip(g.getClip());\r
- }\r
- if (!g.getColor().equals(lastG.getColor())) {\r
- g.setColor(g.getColor());\r
- }\r
- if (!g.getBackground().equals(lastG.getBackground())) {\r
- g.setBackground(g.getBackground());\r
- }\r
- // We don't need this, as this only affects the stroke and font,\r
- // which are dealt with separately later on.\r
- //if (!g.getTransform().equals(lastG.getTransform())) {\r
- // g.setTransform(g.getTransform());\r
- //}\r
- if (!g.getPaint().equals(lastG.getPaint())) {\r
- g.setPaint(g.getPaint());\r
- }\r
- if (!g.getComposite().equals(lastG.getComposite())) {\r
- g.setComposite(g.getComposite());\r
- }\r
- if (!g.getComposite().equals(lastG.getComposite())) {\r
- g.setComposite(g.getComposite());\r
- }\r
- if (!g.getFont().equals(lastG.getFont())) {\r
- g.setFont(g.getFont());\r
- }\r
- if (!g.getStroke().equals(lastG.getStroke())) {\r
- g.setStroke(g.getStroke());\r
- }\r
- }\r
- _lastG = g;\r
-\r
- try {\r
- _bufferedWriter.write(line + "\n");\r
- }\r
- catch (IOException e) {\r
- throw new EpsException("Could not write to the output file: " + e);\r
- }\r