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