1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package org.jibble.epsgraphics; |
22 |
|
|
23 |
|
import jalview.util.MessageManager; |
24 |
|
|
25 |
|
import java.awt.AlphaComposite; |
26 |
|
import java.awt.BasicStroke; |
27 |
|
import java.awt.Color; |
28 |
|
import java.awt.Composite; |
29 |
|
import java.awt.Font; |
30 |
|
import java.awt.FontMetrics; |
31 |
|
import java.awt.Graphics; |
32 |
|
import java.awt.GraphicsConfiguration; |
33 |
|
import java.awt.GraphicsDevice; |
34 |
|
import java.awt.GraphicsEnvironment; |
35 |
|
import java.awt.Image; |
36 |
|
import java.awt.Paint; |
37 |
|
import java.awt.Polygon; |
38 |
|
import java.awt.Rectangle; |
39 |
|
import java.awt.RenderingHints; |
40 |
|
import java.awt.Shape; |
41 |
|
import java.awt.Stroke; |
42 |
|
import java.awt.font.FontRenderContext; |
43 |
|
import java.awt.font.GlyphVector; |
44 |
|
import java.awt.font.TextAttribute; |
45 |
|
import java.awt.font.TextLayout; |
46 |
|
import java.awt.geom.AffineTransform; |
47 |
|
import java.awt.geom.Arc2D; |
48 |
|
import java.awt.geom.Area; |
49 |
|
import java.awt.geom.Ellipse2D; |
50 |
|
import java.awt.geom.GeneralPath; |
51 |
|
import java.awt.geom.Line2D; |
52 |
|
import java.awt.geom.PathIterator; |
53 |
|
import java.awt.geom.Point2D; |
54 |
|
import java.awt.geom.Rectangle2D; |
55 |
|
import java.awt.geom.RoundRectangle2D; |
56 |
|
import java.awt.image.BufferedImage; |
57 |
|
import java.awt.image.BufferedImageOp; |
58 |
|
import java.awt.image.ColorModel; |
59 |
|
import java.awt.image.ImageObserver; |
60 |
|
import java.awt.image.PixelGrabber; |
61 |
|
import java.awt.image.RenderedImage; |
62 |
|
import java.awt.image.WritableRaster; |
63 |
|
import java.awt.image.renderable.RenderableImage; |
64 |
|
import java.io.File; |
65 |
|
import java.io.FileOutputStream; |
66 |
|
import java.io.IOException; |
67 |
|
import java.io.OutputStream; |
68 |
|
import java.io.StringWriter; |
69 |
|
import java.text.AttributedCharacterIterator; |
70 |
|
import java.text.AttributedString; |
71 |
|
import java.text.CharacterIterator; |
72 |
|
import java.util.Hashtable; |
73 |
|
import java.util.Map; |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
|
|
| 31.6% |
Uncovered Elements: 399 (583) |
Complexity: 152 |
Complexity Density: 0.39 |
|
121 |
|
public class EpsGraphics2D extends java.awt.Graphics2D |
122 |
|
implements AutoCloseable |
123 |
|
{ |
124 |
|
|
125 |
|
public static final String VERSION = "0.8.8"; |
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
131 |
0 |
public EpsGraphics2D()... |
132 |
|
{ |
133 |
0 |
this("Untitled"); |
134 |
|
} |
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
|
140 |
5 |
public EpsGraphics2D(String title)... |
141 |
|
{ |
142 |
5 |
_document = new EpsDocument(title); |
143 |
5 |
_backgroundColor = Color.white; |
144 |
5 |
_clip = null; |
145 |
5 |
_transform = new AffineTransform(); |
146 |
5 |
_clipTransform = new AffineTransform(); |
147 |
5 |
_accurateTextMode = true; |
148 |
5 |
setColor(Color.black); |
149 |
5 |
setPaint(Color.black); |
150 |
5 |
setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR)); |
151 |
5 |
setFont(Font.decode(null)); |
152 |
5 |
setStroke(new BasicStroke()); |
153 |
|
} |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
162 |
0 |
public EpsGraphics2D(String title, File file, int minX, int minY,... |
163 |
|
int maxX, int maxY) throws IOException |
164 |
|
{ |
165 |
0 |
this(title, new FileOutputStream(file), minX, minY, maxX, maxY); |
166 |
|
} |
167 |
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
175 |
5 |
public EpsGraphics2D(String title, OutputStream outputStream, int minX,... |
176 |
|
int minY, int maxX, int maxY) throws IOException |
177 |
|
{ |
178 |
5 |
this(title); |
179 |
5 |
_document = new EpsDocument(title, outputStream, minX, minY, maxX, maxY); |
180 |
|
} |
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
|
186 |
0 |
protected EpsGraphics2D(EpsGraphics2D g)... |
187 |
|
{ |
188 |
0 |
_document = g._document; |
189 |
0 |
_backgroundColor = g._backgroundColor; |
190 |
0 |
_clip = g._clip; |
191 |
0 |
_clipTransform = (AffineTransform) g._clipTransform.clone(); |
192 |
0 |
_transform = (AffineTransform) g._transform.clone(); |
193 |
0 |
_color = g._color; |
194 |
0 |
_paint = g._paint; |
195 |
0 |
_composite = g._composite; |
196 |
0 |
_font = g._font; |
197 |
0 |
_stroke = g._stroke; |
198 |
0 |
_accurateTextMode = g._accurateTextMode; |
199 |
|
} |
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
205 |
0 |
private void methodNotSupported()... |
206 |
|
{ |
207 |
0 |
EpsException e = new EpsException(MessageManager.formatMessage( |
208 |
|
"exception.eps_method_not_supported", new String[] { VERSION })); |
209 |
0 |
e.printStackTrace(System.err); |
210 |
|
} |
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
|
|
226 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
227 |
5 |
public void setAccurateTextMode(boolean b)... |
228 |
|
{ |
229 |
5 |
_accurateTextMode = b; |
230 |
|
} |
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
235 |
14300 |
public boolean getAccurateTextMode()... |
236 |
|
{ |
237 |
14300 |
return _accurateTextMode; |
238 |
|
} |
239 |
|
|
240 |
|
|
241 |
|
|
242 |
|
|
243 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
244 |
10 |
public void flush() throws IOException... |
245 |
|
{ |
246 |
10 |
_document.flush(); |
247 |
|
} |
248 |
|
|
249 |
|
|
250 |
|
|
251 |
|
|
252 |
|
|
253 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
254 |
5 |
@Override... |
255 |
|
public void close() throws IOException |
256 |
|
{ |
257 |
5 |
flush(); |
258 |
5 |
_document.close(); |
259 |
|
} |
260 |
|
|
261 |
|
|
262 |
|
|
263 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
264 |
119825 |
private void append(String line)... |
265 |
|
{ |
266 |
119825 |
_document.append(this, line); |
267 |
|
} |
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
272 |
14300 |
private Point2D transform(float x, float y)... |
273 |
|
{ |
274 |
14300 |
Point2D result = new Point2D.Float(x, y); |
275 |
14300 |
result = _transform.transform(result, result); |
276 |
14300 |
result.setLocation(result.getX(), -result.getY()); |
277 |
14300 |
return result; |
278 |
|
} |
279 |
|
|
280 |
|
|
281 |
|
|
282 |
|
|
|
|
| 66.3% |
Uncovered Elements: 30 (89) |
Complexity: 13 |
Complexity Density: 0.2 |
|
283 |
3480 |
private void draw(Shape s, String action)... |
284 |
|
{ |
285 |
|
|
286 |
3480 |
if (s != null) |
287 |
|
{ |
288 |
|
|
289 |
|
|
290 |
3480 |
if (!_transform.isIdentity()) |
291 |
|
{ |
292 |
3475 |
s = _transform.createTransformedShape(s); |
293 |
|
} |
294 |
|
|
295 |
|
|
296 |
3480 |
if (!action.equals("clip")) |
297 |
|
{ |
298 |
3480 |
Rectangle2D shapeBounds = s.getBounds2D(); |
299 |
3480 |
Rectangle2D visibleBounds = shapeBounds; |
300 |
3480 |
if (_clip != null) |
301 |
|
{ |
302 |
0 |
Rectangle2D clipBounds = _clip.getBounds2D(); |
303 |
0 |
visibleBounds = shapeBounds.createIntersection(clipBounds); |
304 |
|
} |
305 |
3480 |
float lineRadius = _stroke.getLineWidth() / 2; |
306 |
3480 |
float minX = (float) visibleBounds.getMinX() - lineRadius; |
307 |
3480 |
float minY = (float) visibleBounds.getMinY() - lineRadius; |
308 |
3480 |
float maxX = (float) visibleBounds.getMaxX() + lineRadius; |
309 |
3480 |
float maxY = (float) visibleBounds.getMaxY() + lineRadius; |
310 |
3480 |
_document.updateBounds(minX, -minY); |
311 |
3480 |
_document.updateBounds(maxX, -maxY); |
312 |
|
} |
313 |
|
|
314 |
3480 |
append("newpath"); |
315 |
3480 |
int type = 0; |
316 |
3480 |
float[] coords = new float[6]; |
317 |
3480 |
PathIterator it = s.getPathIterator(null); |
318 |
3480 |
float x0 = 0; |
319 |
3480 |
float y0 = 0; |
320 |
3480 |
int count = 0; |
321 |
23660 |
while (!it.isDone()) |
322 |
|
{ |
323 |
20180 |
type = it.currentSegment(coords); |
324 |
20180 |
float x1 = coords[0]; |
325 |
20180 |
float y1 = -coords[1]; |
326 |
20180 |
float x2 = coords[2]; |
327 |
20180 |
float y2 = -coords[3]; |
328 |
20180 |
float x3 = coords[4]; |
329 |
20180 |
float y3 = -coords[5]; |
330 |
|
|
331 |
20180 |
if (type == PathIterator.SEG_CLOSE) |
332 |
|
{ |
333 |
3305 |
append("closepath"); |
334 |
3305 |
count++; |
335 |
|
} |
336 |
16875 |
else if (type == PathIterator.SEG_CUBICTO) |
337 |
|
{ |
338 |
0 |
append(x1 + " " + y1 + " " + x2 + " " + y2 + " " + x3 + " " + y3 |
339 |
|
+ " curveto"); |
340 |
0 |
count++; |
341 |
0 |
x0 = x3; |
342 |
0 |
y0 = y3; |
343 |
|
} |
344 |
16875 |
else if (type == PathIterator.SEG_LINETO) |
345 |
|
{ |
346 |
13395 |
append(x1 + " " + y1 + " lineto"); |
347 |
13395 |
count++; |
348 |
13395 |
x0 = x1; |
349 |
13395 |
y0 = y1; |
350 |
|
} |
351 |
3480 |
else if (type == PathIterator.SEG_MOVETO) |
352 |
|
{ |
353 |
3480 |
append(x1 + " " + y1 + " moveto"); |
354 |
3480 |
count++; |
355 |
3480 |
x0 = x1; |
356 |
3480 |
y0 = y1; |
357 |
|
} |
358 |
0 |
else if (type == PathIterator.SEG_QUADTO) |
359 |
|
{ |
360 |
|
|
361 |
0 |
float _x1 = x0 + 2 / 3f * (x1 - x0); |
362 |
0 |
float _y1 = y0 + 2 / 3f * (y1 - y0); |
363 |
0 |
float _x2 = x1 + 1 / 3f * (x2 - x1); |
364 |
0 |
float _y2 = y1 + 1 / 3f * (y2 - y1); |
365 |
0 |
float _x3 = x2; |
366 |
0 |
float _y3 = y2; |
367 |
0 |
append(_x1 + " " + _y1 + " " + _x2 + " " + _y2 + " " + _x3 + " " |
368 |
|
+ _y3 + " curveto"); |
369 |
0 |
count++; |
370 |
0 |
x0 = _x3; |
371 |
0 |
y0 = _y3; |
372 |
|
} |
373 |
0 |
else if (type == PathIterator.WIND_EVEN_ODD) |
374 |
|
{ |
375 |
|
|
376 |
|
} |
377 |
0 |
else if (type == PathIterator.WIND_NON_ZERO) |
378 |
|
{ |
379 |
|
|
380 |
|
} |
381 |
20180 |
it.next(); |
382 |
|
} |
383 |
3480 |
append(action); |
384 |
3480 |
append("newpath"); |
385 |
|
} |
386 |
|
} |
387 |
|
|
388 |
|
|
389 |
|
|
390 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
391 |
0 |
private String toHexString(int n)... |
392 |
|
{ |
393 |
0 |
String result = Integer.toString(n, 16); |
394 |
0 |
while (result.length() < 2) |
395 |
|
{ |
396 |
0 |
result = "0" + result; |
397 |
|
} |
398 |
0 |
return result; |
399 |
|
} |
400 |
|
|
401 |
|
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
|
|
406 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 3 |
Complexity Density: 0.2 |
|
407 |
0 |
@Override... |
408 |
|
public void draw3DRect(int x, int y, int width, int height, boolean raised) |
409 |
|
{ |
410 |
0 |
Color originalColor = getColor(); |
411 |
0 |
Stroke originalStroke = getStroke(); |
412 |
|
|
413 |
0 |
setStroke(new BasicStroke(1.0f)); |
414 |
|
|
415 |
0 |
if (raised) |
416 |
|
{ |
417 |
0 |
setColor(originalColor.brighter()); |
418 |
|
} |
419 |
|
else |
420 |
|
{ |
421 |
0 |
setColor(originalColor.darker()); |
422 |
|
} |
423 |
|
|
424 |
0 |
drawLine(x, y, x + width, y); |
425 |
0 |
drawLine(x, y, x, y + height); |
426 |
|
|
427 |
0 |
if (raised) |
428 |
|
{ |
429 |
0 |
setColor(originalColor.darker()); |
430 |
|
} |
431 |
|
else |
432 |
|
{ |
433 |
0 |
setColor(originalColor.brighter()); |
434 |
|
} |
435 |
|
|
436 |
0 |
drawLine(x + width, y + height, x, y + height); |
437 |
0 |
drawLine(x + width, y + height, x + width, y); |
438 |
|
|
439 |
0 |
setColor(originalColor); |
440 |
0 |
setStroke(originalStroke); |
441 |
|
} |
442 |
|
|
443 |
|
|
444 |
|
|
445 |
|
|
446 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
447 |
0 |
@Override... |
448 |
|
public void fill3DRect(int x, int y, int width, int height, boolean raised) |
449 |
|
{ |
450 |
0 |
Color originalColor = getColor(); |
451 |
|
|
452 |
0 |
if (raised) |
453 |
|
{ |
454 |
0 |
setColor(originalColor.brighter()); |
455 |
|
} |
456 |
|
else |
457 |
|
{ |
458 |
0 |
setColor(originalColor.darker()); |
459 |
|
} |
460 |
0 |
draw(new Rectangle(x, y, width, height), "fill"); |
461 |
0 |
setColor(originalColor); |
462 |
0 |
draw3DRect(x, y, width, height, raised); |
463 |
|
} |
464 |
|
|
465 |
|
|
466 |
|
|
467 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
468 |
175 |
@Override... |
469 |
|
public void draw(Shape s) |
470 |
|
{ |
471 |
175 |
draw(s, "stroke"); |
472 |
|
} |
473 |
|
|
474 |
|
|
475 |
|
|
476 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
477 |
0 |
@Override... |
478 |
|
public boolean drawImage(Image img, AffineTransform xform, |
479 |
|
ImageObserver obs) |
480 |
|
{ |
481 |
0 |
AffineTransform at = getTransform(); |
482 |
0 |
transform(xform); |
483 |
0 |
boolean st = drawImage(img, 0, 0, obs); |
484 |
0 |
setTransform(at); |
485 |
0 |
return st; |
486 |
|
} |
487 |
|
|
488 |
|
|
489 |
|
|
490 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
491 |
0 |
@Override... |
492 |
|
public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) |
493 |
|
{ |
494 |
0 |
BufferedImage img1 = op.filter(img, null); |
495 |
0 |
drawImage(img1, new AffineTransform(1f, 0f, 0f, 1f, x, y), null); |
496 |
|
} |
497 |
|
|
498 |
|
|
499 |
|
|
500 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
501 |
0 |
@Override... |
502 |
|
public void drawRenderedImage(RenderedImage img, AffineTransform xform) |
503 |
|
{ |
504 |
0 |
Hashtable properties = new Hashtable(); |
505 |
0 |
String[] names = img.getPropertyNames(); |
506 |
0 |
for (int i = 0; i < names.length; i++) |
507 |
|
{ |
508 |
0 |
properties.put(names[i], img.getProperty(names[i])); |
509 |
|
} |
510 |
|
|
511 |
0 |
ColorModel cm = img.getColorModel(); |
512 |
0 |
WritableRaster wr = img.copyData(null); |
513 |
0 |
BufferedImage img1 = new BufferedImage(cm, wr, |
514 |
|
cm.isAlphaPremultiplied(), properties); |
515 |
0 |
AffineTransform at = AffineTransform.getTranslateInstance( |
516 |
|
img.getMinX(), img.getMinY()); |
517 |
0 |
at.preConcatenate(xform); |
518 |
0 |
drawImage(img1, at, null); |
519 |
|
} |
520 |
|
|
521 |
|
|
522 |
|
|
523 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
524 |
0 |
@Override... |
525 |
|
public void drawRenderableImage(RenderableImage img, AffineTransform xform) |
526 |
|
{ |
527 |
0 |
drawRenderedImage(img.createDefaultRendering(), xform); |
528 |
|
} |
529 |
|
|
530 |
|
|
531 |
|
|
532 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
533 |
14300 |
@Override... |
534 |
|
public void drawString(String str, int x, int y) |
535 |
|
{ |
536 |
14300 |
drawString(str, (float) x, (float) y); |
537 |
|
} |
538 |
|
|
539 |
|
|
540 |
|
|
541 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
542 |
14300 |
@Override... |
543 |
|
public void drawString(String s, float x, float y) |
544 |
|
{ |
545 |
14300 |
if (s != null && s.length() > 0) |
546 |
|
{ |
547 |
14300 |
AttributedString as = new AttributedString(s); |
548 |
14300 |
as.addAttribute(TextAttribute.FONT, getFont()); |
549 |
14300 |
drawString(as.getIterator(), x, y); |
550 |
|
} |
551 |
|
} |
552 |
|
|
553 |
|
|
554 |
|
|
555 |
|
|
556 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
557 |
0 |
@Override... |
558 |
|
public void drawString(AttributedCharacterIterator iterator, int x, int y) |
559 |
|
{ |
560 |
0 |
drawString(iterator, (float) x, (float) y); |
561 |
|
} |
562 |
|
|
563 |
|
|
564 |
|
|
565 |
|
|
566 |
|
|
|
|
| 68.4% |
Uncovered Elements: 6 (19) |
Complexity: 5 |
Complexity Density: 0.38 |
|
567 |
14300 |
@Override... |
568 |
|
public void drawString(AttributedCharacterIterator iterator, float x, |
569 |
|
float y) |
570 |
|
{ |
571 |
14300 |
if (getAccurateTextMode()) |
572 |
|
{ |
573 |
0 |
TextLayout layout = new TextLayout(iterator, getFontRenderContext()); |
574 |
0 |
Shape shape = layout.getOutline(AffineTransform.getTranslateInstance( |
575 |
|
x, y)); |
576 |
0 |
draw(shape, "fill"); |
577 |
|
} |
578 |
|
else |
579 |
|
{ |
580 |
14300 |
append("newpath"); |
581 |
14300 |
Point2D location = transform(x, y); |
582 |
14300 |
append(location.getX() + " " + location.getY() + " moveto"); |
583 |
14300 |
StringBuffer buffer = new StringBuffer(); |
584 |
29995 |
for (char ch = iterator.first(); ch != CharacterIterator.DONE; ch = iterator |
585 |
|
.next()) |
586 |
|
{ |
587 |
15695 |
if (ch == '(' || ch == ')') |
588 |
|
{ |
589 |
0 |
buffer.append('\\'); |
590 |
|
} |
591 |
15695 |
buffer.append(ch); |
592 |
|
} |
593 |
14300 |
append("(" + buffer.toString() + ") show"); |
594 |
|
} |
595 |
|
} |
596 |
|
|
597 |
|
|
598 |
|
|
599 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
600 |
0 |
@Override... |
601 |
|
public void drawGlyphVector(GlyphVector g, float x, float y) |
602 |
|
{ |
603 |
0 |
Shape shape = g.getOutline(x, y); |
604 |
0 |
draw(shape, "fill"); |
605 |
|
} |
606 |
|
|
607 |
|
|
608 |
|
|
609 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
610 |
0 |
@Override... |
611 |
|
public void fill(Shape s) |
612 |
|
{ |
613 |
0 |
draw(s, "fill"); |
614 |
|
} |
615 |
|
|
616 |
|
|
617 |
|
|
618 |
|
|
619 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
620 |
0 |
@Override... |
621 |
|
public boolean hit(Rectangle rect, Shape s, boolean onStroke) |
622 |
|
{ |
623 |
0 |
return s.intersects(rect); |
624 |
|
} |
625 |
|
|
626 |
|
|
627 |
|
|
628 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
629 |
0 |
@Override... |
630 |
|
public GraphicsConfiguration getDeviceConfiguration() |
631 |
|
{ |
632 |
0 |
GraphicsConfiguration gc = null; |
633 |
0 |
GraphicsEnvironment ge = GraphicsEnvironment |
634 |
|
.getLocalGraphicsEnvironment(); |
635 |
0 |
GraphicsDevice[] gds = ge.getScreenDevices(); |
636 |
0 |
for (int i = 0; i < gds.length; i++) |
637 |
|
{ |
638 |
0 |
GraphicsDevice gd = gds[i]; |
639 |
0 |
GraphicsConfiguration[] gcs = gd.getConfigurations(); |
640 |
0 |
if (gcs.length > 0) |
641 |
|
{ |
642 |
0 |
return gcs[0]; |
643 |
|
} |
644 |
|
} |
645 |
0 |
return gc; |
646 |
|
} |
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
|
651 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
652 |
5 |
@Override... |
653 |
|
public void setComposite(Composite comp) |
654 |
|
{ |
655 |
5 |
_composite = comp; |
656 |
|
} |
657 |
|
|
658 |
|
|
659 |
|
|
660 |
|
|
661 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
662 |
5 |
@Override... |
663 |
|
public void setPaint(Paint paint) |
664 |
|
{ |
665 |
5 |
_paint = paint; |
666 |
5 |
if (paint instanceof Color) |
667 |
|
{ |
668 |
5 |
setColor((Color) paint); |
669 |
|
} |
670 |
|
} |
671 |
|
|
672 |
|
|
673 |
|
|
674 |
|
|
675 |
|
|
|
|
| 68% |
Uncovered Elements: 8 (25) |
Complexity: 5 |
Complexity Density: 0.29 |
|
676 |
4770 |
@Override... |
677 |
|
public void setStroke(Stroke s) |
678 |
|
{ |
679 |
4770 |
if (s instanceof BasicStroke) |
680 |
|
{ |
681 |
4770 |
_stroke = (BasicStroke) s; |
682 |
|
|
683 |
4770 |
append(_stroke.getLineWidth() + " setlinewidth"); |
684 |
4770 |
float miterLimit = _stroke.getMiterLimit(); |
685 |
4770 |
if (miterLimit < 1.0f) |
686 |
|
{ |
687 |
0 |
miterLimit = 1; |
688 |
|
} |
689 |
4770 |
append(miterLimit + " setmiterlimit"); |
690 |
4770 |
append(_stroke.getLineJoin() + " setlinejoin"); |
691 |
4770 |
append(_stroke.getEndCap() + " setlinecap"); |
692 |
|
|
693 |
4770 |
StringBuffer dashes = new StringBuffer(); |
694 |
4770 |
dashes.append("[ "); |
695 |
4770 |
float[] dashArray = _stroke.getDashArray(); |
696 |
4770 |
if (dashArray != null) |
697 |
|
{ |
698 |
0 |
for (int i = 0; i < dashArray.length; i++) |
699 |
|
{ |
700 |
0 |
dashes.append((dashArray[i]) + " "); |
701 |
|
} |
702 |
|
} |
703 |
4770 |
dashes.append("]"); |
704 |
4770 |
append(dashes.toString() + " 0 setdash"); |
705 |
|
} |
706 |
|
} |
707 |
|
|
708 |
|
|
709 |
|
|
710 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
711 |
15 |
@Override... |
712 |
|
public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue) |
713 |
|
{ |
714 |
|
|
715 |
|
} |
716 |
|
|
717 |
|
|
718 |
|
|
719 |
|
|
720 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
721 |
0 |
@Override... |
722 |
|
public Object getRenderingHint(RenderingHints.Key hintKey) |
723 |
|
{ |
724 |
0 |
return null; |
725 |
|
} |
726 |
|
|
727 |
|
|
728 |
|
|
729 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
730 |
0 |
@Override... |
731 |
|
public void setRenderingHints(Map hints) |
732 |
|
{ |
733 |
|
|
734 |
|
} |
735 |
|
|
736 |
|
|
737 |
|
|
738 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
739 |
0 |
@Override... |
740 |
|
public void addRenderingHints(Map hints) |
741 |
|
{ |
742 |
|
|
743 |
|
} |
744 |
|
|
745 |
|
|
746 |
|
|
747 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
748 |
0 |
@Override... |
749 |
|
public RenderingHints getRenderingHints() |
750 |
|
{ |
751 |
0 |
return new RenderingHints(null); |
752 |
|
} |
753 |
|
|
754 |
|
|
755 |
|
|
756 |
|
|
757 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
758 |
4765 |
@Override... |
759 |
|
public void translate(int x, int y) |
760 |
|
{ |
761 |
4765 |
translate((double) x, (double) y); |
762 |
|
} |
763 |
|
|
764 |
|
|
765 |
|
|
766 |
|
|
767 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
768 |
4765 |
@Override... |
769 |
|
public void translate(double tx, double ty) |
770 |
|
{ |
771 |
4765 |
transform(AffineTransform.getTranslateInstance(tx, ty)); |
772 |
|
} |
773 |
|
|
774 |
|
|
775 |
|
|
776 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
777 |
0 |
@Override... |
778 |
|
public void rotate(double theta) |
779 |
|
{ |
780 |
0 |
rotate(theta, 0, 0); |
781 |
|
} |
782 |
|
|
783 |
|
|
784 |
|
|
785 |
|
|
786 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
787 |
0 |
@Override... |
788 |
|
public void rotate(double theta, double x, double y) |
789 |
|
{ |
790 |
0 |
transform(AffineTransform.getRotateInstance(theta, x, y)); |
791 |
|
} |
792 |
|
|
793 |
|
|
794 |
|
|
795 |
|
|
796 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
797 |
0 |
@Override... |
798 |
|
public void scale(double sx, double sy) |
799 |
|
{ |
800 |
0 |
transform(AffineTransform.getScaleInstance(sx, sy)); |
801 |
|
} |
802 |
|
|
803 |
|
|
804 |
|
|
805 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
806 |
0 |
@Override... |
807 |
|
public void shear(double shx, double shy) |
808 |
|
{ |
809 |
0 |
transform(AffineTransform.getShearInstance(shx, shy)); |
810 |
|
} |
811 |
|
|
812 |
|
|
813 |
|
|
814 |
|
|
815 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
816 |
4765 |
@Override... |
817 |
|
public void transform(AffineTransform Tx) |
818 |
|
{ |
819 |
4765 |
_transform.concatenate(Tx); |
820 |
4765 |
setTransform(getTransform()); |
821 |
|
} |
822 |
|
|
823 |
|
|
824 |
|
|
825 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
826 |
4765 |
@Override... |
827 |
|
public void setTransform(AffineTransform Tx) |
828 |
|
{ |
829 |
4765 |
if (Tx == null) |
830 |
|
{ |
831 |
0 |
_transform = new AffineTransform(); |
832 |
|
} |
833 |
|
else |
834 |
|
{ |
835 |
4765 |
_transform = new AffineTransform(Tx); |
836 |
|
} |
837 |
|
|
838 |
4765 |
setStroke(getStroke()); |
839 |
4765 |
setFont(getFont()); |
840 |
|
} |
841 |
|
|
842 |
|
|
843 |
|
|
844 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
845 |
4765 |
@Override... |
846 |
|
public AffineTransform getTransform() |
847 |
|
{ |
848 |
4765 |
return new AffineTransform(_transform); |
849 |
|
} |
850 |
|
|
851 |
|
|
852 |
|
|
853 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
854 |
0 |
@Override... |
855 |
|
public Paint getPaint() |
856 |
|
{ |
857 |
0 |
return _paint; |
858 |
|
} |
859 |
|
|
860 |
|
|
861 |
|
|
862 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
863 |
0 |
@Override... |
864 |
|
public Composite getComposite() |
865 |
|
{ |
866 |
0 |
return _composite; |
867 |
|
} |
868 |
|
|
869 |
|
|
870 |
|
|
871 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
872 |
0 |
@Override... |
873 |
|
public void setBackground(Color color) |
874 |
|
{ |
875 |
0 |
if (color == null) |
876 |
|
{ |
877 |
0 |
color = Color.black; |
878 |
|
} |
879 |
0 |
_backgroundColor = color; |
880 |
|
} |
881 |
|
|
882 |
|
|
883 |
|
|
884 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
885 |
0 |
@Override... |
886 |
|
public Color getBackground() |
887 |
|
{ |
888 |
0 |
return _backgroundColor; |
889 |
|
} |
890 |
|
|
891 |
|
|
892 |
|
|
893 |
|
|
894 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
895 |
4765 |
@Override... |
896 |
|
public Stroke getStroke() |
897 |
|
{ |
898 |
4765 |
return _stroke; |
899 |
|
} |
900 |
|
|
901 |
|
|
902 |
|
|
903 |
|
|
904 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
905 |
0 |
@Override... |
906 |
|
public void clip(Shape s) |
907 |
|
{ |
908 |
0 |
if (_clip == null) |
909 |
|
{ |
910 |
0 |
setClip(s); |
911 |
|
} |
912 |
|
else |
913 |
|
{ |
914 |
0 |
Area area = new Area(_clip); |
915 |
0 |
area.intersect(new Area(s)); |
916 |
0 |
setClip(area); |
917 |
|
} |
918 |
|
} |
919 |
|
|
920 |
|
|
921 |
|
|
922 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
923 |
10 |
@Override... |
924 |
|
public FontRenderContext getFontRenderContext() |
925 |
|
{ |
926 |
10 |
return _fontRenderContext; |
927 |
|
} |
928 |
|
|
929 |
|
|
930 |
|
|
931 |
|
|
932 |
|
|
933 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
934 |
0 |
@Override... |
935 |
|
public Graphics create() |
936 |
|
{ |
937 |
0 |
return new EpsGraphics2D(this); |
938 |
|
} |
939 |
|
|
940 |
|
|
941 |
|
|
942 |
|
|
943 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
944 |
0 |
@Override... |
945 |
|
public Graphics create(int x, int y, int width, int height) |
946 |
|
{ |
947 |
0 |
Graphics g = create(); |
948 |
0 |
g.translate(x, y); |
949 |
0 |
g.clipRect(0, 0, width, height); |
950 |
0 |
return g; |
951 |
|
} |
952 |
|
|
953 |
|
|
954 |
|
|
955 |
|
|
956 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
957 |
0 |
@Override... |
958 |
|
public Color getColor() |
959 |
|
{ |
960 |
0 |
return _color; |
961 |
|
} |
962 |
|
|
963 |
|
|
964 |
|
|
965 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
966 |
17655 |
@Override... |
967 |
|
public void setColor(Color c) |
968 |
|
{ |
969 |
17655 |
if (c == null) |
970 |
|
{ |
971 |
0 |
c = Color.black; |
972 |
|
} |
973 |
17655 |
_color = c; |
974 |
17655 |
append((c.getRed() / 255f) + " " + (c.getGreen() / 255f) + " " |
975 |
|
+ (c.getBlue() / 255f) + " setrgbcolor"); |
976 |
|
} |
977 |
|
|
978 |
|
|
979 |
|
|
980 |
|
|
981 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
982 |
0 |
@Override... |
983 |
|
public void setPaintMode() |
984 |
|
{ |
985 |
|
|
986 |
|
} |
987 |
|
|
988 |
|
|
989 |
|
|
990 |
|
|
991 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
992 |
0 |
@Override... |
993 |
|
public void setXORMode(Color c1) |
994 |
|
{ |
995 |
0 |
methodNotSupported(); |
996 |
|
} |
997 |
|
|
998 |
|
|
999 |
|
|
1000 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1001 |
19115 |
@Override... |
1002 |
|
public Font getFont() |
1003 |
|
{ |
1004 |
19115 |
return _font; |
1005 |
|
} |
1006 |
|
|
1007 |
|
|
1008 |
|
|
1009 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
1010 |
4800 |
@Override... |
1011 |
|
public void setFont(Font font) |
1012 |
|
{ |
1013 |
4800 |
if (font == null) |
1014 |
|
{ |
1015 |
0 |
font = Font.decode(null); |
1016 |
|
} |
1017 |
4800 |
_font = font; |
1018 |
4800 |
append("/" + _font.getPSName() + " findfont " + (_font.getSize()) |
1019 |
|
+ " scalefont setfont"); |
1020 |
|
} |
1021 |
|
|
1022 |
|
|
1023 |
|
|
1024 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1025 |
15 |
@Override... |
1026 |
|
public FontMetrics getFontMetrics() |
1027 |
|
{ |
1028 |
15 |
return getFontMetrics(getFont()); |
1029 |
|
} |
1030 |
|
|
1031 |
|
|
1032 |
|
|
1033 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1034 |
25 |
@Override... |
1035 |
|
public FontMetrics getFontMetrics(Font f) |
1036 |
|
{ |
1037 |
25 |
BufferedImage image = new BufferedImage(1, 1, |
1038 |
|
BufferedImage.TYPE_INT_RGB); |
1039 |
25 |
Graphics g = image.getGraphics(); |
1040 |
25 |
return g.getFontMetrics(f); |
1041 |
|
} |
1042 |
|
|
1043 |
|
|
1044 |
|
|
1045 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
1046 |
0 |
@Override... |
1047 |
|
public Rectangle getClipBounds() |
1048 |
|
{ |
1049 |
0 |
if (_clip == null) |
1050 |
|
{ |
1051 |
0 |
return null; |
1052 |
|
} |
1053 |
0 |
Rectangle rect = getClip().getBounds(); |
1054 |
0 |
return rect; |
1055 |
|
} |
1056 |
|
|
1057 |
|
|
1058 |
|
|
1059 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1060 |
0 |
@Override... |
1061 |
|
public void clipRect(int x, int y, int width, int height) |
1062 |
|
{ |
1063 |
0 |
clip(new Rectangle(x, y, width, height)); |
1064 |
|
} |
1065 |
|
|
1066 |
|
|
1067 |
|
|
1068 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1069 |
0 |
@Override... |
1070 |
|
public void setClip(int x, int y, int width, int height) |
1071 |
|
{ |
1072 |
0 |
setClip(new Rectangle(x, y, width, height)); |
1073 |
|
} |
1074 |
|
|
1075 |
|
|
1076 |
|
|
1077 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
1078 |
0 |
@Override... |
1079 |
|
public Shape getClip() |
1080 |
|
{ |
1081 |
0 |
if (_clip == null) |
1082 |
|
{ |
1083 |
0 |
return null; |
1084 |
|
} |
1085 |
|
else |
1086 |
|
{ |
1087 |
0 |
try |
1088 |
|
{ |
1089 |
0 |
AffineTransform t = _transform.createInverse(); |
1090 |
0 |
t.concatenate(_clipTransform); |
1091 |
0 |
return t.createTransformedShape(_clip); |
1092 |
|
} catch (Exception e) |
1093 |
|
{ |
1094 |
0 |
throw new EpsException(MessageManager.formatMessage( |
1095 |
|
"exception.eps_unable_to_get_inverse_matrix", |
1096 |
|
new String[] { _transform.toString() })); |
1097 |
|
} |
1098 |
|
} |
1099 |
|
} |
1100 |
|
|
1101 |
|
|
1102 |
|
|
1103 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 4 |
Complexity Density: 0.31 |
|
1104 |
0 |
@Override... |
1105 |
|
public void setClip(Shape clip) |
1106 |
|
{ |
1107 |
0 |
if (clip != null) |
1108 |
|
{ |
1109 |
0 |
if (_document.isClipSet()) |
1110 |
|
{ |
1111 |
0 |
append("grestore"); |
1112 |
0 |
append("gsave"); |
1113 |
|
} |
1114 |
|
else |
1115 |
|
{ |
1116 |
0 |
_document.setClipSet(true); |
1117 |
0 |
append("gsave"); |
1118 |
|
} |
1119 |
0 |
draw(clip, "clip"); |
1120 |
0 |
_clip = clip; |
1121 |
0 |
_clipTransform = (AffineTransform) _transform.clone(); |
1122 |
|
} |
1123 |
|
else |
1124 |
|
{ |
1125 |
0 |
if (_document.isClipSet()) |
1126 |
|
{ |
1127 |
0 |
append("grestore"); |
1128 |
0 |
_document.setClipSet(false); |
1129 |
|
} |
1130 |
0 |
_clip = null; |
1131 |
|
} |
1132 |
|
} |
1133 |
|
|
1134 |
|
|
1135 |
|
|
1136 |
|
|
1137 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1138 |
0 |
@Override... |
1139 |
|
public void copyArea(int x, int y, int width, int height, int dx, int dy) |
1140 |
|
{ |
1141 |
0 |
methodNotSupported(); |
1142 |
|
} |
1143 |
|
|
1144 |
|
|
1145 |
|
|
1146 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1147 |
175 |
@Override... |
1148 |
|
public void drawLine(int x1, int y1, int x2, int y2) |
1149 |
|
{ |
1150 |
175 |
Shape shape = new Line2D.Float(x1, y1, x2, y2); |
1151 |
175 |
draw(shape); |
1152 |
|
} |
1153 |
|
|
1154 |
|
|
1155 |
|
|
1156 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1157 |
3305 |
@Override... |
1158 |
|
public void fillRect(int x, int y, int width, int height) |
1159 |
|
{ |
1160 |
3305 |
Shape shape = new Rectangle(x, y, width, height); |
1161 |
3305 |
draw(shape, "fill"); |
1162 |
|
} |
1163 |
|
|
1164 |
|
|
1165 |
|
|
1166 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1167 |
0 |
@Override... |
1168 |
|
public void drawRect(int x, int y, int width, int height) |
1169 |
|
{ |
1170 |
0 |
Shape shape = new Rectangle(x, y, width, height); |
1171 |
0 |
draw(shape); |
1172 |
|
} |
1173 |
|
|
1174 |
|
|
1175 |
|
|
1176 |
|
|
1177 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
1178 |
0 |
@Override... |
1179 |
|
public void clearRect(int x, int y, int width, int height) |
1180 |
|
{ |
1181 |
0 |
Color originalColor = getColor(); |
1182 |
|
|
1183 |
0 |
setColor(getBackground()); |
1184 |
0 |
Shape shape = new Rectangle(x, y, width, height); |
1185 |
0 |
draw(shape, "fill"); |
1186 |
|
|
1187 |
0 |
setColor(originalColor); |
1188 |
|
} |
1189 |
|
|
1190 |
|
|
1191 |
|
|
1192 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1193 |
0 |
@Override... |
1194 |
|
public void drawRoundRect(int x, int y, int width, int height, |
1195 |
|
int arcWidth, int arcHeight) |
1196 |
|
{ |
1197 |
0 |
Shape shape = new RoundRectangle2D.Float(x, y, width, height, arcWidth, |
1198 |
|
arcHeight); |
1199 |
0 |
draw(shape); |
1200 |
|
} |
1201 |
|
|
1202 |
|
|
1203 |
|
|
1204 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1205 |
0 |
@Override... |
1206 |
|
public void fillRoundRect(int x, int y, int width, int height, |
1207 |
|
int arcWidth, int arcHeight) |
1208 |
|
{ |
1209 |
0 |
Shape shape = new RoundRectangle2D.Float(x, y, width, height, arcWidth, |
1210 |
|
arcHeight); |
1211 |
0 |
draw(shape, "fill"); |
1212 |
|
} |
1213 |
|
|
1214 |
|
|
1215 |
|
|
1216 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1217 |
0 |
@Override... |
1218 |
|
public void drawOval(int x, int y, int width, int height) |
1219 |
|
{ |
1220 |
0 |
Shape shape = new Ellipse2D.Float(x, y, width, height); |
1221 |
0 |
draw(shape); |
1222 |
|
} |
1223 |
|
|
1224 |
|
|
1225 |
|
|
1226 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1227 |
0 |
@Override... |
1228 |
|
public void fillOval(int x, int y, int width, int height) |
1229 |
|
{ |
1230 |
0 |
Shape shape = new Ellipse2D.Float(x, y, width, height); |
1231 |
0 |
draw(shape, "fill"); |
1232 |
|
} |
1233 |
|
|
1234 |
|
|
1235 |
|
|
1236 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1237 |
0 |
@Override... |
1238 |
|
public void drawArc(int x, int y, int width, int height, int startAngle, |
1239 |
|
int arcAngle) |
1240 |
|
{ |
1241 |
0 |
Shape shape = new Arc2D.Float(x, y, width, height, startAngle, |
1242 |
|
arcAngle, Arc2D.OPEN); |
1243 |
0 |
draw(shape); |
1244 |
|
} |
1245 |
|
|
1246 |
|
|
1247 |
|
|
1248 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1249 |
0 |
@Override... |
1250 |
|
public void fillArc(int x, int y, int width, int height, int startAngle, |
1251 |
|
int arcAngle) |
1252 |
|
{ |
1253 |
0 |
Shape shape = new Arc2D.Float(x, y, width, height, startAngle, |
1254 |
|
arcAngle, Arc2D.PIE); |
1255 |
0 |
draw(shape, "fill"); |
1256 |
|
} |
1257 |
|
|
1258 |
|
|
1259 |
|
|
1260 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
1261 |
0 |
@Override... |
1262 |
|
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) |
1263 |
|
{ |
1264 |
0 |
if (nPoints > 0) |
1265 |
|
{ |
1266 |
0 |
GeneralPath path = new GeneralPath(); |
1267 |
0 |
path.moveTo(xPoints[0], yPoints[0]); |
1268 |
0 |
for (int i = 1; i < nPoints; i++) |
1269 |
|
{ |
1270 |
0 |
path.lineTo(xPoints[i], yPoints[i]); |
1271 |
|
} |
1272 |
0 |
draw(path); |
1273 |
|
} |
1274 |
|
} |
1275 |
|
|
1276 |
|
|
1277 |
|
|
1278 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1279 |
0 |
@Override... |
1280 |
|
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) |
1281 |
|
{ |
1282 |
0 |
Shape shape = new Polygon(xPoints, yPoints, nPoints); |
1283 |
0 |
draw(shape); |
1284 |
|
} |
1285 |
|
|
1286 |
|
|
1287 |
|
|
1288 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1289 |
0 |
@Override... |
1290 |
|
public void drawPolygon(Polygon p) |
1291 |
|
{ |
1292 |
0 |
draw(p); |
1293 |
|
} |
1294 |
|
|
1295 |
|
|
1296 |
|
|
1297 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1298 |
0 |
@Override... |
1299 |
|
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) |
1300 |
|
{ |
1301 |
0 |
Shape shape = new Polygon(xPoints, yPoints, nPoints); |
1302 |
0 |
draw(shape, "fill"); |
1303 |
|
} |
1304 |
|
|
1305 |
|
|
1306 |
|
|
1307 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1308 |
0 |
@Override... |
1309 |
|
public void fillPolygon(Polygon p) |
1310 |
|
{ |
1311 |
0 |
draw(p, "fill"); |
1312 |
|
} |
1313 |
|
|
1314 |
|
|
1315 |
|
|
1316 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1317 |
0 |
@Override... |
1318 |
|
public void drawChars(char[] data, int offset, int length, int x, int y) |
1319 |
|
{ |
1320 |
0 |
String string = new String(data, offset, length); |
1321 |
0 |
drawString(string, x, y); |
1322 |
|
} |
1323 |
|
|
1324 |
|
|
1325 |
|
|
1326 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1327 |
0 |
@Override... |
1328 |
|
public void drawBytes(byte[] data, int offset, int length, int x, int y) |
1329 |
|
{ |
1330 |
0 |
String string = new String(data, offset, length); |
1331 |
0 |
drawString(string, x, y); |
1332 |
|
} |
1333 |
|
|
1334 |
|
|
1335 |
|
|
1336 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1337 |
0 |
@Override... |
1338 |
|
public boolean drawImage(Image img, int x, int y, ImageObserver observer) |
1339 |
|
{ |
1340 |
0 |
return drawImage(img, x, y, Color.white, observer); |
1341 |
|
} |
1342 |
|
|
1343 |
|
|
1344 |
|
|
1345 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1346 |
0 |
@Override... |
1347 |
|
public boolean drawImage(Image img, int x, int y, int width, int height, |
1348 |
|
ImageObserver observer) |
1349 |
|
{ |
1350 |
0 |
return drawImage(img, x, y, width, height, Color.white, observer); |
1351 |
|
} |
1352 |
|
|
1353 |
|
|
1354 |
|
|
1355 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1356 |
0 |
@Override... |
1357 |
|
public boolean drawImage(Image img, int x, int y, Color bgcolor, |
1358 |
|
ImageObserver observer) |
1359 |
|
{ |
1360 |
0 |
int width = img.getWidth(null); |
1361 |
0 |
int height = img.getHeight(null); |
1362 |
0 |
return drawImage(img, x, y, width, height, bgcolor, observer); |
1363 |
|
} |
1364 |
|
|
1365 |
|
|
1366 |
|
|
1367 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1368 |
0 |
@Override... |
1369 |
|
public boolean drawImage(Image img, int x, int y, int width, int height, |
1370 |
|
Color bgcolor, ImageObserver observer) |
1371 |
|
{ |
1372 |
0 |
return drawImage(img, x, y, x + width, y + height, 0, 0, width, height, |
1373 |
|
bgcolor, observer); |
1374 |
|
} |
1375 |
|
|
1376 |
|
|
1377 |
|
|
1378 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1379 |
0 |
@Override... |
1380 |
|
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, |
1381 |
|
int sx1, int sy1, int sx2, int sy2, ImageObserver observer) |
1382 |
|
{ |
1383 |
0 |
return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, |
1384 |
|
Color.white, observer); |
1385 |
|
} |
1386 |
|
|
1387 |
|
|
1388 |
|
|
1389 |
|
|
|
|
| 0% |
Uncovered Elements: 62 (62) |
Complexity: 11 |
Complexity Density: 0.24 |
|
1390 |
0 |
@Override... |
1391 |
|
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, |
1392 |
|
int sx1, int sy1, int sx2, int sy2, Color bgcolor, |
1393 |
|
ImageObserver observer) |
1394 |
|
{ |
1395 |
0 |
if (dx1 >= dx2) |
1396 |
|
{ |
1397 |
0 |
throw new IllegalArgumentException("dx1 >= dx2"); |
1398 |
|
} |
1399 |
0 |
if (sx1 >= sx2) |
1400 |
|
{ |
1401 |
0 |
throw new IllegalArgumentException("sx1 >= sx2"); |
1402 |
|
} |
1403 |
0 |
if (dy1 >= dy2) |
1404 |
|
{ |
1405 |
0 |
throw new IllegalArgumentException("dy1 >= dy2"); |
1406 |
|
} |
1407 |
0 |
if (sy1 >= sy2) |
1408 |
|
{ |
1409 |
0 |
throw new IllegalArgumentException("sy1 >= sy2"); |
1410 |
|
} |
1411 |
|
|
1412 |
0 |
append("gsave"); |
1413 |
|
|
1414 |
0 |
int width = sx2 - sx1; |
1415 |
0 |
int height = sy2 - sy1; |
1416 |
0 |
int destWidth = dx2 - dx1; |
1417 |
0 |
int destHeight = dy2 - dy1; |
1418 |
|
|
1419 |
0 |
int[] pixels = new int[width * height]; |
1420 |
0 |
PixelGrabber pg = new PixelGrabber(img, sx1, sy1, sx2 - sx1, sy2 - sy1, |
1421 |
|
pixels, 0, width); |
1422 |
0 |
try |
1423 |
|
{ |
1424 |
0 |
pg.grabPixels(); |
1425 |
|
} catch (InterruptedException e) |
1426 |
|
{ |
1427 |
0 |
return false; |
1428 |
|
} |
1429 |
|
|
1430 |
0 |
AffineTransform matrix = new AffineTransform(_transform); |
1431 |
0 |
matrix.translate(dx1, dy1); |
1432 |
0 |
matrix.scale(destWidth / (double) width, destHeight / (double) height); |
1433 |
0 |
double[] m = new double[6]; |
1434 |
0 |
try |
1435 |
|
{ |
1436 |
0 |
matrix = matrix.createInverse(); |
1437 |
|
} catch (Exception e) |
1438 |
|
{ |
1439 |
0 |
throw new EpsException(MessageManager.formatMessage( |
1440 |
|
"exception.eps_unable_to_get_inverse_matrix", |
1441 |
|
new String[] { matrix.toString() })); |
1442 |
|
} |
1443 |
0 |
matrix.scale(1, -1); |
1444 |
0 |
matrix.getMatrix(m); |
1445 |
0 |
append(width + " " + height + " 8 [" + m[0] + " " + m[1] + " " + m[2] |
1446 |
|
+ " " + m[3] + " " + m[4] + " " + m[5] + "]"); |
1447 |
|
|
1448 |
0 |
Color oldColor = getColor(); |
1449 |
0 |
setColor(getBackground()); |
1450 |
0 |
fillRect(dx1, dy1, destWidth, destHeight); |
1451 |
0 |
setColor(oldColor); |
1452 |
0 |
append("{currentfile 3 " + width |
1453 |
|
+ " mul string readhexstring pop} bind"); |
1454 |
0 |
append("false 3 colorimage"); |
1455 |
0 |
StringBuffer line = new StringBuffer(); |
1456 |
0 |
for (int y = 0; y < height; y++) |
1457 |
|
{ |
1458 |
0 |
for (int x = 0; x < width; x++) |
1459 |
|
{ |
1460 |
0 |
Color color = new Color(pixels[x + width * y]); |
1461 |
0 |
line.append(toHexString(color.getRed()) |
1462 |
|
+ toHexString(color.getGreen()) |
1463 |
|
+ toHexString(color.getBlue())); |
1464 |
0 |
if (line.length() > 64) |
1465 |
|
{ |
1466 |
0 |
append(line.toString()); |
1467 |
0 |
line = new StringBuffer(); |
1468 |
|
} |
1469 |
|
} |
1470 |
|
} |
1471 |
0 |
if (line.length() > 0) |
1472 |
|
{ |
1473 |
0 |
append(line.toString()); |
1474 |
|
} |
1475 |
|
|
1476 |
0 |
append("grestore"); |
1477 |
|
|
1478 |
0 |
return true; |
1479 |
|
} |
1480 |
|
|
1481 |
|
|
1482 |
|
|
1483 |
|
|
1484 |
|
|
1485 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1486 |
0 |
@Override... |
1487 |
|
public void dispose() |
1488 |
|
{ |
1489 |
0 |
_document = null; |
1490 |
|
} |
1491 |
|
|
1492 |
|
|
1493 |
|
|
1494 |
|
|
1495 |
|
|
1496 |
|
|
1497 |
|
|
1498 |
|
|
1499 |
|
|
1500 |
|
|
1501 |
|
|
1502 |
|
|
1503 |
|
|
1504 |
|
|
1505 |
|
|
1506 |
|
|
1507 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
1508 |
0 |
@Override... |
1509 |
|
public String toString() |
1510 |
|
{ |
1511 |
0 |
StringWriter writer = new StringWriter(); |
1512 |
0 |
try |
1513 |
|
{ |
1514 |
0 |
_document.write(writer); |
1515 |
0 |
_document.flush(); |
1516 |
0 |
_document.close(); |
1517 |
|
} catch (IOException e) |
1518 |
|
{ |
1519 |
0 |
throw new EpsException(e.toString()); |
1520 |
|
} |
1521 |
0 |
return writer.toString(); |
1522 |
|
} |
1523 |
|
|
1524 |
|
|
1525 |
|
|
1526 |
|
|
1527 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
1528 |
0 |
@Override... |
1529 |
|
public boolean hitClip(int x, int y, int width, int height) |
1530 |
|
{ |
1531 |
0 |
if (_clip == null) |
1532 |
|
{ |
1533 |
0 |
return true; |
1534 |
|
} |
1535 |
0 |
Rectangle rect = new Rectangle(x, y, width, height); |
1536 |
0 |
return hit(rect, _clip, true); |
1537 |
|
} |
1538 |
|
|
1539 |
|
|
1540 |
|
|
1541 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
1542 |
0 |
@Override... |
1543 |
|
public Rectangle getClipBounds(Rectangle r) |
1544 |
|
{ |
1545 |
0 |
if (_clip == null) |
1546 |
|
{ |
1547 |
0 |
return r; |
1548 |
|
} |
1549 |
0 |
Rectangle rect = getClipBounds(); |
1550 |
0 |
r.setLocation((int) rect.getX(), (int) rect.getY()); |
1551 |
0 |
r.setSize((int) rect.getWidth(), (int) rect.getHeight()); |
1552 |
0 |
return r; |
1553 |
|
} |
1554 |
|
|
1555 |
|
private Color _color; |
1556 |
|
|
1557 |
|
private Color _backgroundColor; |
1558 |
|
|
1559 |
|
private Paint _paint; |
1560 |
|
|
1561 |
|
private Composite _composite; |
1562 |
|
|
1563 |
|
private BasicStroke _stroke; |
1564 |
|
|
1565 |
|
private Font _font; |
1566 |
|
|
1567 |
|
private Shape _clip; |
1568 |
|
|
1569 |
|
private AffineTransform _clipTransform; |
1570 |
|
|
1571 |
|
private AffineTransform _transform; |
1572 |
|
|
1573 |
|
private boolean _accurateTextMode; |
1574 |
|
|
1575 |
|
private EpsDocument _document; |
1576 |
|
|
1577 |
|
private static FontRenderContext _fontRenderContext = new FontRenderContext( |
1578 |
|
null, false, true); |
1579 |
|
} |