1 | /* | |
2 | * $Id: PdfContentByte.java 4065 2009-09-16 23:09:11Z psoares33 $ | |
3 | * | |
4 | * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie | |
5 | * | |
6 | * The contents of this file are subject to the Mozilla Public License Version 1.1 | |
7 | * (the "License"); you may not use this file except in compliance with the License. | |
8 | * You may obtain a copy of the License at http://www.mozilla.org/MPL/ | |
9 | * | |
10 | * Software distributed under the License is distributed on an "AS IS" basis, | |
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
12 | * for the specific language governing rights and limitations under the License. | |
13 | * | |
14 | * The Original Code is 'iText, a free JAVA-PDF library'. | |
15 | * | |
16 | * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by | |
17 | * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie. | |
18 | * All Rights Reserved. | |
19 | * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer | |
20 | * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved. | |
21 | * | |
22 | * Contributor(s): all the names of the contributors are added in the source code | |
23 | * where applicable. | |
24 | * | |
25 | * Alternatively, the contents of this file may be used under the terms of the | |
26 | * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the | |
27 | * provisions of LGPL are applicable instead of those above. If you wish to | |
28 | * allow use of your version of this file only under the terms of the LGPL | |
29 | * License and not to allow others to use your version of this file under | |
30 | * the MPL, indicate your decision by deleting the provisions above and | |
31 | * replace them with the notice and other provisions required by the LGPL. | |
32 | * If you do not delete the provisions above, a recipient may use your version | |
33 | * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE. | |
34 | * | |
35 | * This library is free software; you can redistribute it and/or modify it | |
36 | * under the terms of the MPL as stated above or under the terms of the GNU | |
37 | * Library General Public License as published by the Free Software Foundation; | |
38 | * either version 2 of the License, or any later version. | |
39 | * | |
40 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
41 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
42 | * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more | |
43 | * details. | |
44 | * | |
45 | * If you didn't download this code from the following link, you should check if | |
46 | * you aren't using an obsolete version: | |
47 | * http://www.lowagie.com/iText/ | |
48 | */ | |
49 | ||
50 | package com.lowagie.text.pdf; | |
51 | ||
52 | import java.awt.Color; | |
53 | import java.awt.font.GlyphVector; | |
54 | import java.awt.geom.AffineTransform; | |
55 | import java.awt.print.PrinterJob; | |
56 | import java.io.IOException; | |
57 | import java.util.ArrayList; | |
58 | import java.util.HashMap; | |
59 | import java.util.List; | |
60 | import java.util.Map; | |
61 | ||
62 | import com.lowagie.text.Annotation; | |
63 | import com.lowagie.text.DocumentException; | |
64 | import com.lowagie.text.Element; | |
65 | ||
66 | import com.lowagie.text.Image; | |
67 | import com.lowagie.text.ImgJBIG2; | |
68 | import com.lowagie.text.Rectangle; | |
69 | import com.lowagie.text.error_messages.MessageLocalization; | |
70 | import com.lowagie.text.ExceptionConverter; | |
71 | import com.lowagie.text.exceptions.IllegalPdfSyntaxException; | |
72 | import com.lowagie.text.pdf.internal.PdfAnnotationsImp; | |
73 | import com.lowagie.text.pdf.internal.PdfXConformanceImp; | |
74 | ||
75 | /** | |
76 | * <CODE>PdfContentByte</CODE> is an object containing the user positioned | |
77 | * text and graphic contents of a page. It knows how to apply the proper | |
78 | * font encoding. | |
79 | */ | |
80 | ||
81 | public class PdfContentByte { | |
82 | ||
83 | /** | |
84 | * This class keeps the graphic state of the current page | |
85 | */ | |
86 | ||
87 | static class GraphicState { | |
88 | ||
89 | /** This is the font in use */ | |
90 | FontDetails fontDetails; | |
91 | ||
92 | /** This is the color in use */ | |
93 | ColorDetails colorDetails; | |
94 | ||
95 | /** This is the font size in use */ | |
96 | float size; | |
97 | ||
98 | /** The x position of the text line matrix. */ | |
99 | protected float xTLM = 0; | |
100 | /** The y position of the text line matrix. */ | |
101 | protected float yTLM = 0; | |
102 | ||
103 | /** The current text leading. */ | |
104 | protected float leading = 0; | |
105 | ||
106 | /** The current horizontal scaling */ | |
107 | protected float scale = 100; | |
108 | ||
109 | /** The current character spacing */ | |
110 | protected float charSpace = 0; | |
111 | ||
112 | /** The current word spacing */ | |
113 | protected float wordSpace = 0; | |
114 | ||
115 | GraphicState() { | |
116 | } | |
117 | ||
118 | GraphicState(GraphicState cp) { | |
119 | fontDetails = cp.fontDetails; | |
120 | colorDetails = cp.colorDetails; | |
121 | size = cp.size; | |
122 | xTLM = cp.xTLM; | |
123 | yTLM = cp.yTLM; | |
124 | leading = cp.leading; | |
125 | scale = cp.scale; | |
126 | charSpace = cp.charSpace; | |
127 | wordSpace = cp.wordSpace; | |
128 | } | |
129 | } | |
130 | ||
131 | /** The alignment is center */ | |
132 | public static final int ALIGN_CENTER = Element.ALIGN_CENTER; | |
133 | ||
134 | /** The alignment is left */ | |
135 | public static final int ALIGN_LEFT = Element.ALIGN_LEFT; | |
136 | ||
137 | /** The alignment is right */ | |
138 | public static final int ALIGN_RIGHT = Element.ALIGN_RIGHT; | |
139 | ||
140 | /** A possible line cap value */ | |
141 | public static final int LINE_CAP_BUTT = 0; | |
142 | /** A possible line cap value */ | |
143 | public static final int LINE_CAP_ROUND = 1; | |
144 | /** A possible line cap value */ | |
145 | public static final int LINE_CAP_PROJECTING_SQUARE = 2; | |
146 | ||
147 | /** A possible line join value */ | |
148 | public static final int LINE_JOIN_MITER = 0; | |
149 | /** A possible line join value */ | |
150 | public static final int LINE_JOIN_ROUND = 1; | |
151 | /** A possible line join value */ | |
152 | public static final int LINE_JOIN_BEVEL = 2; | |
153 | ||
154 | /** A possible text rendering value */ | |
155 | public static final int TEXT_RENDER_MODE_FILL = 0; | |
156 | /** A possible text rendering value */ | |
157 | public static final int TEXT_RENDER_MODE_STROKE = 1; | |
158 | /** A possible text rendering value */ | |
159 | public static final int TEXT_RENDER_MODE_FILL_STROKE = 2; | |
160 | /** A possible text rendering value */ | |
161 | public static final int TEXT_RENDER_MODE_INVISIBLE = 3; | |
162 | /** A possible text rendering value */ | |
163 | public static final int TEXT_RENDER_MODE_FILL_CLIP = 4; | |
164 | /** A possible text rendering value */ | |
165 | public static final int TEXT_RENDER_MODE_STROKE_CLIP = 5; | |
166 | /** A possible text rendering value */ | |
167 | public static final int TEXT_RENDER_MODE_FILL_STROKE_CLIP = 6; | |
168 | /** A possible text rendering value */ | |
169 | public static final int TEXT_RENDER_MODE_CLIP = 7; | |
170 | ||
171 | private static final float[] unitRect = {0, 0, 0, 1, 1, 0, 1, 1}; | |
172 | // membervariables | |
173 | ||
174 | /** This is the actual content */ | |
175 | protected ByteBuffer content = new ByteBuffer(); | |
176 | ||
177 | /** This is the writer */ | |
178 | protected PdfWriter writer; | |
179 | ||
180 | /** This is the PdfDocument */ | |
181 | protected PdfDocument pdf; | |
182 | ||
183 | /** This is the GraphicState in use */ | |
184 | protected GraphicState state = new GraphicState(); | |
185 | ||
186 | private static Map<PdfName, String> abrev = new HashMap<>(); | |
187 | /** The list were we save/restore the state */ | |
188 | protected List<GraphicState> stateList = new ArrayList<>(); | |
189 | ||
190 | /** The separator between commands. | |
191 | */ | |
192 | protected int separator = '\n'; | |
193 | | |
194 | private int mcDepth = 0; | |
195 | private boolean inText = false; | |
196 | /** The list were we save/restore the layer depth */ | |
197 | protected List<Integer> layerDepth; | |
198 | ||
199 | static { | |
200 | abrev.put(PdfName.BITSPERCOMPONENT, "/BPC "); | |
201 | abrev.put(PdfName.COLORSPACE, "/CS "); | |
202 | abrev.put(PdfName.DECODE, "/D "); | |
203 | abrev.put(PdfName.DECODEPARMS, "/DP "); | |
204 | abrev.put(PdfName.FILTER, "/F "); | |
205 | abrev.put(PdfName.HEIGHT, "/H "); | |
206 | abrev.put(PdfName.IMAGEMASK, "/IM "); | |
207 | abrev.put(PdfName.INTENT, "/Intent "); | |
208 | abrev.put(PdfName.INTERPOLATE, "/I "); | |
209 | abrev.put(PdfName.WIDTH, "/W "); | |
210 | } | |
211 | ||
212 | // constructors | |
213 | ||
214 | /** | |
215 | * Constructs a new <CODE>PdfContentByte</CODE>-object. | |
216 | * | |
217 | * @param wr the writer associated to this content | |
218 | */ | |
219 | ||
220 | public PdfContentByte(PdfWriter wr) { | |
221 |
1
1. |
if (wr != null) { |
222 | writer = wr; | |
223 | pdf = writer.getPdfDocument(); | |
224 | } | |
225 | } | |
226 | ||
227 | // methods to get the content of this object | |
228 | ||
229 | /** | |
230 | * Returns the <CODE>String</CODE> representation of this <CODE>PdfContentByte</CODE>-object. | |
231 | * | |
232 | * @return a <CODE>String</CODE> | |
233 | */ | |
234 | ||
235 | public String toString() { | |
236 | return content.toString(); | |
237 | } | |
238 | ||
239 | /** | |
240 | * Gets the internal buffer. | |
241 | * @return the internal buffer | |
242 | */ | |
243 | public ByteBuffer getInternalBuffer() { | |
244 | return content; | |
245 | } | |
246 | ||
247 | /** Returns the PDF representation of this <CODE>PdfContentByte</CODE>-object. | |
248 | * | |
249 | * @param writer the <CODE>PdfWriter</CODE> | |
250 | * @return a <CODE>byte</CODE> array with the representation | |
251 | */ | |
252 | ||
253 | public byte[] toPdf(PdfWriter writer) { | |
254 |
1
1. toPdf : removed call to com/lowagie/text/pdf/PdfContentByte::sanityCheck → NO_COVERAGE |
sanityCheck(); |
255 |
1
1. toPdf : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::toPdf to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return content.toByteArray(); |
256 | } | |
257 | ||
258 | // methods to add graphical content | |
259 | ||
260 | /** | |
261 | * Adds the content of another <CODE>PdfContent</CODE>-object to this object. | |
262 | * | |
263 | * @param other another <CODE>PdfByteContent</CODE>-object | |
264 | */ | |
265 | ||
266 | public void add(PdfContentByte other) { | |
267 |
2
1. add : negated conditional → NO_COVERAGE 2. add : negated conditional → NO_COVERAGE |
if (other.writer != null && writer != other.writer) |
268 | throw new RuntimeException(MessageLocalization.getComposedMessage("inconsistent.writers.are.you.mixing.two.documents")); | |
269 | content.append(other.content); | |
270 | } | |
271 | ||
272 | /** | |
273 | * Gets the x position of the text line matrix. | |
274 | * | |
275 | * @return the x position of the text line matrix | |
276 | */ | |
277 | public float getXTLM() { | |
278 |
1
1. getXTLM : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfContentByte::getXTLM → NO_COVERAGE |
return state.xTLM; |
279 | } | |
280 | ||
281 | /** | |
282 | * Gets the y position of the text line matrix. | |
283 | * | |
284 | * @return the y position of the text line matrix | |
285 | */ | |
286 | public float getYTLM() { | |
287 |
1
1. getYTLM : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfContentByte::getYTLM → NO_COVERAGE |
return state.yTLM; |
288 | } | |
289 | ||
290 | /** | |
291 | * Gets the current text leading. | |
292 | * | |
293 | * @return the current text leading | |
294 | */ | |
295 | public float getLeading() { | |
296 |
1
1. getLeading : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfContentByte::getLeading → NO_COVERAGE |
return state.leading; |
297 | } | |
298 | ||
299 | /** | |
300 | * Gets the current character spacing. | |
301 | * | |
302 | * @return the current character spacing | |
303 | */ | |
304 | public float getCharacterSpacing() { | |
305 |
1
1. getCharacterSpacing : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfContentByte::getCharacterSpacing → NO_COVERAGE |
return state.charSpace; |
306 | } | |
307 | ||
308 | /** | |
309 | * Gets the current word spacing. | |
310 | * | |
311 | * @return the current word spacing | |
312 | */ | |
313 | public float getWordSpacing() { | |
314 |
1
1. getWordSpacing : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfContentByte::getWordSpacing → NO_COVERAGE |
return state.wordSpace; |
315 | } | |
316 | ||
317 | /** | |
318 | * Gets the current character spacing. | |
319 | * | |
320 | * @return the current character spacing | |
321 | */ | |
322 | public float getHorizontalScaling() { | |
323 |
1
1. getHorizontalScaling : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfContentByte::getHorizontalScaling → NO_COVERAGE |
return state.scale; |
324 | } | |
325 | ||
326 | /** | |
327 | * Changes the <VAR>Flatness</VAR>. | |
328 | * <P> | |
329 | * <VAR>Flatness</VAR> sets the maximum permitted distance in device pixels between the | |
330 | * mathematically correct path and an approximation constructed from straight line segments.<BR> | |
331 | * | |
332 | * @param flatness a value | |
333 | */ | |
334 | ||
335 | public void setFlatness(float flatness) { | |
336 |
4
1. setFlatness : changed conditional boundary → NO_COVERAGE 2. setFlatness : changed conditional boundary → NO_COVERAGE 3. setFlatness : negated conditional → NO_COVERAGE 4. setFlatness : negated conditional → NO_COVERAGE |
if (flatness >= 0 && flatness <= 100) { |
337 | content.append(flatness).append(" i").append_i(separator); | |
338 | } | |
339 | } | |
340 | ||
341 | /** | |
342 | * Changes the <VAR>Line cap style</VAR>. | |
343 | * <P> | |
344 | * The <VAR>line cap style</VAR> specifies the shape to be used at the end of open subpaths | |
345 | * when they are stroked.<BR> | |
346 | * Allowed values are LINE_CAP_BUTT, LINE_CAP_ROUND and LINE_CAP_PROJECTING_SQUARE.<BR> | |
347 | * | |
348 | * @param style a value | |
349 | */ | |
350 | ||
351 | public void setLineCap(int style) { | |
352 |
4
1. setLineCap : changed conditional boundary → NO_COVERAGE 2. setLineCap : changed conditional boundary → NO_COVERAGE 3. setLineCap : negated conditional → NO_COVERAGE 4. setLineCap : negated conditional → NO_COVERAGE |
if (style >= 0 && style <= 2) { |
353 | content.append(style).append(" J").append_i(separator); | |
354 | } | |
355 | } | |
356 | ||
357 | /** | |
358 | * Changes the value of the <VAR>line dash pattern</VAR>. | |
359 | * <P> | |
360 | * The line dash pattern controls the pattern of dashes and gaps used to stroke paths. | |
361 | * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length | |
362 | * of the alternating dashes and gaps. The phase specifies the distance into the dash | |
363 | * pattern to start the dash.<BR> | |
364 | * | |
365 | * @param phase the value of the phase | |
366 | */ | |
367 | ||
368 | public void setLineDash(float phase) { | |
369 | content.append("[] ").append(phase).append(" d").append_i(separator); | |
370 | } | |
371 | ||
372 | /** | |
373 | * Changes the value of the <VAR>line dash pattern</VAR>. | |
374 | * <P> | |
375 | * The line dash pattern controls the pattern of dashes and gaps used to stroke paths. | |
376 | * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length | |
377 | * of the alternating dashes and gaps. The phase specifies the distance into the dash | |
378 | * pattern to start the dash.<BR> | |
379 | * | |
380 | * @param phase the value of the phase | |
381 | * @param unitsOn the number of units that must be 'on' (equals the number of units that must be 'off'). | |
382 | */ | |
383 | ||
384 | public void setLineDash(float unitsOn, float phase) { | |
385 | content.append("[").append(unitsOn).append("] ").append(phase).append(" d").append_i(separator); | |
386 | } | |
387 | ||
388 | /** | |
389 | * Changes the value of the <VAR>line dash pattern</VAR>. | |
390 | * <P> | |
391 | * The line dash pattern controls the pattern of dashes and gaps used to stroke paths. | |
392 | * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length | |
393 | * of the alternating dashes and gaps. The phase specifies the distance into the dash | |
394 | * pattern to start the dash.<BR> | |
395 | * | |
396 | * @param phase the value of the phase | |
397 | * @param unitsOn the number of units that must be 'on' | |
398 | * @param unitsOff the number of units that must be 'off' | |
399 | */ | |
400 | ||
401 | public void setLineDash(float unitsOn, float unitsOff, float phase) { | |
402 | content.append("[").append(unitsOn).append(' ').append(unitsOff).append("] ").append(phase).append(" d").append_i(separator); | |
403 | } | |
404 | ||
405 | /** | |
406 | * Changes the value of the <VAR>line dash pattern</VAR>. | |
407 | * <P> | |
408 | * The line dash pattern controls the pattern of dashes and gaps used to stroke paths. | |
409 | * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length | |
410 | * of the alternating dashes and gaps. The phase specifies the distance into the dash | |
411 | * pattern to start the dash.<BR> | |
412 | * | |
413 | * @param array length of the alternating dashes and gaps | |
414 | * @param phase the value of the phase | |
415 | */ | |
416 | ||
417 | public final void setLineDash(float[] array, float phase) { | |
418 | content.append("["); | |
419 |
2
1. setLineDash : changed conditional boundary → NO_COVERAGE 2. setLineDash : negated conditional → NO_COVERAGE |
for (int i = 0; i < array.length; i++) { |
420 | content.append(array[i]); | |
421 |
3
1. setLineDash : changed conditional boundary → NO_COVERAGE 2. setLineDash : Replaced integer subtraction with addition → NO_COVERAGE 3. setLineDash : negated conditional → NO_COVERAGE |
if (i < array.length - 1) content.append(' '); |
422 | } | |
423 | content.append("] ").append(phase).append(" d").append_i(separator); | |
424 | } | |
425 | ||
426 | /** | |
427 | * Changes the <VAR>Line join style</VAR>. | |
428 | * <P> | |
429 | * The <VAR>line join style</VAR> specifies the shape to be used at the corners of paths | |
430 | * that are stroked.<BR> | |
431 | * Allowed values are LINE_JOIN_MITER (Miter joins), LINE_JOIN_ROUND (Round joins) and LINE_JOIN_BEVEL (Bevel joins).<BR> | |
432 | * | |
433 | * @param style a value | |
434 | */ | |
435 | ||
436 | public void setLineJoin(int style) { | |
437 |
4
1. setLineJoin : changed conditional boundary → NO_COVERAGE 2. setLineJoin : changed conditional boundary → NO_COVERAGE 3. setLineJoin : negated conditional → NO_COVERAGE 4. setLineJoin : negated conditional → NO_COVERAGE |
if (style >= 0 && style <= 2) { |
438 | content.append(style).append(" j").append_i(separator); | |
439 | } | |
440 | } | |
441 | ||
442 | /** | |
443 | * Changes the <VAR>line width</VAR>. | |
444 | * <P> | |
445 | * The line width specifies the thickness of the line used to stroke a path and is measured | |
446 | * in user space units.<BR> | |
447 | * | |
448 | * @param w a width | |
449 | */ | |
450 | ||
451 | public void setLineWidth(float w) { | |
452 | content.append(w).append(" w").append_i(separator); | |
453 | } | |
454 | ||
455 | /** | |
456 | * Changes the <VAR>Miter limit</VAR>. | |
457 | * <P> | |
458 | * When two line segments meet at a sharp angle and mitered joins have been specified as the | |
459 | * line join style, it is possible for the miter to extend far beyond the thickness of the line | |
460 | * stroking path. The miter limit imposes a maximum on the ratio of the miter length to the line | |
461 | * witdh. When the limit is exceeded, the join is converted from a miter to a bevel.<BR> | |
462 | * | |
463 | * @param miterLimit a miter limit | |
464 | */ | |
465 | ||
466 | public void setMiterLimit(float miterLimit) { | |
467 |
2
1. setMiterLimit : changed conditional boundary → NO_COVERAGE 2. setMiterLimit : negated conditional → NO_COVERAGE |
if (miterLimit > 1) { |
468 | content.append(miterLimit).append(" M").append_i(separator); | |
469 | } | |
470 | } | |
471 | ||
472 | /** | |
473 | * Modify the current clipping path by intersecting it with the current path, using the | |
474 | * nonzero winding number rule to determine which regions lie inside the clipping | |
475 | * path. | |
476 | */ | |
477 | ||
478 | public void clip() { | |
479 | content.append("W").append_i(separator); | |
480 | } | |
481 | ||
482 | /** | |
483 | * Modify the current clipping path by intersecting it with the current path, using the | |
484 | * even-odd rule to determine which regions lie inside the clipping path. | |
485 | */ | |
486 | ||
487 | public void eoClip() { | |
488 | content.append("W*").append_i(separator); | |
489 | } | |
490 | ||
491 | /** | |
492 | * Changes the currentgray tint for filling paths (device dependent colors!). | |
493 | * <P> | |
494 | * Sets the color space to <B>DeviceGray</B> (or the <B>DefaultGray</B> color space), | |
495 | * and sets the gray tint to use for filling paths.</P> | |
496 | * | |
497 | * @param gray a value between 0 (black) and 1 (white) | |
498 | */ | |
499 | ||
500 | public void setGrayFill(float gray) { | |
501 | content.append(gray).append(" g").append_i(separator); | |
502 | } | |
503 | ||
504 | /** | |
505 | * Changes the current gray tint for filling paths to black. | |
506 | */ | |
507 | ||
508 | public void resetGrayFill() { | |
509 | content.append("0 g").append_i(separator); | |
510 | } | |
511 | ||
512 | /** | |
513 | * Changes the currentgray tint for stroking paths (device dependent colors!). | |
514 | * <P> | |
515 | * Sets the color space to <B>DeviceGray</B> (or the <B>DefaultGray</B> color space), | |
516 | * and sets the gray tint to use for stroking paths.</P> | |
517 | * | |
518 | * @param gray a value between 0 (black) and 1 (white) | |
519 | */ | |
520 | ||
521 | public void setGrayStroke(float gray) { | |
522 | content.append(gray).append(" G").append_i(separator); | |
523 | } | |
524 | ||
525 | /** | |
526 | * Changes the current gray tint for stroking paths to black. | |
527 | */ | |
528 | ||
529 | public void resetGrayStroke() { | |
530 | content.append("0 G").append_i(separator); | |
531 | } | |
532 | ||
533 | /** | |
534 | * Helper to validate and write the RGB color components | |
535 | * @param red the intensity of red. A value between 0 and 1 | |
536 | * @param green the intensity of green. A value between 0 and 1 | |
537 | * @param blue the intensity of blue. A value between 0 and 1 | |
538 | */ | |
539 | private void HelperRGB(float red, float green, float blue) { | |
540 |
1
1. HelperRGB : removed call to com/lowagie/text/pdf/internal/PdfXConformanceImp::checkPDFXConformance → NO_COVERAGE |
PdfXConformanceImp.checkPDFXConformance(writer, PdfXConformanceImp.PDFXKEY_RGB, null); |
541 |
2
1. HelperRGB : changed conditional boundary → NO_COVERAGE 2. HelperRGB : negated conditional → NO_COVERAGE |
if (red < 0) |
542 | red = 0.0f; | |
543 |
2
1. HelperRGB : changed conditional boundary → NO_COVERAGE 2. HelperRGB : negated conditional → NO_COVERAGE |
else if (red > 1.0f) |
544 | red = 1.0f; | |
545 |
2
1. HelperRGB : changed conditional boundary → NO_COVERAGE 2. HelperRGB : negated conditional → NO_COVERAGE |
if (green < 0) |
546 | green = 0.0f; | |
547 |
2
1. HelperRGB : changed conditional boundary → NO_COVERAGE 2. HelperRGB : negated conditional → NO_COVERAGE |
else if (green > 1.0f) |
548 | green = 1.0f; | |
549 |
2
1. HelperRGB : changed conditional boundary → NO_COVERAGE 2. HelperRGB : negated conditional → NO_COVERAGE |
if (blue < 0) |
550 | blue = 0.0f; | |
551 |
2
1. HelperRGB : changed conditional boundary → NO_COVERAGE 2. HelperRGB : negated conditional → NO_COVERAGE |
else if (blue > 1.0f) |
552 | blue = 1.0f; | |
553 | content.append(red).append(' ').append(green).append(' ').append(blue); | |
554 | } | |
555 | ||
556 | /** | |
557 | * Changes the current color for filling paths (device dependent colors!). | |
558 | * <P> | |
559 | * Sets the color space to <B>DeviceRGB</B> (or the <B>DefaultRGB</B> color space), | |
560 | * and sets the color to use for filling paths.</P> | |
561 | * <P> | |
562 | * Following the PDF manual, each operand must be a number between 0 (minimum intensity) and | |
563 | * 1 (maximum intensity).</P> | |
564 | * | |
565 | * @param red the intensity of red. A value between 0 and 1 | |
566 | * @param green the intensity of green. A value between 0 and 1 | |
567 | * @param blue the intensity of blue. A value between 0 and 1 | |
568 | */ | |
569 | ||
570 | public void setRGBColorFillF(float red, float green, float blue) { | |
571 |
1
1. setRGBColorFillF : removed call to com/lowagie/text/pdf/PdfContentByte::HelperRGB → NO_COVERAGE |
HelperRGB(red, green, blue); |
572 | content.append(" rg").append_i(separator); | |
573 | } | |
574 | ||
575 | /** | |
576 | * Changes the current color for filling paths to black. | |
577 | */ | |
578 | ||
579 | public void resetRGBColorFill() { | |
580 | content.append("0 g").append_i(separator); | |
581 | } | |
582 | ||
583 | /** | |
584 | * Changes the current color for stroking paths (device dependent colors!). | |
585 | * <P> | |
586 | * Sets the color space to <B>DeviceRGB</B> (or the <B>DefaultRGB</B> color space), | |
587 | * and sets the color to use for stroking paths.</P> | |
588 | * <P> | |
589 | * Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and | |
590 | * 1 (maximum intensity). | |
591 | * | |
592 | * @param red the intensity of red. A value between 0 and 1 | |
593 | * @param green the intensity of green. A value between 0 and 1 | |
594 | * @param blue the intensity of blue. A value between 0 and 1 | |
595 | */ | |
596 | ||
597 | public void setRGBColorStrokeF(float red, float green, float blue) { | |
598 |
1
1. setRGBColorStrokeF : removed call to com/lowagie/text/pdf/PdfContentByte::HelperRGB → NO_COVERAGE |
HelperRGB(red, green, blue); |
599 | content.append(" RG").append_i(separator); | |
600 | } | |
601 | ||
602 | /** | |
603 | * Changes the current color for stroking paths to black. | |
604 | * | |
605 | */ | |
606 | ||
607 | public void resetRGBColorStroke() { | |
608 | content.append("0 G").append_i(separator); | |
609 | } | |
610 | ||
611 | /** | |
612 | * Helper to validate and write the CMYK color components. | |
613 | * | |
614 | * @param cyan the intensity of cyan. A value between 0 and 1 | |
615 | * @param magenta the intensity of magenta. A value between 0 and 1 | |
616 | * @param yellow the intensity of yellow. A value between 0 and 1 | |
617 | * @param black the intensity of black. A value between 0 and 1 | |
618 | */ | |
619 | private void HelperCMYK(float cyan, float magenta, float yellow, float black) { | |
620 |
2
1. HelperCMYK : changed conditional boundary → NO_COVERAGE 2. HelperCMYK : negated conditional → NO_COVERAGE |
if (cyan < 0) |
621 | cyan = 0.0f; | |
622 |
2
1. HelperCMYK : changed conditional boundary → NO_COVERAGE 2. HelperCMYK : negated conditional → NO_COVERAGE |
else if (cyan > 1.0f) |
623 | cyan = 1.0f; | |
624 |
2
1. HelperCMYK : changed conditional boundary → NO_COVERAGE 2. HelperCMYK : negated conditional → NO_COVERAGE |
if (magenta < 0) |
625 | magenta = 0.0f; | |
626 |
2
1. HelperCMYK : changed conditional boundary → NO_COVERAGE 2. HelperCMYK : negated conditional → NO_COVERAGE |
else if (magenta > 1.0f) |
627 | magenta = 1.0f; | |
628 |
2
1. HelperCMYK : changed conditional boundary → NO_COVERAGE 2. HelperCMYK : negated conditional → NO_COVERAGE |
if (yellow < 0) |
629 | yellow = 0.0f; | |
630 |
2
1. HelperCMYK : changed conditional boundary → NO_COVERAGE 2. HelperCMYK : negated conditional → NO_COVERAGE |
else if (yellow > 1.0f) |
631 | yellow = 1.0f; | |
632 |
2
1. HelperCMYK : changed conditional boundary → NO_COVERAGE 2. HelperCMYK : negated conditional → NO_COVERAGE |
if (black < 0) |
633 | black = 0.0f; | |
634 |
2
1. HelperCMYK : changed conditional boundary → NO_COVERAGE 2. HelperCMYK : negated conditional → NO_COVERAGE |
else if (black > 1.0f) |
635 | black = 1.0f; | |
636 | content.append(cyan).append(' ').append(magenta).append(' ').append(yellow).append(' ').append(black); | |
637 | } | |
638 | ||
639 | /** | |
640 | * Changes the current color for filling paths (device dependent colors!). | |
641 | * <P> | |
642 | * Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space), | |
643 | * and sets the color to use for filling paths.</P> | |
644 | * <P> | |
645 | * Following the PDF manual, each operand must be a number between 0 (no ink) and | |
646 | * 1 (maximum ink).</P> | |
647 | * | |
648 | * @param cyan the intensity of cyan. A value between 0 and 1 | |
649 | * @param magenta the intensity of magenta. A value between 0 and 1 | |
650 | * @param yellow the intensity of yellow. A value between 0 and 1 | |
651 | * @param black the intensity of black. A value between 0 and 1 | |
652 | */ | |
653 | ||
654 | public void setCMYKColorFillF(float cyan, float magenta, float yellow, float black) { | |
655 |
1
1. setCMYKColorFillF : removed call to com/lowagie/text/pdf/PdfContentByte::HelperCMYK → NO_COVERAGE |
HelperCMYK(cyan, magenta, yellow, black); |
656 | content.append(" k").append_i(separator); | |
657 | } | |
658 | ||
659 | /** | |
660 | * Changes the current color for filling paths to black. | |
661 | * | |
662 | */ | |
663 | ||
664 | public void resetCMYKColorFill() { | |
665 | content.append("0 0 0 1 k").append_i(separator); | |
666 | } | |
667 | ||
668 | /** | |
669 | * Changes the current color for stroking paths (device dependent colors!). | |
670 | * <P> | |
671 | * Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space), | |
672 | * and sets the color to use for stroking paths.</P> | |
673 | * <P> | |
674 | * Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and | |
675 | * 1 (maximum intensity). | |
676 | * | |
677 | * @param cyan the intensity of cyan. A value between 0 and 1 | |
678 | * @param magenta the intensity of magenta. A value between 0 and 1 | |
679 | * @param yellow the intensity of yellow. A value between 0 and 1 | |
680 | * @param black the intensity of black. A value between 0 and 1 | |
681 | */ | |
682 | ||
683 | public void setCMYKColorStrokeF(float cyan, float magenta, float yellow, float black) { | |
684 |
1
1. setCMYKColorStrokeF : removed call to com/lowagie/text/pdf/PdfContentByte::HelperCMYK → NO_COVERAGE |
HelperCMYK(cyan, magenta, yellow, black); |
685 | content.append(" K").append_i(separator); | |
686 | } | |
687 | ||
688 | /** | |
689 | * Changes the current color for stroking paths to black. | |
690 | * | |
691 | */ | |
692 | ||
693 | public void resetCMYKColorStroke() { | |
694 | content.append("0 0 0 1 K").append_i(separator); | |
695 | } | |
696 | ||
697 | /** | |
698 | * Move the current point <I>(x, y)</I>, omitting any connecting line segment. | |
699 | * | |
700 | * @param x new x-coordinate | |
701 | * @param y new y-coordinate | |
702 | */ | |
703 | ||
704 | public void moveTo(float x, float y) { | |
705 | content.append(x).append(' ').append(y).append(" m").append_i(separator); | |
706 | } | |
707 | ||
708 | /** | |
709 | * Appends a straight line segment from the current point <I>(x, y)</I>. The new current | |
710 | * point is <I>(x, y)</I>. | |
711 | * | |
712 | * @param x new x-coordinate | |
713 | * @param y new y-coordinate | |
714 | */ | |
715 | ||
716 | public void lineTo(float x, float y) { | |
717 | content.append(x).append(' ').append(y).append(" l").append_i(separator); | |
718 | } | |
719 | ||
720 | /** | |
721 | * Appends a Bêzier curve to the path, starting from the current point. | |
722 | * | |
723 | * @param x1 x-coordinate of the first control point | |
724 | * @param y1 y-coordinate of the first control point | |
725 | * @param x2 x-coordinate of the second control point | |
726 | * @param y2 y-coordinate of the second control point | |
727 | * @param x3 x-coordinate of the ending point (= new current point) | |
728 | * @param y3 y-coordinate of the ending point (= new current point) | |
729 | */ | |
730 | ||
731 | public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) { | |
732 | content.append(x1).append(' ').append(y1).append(' ').append(x2).append(' ').append(y2).append(' ').append(x3).append(' ').append(y3).append(" c").append_i(separator); | |
733 | } | |
734 | ||
735 | /** | |
736 | * Appends a Bêzier curve to the path, starting from the current point. | |
737 | * | |
738 | * @param x2 x-coordinate of the second control point | |
739 | * @param y2 y-coordinate of the second control point | |
740 | * @param x3 x-coordinate of the ending point (= new current point) | |
741 | * @param y3 y-coordinate of the ending point (= new current point) | |
742 | */ | |
743 | ||
744 | public void curveTo(float x2, float y2, float x3, float y3) { | |
745 | content.append(x2).append(' ').append(y2).append(' ').append(x3).append(' ').append(y3).append(" v").append_i(separator); | |
746 | } | |
747 | ||
748 | /** | |
749 | * Appends a Bêzier curve to the path, starting from the current point. | |
750 | * | |
751 | * @param x1 x-coordinate of the first control point | |
752 | * @param y1 y-coordinate of the first control point | |
753 | * @param x3 x-coordinate of the ending point (= new current point) | |
754 | * @param y3 y-coordinate of the ending point (= new current point) | |
755 | */ | |
756 | ||
757 | public void curveFromTo(float x1, float y1, float x3, float y3) { | |
758 | content.append(x1).append(' ').append(y1).append(' ').append(x3).append(' ').append(y3).append(" y").append_i(separator); | |
759 | } | |
760 | ||
761 | /** Draws a circle. The endpoint will (x+r, y). | |
762 | * | |
763 | * @param x x center of circle | |
764 | * @param y y center of circle | |
765 | * @param r radius of circle | |
766 | */ | |
767 | public void circle(float x, float y, float r) { | |
768 | float b = 0.5523f; | |
769 |
2
1. circle : Replaced float addition with subtraction → NO_COVERAGE 2. circle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(x + r, y); |
770 |
8
1. circle : Replaced float addition with subtraction → NO_COVERAGE 2. circle : Replaced float multiplication with division → NO_COVERAGE 3. circle : Replaced float addition with subtraction → NO_COVERAGE 4. circle : Replaced float multiplication with division → NO_COVERAGE 5. circle : Replaced float addition with subtraction → NO_COVERAGE 6. circle : Replaced float addition with subtraction → NO_COVERAGE 7. circle : Replaced float addition with subtraction → NO_COVERAGE 8. circle : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
curveTo(x + r, y + r * b, x + r * b, y + r, x, y + r); |
771 |
8
1. circle : Replaced float multiplication with division → NO_COVERAGE 2. circle : Replaced float subtraction with addition → NO_COVERAGE 3. circle : Replaced float addition with subtraction → NO_COVERAGE 4. circle : Replaced float subtraction with addition → NO_COVERAGE 5. circle : Replaced float multiplication with division → NO_COVERAGE 6. circle : Replaced float addition with subtraction → NO_COVERAGE 7. circle : Replaced float subtraction with addition → NO_COVERAGE 8. circle : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
curveTo(x - r * b, y + r, x - r, y + r * b, x - r, y); |
772 |
8
1. circle : Replaced float subtraction with addition → NO_COVERAGE 2. circle : Replaced float multiplication with division → NO_COVERAGE 3. circle : Replaced float subtraction with addition → NO_COVERAGE 4. circle : Replaced float multiplication with division → NO_COVERAGE 5. circle : Replaced float subtraction with addition → NO_COVERAGE 6. circle : Replaced float subtraction with addition → NO_COVERAGE 7. circle : Replaced float subtraction with addition → NO_COVERAGE 8. circle : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
curveTo(x - r, y - r * b, x - r * b, y - r, x, y - r); |
773 |
8
1. circle : Replaced float multiplication with division → NO_COVERAGE 2. circle : Replaced float addition with subtraction → NO_COVERAGE 3. circle : Replaced float subtraction with addition → NO_COVERAGE 4. circle : Replaced float addition with subtraction → NO_COVERAGE 5. circle : Replaced float multiplication with division → NO_COVERAGE 6. circle : Replaced float subtraction with addition → NO_COVERAGE 7. circle : Replaced float addition with subtraction → NO_COVERAGE 8. circle : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
curveTo(x + r * b, y - r, x + r, y - r * b, x + r, y); |
774 | } | |
775 | ||
776 | ||
777 | ||
778 | /** | |
779 | * Adds a rectangle to the current path. | |
780 | * | |
781 | * @param x x-coordinate of the starting point | |
782 | * @param y y-coordinate of the starting point | |
783 | * @param w width | |
784 | * @param h height | |
785 | */ | |
786 | ||
787 | public void rectangle(float x, float y, float w, float h) { | |
788 | content.append(x).append(' ').append(y).append(' ').append(w).append(' ').append(h).append(" re").append_i(separator); | |
789 | } | |
790 | ||
791 | private boolean compareColors(Color c1, Color c2) { | |
792 |
2
1. compareColors : negated conditional → NO_COVERAGE 2. compareColors : negated conditional → NO_COVERAGE |
if (c1 == null && c2 == null) |
793 |
1
1. compareColors : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
794 |
2
1. compareColors : negated conditional → NO_COVERAGE 2. compareColors : negated conditional → NO_COVERAGE |
if (c1 == null || c2 == null) |
795 |
1
1. compareColors : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
796 |
1
1. compareColors : negated conditional → NO_COVERAGE |
if (c1 instanceof ExtendedColor) |
797 |
1
1. compareColors : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return c1.equals(c2); |
798 |
1
1. compareColors : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return c2.equals(c1); |
799 | } | |
800 | ||
801 | /** | |
802 | * Adds a variable width border to the current path. | |
803 | * Only use if {@link com.lowagie.text.Rectangle#isUseVariableBorders() Rectangle.isUseVariableBorders} | |
804 | * = true. | |
805 | * @param rect a <CODE>Rectangle</CODE> | |
806 | */ | |
807 | public void variableRectangle(Rectangle rect) { | |
808 | float t = rect.getTop(); | |
809 | float b = rect.getBottom(); | |
810 | float r = rect.getRight(); | |
811 | float l = rect.getLeft(); | |
812 | float wt = rect.getBorderWidthTop(); | |
813 | float wb = rect.getBorderWidthBottom(); | |
814 | float wr = rect.getBorderWidthRight(); | |
815 | float wl = rect.getBorderWidthLeft(); | |
816 | Color ct = rect.getBorderColorTop(); | |
817 | Color cb = rect.getBorderColorBottom(); | |
818 | Color cr = rect.getBorderColorRight(); | |
819 | Color cl = rect.getBorderColorLeft(); | |
820 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::saveState → NO_COVERAGE |
saveState(); |
821 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(PdfContentByte.LINE_CAP_BUTT); |
822 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setLineJoin → NO_COVERAGE |
setLineJoin(PdfContentByte.LINE_JOIN_MITER); |
823 | float clw = 0; | |
824 | boolean cdef = false; | |
825 | Color ccol = null; | |
826 | boolean cdefi = false; | |
827 | Color cfil = null; | |
828 | // draw top | |
829 |
2
1. variableRectangle : changed conditional boundary → NO_COVERAGE 2. variableRectangle : negated conditional → NO_COVERAGE |
if (wt > 0) { |
830 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(clw = wt); |
831 | cdef = true; | |
832 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (ct == null) |
833 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::resetRGBColorStroke → NO_COVERAGE |
resetRGBColorStroke(); |
834 | else | |
835 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(ct); |
836 | ccol = ct; | |
837 |
3
1. variableRectangle : Replaced float division with multiplication → NO_COVERAGE 2. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 3. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(l, t - wt / 2f); |
838 |
3
1. variableRectangle : Replaced float division with multiplication → NO_COVERAGE 2. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 3. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(r, t - wt / 2f); |
839 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
840 | } | |
841 | ||
842 | // Draw bottom | |
843 |
2
1. variableRectangle : changed conditional boundary → NO_COVERAGE 2. variableRectangle : negated conditional → NO_COVERAGE |
if (wb > 0) { |
844 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (wb != clw) |
845 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(clw = wb); |
846 |
2
1. variableRectangle : negated conditional → NO_COVERAGE 2. variableRectangle : negated conditional → NO_COVERAGE |
if (!cdef || !compareColors(ccol, cb)) { |
847 | cdef = true; | |
848 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (cb == null) |
849 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::resetRGBColorStroke → NO_COVERAGE |
resetRGBColorStroke(); |
850 | else | |
851 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(cb); |
852 | ccol = cb; | |
853 | } | |
854 |
3
1. variableRectangle : Replaced float division with multiplication → NO_COVERAGE 2. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(r, b + wb / 2f); |
855 |
3
1. variableRectangle : Replaced float division with multiplication → NO_COVERAGE 2. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(l, b + wb / 2f); |
856 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
857 | } | |
858 | ||
859 | // Draw right | |
860 |
2
1. variableRectangle : changed conditional boundary → NO_COVERAGE 2. variableRectangle : negated conditional → NO_COVERAGE |
if (wr > 0) { |
861 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (wr != clw) |
862 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(clw = wr); |
863 |
2
1. variableRectangle : negated conditional → NO_COVERAGE 2. variableRectangle : negated conditional → NO_COVERAGE |
if (!cdef || !compareColors(ccol, cr)) { |
864 | cdef = true; | |
865 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (cr == null) |
866 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::resetRGBColorStroke → NO_COVERAGE |
resetRGBColorStroke(); |
867 | else | |
868 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(cr); |
869 | ccol = cr; | |
870 | } | |
871 | boolean bt = compareColors(ct, cr); | |
872 | boolean bb = compareColors(cb, cr); | |
873 |
5
1. variableRectangle : Replaced float division with multiplication → NO_COVERAGE 2. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 3. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 4. variableRectangle : negated conditional → NO_COVERAGE 5. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(r - wr / 2f, bt ? t : t - wt); |
874 |
5
1. variableRectangle : Replaced float division with multiplication → NO_COVERAGE 2. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 3. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 4. variableRectangle : negated conditional → NO_COVERAGE 5. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(r - wr / 2f, bb ? b : b + wb); |
875 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
876 |
2
1. variableRectangle : negated conditional → NO_COVERAGE 2. variableRectangle : negated conditional → NO_COVERAGE |
if (!bt || !bb) { |
877 | cdefi = true; | |
878 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (cr == null) |
879 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::resetRGBColorFill → NO_COVERAGE |
resetRGBColorFill(); |
880 | else | |
881 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
setColorFill(cr); |
882 | cfil = cr; | |
883 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (!bt) { |
884 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(r, t); |
885 |
2
1. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 2. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(r, t - wt); |
886 |
3
1. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 2. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 3. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(r - wr, t - wt); |
887 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
fill(); |
888 | } | |
889 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (!bb) { |
890 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(r, b); |
891 |
2
1. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(r, b + wb); |
892 |
3
1. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 2. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(r - wr, b + wb); |
893 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
fill(); |
894 | } | |
895 | } | |
896 | } | |
897 | ||
898 | // Draw Left | |
899 |
2
1. variableRectangle : changed conditional boundary → NO_COVERAGE 2. variableRectangle : negated conditional → NO_COVERAGE |
if (wl > 0) { |
900 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (wl != clw) |
901 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(wl); |
902 |
2
1. variableRectangle : negated conditional → NO_COVERAGE 2. variableRectangle : negated conditional → NO_COVERAGE |
if (!cdef || !compareColors(ccol, cl)) { |
903 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (cl == null) |
904 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::resetRGBColorStroke → NO_COVERAGE |
resetRGBColorStroke(); |
905 | else | |
906 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(cl); |
907 | } | |
908 | boolean bt = compareColors(ct, cl); | |
909 | boolean bb = compareColors(cb, cl); | |
910 |
5
1. variableRectangle : Replaced float division with multiplication → NO_COVERAGE 2. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 4. variableRectangle : negated conditional → NO_COVERAGE 5. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(l + wl / 2f, bt ? t : t - wt); |
911 |
5
1. variableRectangle : Replaced float division with multiplication → NO_COVERAGE 2. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 4. variableRectangle : negated conditional → NO_COVERAGE 5. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(l + wl / 2f, bb ? b : b + wb); |
912 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
913 |
2
1. variableRectangle : negated conditional → NO_COVERAGE 2. variableRectangle : negated conditional → NO_COVERAGE |
if (!bt || !bb) { |
914 |
2
1. variableRectangle : negated conditional → NO_COVERAGE 2. variableRectangle : negated conditional → NO_COVERAGE |
if (!cdefi || !compareColors(cfil, cl)) { |
915 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (cl == null) |
916 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::resetRGBColorFill → NO_COVERAGE |
resetRGBColorFill(); |
917 | else | |
918 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
setColorFill(cl); |
919 | } | |
920 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (!bt) { |
921 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(l, t); |
922 |
2
1. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 2. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(l, t - wt); |
923 |
3
1. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. variableRectangle : Replaced float subtraction with addition → NO_COVERAGE 3. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(l + wl, t - wt); |
924 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
fill(); |
925 | } | |
926 |
1
1. variableRectangle : negated conditional → NO_COVERAGE |
if (!bb) { |
927 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(l, b); |
928 |
2
1. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(l, b + wb); |
929 |
3
1. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. variableRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(l + wl, b + wb); |
930 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
fill(); |
931 | } | |
932 | } | |
933 | } | |
934 |
1
1. variableRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::restoreState → NO_COVERAGE |
restoreState(); |
935 | } | |
936 | ||
937 | /** | |
938 | * Adds a border (complete or partially) to the current path.. | |
939 | * | |
940 | * @param rectangle a <CODE>Rectangle</CODE> | |
941 | */ | |
942 | ||
943 | public void rectangle(Rectangle rectangle) { | |
944 | // the coordinates of the border are retrieved | |
945 | float x1 = rectangle.getLeft(); | |
946 | float y1 = rectangle.getBottom(); | |
947 | float x2 = rectangle.getRight(); | |
948 | float y2 = rectangle.getTop(); | |
949 | ||
950 | // the backgroundcolor is set | |
951 | Color background = rectangle.getBackgroundColor(); | |
952 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (background != null) { |
953 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::saveState → NO_COVERAGE |
saveState(); |
954 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
setColorFill(background); |
955 |
3
1. rectangle : Replaced float subtraction with addition → NO_COVERAGE 2. rectangle : Replaced float subtraction with addition → NO_COVERAGE 3. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
rectangle(x1, y1, x2 - x1, y2 - y1); |
956 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
fill(); |
957 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::restoreState → NO_COVERAGE |
restoreState(); |
958 | } | |
959 | ||
960 | // if the element hasn't got any borders, nothing is added | |
961 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (! rectangle.hasBorders()) { |
962 | return; | |
963 | } | |
964 | ||
965 | // if any of the individual border colors are set | |
966 | // we draw the borders all around using the | |
967 | // different colors | |
968 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (rectangle.isUseVariableBorders()) { |
969 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::variableRectangle → NO_COVERAGE |
variableRectangle(rectangle); |
970 | } | |
971 | else { | |
972 | // the width is set to the width of the element | |
973 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (rectangle.getBorderWidth() != Rectangle.UNDEFINED) { |
974 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(rectangle.getBorderWidth()); |
975 | } | |
976 | ||
977 | // the color is set to the color of the element | |
978 | Color color = rectangle.getBorderColor(); | |
979 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (color != null) { |
980 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(color); |
981 | } | |
982 | ||
983 | // if the box is a rectangle, it is added as a rectangle | |
984 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (rectangle.hasBorder(Rectangle.BOX)) { |
985 |
3
1. rectangle : Replaced float subtraction with addition → NO_COVERAGE 2. rectangle : Replaced float subtraction with addition → NO_COVERAGE 3. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
rectangle(x1, y1, x2 - x1, y2 - y1); |
986 | } | |
987 | // if the border isn't a rectangle, the different sides are added apart | |
988 | else { | |
989 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (rectangle.hasBorder(Rectangle.RIGHT)) { |
990 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(x2, y1); |
991 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(x2, y2); |
992 | } | |
993 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (rectangle.hasBorder(Rectangle.LEFT)) { |
994 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(x1, y1); |
995 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(x1, y2); |
996 | } | |
997 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (rectangle.hasBorder(Rectangle.BOTTOM)) { |
998 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(x1, y1); |
999 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(x2, y1); |
1000 | } | |
1001 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (rectangle.hasBorder(Rectangle.TOP)) { |
1002 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(x1, y2); |
1003 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(x2, y2); |
1004 | } | |
1005 | } | |
1006 | ||
1007 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
1008 | ||
1009 |
1
1. rectangle : negated conditional → NO_COVERAGE |
if (color != null) { |
1010 |
1
1. rectangle : removed call to com/lowagie/text/pdf/PdfContentByte::resetRGBColorStroke → NO_COVERAGE |
resetRGBColorStroke(); |
1011 | } | |
1012 | } | |
1013 | } | |
1014 | ||
1015 | /** | |
1016 | * Closes the current subpath by appending a straight line segment from the current point | |
1017 | * to the starting point of the subpath. | |
1018 | */ | |
1019 | ||
1020 | public void closePath() { | |
1021 | content.append("h").append_i(separator); | |
1022 | } | |
1023 | ||
1024 | /** | |
1025 | * Ends the path without filling or stroking it. | |
1026 | */ | |
1027 | ||
1028 | public void newPath() { | |
1029 | content.append("n").append_i(separator); | |
1030 | } | |
1031 | ||
1032 | /** | |
1033 | * Strokes the path. | |
1034 | */ | |
1035 | ||
1036 | public void stroke() { | |
1037 | content.append("S").append_i(separator); | |
1038 | } | |
1039 | ||
1040 | /** | |
1041 | * Closes the path and strokes it. | |
1042 | */ | |
1043 | ||
1044 | public void closePathStroke() { | |
1045 | content.append("s").append_i(separator); | |
1046 | } | |
1047 | ||
1048 | /** | |
1049 | * Fills the path, using the non-zero winding number rule to determine the region to fill. | |
1050 | */ | |
1051 | ||
1052 | public void fill() { | |
1053 | content.append("f").append_i(separator); | |
1054 | } | |
1055 | ||
1056 | /** | |
1057 | * Fills the path, using the even-odd rule to determine the region to fill. | |
1058 | */ | |
1059 | ||
1060 | public void eoFill() { | |
1061 | content.append("f*").append_i(separator); | |
1062 | } | |
1063 | ||
1064 | /** | |
1065 | * Fills the path using the non-zero winding number rule to determine the region to fill and strokes it. | |
1066 | */ | |
1067 | ||
1068 | public void fillStroke() { | |
1069 | content.append("B").append_i(separator); | |
1070 | } | |
1071 | ||
1072 | /** | |
1073 | * Closes the path, fills it using the non-zero winding number rule to determine the region to fill and strokes it. | |
1074 | */ | |
1075 | ||
1076 | public void closePathFillStroke() { | |
1077 | content.append("b").append_i(separator); | |
1078 | } | |
1079 | ||
1080 | /** | |
1081 | * Fills the path, using the even-odd rule to determine the region to fill and strokes it. | |
1082 | */ | |
1083 | ||
1084 | public void eoFillStroke() { | |
1085 | content.append("B*").append_i(separator); | |
1086 | } | |
1087 | ||
1088 | /** | |
1089 | * Closes the path, fills it using the even-odd rule to determine the region to fill and strokes it. | |
1090 | */ | |
1091 | ||
1092 | public void closePathEoFillStroke() { | |
1093 | content.append("b*").append_i(separator); | |
1094 | } | |
1095 | ||
1096 | /** | |
1097 | * Adds an <CODE>Image</CODE> to the page. The <CODE>Image</CODE> must have | |
1098 | * absolute positioning. | |
1099 | * @param image the <CODE>Image</CODE> object | |
1100 | * @throws DocumentException if the <CODE>Image</CODE> does not have absolute positioning | |
1101 | */ | |
1102 | public void addImage(Image image) throws DocumentException { | |
1103 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::addImage → NO_COVERAGE |
addImage(image, false); |
1104 | } | |
1105 | ||
1106 | /** | |
1107 | * Adds an <CODE>Image</CODE> to the page. The <CODE>Image</CODE> must have | |
1108 | * absolute positioning. The image can be placed inline. | |
1109 | * @param image the <CODE>Image</CODE> object | |
1110 | * @param inlineImage <CODE>true</CODE> to place this image inline, <CODE>false</CODE> otherwise | |
1111 | * @throws DocumentException if the <CODE>Image</CODE> does not have absolute positioning | |
1112 | */ | |
1113 | public void addImage(Image image, boolean inlineImage) throws DocumentException { | |
1114 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (!image.hasAbsoluteY()) |
1115 | throw new DocumentException(MessageLocalization.getComposedMessage("the.image.must.have.absolute.positioning")); | |
1116 | float[] matrix = image.matrix(); | |
1117 |
1
1. addImage : Replaced float subtraction with addition → NO_COVERAGE |
matrix[Image.CX] = image.getAbsoluteX() - matrix[Image.CX]; |
1118 |
1
1. addImage : Replaced float subtraction with addition → NO_COVERAGE |
matrix[Image.CY] = image.getAbsoluteY() - matrix[Image.CY]; |
1119 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::addImage → NO_COVERAGE |
addImage(image, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], inlineImage); |
1120 | } | |
1121 | ||
1122 | /** | |
1123 | * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE> | |
1124 | * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y) | |
1125 | * use addImage(image, image_width, 0, 0, image_height, x, y). | |
1126 | * @param image the <CODE>Image</CODE> object | |
1127 | * @param a an element of the transformation matrix | |
1128 | * @param b an element of the transformation matrix | |
1129 | * @param c an element of the transformation matrix | |
1130 | * @param d an element of the transformation matrix | |
1131 | * @param e an element of the transformation matrix | |
1132 | * @param f an element of the transformation matrix | |
1133 | * @throws DocumentException on error | |
1134 | */ | |
1135 | public void addImage(Image image, float a, float b, float c, float d, float e, float f) throws DocumentException { | |
1136 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::addImage → NO_COVERAGE |
addImage(image, a, b, c, d, e, f, false); |
1137 | } | |
1138 | ||
1139 | /** | |
1140 | * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE> | |
1141 | * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y) | |
1142 | * use addImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline. | |
1143 | * @param image the <CODE>Image</CODE> object | |
1144 | * @param a an element of the transformation matrix | |
1145 | * @param b an element of the transformation matrix | |
1146 | * @param c an element of the transformation matrix | |
1147 | * @param d an element of the transformation matrix | |
1148 | * @param e an element of the transformation matrix | |
1149 | * @param f an element of the transformation matrix | |
1150 | * @param inlineImage <CODE>true</CODE> to place this image inline, <CODE>false</CODE> otherwise | |
1151 | * @throws DocumentException on error | |
1152 | */ | |
1153 | public void addImage(Image image, float a, float b, float c, float d, float e, float f, boolean inlineImage) throws DocumentException { | |
1154 | try { | |
1155 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (image.getLayer() != null) |
1156 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::beginLayer → NO_COVERAGE |
beginLayer(image.getLayer()); |
1157 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (image.isImgTemplate()) { |
1158 | writer.addDirectImageSimple(image); | |
1159 | PdfTemplate template = image.getTemplateData(); | |
1160 | float w = template.getWidth(); | |
1161 | float h = template.getHeight(); | |
1162 |
5
1. addImage : Replaced float division with multiplication → NO_COVERAGE 2. addImage : Replaced float division with multiplication → NO_COVERAGE 3. addImage : Replaced float division with multiplication → NO_COVERAGE 4. addImage : Replaced float division with multiplication → NO_COVERAGE 5. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::addTemplate → NO_COVERAGE |
addTemplate(template, a / w, b / w, c / h, d / h, e, f); |
1163 | } | |
1164 | else { | |
1165 | content.append("q "); | |
1166 | content.append(a).append(' '); | |
1167 | content.append(b).append(' '); | |
1168 | content.append(c).append(' '); | |
1169 | content.append(d).append(' '); | |
1170 | content.append(e).append(' '); | |
1171 | content.append(f).append(" cm"); | |
1172 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (inlineImage) { |
1173 | content.append("\nBI\n"); | |
1174 | PdfImage pimage = new PdfImage(image, "", null); | |
1175 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (image instanceof ImgJBIG2) { |
1176 | byte[] globals = ((ImgJBIG2)image).getGlobalBytes(); | |
1177 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (globals != null) { |
1178 | PdfDictionary decodeparms = new PdfDictionary(); | |
1179 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE |
decodeparms.put(PdfName.JBIG2GLOBALS, writer.getReferenceJBIG2Globals(globals)); |
1180 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfImage::put → NO_COVERAGE |
pimage.put(PdfName.DECODEPARMS, decodeparms); |
1181 | } | |
1182 | } | |
1183 | for (PdfName key : pimage.getKeys()) { | |
1184 | PdfObject value = pimage.get(key); | |
1185 | String s = abrev.get(key); | |
1186 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (s == null) |
1187 | continue; | |
1188 | content.append(s); | |
1189 | boolean check = true; | |
1190 |
2
1. addImage : negated conditional → NO_COVERAGE 2. addImage : negated conditional → NO_COVERAGE |
if (key.equals(PdfName.COLORSPACE) && value.isArray()) { |
1191 | PdfArray ar = (PdfArray) value; | |
1192 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (ar.size() == 4 |
1193 |
1
1. addImage : negated conditional → NO_COVERAGE |
&& PdfName.INDEXED.equals(ar.getAsName(0)) |
1194 |
1
1. addImage : negated conditional → NO_COVERAGE |
&& ar.getPdfObject(1).isName() |
1195 |
1
1. addImage : negated conditional → NO_COVERAGE |
&& ar.getPdfObject(2).isNumber() |
1196 |
1
1. addImage : negated conditional → NO_COVERAGE |
&& ar.getPdfObject(3).isString() |
1197 | ) { | |
1198 | check = false; | |
1199 | } | |
1200 | ||
1201 | } | |
1202 |
3
1. addImage : negated conditional → NO_COVERAGE 2. addImage : negated conditional → NO_COVERAGE 3. addImage : negated conditional → NO_COVERAGE |
if (check && key.equals(PdfName.COLORSPACE) && !value.isName()) { |
1203 | PdfName cs = writer.getColorspaceName(); | |
1204 | PageResources prs = getPageResources(); | |
1205 | prs.addColor(cs, writer.addToBody(value).getIndirectReference()); | |
1206 | value = cs; | |
1207 | } | |
1208 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfObject::toPdf → NO_COVERAGE |
value.toPdf(null, content); |
1209 | content.append('\n'); | |
1210 | } | |
1211 | content.append("ID\n"); | |
1212 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfImage::writeContent → NO_COVERAGE |
pimage.writeContent(content); |
1213 | content.append("\nEI\nQ").append_i(separator); | |
1214 | } | |
1215 | else { | |
1216 | PdfName name; | |
1217 | PageResources prs = getPageResources(); | |
1218 | Image maskImage = image.getImageMask(); | |
1219 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (maskImage != null) { |
1220 | name = writer.addDirectImageSimple(maskImage); | |
1221 | prs.addXObject(name, writer.getImageReference(name)); | |
1222 | } | |
1223 | name = writer.addDirectImageSimple(image); | |
1224 | name = prs.addXObject(name, writer.getImageReference(name)); | |
1225 | content.append(' ').append(name.getBytes()).append(" Do Q").append_i(separator); | |
1226 | } | |
1227 | } | |
1228 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (image.hasBorders()) { |
1229 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::saveState → NO_COVERAGE |
saveState(); |
1230 | float w = image.getWidth(); | |
1231 | float h = image.getHeight(); | |
1232 |
5
1. addImage : Replaced float division with multiplication → NO_COVERAGE 2. addImage : Replaced float division with multiplication → NO_COVERAGE 3. addImage : Replaced float division with multiplication → NO_COVERAGE 4. addImage : Replaced float division with multiplication → NO_COVERAGE 5. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::concatCTM → NO_COVERAGE |
concatCTM(a / w, b / w, c / h, d / h, e, f); |
1233 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
rectangle(image); |
1234 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::restoreState → NO_COVERAGE |
restoreState(); |
1235 | } | |
1236 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (image.getLayer() != null) |
1237 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::endLayer → NO_COVERAGE |
endLayer(); |
1238 | Annotation annot = image.getAnnotation(); | |
1239 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (annot == null) |
1240 | return; | |
1241 | float[] r = new float[unitRect.length]; | |
1242 |
3
1. addImage : changed conditional boundary → NO_COVERAGE 2. addImage : Changed increment from 2 to -2 → NO_COVERAGE 3. addImage : negated conditional → NO_COVERAGE |
for (int k = 0; k < unitRect.length; k += 2) { |
1243 |
5
1. addImage : Replaced float multiplication with division → NO_COVERAGE 2. addImage : Replaced integer addition with subtraction → NO_COVERAGE 3. addImage : Replaced float multiplication with division → NO_COVERAGE 4. addImage : Replaced float addition with subtraction → NO_COVERAGE 5. addImage : Replaced float addition with subtraction → NO_COVERAGE |
r[k] = a * unitRect[k] + c * unitRect[k + 1] + e; |
1244 |
6
1. addImage : Replaced integer addition with subtraction → NO_COVERAGE 2. addImage : Replaced float multiplication with division → NO_COVERAGE 3. addImage : Replaced integer addition with subtraction → NO_COVERAGE 4. addImage : Replaced float multiplication with division → NO_COVERAGE 5. addImage : Replaced float addition with subtraction → NO_COVERAGE 6. addImage : Replaced float addition with subtraction → NO_COVERAGE |
r[k + 1] = b * unitRect[k] + d * unitRect[k + 1] + f; |
1245 | } | |
1246 | float llx = r[0]; | |
1247 | float lly = r[1]; | |
1248 | float urx = llx; | |
1249 | float ury = lly; | |
1250 |
2
1. addImage : changed conditional boundary → NO_COVERAGE 2. addImage : negated conditional → NO_COVERAGE |
for (int k = 2; k < r.length; k += 2) { |
1251 | llx = Math.min(llx, r[k]); | |
1252 |
1
1. addImage : Replaced integer addition with subtraction → NO_COVERAGE |
lly = Math.min(lly, r[k + 1]); |
1253 | urx = Math.max(urx, r[k]); | |
1254 |
1
1. addImage : Replaced integer addition with subtraction → NO_COVERAGE |
ury = Math.max(ury, r[k + 1]); |
1255 | } | |
1256 | annot = new Annotation(annot); | |
1257 |
1
1. addImage : removed call to com/lowagie/text/Annotation::setDimensions → NO_COVERAGE |
annot.setDimensions(llx, lly, urx, ury); |
1258 | PdfAnnotation an = PdfAnnotationsImp.convertAnnotation(writer, annot, new Rectangle(llx, lly, urx, ury)); | |
1259 |
1
1. addImage : negated conditional → NO_COVERAGE |
if (an == null) |
1260 | return; | |
1261 |
1
1. addImage : removed call to com/lowagie/text/pdf/PdfContentByte::addAnnotation → NO_COVERAGE |
addAnnotation(an); |
1262 | } | |
1263 | catch (Exception ee) { | |
1264 | throw new DocumentException(ee); | |
1265 | } | |
1266 | } | |
1267 | ||
1268 | /** | |
1269 | * Makes this <CODE>PdfContentByte</CODE> empty. | |
1270 | * Calls <code>reset( true )</code> | |
1271 | */ | |
1272 | public void reset() { | |
1273 |
1
1. reset : removed call to com/lowagie/text/pdf/PdfContentByte::reset → NO_COVERAGE |
reset( true ); |
1274 | } | |
1275 | ||
1276 | /** | |
1277 | * Makes this <CODE>PdfContentByte</CODE> empty. | |
1278 | * @param validateContent will call <code>sanityCheck()</code> if true. | |
1279 | * @since 2.1.6 | |
1280 | */ | |
1281 | public void reset( boolean validateContent ) { | |
1282 |
1
1. reset : removed call to com/lowagie/text/pdf/ByteBuffer::reset → NO_COVERAGE |
content.reset(); |
1283 |
1
1. reset : negated conditional → NO_COVERAGE |
if (validateContent) { |
1284 |
1
1. reset : removed call to com/lowagie/text/pdf/PdfContentByte::sanityCheck → NO_COVERAGE |
sanityCheck(); |
1285 | } | |
1286 | state = new GraphicState(); | |
1287 | } | |
1288 | ||
1289 | ||
1290 | /** | |
1291 | * Starts the writing of text. | |
1292 | */ | |
1293 | public void beginText() { | |
1294 |
1
1. beginText : negated conditional → NO_COVERAGE |
if (inText) { |
1295 | throw new IllegalPdfSyntaxException(MessageLocalization.getComposedMessage("unbalanced.begin.end.text.operators")); | |
1296 | } | |
1297 | inText = true; | |
1298 | state.xTLM = 0; | |
1299 | state.yTLM = 0; | |
1300 | content.append("BT").append_i(separator); | |
1301 | } | |
1302 | ||
1303 | /** | |
1304 | * Ends the writing of text and makes the current font invalid. | |
1305 | */ | |
1306 | public void endText() { | |
1307 |
1
1. endText : negated conditional → NO_COVERAGE |
if (!inText) { |
1308 | throw new IllegalPdfSyntaxException(MessageLocalization.getComposedMessage("unbalanced.begin.end.text.operators")); | |
1309 | } | |
1310 | inText = false; | |
1311 | content.append("ET").append_i(separator); | |
1312 | } | |
1313 | ||
1314 | /** | |
1315 | * Saves the graphic state. <CODE>saveState</CODE> and | |
1316 | * <CODE>restoreState</CODE> must be balanced. | |
1317 | */ | |
1318 | public void saveState() { | |
1319 | content.append("q").append_i(separator); | |
1320 | stateList.add(new GraphicState(state)); | |
1321 | } | |
1322 | ||
1323 | /** | |
1324 | * Restores the graphic state. <CODE>saveState</CODE> and | |
1325 | * <CODE>restoreState</CODE> must be balanced. | |
1326 | */ | |
1327 | public void restoreState() { | |
1328 | content.append("Q").append_i(separator); | |
1329 |
1
1. restoreState : Replaced integer subtraction with addition → NO_COVERAGE |
int idx = stateList.size() - 1; |
1330 |
2
1. restoreState : changed conditional boundary → NO_COVERAGE 2. restoreState : negated conditional → NO_COVERAGE |
if (idx < 0) |
1331 | throw new IllegalPdfSyntaxException(MessageLocalization.getComposedMessage("unbalanced.save.restore.state.operators")); | |
1332 | state = stateList.get(idx); | |
1333 | stateList.remove(idx); | |
1334 | } | |
1335 | ||
1336 | /** | |
1337 | * Sets the character spacing parameter. | |
1338 | * | |
1339 | * @param charSpace a parameter | |
1340 | */ | |
1341 | public void setCharacterSpacing(float charSpace) { | |
1342 | state.charSpace = charSpace; | |
1343 | content.append(charSpace).append(" Tc").append_i(separator); | |
1344 | } | |
1345 | ||
1346 | /** | |
1347 | * Sets the word spacing parameter. | |
1348 | * | |
1349 | * @param wordSpace a parameter | |
1350 | */ | |
1351 | public void setWordSpacing(float wordSpace) { | |
1352 | state.wordSpace = wordSpace; | |
1353 | content.append(wordSpace).append(" Tw").append_i(separator); | |
1354 | } | |
1355 | ||
1356 | /** | |
1357 | * Sets the horizontal scaling parameter. | |
1358 | * | |
1359 | * @param scale a parameter | |
1360 | */ | |
1361 | public void setHorizontalScaling(float scale) { | |
1362 | state.scale = scale; | |
1363 | content.append(scale).append(" Tz").append_i(separator); | |
1364 | } | |
1365 | ||
1366 | /** | |
1367 | * Sets the text leading parameter. | |
1368 | * <P> | |
1369 | * The leading parameter is measured in text space units. It specifies the vertical distance | |
1370 | * between the baselines of adjacent lines of text.</P> | |
1371 | * | |
1372 | * @param leading the new leading | |
1373 | */ | |
1374 | public void setLeading(float leading) { | |
1375 | state.leading = leading; | |
1376 | content.append(leading).append(" TL").append_i(separator); | |
1377 | } | |
1378 | ||
1379 | /** | |
1380 | * Set the font and the size for the subsequent text writing. | |
1381 | * | |
1382 | * @param bf the font | |
1383 | * @param size the font size in points | |
1384 | */ | |
1385 | public void setFontAndSize(BaseFont bf, float size) { | |
1386 |
1
1. setFontAndSize : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
1387 |
4
1. setFontAndSize : changed conditional boundary → NO_COVERAGE 2. setFontAndSize : changed conditional boundary → NO_COVERAGE 3. setFontAndSize : negated conditional → NO_COVERAGE 4. setFontAndSize : negated conditional → NO_COVERAGE |
if (size < 0.0001f && size > -0.0001f) |
1388 | throw new IllegalArgumentException(MessageLocalization.getComposedMessage("font.size.too.small.1", String.valueOf(size))); | |
1389 | state.size = size; | |
1390 | state.fontDetails = writer.addSimple(bf); | |
1391 | PageResources prs = getPageResources(); | |
1392 | PdfName name = state.fontDetails.getFontName(); | |
1393 | name = prs.addFont(name, state.fontDetails.getIndirectReference()); | |
1394 | content.append(name.getBytes()).append(' ').append(size).append(" Tf").append_i(separator); | |
1395 | } | |
1396 | ||
1397 | /** | |
1398 | * Sets the text rendering parameter. | |
1399 | * | |
1400 | * @param rendering a parameter | |
1401 | */ | |
1402 | public void setTextRenderingMode(int rendering) { | |
1403 | content.append(rendering).append(" Tr").append_i(separator); | |
1404 | } | |
1405 | ||
1406 | /** | |
1407 | * Sets the text rise parameter. | |
1408 | * <P> | |
1409 | * This allows to write text in subscript or superscript mode.</P> | |
1410 | * | |
1411 | * @param rise a parameter | |
1412 | */ | |
1413 | public void setTextRise(float rise) { | |
1414 | content.append(rise).append(" Ts").append_i(separator); | |
1415 | } | |
1416 | ||
1417 | /** | |
1418 | * A helper to insert into the content stream the <CODE>text</CODE> | |
1419 | * converted to bytes according to the font's encoding. | |
1420 | * | |
1421 | * @param text the text to write | |
1422 | */ | |
1423 | private void showText2(String text) { | |
1424 |
1
1. showText2 : negated conditional → NO_COVERAGE |
if (state.fontDetails == null) |
1425 | throw new NullPointerException(MessageLocalization.getComposedMessage("font.and.size.must.be.set.before.writing.any.text")); | |
1426 | byte[] b = state.fontDetails.convertToBytes(text); | |
1427 |
1
1. showText2 : removed call to com/lowagie/text/pdf/PdfContentByte::escapeString → NO_COVERAGE |
escapeString(b, content); |
1428 | } | |
1429 | ||
1430 | /** | |
1431 | * Shows the <CODE>text</CODE>. | |
1432 | * | |
1433 | * @param text the text to write | |
1434 | */ | |
1435 | public void showText(String text) { | |
1436 |
1
1. showText : removed call to com/lowagie/text/pdf/PdfContentByte::showText2 → NO_COVERAGE |
showText2(text); |
1437 | content.append("Tj").append_i(separator); | |
1438 | } | |
1439 | | |
1440 | public void showText(GlyphVector glyphVector) { | |
1441 | byte[] b = state.fontDetails.convertToBytes(glyphVector); | |
1442 |
1
1. showText : removed call to com/lowagie/text/pdf/PdfContentByte::escapeString → NO_COVERAGE |
escapeString(b, content); |
1443 | content.append("Tj").append_i(separator); | |
1444 | } | |
1445 | | |
1446 | /** | |
1447 | * Constructs a kern array for a text in a certain font | |
1448 | * @param text the text | |
1449 | * @param font the font | |
1450 | * @return a PdfTextArray | |
1451 | */ | |
1452 | public static PdfTextArray getKernArray(String text, BaseFont font) { | |
1453 | PdfTextArray pa = new PdfTextArray(); | |
1454 | StringBuilder acc = new StringBuilder(); | |
1455 |
1
1. getKernArray : Replaced integer subtraction with addition → NO_COVERAGE |
int len = text.length() - 1; |
1456 | char[] c = text.toCharArray(); | |
1457 |
2
1. getKernArray : changed conditional boundary → NO_COVERAGE 2. getKernArray : negated conditional → NO_COVERAGE |
if (len >= 0) |
1458 | acc.append(c, 0, 1); | |
1459 |
3
1. getKernArray : changed conditional boundary → NO_COVERAGE 2. getKernArray : Changed increment from 1 to -1 → NO_COVERAGE 3. getKernArray : negated conditional → NO_COVERAGE |
for (int k = 0; k < len; ++k) { |
1460 |
1
1. getKernArray : Replaced integer addition with subtraction → NO_COVERAGE |
char c2 = c[k + 1]; |
1461 | int kern = font.getKerning(c[k], c2); | |
1462 |
1
1. getKernArray : negated conditional → NO_COVERAGE |
if (kern == 0) { |
1463 | acc.append(c2); | |
1464 | } | |
1465 | else { | |
1466 |
1
1. getKernArray : removed call to com/lowagie/text/pdf/PdfTextArray::add → NO_COVERAGE |
pa.add(acc.toString()); |
1467 |
1
1. getKernArray : removed call to java/lang/StringBuilder::setLength → NO_COVERAGE |
acc.setLength(0); |
1468 |
1
1. getKernArray : Replaced integer addition with subtraction → NO_COVERAGE |
acc.append(c, k + 1, 1); |
1469 |
2
1. getKernArray : removed negation → NO_COVERAGE 2. getKernArray : removed call to com/lowagie/text/pdf/PdfTextArray::add → NO_COVERAGE |
pa.add(-kern); |
1470 | } | |
1471 | } | |
1472 |
1
1. getKernArray : removed call to com/lowagie/text/pdf/PdfTextArray::add → NO_COVERAGE |
pa.add(acc.toString()); |
1473 |
1
1. getKernArray : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::getKernArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return pa; |
1474 | } | |
1475 | ||
1476 | /** | |
1477 | * Shows the <CODE>text</CODE> kerned. | |
1478 | * | |
1479 | * @param text the text to write | |
1480 | */ | |
1481 | public void showTextKerned(String text) { | |
1482 |
1
1. showTextKerned : negated conditional → NO_COVERAGE |
if (state.fontDetails == null) |
1483 | throw new NullPointerException(MessageLocalization.getComposedMessage("font.and.size.must.be.set.before.writing.any.text")); | |
1484 | BaseFont bf = state.fontDetails.getBaseFont(); | |
1485 |
1
1. showTextKerned : negated conditional → NO_COVERAGE |
if (bf.hasKernPairs()) |
1486 |
1
1. showTextKerned : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE |
showText(getKernArray(text, bf)); |
1487 | else | |
1488 |
1
1. showTextKerned : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE |
showText(text); |
1489 | } | |
1490 | ||
1491 | /** | |
1492 | * Moves to the next line and shows <CODE>text</CODE>. | |
1493 | * | |
1494 | * @param text the text to write | |
1495 | */ | |
1496 | public void newlineShowText(String text) { | |
1497 |
1
1. newlineShowText : Replaced float subtraction with addition → NO_COVERAGE |
state.yTLM -= state.leading; |
1498 |
1
1. newlineShowText : removed call to com/lowagie/text/pdf/PdfContentByte::showText2 → NO_COVERAGE |
showText2(text); |
1499 | content.append("'").append_i(separator); | |
1500 | } | |
1501 | ||
1502 | /** | |
1503 | * Moves to the next line and shows text string, using the given values of the character and word spacing parameters. | |
1504 | * | |
1505 | * @param wordSpacing a parameter | |
1506 | * @param charSpacing a parameter | |
1507 | * @param text the text to write | |
1508 | */ | |
1509 | public void newlineShowText(float wordSpacing, float charSpacing, String text) { | |
1510 |
1
1. newlineShowText : Replaced float subtraction with addition → NO_COVERAGE |
state.yTLM -= state.leading; |
1511 | content.append(wordSpacing).append(' ').append(charSpacing); | |
1512 |
1
1. newlineShowText : removed call to com/lowagie/text/pdf/PdfContentByte::showText2 → NO_COVERAGE |
showText2(text); |
1513 | content.append("\"").append_i(separator); | |
1514 | ||
1515 | // The " operator sets charSpace and wordSpace into graphics state | |
1516 | // (cfr PDF reference v1.6, table 5.6) | |
1517 | state.charSpace = charSpacing; | |
1518 | state.wordSpace = wordSpacing; | |
1519 | } | |
1520 | ||
1521 | /** | |
1522 | * Changes the text matrix. | |
1523 | * <P> | |
1524 | * Remark: this operation also initializes the current point position.</P> | |
1525 | * | |
1526 | * @param a operand 1,1 in the matrix | |
1527 | * @param b operand 1,2 in the matrix | |
1528 | * @param c operand 2,1 in the matrix | |
1529 | * @param d operand 2,2 in the matrix | |
1530 | * @param x operand 3,1 in the matrix | |
1531 | * @param y operand 3,2 in the matrix | |
1532 | */ | |
1533 | public void setTextMatrix(float a, float b, float c, float d, float x, float y) { | |
1534 | state.xTLM = x; | |
1535 | state.yTLM = y; | |
1536 | content.append(a).append(' ').append(b).append_i(' ') | |
1537 | .append(c).append_i(' ').append(d).append_i(' ') | |
1538 | .append(x).append_i(' ').append(y).append(" Tm").append_i(separator); | |
1539 | } | |
1540 | ||
1541 | /** | |
1542 | * Changes the text matrix. The first four parameters are {1,0,0,1}. | |
1543 | * <P> | |
1544 | * Remark: this operation also initializes the current point position.</P> | |
1545 | * | |
1546 | * @param x operand 3,1 in the matrix | |
1547 | * @param y operand 3,2 in the matrix | |
1548 | */ | |
1549 | public void setTextMatrix(float x, float y) { | |
1550 |
1
1. setTextMatrix : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE |
setTextMatrix(1, 0, 0, 1, x, y); |
1551 | } | |
1552 | ||
1553 | /** | |
1554 | * Moves to the start of the next line, offset from the start of the current line. | |
1555 | * | |
1556 | * @param x x-coordinate of the new current point | |
1557 | * @param y y-coordinate of the new current point | |
1558 | */ | |
1559 | public void moveText(float x, float y) { | |
1560 |
1
1. moveText : Replaced float addition with subtraction → NO_COVERAGE |
state.xTLM += x; |
1561 |
1
1. moveText : Replaced float addition with subtraction → NO_COVERAGE |
state.yTLM += y; |
1562 | content.append(x).append(' ').append(y).append(" Td").append_i(separator); | |
1563 | } | |
1564 | ||
1565 | /** | |
1566 | * Moves to the start of the next line, offset from the start of the current line. | |
1567 | * <P> | |
1568 | * As a side effect, this sets the leading parameter in the text state.</P> | |
1569 | * | |
1570 | * @param x offset of the new current point | |
1571 | * @param y y-coordinate of the new current point | |
1572 | */ | |
1573 | public void moveTextWithLeading(float x, float y) { | |
1574 |
1
1. moveTextWithLeading : Replaced float addition with subtraction → NO_COVERAGE |
state.xTLM += x; |
1575 |
1
1. moveTextWithLeading : Replaced float addition with subtraction → NO_COVERAGE |
state.yTLM += y; |
1576 |
1
1. moveTextWithLeading : removed negation → NO_COVERAGE |
state.leading = -y; |
1577 | content.append(x).append(' ').append(y).append(" TD").append_i(separator); | |
1578 | } | |
1579 | ||
1580 | /** | |
1581 | * Moves to the start of the next line. | |
1582 | */ | |
1583 | public void newlineText() { | |
1584 |
1
1. newlineText : Replaced float subtraction with addition → NO_COVERAGE |
state.yTLM -= state.leading; |
1585 | content.append("T*").append_i(separator); | |
1586 | } | |
1587 | ||
1588 | /** | |
1589 | * Gets the size of this content. | |
1590 | * | |
1591 | * @return the size of the content | |
1592 | */ | |
1593 | int size() { | |
1594 | return content.size(); | |
1595 | } | |
1596 | ||
1597 | /** | |
1598 | * Escapes a <CODE>byte</CODE> array according to the PDF conventions. | |
1599 | * | |
1600 | * @param b the <CODE>byte</CODE> array to escape | |
1601 | * @return an escaped <CODE>byte</CODE> array | |
1602 | */ | |
1603 | static byte[] escapeString(byte[] b) { | |
1604 | ByteBuffer content = new ByteBuffer(); | |
1605 |
1
1. escapeString : removed call to com/lowagie/text/pdf/PdfContentByte::escapeString → NO_COVERAGE |
escapeString(b, content); |
1606 |
1
1. escapeString : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::escapeString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return content.toByteArray(); |
1607 | } | |
1608 | ||
1609 | /** | |
1610 | * Escapes a <CODE>byte</CODE> array according to the PDF conventions. | |
1611 | * | |
1612 | * @param b the <CODE>byte</CODE> array to escape | |
1613 | * @param content the content | |
1614 | */ | |
1615 | static void escapeString(byte[] b, ByteBuffer content) { | |
1616 | content.append_i('('); | |
1617 | for (byte c : b) { | |
1618 | switch (c) { | |
1619 | case '\r': | |
1620 | content.append("\\r"); | |
1621 | break; | |
1622 | case '\n': | |
1623 | content.append("\\n"); | |
1624 | break; | |
1625 | case '\t': | |
1626 | content.append("\\t"); | |
1627 | break; | |
1628 | case '\b': | |
1629 | content.append("\\b"); | |
1630 | break; | |
1631 | case '\f': | |
1632 | content.append("\\f"); | |
1633 | break; | |
1634 | case '(': | |
1635 | case ')': | |
1636 | case '\\': | |
1637 | content.append_i('\\').append_i(c); | |
1638 | break; | |
1639 | default: | |
1640 | content.append_i(c); | |
1641 | } | |
1642 | } | |
1643 | content.append(")"); | |
1644 | } | |
1645 | ||
1646 | /** | |
1647 | * Adds a named outline to the document. | |
1648 | * | |
1649 | * @param outline the outline | |
1650 | * @param name the name for the local destination | |
1651 | */ | |
1652 | public void addOutline(PdfOutline outline, String name) { | |
1653 |
1
1. addOutline : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
1654 |
1
1. addOutline : removed call to com/lowagie/text/pdf/PdfDocument::addOutline → NO_COVERAGE |
pdf.addOutline(outline, name); |
1655 | } | |
1656 | /** | |
1657 | * Gets the root outline. | |
1658 | * | |
1659 | * @return the root outline | |
1660 | */ | |
1661 | public PdfOutline getRootOutline() { | |
1662 |
1
1. getRootOutline : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
1663 |
1
1. getRootOutline : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::getRootOutline to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return pdf.getRootOutline(); |
1664 | } | |
1665 | ||
1666 | /** | |
1667 | * Computes the width of the given string taking in account | |
1668 | * the current values of "Character spacing", "Word Spacing" | |
1669 | * and "Horizontal Scaling". | |
1670 | * The additional spacing is not computed for the last character | |
1671 | * of the string. | |
1672 | * @param text the string to get width of | |
1673 | * @param kerned the kerning option | |
1674 | * @return the width | |
1675 | */ | |
1676 | ||
1677 | public float getEffectiveStringWidth(String text, boolean kerned) { | |
1678 | BaseFont bf = state.fontDetails.getBaseFont(); | |
1679 | ||
1680 | float w; | |
1681 |
1
1. getEffectiveStringWidth : negated conditional → NO_COVERAGE |
if (kerned) |
1682 | w = bf.getWidthPointKerned(text, state.size); | |
1683 | else | |
1684 | w = bf.getWidthPoint(text, state.size); | |
1685 | ||
1686 |
3
1. getEffectiveStringWidth : changed conditional boundary → NO_COVERAGE 2. getEffectiveStringWidth : negated conditional → NO_COVERAGE 3. getEffectiveStringWidth : negated conditional → NO_COVERAGE |
if (state.charSpace != 0.0f && text.length() > 1) { |
1687 |
3
1. getEffectiveStringWidth : Replaced integer subtraction with addition → NO_COVERAGE 2. getEffectiveStringWidth : Replaced float multiplication with division → NO_COVERAGE 3. getEffectiveStringWidth : Replaced float addition with subtraction → NO_COVERAGE |
w += state.charSpace * (text.length() -1); |
1688 | } | |
1689 | ||
1690 | int ft = bf.getFontType(); | |
1691 |
4
1. getEffectiveStringWidth : negated conditional → NO_COVERAGE 2. getEffectiveStringWidth : negated conditional → NO_COVERAGE 3. getEffectiveStringWidth : negated conditional → NO_COVERAGE 4. getEffectiveStringWidth : negated conditional → NO_COVERAGE |
if (state.wordSpace != 0.0f && (ft == BaseFont.FONT_TYPE_T1 || ft == BaseFont.FONT_TYPE_TT || ft == BaseFont.FONT_TYPE_T3)) { |
1692 |
4
1. getEffectiveStringWidth : changed conditional boundary → NO_COVERAGE 2. getEffectiveStringWidth : Changed increment from 1 to -1 → NO_COVERAGE 3. getEffectiveStringWidth : Replaced integer subtraction with addition → NO_COVERAGE 4. getEffectiveStringWidth : negated conditional → NO_COVERAGE |
for (int i = 0; i < (text.length() -1); i++) { |
1693 |
1
1. getEffectiveStringWidth : negated conditional → NO_COVERAGE |
if (text.charAt(i) == ' ') |
1694 |
1
1. getEffectiveStringWidth : Replaced float addition with subtraction → NO_COVERAGE |
w += state.wordSpace; |
1695 | } | |
1696 | } | |
1697 |
1
1. getEffectiveStringWidth : negated conditional → NO_COVERAGE |
if (state.scale != 100.0) |
1698 |
2
1. getEffectiveStringWidth : Replaced float multiplication with division → NO_COVERAGE 2. getEffectiveStringWidth : Replaced float division with multiplication → NO_COVERAGE |
w = (w * state.scale) / 100.0f; |
1699 | ||
1700 | //System.out.println("String width = " + Float.toString(w)); | |
1701 |
1
1. getEffectiveStringWidth : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfContentByte::getEffectiveStringWidth → NO_COVERAGE |
return w; |
1702 | } | |
1703 | ||
1704 | /** | |
1705 | * Shows text right, left or center aligned with rotation. | |
1706 | * @param alignment the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT | |
1707 | * @param text the text to show | |
1708 | * @param x the x pivot position | |
1709 | * @param y the y pivot position | |
1710 | * @param rotation the rotation to be applied in degrees counterclockwise | |
1711 | */ | |
1712 | public void showTextAligned(int alignment, String text, float x, float y, float rotation) { | |
1713 |
1
1. showTextAligned : removed call to com/lowagie/text/pdf/PdfContentByte::showTextAligned → NO_COVERAGE |
showTextAligned(alignment, text, x, y, rotation, false); |
1714 | } | |
1715 | ||
1716 | private void showTextAligned(int alignment, String text, float x, float y, float rotation, boolean kerned) { | |
1717 |
1
1. showTextAligned : negated conditional → NO_COVERAGE |
if (state.fontDetails == null) |
1718 | throw new NullPointerException(MessageLocalization.getComposedMessage("font.and.size.must.be.set.before.writing.any.text")); | |
1719 |
1
1. showTextAligned : negated conditional → NO_COVERAGE |
if (rotation == 0) { |
1720 | switch (alignment) { | |
1721 | case ALIGN_CENTER: | |
1722 |
2
1. showTextAligned : Replaced float division with multiplication → NO_COVERAGE 2. showTextAligned : Replaced float subtraction with addition → NO_COVERAGE |
x -= getEffectiveStringWidth(text, kerned) / 2; |
1723 | break; | |
1724 | case ALIGN_RIGHT: | |
1725 |
1
1. showTextAligned : Replaced float subtraction with addition → NO_COVERAGE |
x -= getEffectiveStringWidth(text, kerned); |
1726 | break; | |
1727 | } | |
1728 |
1
1. showTextAligned : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE |
setTextMatrix(x, y); |
1729 |
1
1. showTextAligned : negated conditional → NO_COVERAGE |
if (kerned) |
1730 |
1
1. showTextAligned : removed call to com/lowagie/text/pdf/PdfContentByte::showTextKerned → NO_COVERAGE |
showTextKerned(text); |
1731 | else | |
1732 |
1
1. showTextAligned : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE |
showText(text); |
1733 | } | |
1734 | else { | |
1735 |
2
1. showTextAligned : Replaced double multiplication with division → NO_COVERAGE 2. showTextAligned : Replaced double division with multiplication → NO_COVERAGE |
double alpha = rotation * Math.PI / 180.0; |
1736 | float cos = (float)Math.cos(alpha); | |
1737 | float sin = (float)Math.sin(alpha); | |
1738 | float len; | |
1739 | switch (alignment) { | |
1740 | case ALIGN_CENTER: | |
1741 |
1
1. showTextAligned : Replaced float division with multiplication → NO_COVERAGE |
len = getEffectiveStringWidth(text, kerned) / 2; |
1742 |
2
1. showTextAligned : Replaced float multiplication with division → NO_COVERAGE 2. showTextAligned : Replaced float subtraction with addition → NO_COVERAGE |
x -= len * cos; |
1743 |
2
1. showTextAligned : Replaced float multiplication with division → NO_COVERAGE 2. showTextAligned : Replaced float subtraction with addition → NO_COVERAGE |
y -= len * sin; |
1744 | break; | |
1745 | case ALIGN_RIGHT: | |
1746 | len = getEffectiveStringWidth(text, kerned); | |
1747 |
2
1. showTextAligned : Replaced float multiplication with division → NO_COVERAGE 2. showTextAligned : Replaced float subtraction with addition → NO_COVERAGE |
x -= len * cos; |
1748 |
2
1. showTextAligned : Replaced float multiplication with division → NO_COVERAGE 2. showTextAligned : Replaced float subtraction with addition → NO_COVERAGE |
y -= len * sin; |
1749 | break; | |
1750 | } | |
1751 |
2
1. showTextAligned : removed negation → NO_COVERAGE 2. showTextAligned : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE |
setTextMatrix(cos, sin, -sin, cos, x, y); |
1752 |
1
1. showTextAligned : negated conditional → NO_COVERAGE |
if (kerned) |
1753 |
1
1. showTextAligned : removed call to com/lowagie/text/pdf/PdfContentByte::showTextKerned → NO_COVERAGE |
showTextKerned(text); |
1754 | else | |
1755 |
1
1. showTextAligned : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE |
showText(text); |
1756 |
1
1. showTextAligned : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE |
setTextMatrix(0f, 0f); |
1757 | } | |
1758 | } | |
1759 | ||
1760 | /** | |
1761 | * Shows text kerned right, left or center aligned with rotation. | |
1762 | * @param alignment the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT | |
1763 | * @param text the text to show | |
1764 | * @param x the x pivot position | |
1765 | * @param y the y pivot position | |
1766 | * @param rotation the rotation to be applied in degrees counterclockwise | |
1767 | */ | |
1768 | public void showTextAlignedKerned(int alignment, String text, float x, float y, float rotation) { | |
1769 |
1
1. showTextAlignedKerned : removed call to com/lowagie/text/pdf/PdfContentByte::showTextAligned → NO_COVERAGE |
showTextAligned(alignment, text, x, y, rotation, true); |
1770 | } | |
1771 | ||
1772 | /** | |
1773 | * Concatenate a matrix to the current transformation matrix. | |
1774 | * @param a an element of the transformation matrix | |
1775 | * @param b an element of the transformation matrix | |
1776 | * @param c an element of the transformation matrix | |
1777 | * @param d an element of the transformation matrix | |
1778 | * @param e an element of the transformation matrix | |
1779 | * @param f an element of the transformation matrix | |
1780 | **/ | |
1781 | public void concatCTM(float a, float b, float c, float d, float e, float f) { | |
1782 | content.append(a).append(' ').append(b).append(' ').append(c).append(' '); | |
1783 | content.append(d).append(' ').append(e).append(' ').append(f).append(" cm").append_i(separator); | |
1784 | } | |
1785 | ||
1786 | /** | |
1787 | * Generates an array of bezier curves to draw an arc. | |
1788 | * <P> | |
1789 | * (x1, y1) and (x2, y2) are the corners of the enclosing rectangle. | |
1790 | * Angles, measured in degrees, start with 0 to the right (the positive X | |
1791 | * axis) and increase counter-clockwise. The arc extends from startAng | |
1792 | * to startAng+extent. I.e. startAng=0 and extent=180 yields an openside-down | |
1793 | * semi-circle. | |
1794 | * <P> | |
1795 | * The resulting coordinates are of the form float[]{x1,y1,x2,y2,x3,y3, x4,y4} | |
1796 | * such that the curve goes from (x1, y1) to (x4, y4) with (x2, y2) and | |
1797 | * (x3, y3) as their respective Bezier control points. | |
1798 | * <P> | |
1799 | * Note: this code was taken from ReportLab (www.reportlab.org), an excellent | |
1800 | * PDF generator for Python (BSD license: http://www.reportlab.org/devfaq.html#1.3 ). | |
1801 | * | |
1802 | * @param x1 a corner of the enclosing rectangle | |
1803 | * @param y1 a corner of the enclosing rectangle | |
1804 | * @param x2 a corner of the enclosing rectangle | |
1805 | * @param y2 a corner of the enclosing rectangle | |
1806 | * @param startAng starting angle in degrees | |
1807 | * @param extent angle extent in degrees | |
1808 | * @return a list of float[] with the bezier curves | |
1809 | */ | |
1810 | public static List<float[]> bezierArc(float x1, float y1, float x2, float y2, float startAng, float extent) { | |
1811 | float tmp; | |
1812 |
2
1. bezierArc : changed conditional boundary → NO_COVERAGE 2. bezierArc : negated conditional → NO_COVERAGE |
if (x1 > x2) { |
1813 | tmp = x1; | |
1814 | x1 = x2; | |
1815 | x2 = tmp; | |
1816 | } | |
1817 |
2
1. bezierArc : changed conditional boundary → NO_COVERAGE 2. bezierArc : negated conditional → NO_COVERAGE |
if (y2 > y1) { |
1818 | tmp = y1; | |
1819 | y1 = y2; | |
1820 | y2 = tmp; | |
1821 | } | |
1822 | ||
1823 | float fragAngle; | |
1824 | int Nfrag; | |
1825 |
2
1. bezierArc : changed conditional boundary → NO_COVERAGE 2. bezierArc : negated conditional → NO_COVERAGE |
if (Math.abs(extent) <= 90f) { |
1826 | fragAngle = extent; | |
1827 | Nfrag = 1; | |
1828 | } | |
1829 | else { | |
1830 |
1
1. bezierArc : Replaced float division with multiplication → NO_COVERAGE |
Nfrag = (int)(Math.ceil(Math.abs(extent)/90f)); |
1831 |
1
1. bezierArc : Replaced float division with multiplication → NO_COVERAGE |
fragAngle = extent / Nfrag; |
1832 | } | |
1833 |
2
1. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 2. bezierArc : Replaced float division with multiplication → NO_COVERAGE |
float x_cen = (x1+x2)/2f; |
1834 |
2
1. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 2. bezierArc : Replaced float division with multiplication → NO_COVERAGE |
float y_cen = (y1+y2)/2f; |
1835 |
2
1. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 2. bezierArc : Replaced float division with multiplication → NO_COVERAGE |
float rx = (x2-x1)/2f; |
1836 |
2
1. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 2. bezierArc : Replaced float division with multiplication → NO_COVERAGE |
float ry = (y2-y1)/2f; |
1837 |
2
1. bezierArc : Replaced double multiplication with division → NO_COVERAGE 2. bezierArc : Replaced double division with multiplication → NO_COVERAGE |
float halfAng = (float)(fragAngle * Math.PI / 360.); |
1838 |
3
1. bezierArc : Replaced double subtraction with addition → NO_COVERAGE 2. bezierArc : Replaced double multiplication with division → NO_COVERAGE 3. bezierArc : Replaced double division with multiplication → NO_COVERAGE |
float kappa = (float)(Math.abs(4. / 3. * (1. - Math.cos(halfAng)) / Math.sin(halfAng))); |
1839 | List<float[]> pointList = new ArrayList<>(); | |
1840 |
3
1. bezierArc : changed conditional boundary → NO_COVERAGE 2. bezierArc : Changed increment from 1 to -1 → NO_COVERAGE 3. bezierArc : negated conditional → NO_COVERAGE |
for (int i = 0; i < Nfrag; ++i) { |
1841 |
4
1. bezierArc : Replaced float multiplication with division → NO_COVERAGE 2. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 3. bezierArc : Replaced double multiplication with division → NO_COVERAGE 4. bezierArc : Replaced double division with multiplication → NO_COVERAGE |
float theta0 = (float)((startAng + i*fragAngle) * Math.PI / 180.); |
1842 |
5
1. bezierArc : Replaced integer addition with subtraction → NO_COVERAGE 2. bezierArc : Replaced float multiplication with division → NO_COVERAGE 3. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 4. bezierArc : Replaced double multiplication with division → NO_COVERAGE 5. bezierArc : Replaced double division with multiplication → NO_COVERAGE |
float theta1 = (float)((startAng + (i+1)*fragAngle) * Math.PI / 180.); |
1843 | float cos0 = (float)Math.cos(theta0); | |
1844 | float cos1 = (float)Math.cos(theta1); | |
1845 | float sin0 = (float)Math.sin(theta0); | |
1846 | float sin1 = (float)Math.sin(theta1); | |
1847 |
2
1. bezierArc : changed conditional boundary → NO_COVERAGE 2. bezierArc : negated conditional → NO_COVERAGE |
if (fragAngle > 0f) { |
1848 |
24
1. bezierArc : Replaced float multiplication with division → NO_COVERAGE 2. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 3. bezierArc : Replaced float multiplication with division → NO_COVERAGE 4. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 5. bezierArc : Replaced float multiplication with division → NO_COVERAGE 6. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 7. bezierArc : Replaced float multiplication with division → NO_COVERAGE 8. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 9. bezierArc : Replaced float multiplication with division → NO_COVERAGE 10. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 11. bezierArc : Replaced float multiplication with division → NO_COVERAGE 12. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 13. bezierArc : Replaced float multiplication with division → NO_COVERAGE 14. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 15. bezierArc : Replaced float multiplication with division → NO_COVERAGE 16. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 17. bezierArc : Replaced float multiplication with division → NO_COVERAGE 18. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 19. bezierArc : Replaced float multiplication with division → NO_COVERAGE 20. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 21. bezierArc : Replaced float multiplication with division → NO_COVERAGE 22. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 23. bezierArc : Replaced float multiplication with division → NO_COVERAGE 24. bezierArc : Replaced float subtraction with addition → NO_COVERAGE |
pointList.add(new float[]{x_cen + rx * cos0, |
1849 | y_cen - ry * sin0, | |
1850 | x_cen + rx * (cos0 - kappa * sin0), | |
1851 | y_cen - ry * (sin0 + kappa * cos0), | |
1852 | x_cen + rx * (cos1 + kappa * sin1), | |
1853 | y_cen - ry * (sin1 - kappa * cos1), | |
1854 | x_cen + rx * cos1, | |
1855 | y_cen - ry * sin1}); | |
1856 | } | |
1857 | else { | |
1858 |
24
1. bezierArc : Replaced float multiplication with division → NO_COVERAGE 2. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 3. bezierArc : Replaced float multiplication with division → NO_COVERAGE 4. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 5. bezierArc : Replaced float multiplication with division → NO_COVERAGE 6. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 7. bezierArc : Replaced float multiplication with division → NO_COVERAGE 8. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 9. bezierArc : Replaced float multiplication with division → NO_COVERAGE 10. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 11. bezierArc : Replaced float multiplication with division → NO_COVERAGE 12. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 13. bezierArc : Replaced float multiplication with division → NO_COVERAGE 14. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 15. bezierArc : Replaced float multiplication with division → NO_COVERAGE 16. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 17. bezierArc : Replaced float multiplication with division → NO_COVERAGE 18. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 19. bezierArc : Replaced float multiplication with division → NO_COVERAGE 20. bezierArc : Replaced float subtraction with addition → NO_COVERAGE 21. bezierArc : Replaced float multiplication with division → NO_COVERAGE 22. bezierArc : Replaced float addition with subtraction → NO_COVERAGE 23. bezierArc : Replaced float multiplication with division → NO_COVERAGE 24. bezierArc : Replaced float subtraction with addition → NO_COVERAGE |
pointList.add(new float[]{x_cen + rx * cos0, |
1859 | y_cen - ry * sin0, | |
1860 | x_cen + rx * (cos0 + kappa * sin0), | |
1861 | y_cen - ry * (sin0 - kappa * cos0), | |
1862 | x_cen + rx * (cos1 - kappa * sin1), | |
1863 | y_cen - ry * (sin1 + kappa * cos1), | |
1864 | x_cen + rx * cos1, | |
1865 | y_cen - ry * sin1}); | |
1866 | } | |
1867 | } | |
1868 |
1
1. bezierArc : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::bezierArc to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return pointList; |
1869 | } | |
1870 | ||
1871 | /** | |
1872 | * Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2, | |
1873 | * starting at startAng degrees and covering extent degrees. Angles | |
1874 | * start with 0 to the right (+x) and increase counter-clockwise. | |
1875 | * | |
1876 | * @param x1 a corner of the enclosing rectangle | |
1877 | * @param y1 a corner of the enclosing rectangle | |
1878 | * @param x2 a corner of the enclosing rectangle | |
1879 | * @param y2 a corner of the enclosing rectangle | |
1880 | * @param startAng starting angle in degrees | |
1881 | * @param extent angle extent in degrees | |
1882 | */ | |
1883 | public void arc(float x1, float y1, float x2, float y2, float startAng, float extent) { | |
1884 | List<float[]> ar = bezierArc(x1, y1, x2, y2, startAng, extent); | |
1885 |
1
1. arc : negated conditional → NO_COVERAGE |
if (ar.isEmpty()) |
1886 | return; | |
1887 | float[] pt = ar.get(0); | |
1888 |
1
1. arc : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(pt[0], pt[1]); |
1889 | for (float[] anAr : ar) { | |
1890 | pt = anAr; | |
1891 |
1
1. arc : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
curveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]); |
1892 | } | |
1893 | } | |
1894 | ||
1895 | /** | |
1896 | * Draws an ellipse inscribed within the rectangle x1,y1,x2,y2. | |
1897 | * | |
1898 | * @param x1 a corner of the enclosing rectangle | |
1899 | * @param y1 a corner of the enclosing rectangle | |
1900 | * @param x2 a corner of the enclosing rectangle | |
1901 | * @param y2 a corner of the enclosing rectangle | |
1902 | */ | |
1903 | public void ellipse(float x1, float y1, float x2, float y2) { | |
1904 |
1
1. ellipse : removed call to com/lowagie/text/pdf/PdfContentByte::arc → NO_COVERAGE |
arc(x1, y1, x2, y2, 0f, 360f); |
1905 | } | |
1906 | ||
1907 | /** | |
1908 | * Create a new colored tiling pattern. | |
1909 | * | |
1910 | * @param width the width of the pattern | |
1911 | * @param height the height of the pattern | |
1912 | * @param xstep the desired horizontal spacing between pattern cells. | |
1913 | * May be either positive or negative, but not zero. | |
1914 | * @param ystep the desired vertical spacing between pattern cells. | |
1915 | * May be either positive or negative, but not zero. | |
1916 | * @return the <CODE>PdfPatternPainter</CODE> where the pattern will be created | |
1917 | */ | |
1918 | public PdfPatternPainter createPattern(float width, float height, float xstep, float ystep) { | |
1919 |
1
1. createPattern : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
1920 |
2
1. createPattern : negated conditional → NO_COVERAGE 2. createPattern : negated conditional → NO_COVERAGE |
if ( xstep == 0.0f || ystep == 0.0f ) |
1921 | throw new RuntimeException(MessageLocalization.getComposedMessage("xstep.or.ystep.can.not.be.zero")); | |
1922 | PdfPatternPainter painter = new PdfPatternPainter(writer); | |
1923 |
1
1. createPattern : removed call to com/lowagie/text/pdf/PdfPatternPainter::setWidth → NO_COVERAGE |
painter.setWidth(width); |
1924 |
1
1. createPattern : removed call to com/lowagie/text/pdf/PdfPatternPainter::setHeight → NO_COVERAGE |
painter.setHeight(height); |
1925 |
1
1. createPattern : removed call to com/lowagie/text/pdf/PdfPatternPainter::setXStep → NO_COVERAGE |
painter.setXStep(xstep); |
1926 |
1
1. createPattern : removed call to com/lowagie/text/pdf/PdfPatternPainter::setYStep → NO_COVERAGE |
painter.setYStep(ystep); |
1927 | writer.addSimplePattern(painter); | |
1928 |
1
1. createPattern : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::createPattern to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return painter; |
1929 | } | |
1930 | ||
1931 | /** | |
1932 | * Create a new colored tiling pattern. Variables xstep and ystep are set to the same values | |
1933 | * of width and height. | |
1934 | * @param width the width of the pattern | |
1935 | * @param height the height of the pattern | |
1936 | * @return the <CODE>PdfPatternPainter</CODE> where the pattern will be created | |
1937 | */ | |
1938 | public PdfPatternPainter createPattern(float width, float height) { | |
1939 | return createPattern(width, height, width, height); | |
1940 | } | |
1941 | ||
1942 | /** | |
1943 | * Create a new uncolored tiling pattern. | |
1944 | * | |
1945 | * @param width the width of the pattern | |
1946 | * @param height the height of the pattern | |
1947 | * @param xstep the desired horizontal spacing between pattern cells. | |
1948 | * May be either positive or negative, but not zero. | |
1949 | * @param ystep the desired vertical spacing between pattern cells. | |
1950 | * May be either positive or negative, but not zero. | |
1951 | * @param color the default color. Can be <CODE>null</CODE> | |
1952 | * @return the <CODE>PdfPatternPainter</CODE> where the pattern will be created | |
1953 | */ | |
1954 | public PdfPatternPainter createPattern(float width, float height, float xstep, float ystep, Color color) { | |
1955 |
1
1. createPattern : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
1956 |
2
1. createPattern : negated conditional → NO_COVERAGE 2. createPattern : negated conditional → NO_COVERAGE |
if ( xstep == 0.0f || ystep == 0.0f ) |
1957 | throw new RuntimeException(MessageLocalization.getComposedMessage("xstep.or.ystep.can.not.be.zero")); | |
1958 | PdfPatternPainter painter = new PdfPatternPainter(writer, color); | |
1959 |
1
1. createPattern : removed call to com/lowagie/text/pdf/PdfPatternPainter::setWidth → NO_COVERAGE |
painter.setWidth(width); |
1960 |
1
1. createPattern : removed call to com/lowagie/text/pdf/PdfPatternPainter::setHeight → NO_COVERAGE |
painter.setHeight(height); |
1961 |
1
1. createPattern : removed call to com/lowagie/text/pdf/PdfPatternPainter::setXStep → NO_COVERAGE |
painter.setXStep(xstep); |
1962 |
1
1. createPattern : removed call to com/lowagie/text/pdf/PdfPatternPainter::setYStep → NO_COVERAGE |
painter.setYStep(ystep); |
1963 | writer.addSimplePattern(painter); | |
1964 |
1
1. createPattern : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::createPattern to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return painter; |
1965 | } | |
1966 | ||
1967 | /** | |
1968 | * Create a new uncolored tiling pattern. | |
1969 | * Variables xstep and ystep are set to the same values | |
1970 | * of width and height. | |
1971 | * @param width the width of the pattern | |
1972 | * @param height the height of the pattern | |
1973 | * @param color the default color. Can be <CODE>null</CODE> | |
1974 | * @return the <CODE>PdfPatternPainter</CODE> where the pattern will be created | |
1975 | */ | |
1976 | public PdfPatternPainter createPattern(float width, float height, Color color) { | |
1977 | return createPattern(width, height, width, height, color); | |
1978 | } | |
1979 | ||
1980 | /** | |
1981 | * Creates a new template. | |
1982 | * <P> | |
1983 | * Creates a new template that is nothing more than a form XObject. This template can be included | |
1984 | * in this <CODE>PdfContentByte</CODE> or in another template. Templates are only written | |
1985 | * to the output when the document is closed permitting things like showing text in the first page | |
1986 | * that is only defined in the last page. | |
1987 | * | |
1988 | * @param width the bounding box width | |
1989 | * @param height the bounding box height | |
1990 | * @return the created template | |
1991 | */ | |
1992 | public PdfTemplate createTemplate(float width, float height) { | |
1993 |
1
1. createTemplate : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::createTemplate to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return createTemplate(width, height, null); |
1994 | } | |
1995 | ||
1996 | PdfTemplate createTemplate(float width, float height, PdfName forcedName) { | |
1997 |
1
1. createTemplate : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
1998 | PdfTemplate template = new PdfTemplate(writer); | |
1999 |
1
1. createTemplate : removed call to com/lowagie/text/pdf/PdfTemplate::setWidth → NO_COVERAGE |
template.setWidth(width); |
2000 |
1
1. createTemplate : removed call to com/lowagie/text/pdf/PdfTemplate::setHeight → NO_COVERAGE |
template.setHeight(height); |
2001 | writer.addDirectTemplateSimple(template, forcedName); | |
2002 |
1
1. createTemplate : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::createTemplate to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return template; |
2003 | } | |
2004 | ||
2005 | /** | |
2006 | * Creates a new appearance to be used with form fields. | |
2007 | * | |
2008 | * @param width the bounding box width | |
2009 | * @param height the bounding box height | |
2010 | * @return the appearance created | |
2011 | */ | |
2012 | public PdfAppearance createAppearance(float width, float height) { | |
2013 |
1
1. createAppearance : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::createAppearance to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return createAppearance(width, height, null); |
2014 | } | |
2015 | ||
2016 | PdfAppearance createAppearance(float width, float height, PdfName forcedName) { | |
2017 |
1
1. createAppearance : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
2018 | PdfAppearance template = new PdfAppearance(writer); | |
2019 |
1
1. createAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::setWidth → NO_COVERAGE |
template.setWidth(width); |
2020 |
1
1. createAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::setHeight → NO_COVERAGE |
template.setHeight(height); |
2021 | writer.addDirectTemplateSimple(template, forcedName); | |
2022 |
1
1. createAppearance : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::createAppearance to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return template; |
2023 | } | |
2024 | ||
2025 | /** | |
2026 | * Adds a PostScript XObject to this content. | |
2027 | * | |
2028 | * @param psobject the object | |
2029 | */ | |
2030 | public void addPSXObject(PdfPSXObject psobject) { | |
2031 |
1
1. addPSXObject : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
2032 | PdfName name = writer.addDirectTemplateSimple(psobject, null); | |
2033 | PageResources prs = getPageResources(); | |
2034 | name = prs.addXObject(name, psobject.getIndirectReference()); | |
2035 | content.append(name.getBytes()).append(" Do").append_i(separator); | |
2036 | } | |
2037 | ||
2038 | /** | |
2039 | * Adds a template to this content. | |
2040 | * | |
2041 | * @param template the template | |
2042 | * @param a an element of the transformation matrix | |
2043 | * @param b an element of the transformation matrix | |
2044 | * @param c an element of the transformation matrix | |
2045 | * @param d an element of the transformation matrix | |
2046 | * @param e an element of the transformation matrix | |
2047 | * @param f an element of the transformation matrix | |
2048 | */ | |
2049 | public void addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f) { | |
2050 |
1
1. addTemplate : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
2051 |
1
1. addTemplate : removed call to com/lowagie/text/pdf/PdfContentByte::checkNoPattern → NO_COVERAGE |
checkNoPattern(template); |
2052 | PdfName name = writer.addDirectTemplateSimple(template, null); | |
2053 | PageResources prs = getPageResources(); | |
2054 | name = prs.addXObject(name, template.getIndirectReference()); | |
2055 | content.append("q "); | |
2056 | content.append(a).append(' '); | |
2057 | content.append(b).append(' '); | |
2058 | content.append(c).append(' '); | |
2059 | content.append(d).append(' '); | |
2060 | content.append(e).append(' '); | |
2061 | content.append(f).append(" cm "); | |
2062 | content.append(name.getBytes()).append(" Do Q").append_i(separator); | |
2063 | } | |
2064 | ||
2065 | void addTemplateReference(PdfIndirectReference template, PdfName name, float a, float b, float c, float d, float e, float f) { | |
2066 |
1
1. addTemplateReference : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
2067 | PageResources prs = getPageResources(); | |
2068 | name = prs.addXObject(name, template); | |
2069 | content.append("q "); | |
2070 | content.append(a).append(' '); | |
2071 | content.append(b).append(' '); | |
2072 | content.append(c).append(' '); | |
2073 | content.append(d).append(' '); | |
2074 | content.append(e).append(' '); | |
2075 | content.append(f).append(" cm "); | |
2076 | content.append(name.getBytes()).append(" Do Q").append_i(separator); | |
2077 | } | |
2078 | ||
2079 | /** | |
2080 | * Adds a template to this content. | |
2081 | * | |
2082 | * @param template the template | |
2083 | * @param x the x location of this template | |
2084 | * @param y the y location of this template | |
2085 | */ | |
2086 | public void addTemplate(PdfTemplate template, float x, float y) { | |
2087 |
1
1. addTemplate : removed call to com/lowagie/text/pdf/PdfContentByte::addTemplate → NO_COVERAGE |
addTemplate(template, 1, 0, 0, 1, x, y); |
2088 | } | |
2089 | ||
2090 | /** | |
2091 | * Changes the current color for filling paths (device dependent colors!). | |
2092 | * <P> | |
2093 | * Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space), | |
2094 | * and sets the color to use for filling paths.</P> | |
2095 | * <P> | |
2096 | * This method is described in the 'Portable Document Format Reference Manual version 1.3' | |
2097 | * section 8.5.2.1 (page 331).</P> | |
2098 | * <P> | |
2099 | * Following the PDF manual, each operand must be a number between 0 (no ink) and | |
2100 | * 1 (maximum ink). This method however accepts only integers between 0x00 and 0xFF.</P> | |
2101 | * | |
2102 | * @param cyan the intensity of cyan | |
2103 | * @param magenta the intensity of magenta | |
2104 | * @param yellow the intensity of yellow | |
2105 | * @param black the intensity of black | |
2106 | */ | |
2107 | ||
2108 | public void setCMYKColorFill(int cyan, int magenta, int yellow, int black) { | |
2109 |
2
1. setCMYKColorFill : Replaced bitwise AND with OR → NO_COVERAGE 2. setCMYKColorFill : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(cyan & 0xFF) / 0xFF); |
2110 | content.append(' '); | |
2111 |
2
1. setCMYKColorFill : Replaced bitwise AND with OR → NO_COVERAGE 2. setCMYKColorFill : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(magenta & 0xFF) / 0xFF); |
2112 | content.append(' '); | |
2113 |
2
1. setCMYKColorFill : Replaced bitwise AND with OR → NO_COVERAGE 2. setCMYKColorFill : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(yellow & 0xFF) / 0xFF); |
2114 | content.append(' '); | |
2115 |
2
1. setCMYKColorFill : Replaced bitwise AND with OR → NO_COVERAGE 2. setCMYKColorFill : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(black & 0xFF) / 0xFF); |
2116 | content.append(" k").append_i(separator); | |
2117 | } | |
2118 | /** | |
2119 | * Changes the current color for stroking paths (device dependent colors!). | |
2120 | * <P> | |
2121 | * Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space), | |
2122 | * and sets the color to use for stroking paths.</P> | |
2123 | * <P> | |
2124 | * This method is described in the 'Portable Document Format Reference Manual version 1.3' | |
2125 | * section 8.5.2.1 (page 331).</P> | |
2126 | * Following the PDF manual, each operand must be a number between 0 (minimum intensity) and | |
2127 | * 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF. | |
2128 | * | |
2129 | * @param cyan the intensity of red | |
2130 | * @param magenta the intensity of green | |
2131 | * @param yellow the intensity of blue | |
2132 | * @param black the intensity of black | |
2133 | */ | |
2134 | ||
2135 | public void setCMYKColorStroke(int cyan, int magenta, int yellow, int black) { | |
2136 |
2
1. setCMYKColorStroke : Replaced bitwise AND with OR → NO_COVERAGE 2. setCMYKColorStroke : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(cyan & 0xFF) / 0xFF); |
2137 | content.append(' '); | |
2138 |
2
1. setCMYKColorStroke : Replaced bitwise AND with OR → NO_COVERAGE 2. setCMYKColorStroke : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(magenta & 0xFF) / 0xFF); |
2139 | content.append(' '); | |
2140 |
2
1. setCMYKColorStroke : Replaced bitwise AND with OR → NO_COVERAGE 2. setCMYKColorStroke : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(yellow & 0xFF) / 0xFF); |
2141 | content.append(' '); | |
2142 |
2
1. setCMYKColorStroke : Replaced bitwise AND with OR → NO_COVERAGE 2. setCMYKColorStroke : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(black & 0xFF) / 0xFF); |
2143 | content.append(" K").append_i(separator); | |
2144 | } | |
2145 | ||
2146 | /** | |
2147 | * Changes the current color for filling paths (device dependent colors!). | |
2148 | * <P> | |
2149 | * Sets the color space to <B>DeviceRGB</B> (or the <B>DefaultRGB</B> color space), | |
2150 | * and sets the color to use for filling paths.</P> | |
2151 | * <P> | |
2152 | * This method is described in the 'Portable Document Format Reference Manual version 1.3' | |
2153 | * section 8.5.2.1 (page 331).</P> | |
2154 | * <P> | |
2155 | * Following the PDF manual, each operand must be a number between 0 (minimum intensity) and | |
2156 | * 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF.</P> | |
2157 | * | |
2158 | * @param red the intensity of red | |
2159 | * @param green the intensity of green | |
2160 | * @param blue the intensity of blue | |
2161 | */ | |
2162 | ||
2163 | public void setRGBColorFill(int red, int green, int blue) { | |
2164 |
7
1. setRGBColorFill : Replaced bitwise AND with OR → NO_COVERAGE 2. setRGBColorFill : Replaced float division with multiplication → NO_COVERAGE 3. setRGBColorFill : Replaced bitwise AND with OR → NO_COVERAGE 4. setRGBColorFill : Replaced float division with multiplication → NO_COVERAGE 5. setRGBColorFill : Replaced bitwise AND with OR → NO_COVERAGE 6. setRGBColorFill : Replaced float division with multiplication → NO_COVERAGE 7. setRGBColorFill : removed call to com/lowagie/text/pdf/PdfContentByte::HelperRGB → NO_COVERAGE |
HelperRGB((float)(red & 0xFF) / 0xFF, (float)(green & 0xFF) / 0xFF, (float)(blue & 0xFF) / 0xFF); |
2165 | content.append(" rg").append_i(separator); | |
2166 | } | |
2167 | ||
2168 | /** | |
2169 | * Changes the current color for stroking paths (device dependent colors!). | |
2170 | * <P> | |
2171 | * Sets the color space to <B>DeviceRGB</B> (or the <B>DefaultRGB</B> color space), | |
2172 | * and sets the color to use for stroking paths.</P> | |
2173 | * <P> | |
2174 | * This method is described in the 'Portable Document Format Reference Manual version 1.3' | |
2175 | * section 8.5.2.1 (page 331).</P> | |
2176 | * Following the PDF manual, each operand must be a number between 0 (minimum intensity) and | |
2177 | * 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF. | |
2178 | * | |
2179 | * @param red the intensity of red | |
2180 | * @param green the intensity of green | |
2181 | * @param blue the intensity of blue | |
2182 | */ | |
2183 | ||
2184 | public void setRGBColorStroke(int red, int green, int blue) { | |
2185 |
7
1. setRGBColorStroke : Replaced bitwise AND with OR → NO_COVERAGE 2. setRGBColorStroke : Replaced float division with multiplication → NO_COVERAGE 3. setRGBColorStroke : Replaced bitwise AND with OR → NO_COVERAGE 4. setRGBColorStroke : Replaced float division with multiplication → NO_COVERAGE 5. setRGBColorStroke : Replaced bitwise AND with OR → NO_COVERAGE 6. setRGBColorStroke : Replaced float division with multiplication → NO_COVERAGE 7. setRGBColorStroke : removed call to com/lowagie/text/pdf/PdfContentByte::HelperRGB → NO_COVERAGE |
HelperRGB((float)(red & 0xFF) / 0xFF, (float)(green & 0xFF) / 0xFF, (float)(blue & 0xFF) / 0xFF); |
2186 | content.append(" RG").append_i(separator); | |
2187 | } | |
2188 | ||
2189 | /** Sets the stroke color. <CODE>color</CODE> can be an | |
2190 | * <CODE>ExtendedColor</CODE>. | |
2191 | * @param color the color | |
2192 | */ | |
2193 | public void setColorStroke(Color color) { | |
2194 |
1
1. setColorStroke : removed call to com/lowagie/text/pdf/internal/PdfXConformanceImp::checkPDFXConformance → NO_COVERAGE |
PdfXConformanceImp.checkPDFXConformance(writer, PdfXConformanceImp.PDFXKEY_COLOR, color); |
2195 | int type = ExtendedColor.getType(color); | |
2196 | switch (type) { | |
2197 | case ExtendedColor.TYPE_GRAY: { | |
2198 |
1
1. setColorStroke : removed call to com/lowagie/text/pdf/PdfContentByte::setGrayStroke → NO_COVERAGE |
setGrayStroke(((GrayColor)color).getGray()); |
2199 | break; | |
2200 | } | |
2201 | case ExtendedColor.TYPE_CMYK: { | |
2202 | CMYKColor cmyk = (CMYKColor)color; | |
2203 |
1
1. setColorStroke : removed call to com/lowagie/text/pdf/PdfContentByte::setCMYKColorStrokeF → NO_COVERAGE |
setCMYKColorStrokeF(cmyk.getCyan(), cmyk.getMagenta(), cmyk.getYellow(), cmyk.getBlack()); |
2204 | break; | |
2205 | } | |
2206 | case ExtendedColor.TYPE_SEPARATION: { | |
2207 | SpotColor spot = (SpotColor)color; | |
2208 |
1
1. setColorStroke : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(spot.getPdfSpotColor(), spot.getTint()); |
2209 | break; | |
2210 | } | |
2211 | case ExtendedColor.TYPE_PATTERN: { | |
2212 | PatternColor pat = (PatternColor) color; | |
2213 |
1
1. setColorStroke : removed call to com/lowagie/text/pdf/PdfContentByte::setPatternStroke → NO_COVERAGE |
setPatternStroke(pat.getPainter()); |
2214 | break; | |
2215 | } | |
2216 | case ExtendedColor.TYPE_SHADING: { | |
2217 | ShadingColor shading = (ShadingColor) color; | |
2218 |
1
1. setColorStroke : removed call to com/lowagie/text/pdf/PdfContentByte::setShadingStroke → NO_COVERAGE |
setShadingStroke(shading.getPdfShadingPattern()); |
2219 | break; | |
2220 | } | |
2221 | default: | |
2222 |
1
1. setColorStroke : removed call to com/lowagie/text/pdf/PdfContentByte::setRGBColorStroke → NO_COVERAGE |
setRGBColorStroke(color.getRed(), color.getGreen(), color.getBlue()); |
2223 | } | |
2224 | } | |
2225 | ||
2226 | /** Sets the fill color. <CODE>color</CODE> can be an | |
2227 | * <CODE>ExtendedColor</CODE>. | |
2228 | * @param color the color | |
2229 | */ | |
2230 | public void setColorFill(Color color) { | |
2231 |
1
1. setColorFill : removed call to com/lowagie/text/pdf/internal/PdfXConformanceImp::checkPDFXConformance → NO_COVERAGE |
PdfXConformanceImp.checkPDFXConformance(writer, PdfXConformanceImp.PDFXKEY_COLOR, color); |
2232 | int type = ExtendedColor.getType(color); | |
2233 | switch (type) { | |
2234 | case ExtendedColor.TYPE_GRAY: { | |
2235 |
1
1. setColorFill : removed call to com/lowagie/text/pdf/PdfContentByte::setGrayFill → NO_COVERAGE |
setGrayFill(((GrayColor)color).getGray()); |
2236 | break; | |
2237 | } | |
2238 | case ExtendedColor.TYPE_CMYK: { | |
2239 | CMYKColor cmyk = (CMYKColor)color; | |
2240 |
1
1. setColorFill : removed call to com/lowagie/text/pdf/PdfContentByte::setCMYKColorFillF → NO_COVERAGE |
setCMYKColorFillF(cmyk.getCyan(), cmyk.getMagenta(), cmyk.getYellow(), cmyk.getBlack()); |
2241 | break; | |
2242 | } | |
2243 | case ExtendedColor.TYPE_SEPARATION: { | |
2244 | SpotColor spot = (SpotColor)color; | |
2245 |
1
1. setColorFill : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
setColorFill(spot.getPdfSpotColor(), spot.getTint()); |
2246 | break; | |
2247 | } | |
2248 | case ExtendedColor.TYPE_PATTERN: { | |
2249 | PatternColor pat = (PatternColor) color; | |
2250 |
1
1. setColorFill : removed call to com/lowagie/text/pdf/PdfContentByte::setPatternFill → NO_COVERAGE |
setPatternFill(pat.getPainter()); |
2251 | break; | |
2252 | } | |
2253 | case ExtendedColor.TYPE_SHADING: { | |
2254 | ShadingColor shading = (ShadingColor) color; | |
2255 |
1
1. setColorFill : removed call to com/lowagie/text/pdf/PdfContentByte::setShadingFill → NO_COVERAGE |
setShadingFill(shading.getPdfShadingPattern()); |
2256 | break; | |
2257 | } | |
2258 | default: | |
2259 |
1
1. setColorFill : removed call to com/lowagie/text/pdf/PdfContentByte::setRGBColorFill → NO_COVERAGE |
setRGBColorFill(color.getRed(), color.getGreen(), color.getBlue()); |
2260 | } | |
2261 | } | |
2262 | ||
2263 | /** Sets the fill color to a spot color. | |
2264 | * @param sp the spot color | |
2265 | * @param tint the tint for the spot color. 0 is no color and 1 | |
2266 | * is 100% color | |
2267 | */ | |
2268 | public void setColorFill(PdfSpotColor sp, float tint) { | |
2269 |
1
1. setColorFill : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
2270 | state.colorDetails = writer.addSimple(sp); | |
2271 | PageResources prs = getPageResources(); | |
2272 | PdfName name = state.colorDetails.getColorName(); | |
2273 | name = prs.addColor(name, state.colorDetails.getIndirectReference()); | |
2274 | content.append(name.getBytes()).append(" cs ").append(tint).append(" scn").append_i(separator); | |
2275 | } | |
2276 | ||
2277 | /** Sets the stroke color to a spot color. | |
2278 | * @param sp the spot color | |
2279 | * @param tint the tint for the spot color. 0 is no color and 1 | |
2280 | * is 100% color | |
2281 | */ | |
2282 | public void setColorStroke(PdfSpotColor sp, float tint) { | |
2283 |
1
1. setColorStroke : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
2284 | state.colorDetails = writer.addSimple(sp); | |
2285 | PageResources prs = getPageResources(); | |
2286 | PdfName name = state.colorDetails.getColorName(); | |
2287 | name = prs.addColor(name, state.colorDetails.getIndirectReference()); | |
2288 | content.append(name.getBytes()).append(" CS ").append(tint).append(" SCN").append_i(separator); | |
2289 | } | |
2290 | ||
2291 | /** Sets the fill color to a pattern. The pattern can be | |
2292 | * colored or uncolored. | |
2293 | * @param p the pattern | |
2294 | */ | |
2295 | public void setPatternFill(PdfPatternPainter p) { | |
2296 |
1
1. setPatternFill : negated conditional → NO_COVERAGE |
if (p.isStencil()) { |
2297 |
1
1. setPatternFill : removed call to com/lowagie/text/pdf/PdfContentByte::setPatternFill → NO_COVERAGE |
setPatternFill(p, p.getDefaultColor()); |
2298 | return; | |
2299 | } | |
2300 |
1
1. setPatternFill : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
2301 | PageResources prs = getPageResources(); | |
2302 | PdfName name = writer.addSimplePattern(p); | |
2303 | name = prs.addPattern(name, p.getIndirectReference()); | |
2304 | content.append(PdfName.PATTERN.getBytes()).append(" cs ").append(name.getBytes()).append(" scn").append_i(separator); | |
2305 | } | |
2306 | ||
2307 | /** Outputs the color values to the content. | |
2308 | * @param color The color | |
2309 | * @param tint the tint if it is a spot color, ignored otherwise | |
2310 | */ | |
2311 | void outputColorNumbers(Color color, float tint) { | |
2312 |
1
1. outputColorNumbers : removed call to com/lowagie/text/pdf/internal/PdfXConformanceImp::checkPDFXConformance → NO_COVERAGE |
PdfXConformanceImp.checkPDFXConformance(writer, PdfXConformanceImp.PDFXKEY_COLOR, color); |
2313 | int type = ExtendedColor.getType(color); | |
2314 | switch (type) { | |
2315 | case ExtendedColor.TYPE_RGB: | |
2316 |
1
1. outputColorNumbers : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(color.getRed()) / 0xFF); |
2317 | content.append(' '); | |
2318 |
1
1. outputColorNumbers : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(color.getGreen()) / 0xFF); |
2319 | content.append(' '); | |
2320 |
1
1. outputColorNumbers : Replaced float division with multiplication → NO_COVERAGE |
content.append((float)(color.getBlue()) / 0xFF); |
2321 | break; | |
2322 | case ExtendedColor.TYPE_GRAY: | |
2323 | content.append(((GrayColor)color).getGray()); | |
2324 | break; | |
2325 | case ExtendedColor.TYPE_CMYK: { | |
2326 | CMYKColor cmyk = (CMYKColor)color; | |
2327 | content.append(cmyk.getCyan()).append(' ').append(cmyk.getMagenta()); | |
2328 | content.append(' ').append(cmyk.getYellow()).append(' ').append(cmyk.getBlack()); | |
2329 | break; | |
2330 | } | |
2331 | case ExtendedColor.TYPE_SEPARATION: | |
2332 | content.append(tint); | |
2333 | break; | |
2334 | default: | |
2335 | throw new RuntimeException(MessageLocalization.getComposedMessage("invalid.color.type")); | |
2336 | } | |
2337 | } | |
2338 | ||
2339 | /** Sets the fill color to an uncolored pattern. | |
2340 | * @param p the pattern | |
2341 | * @param color the color of the pattern | |
2342 | */ | |
2343 | public void setPatternFill(PdfPatternPainter p, Color color) { | |
2344 |
1
1. setPatternFill : negated conditional → NO_COVERAGE |
if (ExtendedColor.getType(color) == ExtendedColor.TYPE_SEPARATION) |
2345 |
1
1. setPatternFill : removed call to com/lowagie/text/pdf/PdfContentByte::setPatternFill → NO_COVERAGE |
setPatternFill(p, color, ((SpotColor)color).getTint()); |
2346 | else | |
2347 |
1
1. setPatternFill : removed call to com/lowagie/text/pdf/PdfContentByte::setPatternFill → NO_COVERAGE |
setPatternFill(p, color, 0); |
2348 | } | |
2349 | ||
2350 | /** Sets the fill color to an uncolored pattern. | |
2351 | * @param p the pattern | |
2352 | * @param color the color of the pattern | |
2353 | * @param tint the tint if the color is a spot color, ignored otherwise | |
2354 | */ | |
2355 | public void setPatternFill(PdfPatternPainter p, Color color, float tint) { | |
2356 |
1
1. setPatternFill : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
2357 |
1
1. setPatternFill : negated conditional → NO_COVERAGE |
if (!p.isStencil()) |
2358 | throw new RuntimeException(MessageLocalization.getComposedMessage("an.uncolored.pattern.was.expected")); | |
2359 | PageResources prs = getPageResources(); | |
2360 | PdfName name = writer.addSimplePattern(p); | |
2361 | name = prs.addPattern(name, p.getIndirectReference()); | |
2362 | ColorDetails csDetail = writer.addSimplePatternColorspace(color); | |
2363 | PdfName cName = prs.addColor(csDetail.getColorName(), csDetail.getIndirectReference()); | |
2364 | content.append(cName.getBytes()).append(" cs").append_i(separator); | |
2365 |
1
1. setPatternFill : removed call to com/lowagie/text/pdf/PdfContentByte::outputColorNumbers → NO_COVERAGE |
outputColorNumbers(color, tint); |
2366 | content.append(' ').append(name.getBytes()).append(" scn").append_i(separator); | |
2367 | } | |
2368 | ||
2369 | /** Sets the stroke color to an uncolored pattern. | |
2370 | * @param p the pattern | |
2371 | * @param color the color of the pattern | |
2372 | */ | |
2373 | public void setPatternStroke(PdfPatternPainter p, Color color) { | |
2374 |
1
1. setPatternStroke : negated conditional → NO_COVERAGE |
if (ExtendedColor.getType(color) == ExtendedColor.TYPE_SEPARATION) |
2375 |
1
1. setPatternStroke : removed call to com/lowagie/text/pdf/PdfContentByte::setPatternStroke → NO_COVERAGE |
setPatternStroke(p, color, ((SpotColor)color).getTint()); |
2376 | else | |
2377 |
1
1. setPatternStroke : removed call to com/lowagie/text/pdf/PdfContentByte::setPatternStroke → NO_COVERAGE |
setPatternStroke(p, color, 0); |
2378 | } | |
2379 | ||
2380 | /** Sets the stroke color to an uncolored pattern. | |
2381 | * @param p the pattern | |
2382 | * @param color the color of the pattern | |
2383 | * @param tint the tint if the color is a spot color, ignored otherwise | |
2384 | */ | |
2385 | public void setPatternStroke(PdfPatternPainter p, Color color, float tint) { | |
2386 |
1
1. setPatternStroke : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
2387 |
1
1. setPatternStroke : negated conditional → NO_COVERAGE |
if (!p.isStencil()) |
2388 | throw new RuntimeException(MessageLocalization.getComposedMessage("an.uncolored.pattern.was.expected")); | |
2389 | PageResources prs = getPageResources(); | |
2390 | PdfName name = writer.addSimplePattern(p); | |
2391 | name = prs.addPattern(name, p.getIndirectReference()); | |
2392 | ColorDetails csDetail = writer.addSimplePatternColorspace(color); | |
2393 | PdfName cName = prs.addColor(csDetail.getColorName(), csDetail.getIndirectReference()); | |
2394 | content.append(cName.getBytes()).append(" CS").append_i(separator); | |
2395 |
1
1. setPatternStroke : removed call to com/lowagie/text/pdf/PdfContentByte::outputColorNumbers → NO_COVERAGE |
outputColorNumbers(color, tint); |
2396 | content.append(' ').append(name.getBytes()).append(" SCN").append_i(separator); | |
2397 | } | |
2398 | ||
2399 | /** Sets the stroke color to a pattern. The pattern can be | |
2400 | * colored or uncolored. | |
2401 | * @param p the pattern | |
2402 | */ | |
2403 | public void setPatternStroke(PdfPatternPainter p) { | |
2404 |
1
1. setPatternStroke : negated conditional → NO_COVERAGE |
if (p.isStencil()) { |
2405 |
1
1. setPatternStroke : removed call to com/lowagie/text/pdf/PdfContentByte::setPatternStroke → NO_COVERAGE |
setPatternStroke(p, p.getDefaultColor()); |
2406 | return; | |
2407 | } | |
2408 |
1
1. setPatternStroke : removed call to com/lowagie/text/pdf/PdfContentByte::checkWriter → NO_COVERAGE |
checkWriter(); |
2409 | PageResources prs = getPageResources(); | |
2410 | PdfName name = writer.addSimplePattern(p); | |
2411 | name = prs.addPattern(name, p.getIndirectReference()); | |
2412 | content.append(PdfName.PATTERN.getBytes()).append(" CS ").append(name.getBytes()).append(" SCN").append_i(separator); | |
2413 | } | |
2414 | ||
2415 | /** | |
2416 | * Paints using a shading object. | |
2417 | * @param shading the shading object | |
2418 | */ | |
2419 | public void paintShading(PdfShading shading) { | |
2420 |
1
1. paintShading : removed call to com/lowagie/text/pdf/PdfWriter::addSimpleShading → NO_COVERAGE |
writer.addSimpleShading(shading); |
2421 | PageResources prs = getPageResources(); | |
2422 | PdfName name = prs.addShading(shading.getShadingName(), shading.getShadingReference()); | |
2423 | content.append(name.getBytes()).append(" sh").append_i(separator); | |
2424 | ColorDetails details = shading.getColorDetails(); | |
2425 |
1
1. paintShading : negated conditional → NO_COVERAGE |
if (details != null) |
2426 | prs.addColor(details.getColorName(), details.getIndirectReference()); | |
2427 | } | |
2428 | ||
2429 | /** | |
2430 | * Paints using a shading pattern. | |
2431 | * @param shading the shading pattern | |
2432 | */ | |
2433 | public void paintShading(PdfShadingPattern shading) { | |
2434 |
1
1. paintShading : removed call to com/lowagie/text/pdf/PdfContentByte::paintShading → NO_COVERAGE |
paintShading(shading.getShading()); |
2435 | } | |
2436 | ||
2437 | /** | |
2438 | * Sets the shading fill pattern. | |
2439 | * @param shading the shading pattern | |
2440 | */ | |
2441 | public void setShadingFill(PdfShadingPattern shading) { | |
2442 |
1
1. setShadingFill : removed call to com/lowagie/text/pdf/PdfWriter::addSimpleShadingPattern → NO_COVERAGE |
writer.addSimpleShadingPattern(shading); |
2443 | PageResources prs = getPageResources(); | |
2444 | PdfName name = prs.addPattern(shading.getPatternName(), shading.getPatternReference()); | |
2445 | content.append(PdfName.PATTERN.getBytes()).append(" cs ").append(name.getBytes()).append(" scn").append_i(separator); | |
2446 | ColorDetails details = shading.getColorDetails(); | |
2447 |
1
1. setShadingFill : negated conditional → NO_COVERAGE |
if (details != null) |
2448 | prs.addColor(details.getColorName(), details.getIndirectReference()); | |
2449 | } | |
2450 | ||
2451 | /** | |
2452 | * Sets the shading stroke pattern | |
2453 | * @param shading the shading pattern | |
2454 | */ | |
2455 | public void setShadingStroke(PdfShadingPattern shading) { | |
2456 |
1
1. setShadingStroke : removed call to com/lowagie/text/pdf/PdfWriter::addSimpleShadingPattern → NO_COVERAGE |
writer.addSimpleShadingPattern(shading); |
2457 | PageResources prs = getPageResources(); | |
2458 | PdfName name = prs.addPattern(shading.getPatternName(), shading.getPatternReference()); | |
2459 | content.append(PdfName.PATTERN.getBytes()).append(" CS ").append(name.getBytes()).append(" SCN").append_i(separator); | |
2460 | ColorDetails details = shading.getColorDetails(); | |
2461 |
1
1. setShadingStroke : negated conditional → NO_COVERAGE |
if (details != null) |
2462 | prs.addColor(details.getColorName(), details.getIndirectReference()); | |
2463 | } | |
2464 | ||
2465 | /** Check if we have a valid PdfWriter. | |
2466 | * | |
2467 | */ | |
2468 | protected void checkWriter() { | |
2469 |
1
1. checkWriter : negated conditional → NO_COVERAGE |
if (writer == null) |
2470 | throw new NullPointerException(MessageLocalization.getComposedMessage("the.writer.in.pdfcontentbyte.is.null")); | |
2471 | } | |
2472 | ||
2473 | /** | |
2474 | * Show an array of text. | |
2475 | * @param text array of text | |
2476 | */ | |
2477 | public void showText(PdfTextArray text) { | |
2478 |
1
1. showText : negated conditional → NO_COVERAGE |
if (state.fontDetails == null) |
2479 | throw new NullPointerException(MessageLocalization.getComposedMessage("font.and.size.must.be.set.before.writing.any.text")); | |
2480 | content.append("["); | |
2481 | List arrayList = text.getArrayList(); | |
2482 | boolean lastWasNumber = false; | |
2483 | for (Object obj : arrayList) { | |
2484 |
1
1. showText : negated conditional → NO_COVERAGE |
if (obj instanceof String) { |
2485 |
1
1. showText : removed call to com/lowagie/text/pdf/PdfContentByte::showText2 → NO_COVERAGE |
showText2((String) obj); |
2486 | lastWasNumber = false; | |
2487 | } else { | |
2488 |
1
1. showText : negated conditional → NO_COVERAGE |
if (lastWasNumber) |
2489 | content.append(' '); | |
2490 | else | |
2491 | lastWasNumber = true; | |
2492 | content.append((Float) obj); | |
2493 | } | |
2494 | } | |
2495 | content.append("]TJ").append_i(separator); | |
2496 | } | |
2497 | ||
2498 | /** | |
2499 | * Gets the <CODE>PdfWriter</CODE> in use by this object. | |
2500 | * @return the <CODE>PdfWriter</CODE> in use by this object | |
2501 | */ | |
2502 | public PdfWriter getPdfWriter() { | |
2503 | return writer; | |
2504 | } | |
2505 | ||
2506 | /** | |
2507 | * Gets the <CODE>PdfDocument</CODE> in use by this object. | |
2508 | * @return the <CODE>PdfDocument</CODE> in use by this object | |
2509 | */ | |
2510 | public PdfDocument getPdfDocument() { | |
2511 | return pdf; | |
2512 | } | |
2513 | ||
2514 | /** | |
2515 | * Implements a link to other part of the document. The jump will | |
2516 | * be made to a local destination with the same name, that must exist. | |
2517 | * @param name the name for this link | |
2518 | * @param llx the lower left x corner of the activation area | |
2519 | * @param lly the lower left y corner of the activation area | |
2520 | * @param urx the upper right x corner of the activation area | |
2521 | * @param ury the upper right y corner of the activation area | |
2522 | */ | |
2523 | public void localGoto(String name, float llx, float lly, float urx, float ury) { | |
2524 | pdf.localGoto(name, llx, lly, urx, ury); | |
2525 | } | |
2526 | ||
2527 | /** | |
2528 | * The local destination to where a local goto with the same | |
2529 | * name will jump. | |
2530 | * @param name the name of this local destination | |
2531 | * @param destination the <CODE>PdfDestination</CODE> with the jump coordinates | |
2532 | * @return <CODE>true</CODE> if the local destination was added, | |
2533 | * <CODE>false</CODE> if a local destination with the same name | |
2534 | * already exists | |
2535 | */ | |
2536 | public boolean localDestination(String name, PdfDestination destination) { | |
2537 | return pdf.localDestination(name, destination); | |
2538 | } | |
2539 | ||
2540 | /** | |
2541 | * Gets a duplicate of this <CODE>PdfContentByte</CODE>. All | |
2542 | * the members are copied by reference but the buffer stays different. | |
2543 | * | |
2544 | * @return a copy of this <CODE>PdfContentByte</CODE> | |
2545 | */ | |
2546 | public PdfContentByte getDuplicate() { | |
2547 |
1
1. getDuplicate : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::getDuplicate to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new PdfContentByte(writer); |
2548 | } | |
2549 | ||
2550 | /** | |
2551 | * Implements a link to another document. | |
2552 | * @param filename the filename for the remote document | |
2553 | * @param name the name to jump to | |
2554 | * @param llx the lower left x corner of the activation area | |
2555 | * @param lly the lower left y corner of the activation area | |
2556 | * @param urx the upper right x corner of the activation area | |
2557 | * @param ury the upper right y corner of the activation area | |
2558 | */ | |
2559 | public void remoteGoto(String filename, String name, float llx, float lly, float urx, float ury) { | |
2560 | pdf.remoteGoto(filename, name, llx, lly, urx, ury); | |
2561 | } | |
2562 | ||
2563 | /** | |
2564 | * Implements a link to another document. | |
2565 | * @param filename the filename for the remote document | |
2566 | * @param page the page to jump to | |
2567 | * @param llx the lower left x corner of the activation area | |
2568 | * @param lly the lower left y corner of the activation area | |
2569 | * @param urx the upper right x corner of the activation area | |
2570 | * @param ury the upper right y corner of the activation area | |
2571 | */ | |
2572 | public void remoteGoto(String filename, int page, float llx, float lly, float urx, float ury) { | |
2573 | pdf.remoteGoto(filename, page, llx, lly, urx, ury); | |
2574 | } | |
2575 | /** | |
2576 | * Adds a round rectangle to the current path. | |
2577 | * | |
2578 | * @param x x-coordinate of the starting point | |
2579 | * @param y y-coordinate of the starting point | |
2580 | * @param w width | |
2581 | * @param h height | |
2582 | * @param r radius of the arc corner | |
2583 | */ | |
2584 | public void roundRectangle(float x, float y, float w, float h, float r) { | |
2585 |
2
1. roundRectangle : changed conditional boundary → NO_COVERAGE 2. roundRectangle : negated conditional → NO_COVERAGE |
if (w < 0) { |
2586 |
1
1. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE |
x += w; |
2587 |
1
1. roundRectangle : removed negation → NO_COVERAGE |
w = -w; |
2588 | } | |
2589 |
2
1. roundRectangle : changed conditional boundary → NO_COVERAGE 2. roundRectangle : negated conditional → NO_COVERAGE |
if (h < 0) { |
2590 |
1
1. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE |
y += h; |
2591 |
1
1. roundRectangle : removed negation → NO_COVERAGE |
h = -h; |
2592 | } | |
2593 |
2
1. roundRectangle : changed conditional boundary → NO_COVERAGE 2. roundRectangle : negated conditional → NO_COVERAGE |
if (r < 0) |
2594 |
1
1. roundRectangle : removed negation → NO_COVERAGE |
r = -r; |
2595 | float b = 0.4477f; | |
2596 |
2
1. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. roundRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(x + r, y); |
2597 |
3
1. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. roundRectangle : Replaced float subtraction with addition → NO_COVERAGE 3. roundRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(x + w - r, y); |
2598 |
9
1. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. roundRectangle : Replaced float multiplication with division → NO_COVERAGE 3. roundRectangle : Replaced float subtraction with addition → NO_COVERAGE 4. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 5. roundRectangle : Replaced float multiplication with division → NO_COVERAGE 6. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 7. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 8. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 9. roundRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
curveTo(x + w - r * b, y, x + w, y + r * b, x + w, y + r); |
2599 |
4
1. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. roundRectangle : Replaced float subtraction with addition → NO_COVERAGE 4. roundRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(x + w, y + h - r); |
2600 |
12
1. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. roundRectangle : Replaced float multiplication with division → NO_COVERAGE 4. roundRectangle : Replaced float subtraction with addition → NO_COVERAGE 5. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 6. roundRectangle : Replaced float multiplication with division → NO_COVERAGE 7. roundRectangle : Replaced float subtraction with addition → NO_COVERAGE 8. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 9. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 10. roundRectangle : Replaced float subtraction with addition → NO_COVERAGE 11. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 12. roundRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
curveTo(x + w, y + h - r * b, x + w - r * b, y + h, x + w - r, y + h); |
2601 |
3
1. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. roundRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(x + r, y + h); |
2602 |
9
1. roundRectangle : Replaced float multiplication with division → NO_COVERAGE 2. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 4. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 5. roundRectangle : Replaced float multiplication with division → NO_COVERAGE 6. roundRectangle : Replaced float subtraction with addition → NO_COVERAGE 7. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 8. roundRectangle : Replaced float subtraction with addition → NO_COVERAGE 9. roundRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
curveTo(x + r * b, y + h, x, y + h - r * b, x, y + h - r); |
2603 |
2
1. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 2. roundRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(x, y + r); |
2604 |
6
1. roundRectangle : Replaced float multiplication with division → NO_COVERAGE 2. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 3. roundRectangle : Replaced float multiplication with division → NO_COVERAGE 4. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 5. roundRectangle : Replaced float addition with subtraction → NO_COVERAGE 6. roundRectangle : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
curveTo(x, y + r * b, x + r * b, y, x + r, y); |
2605 | } | |
2606 | ||
2607 | /** Implements an action in an area. | |
2608 | * @param action the <CODE>PdfAction</CODE> | |
2609 | * @param llx the lower left x corner of the activation area | |
2610 | * @param lly the lower left y corner of the activation area | |
2611 | * @param urx the upper right x corner of the activation area | |
2612 | * @param ury the upper right y corner of the activation area | |
2613 | */ | |
2614 | public void setAction(PdfAction action, float llx, float lly, float urx, float ury) { | |
2615 | pdf.setAction(action, llx, lly, urx, ury); | |
2616 | } | |
2617 | ||
2618 | /** Outputs a <CODE>String</CODE> directly to the content. | |
2619 | * @param s the <CODE>String</CODE> | |
2620 | */ | |
2621 | public void setLiteral(String s) { | |
2622 | content.append(s); | |
2623 | } | |
2624 | ||
2625 | /** Outputs a <CODE>char</CODE> directly to the content. | |
2626 | * @param c the <CODE>char</CODE> | |
2627 | */ | |
2628 | public void setLiteral(char c) { | |
2629 | content.append(c); | |
2630 | } | |
2631 | ||
2632 | /** Outputs a <CODE>float</CODE> directly to the content. | |
2633 | * @param n the <CODE>float</CODE> | |
2634 | */ | |
2635 | public void setLiteral(float n) { | |
2636 | content.append(n); | |
2637 | } | |
2638 | ||
2639 | /** Throws an error if it is a pattern. | |
2640 | * @param t the object to check | |
2641 | */ | |
2642 | void checkNoPattern(PdfTemplate t) { | |
2643 |
1
1. checkNoPattern : negated conditional → NO_COVERAGE |
if (t.getType() == PdfTemplate.TYPE_PATTERN) |
2644 | throw new RuntimeException(MessageLocalization.getComposedMessage("invalid.use.of.a.pattern.a.template.was.expected")); | |
2645 | } | |
2646 | ||
2647 | /** | |
2648 | * Draws a TextField. | |
2649 | * @param llx | |
2650 | * @param lly | |
2651 | * @param urx | |
2652 | * @param ury | |
2653 | * @param on | |
2654 | */ | |
2655 | public void drawRadioField(float llx, float lly, float urx, float ury, boolean on) { | |
2656 |
2
1. drawRadioField : changed conditional boundary → NO_COVERAGE 2. drawRadioField : negated conditional → NO_COVERAGE |
if (llx > urx) { float x = llx; llx = urx; urx = x; } |
2657 |
2
1. drawRadioField : changed conditional boundary → NO_COVERAGE 2. drawRadioField : negated conditional → NO_COVERAGE |
if (lly > ury) { float y = lly; lly = ury; ury = y; } |
2658 | // silver circle | |
2659 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2660 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(1); |
2661 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(new Color(0xC0, 0xC0, 0xC0)); |
2662 |
5
1. drawRadioField : Replaced float addition with subtraction → NO_COVERAGE 2. drawRadioField : Replaced float addition with subtraction → NO_COVERAGE 3. drawRadioField : Replaced float subtraction with addition → NO_COVERAGE 4. drawRadioField : Replaced float subtraction with addition → NO_COVERAGE 5. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::arc → NO_COVERAGE |
arc(llx + 1f, lly + 1f, urx - 1f, ury - 1f, 0f, 360f); |
2663 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
2664 | // gray circle-segment | |
2665 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2666 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(1); |
2667 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(new Color(0xA0, 0xA0, 0xA0)); |
2668 |
5
1. drawRadioField : Replaced float addition with subtraction → NO_COVERAGE 2. drawRadioField : Replaced float addition with subtraction → NO_COVERAGE 3. drawRadioField : Replaced float subtraction with addition → NO_COVERAGE 4. drawRadioField : Replaced float subtraction with addition → NO_COVERAGE 5. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::arc → NO_COVERAGE |
arc(llx + 0.5f, lly + 0.5f, urx - 0.5f, ury - 0.5f, 45, 180); |
2669 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
2670 | // black circle-segment | |
2671 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2672 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(1); |
2673 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(new Color(0x00, 0x00, 0x00)); |
2674 |
5
1. drawRadioField : Replaced float addition with subtraction → NO_COVERAGE 2. drawRadioField : Replaced float addition with subtraction → NO_COVERAGE 3. drawRadioField : Replaced float subtraction with addition → NO_COVERAGE 4. drawRadioField : Replaced float subtraction with addition → NO_COVERAGE 5. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::arc → NO_COVERAGE |
arc(llx + 1.5f, lly + 1.5f, urx - 1.5f, ury - 1.5f, 45, 180); |
2675 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
2676 |
1
1. drawRadioField : negated conditional → NO_COVERAGE |
if (on) { |
2677 | // gray circle | |
2678 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2679 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(1); |
2680 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
setColorFill(new Color(0x00, 0x00, 0x00)); |
2681 |
5
1. drawRadioField : Replaced float addition with subtraction → NO_COVERAGE 2. drawRadioField : Replaced float addition with subtraction → NO_COVERAGE 3. drawRadioField : Replaced float subtraction with addition → NO_COVERAGE 4. drawRadioField : Replaced float subtraction with addition → NO_COVERAGE 5. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::arc → NO_COVERAGE |
arc(llx + 4f, lly + 4f, urx - 4f, ury - 4f, 0, 360); |
2682 |
1
1. drawRadioField : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
fill(); |
2683 | } | |
2684 | } | |
2685 | ||
2686 | /** | |
2687 | * Draws a TextField. | |
2688 | * @param llx | |
2689 | * @param lly | |
2690 | * @param urx | |
2691 | * @param ury | |
2692 | */ | |
2693 | public void drawTextField(float llx, float lly, float urx, float ury) { | |
2694 |
2
1. drawTextField : changed conditional boundary → NO_COVERAGE 2. drawTextField : negated conditional → NO_COVERAGE |
if (llx > urx) { float x = llx; llx = urx; urx = x; } |
2695 |
2
1. drawTextField : changed conditional boundary → NO_COVERAGE 2. drawTextField : negated conditional → NO_COVERAGE |
if (lly > ury) { float y = lly; lly = ury; ury = y; } |
2696 | // silver rectangle not filled | |
2697 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(new Color(0xC0, 0xC0, 0xC0)); |
2698 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2699 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(0); |
2700 |
3
1. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 2. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 3. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
rectangle(llx, lly, urx - llx, ury - lly); |
2701 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
2702 | // white rectangle filled | |
2703 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2704 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(0); |
2705 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
setColorFill(new Color(0xFF, 0xFF, 0xFF)); |
2706 |
7
1. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 2. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 3. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 4. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 5. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 6. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 7. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
rectangle(llx + 0.5f, lly + 0.5f, urx - llx - 1f, ury -lly - 1f); |
2707 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
fill(); |
2708 | // silver lines | |
2709 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(new Color(0xC0, 0xC0, 0xC0)); |
2710 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2711 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(0); |
2712 |
3
1. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 2. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 3. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(llx + 1f, lly + 1.5f); |
2713 |
3
1. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 2. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 3. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(urx - 1.5f, lly + 1.5f); |
2714 |
3
1. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 2. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 3. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(urx - 1.5f, ury - 1f); |
2715 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
2716 | // gray lines | |
2717 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(new Color(0xA0, 0xA0, 0xA0)); |
2718 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2719 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(0); |
2720 |
3
1. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 2. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 3. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(llx + 1f, lly + 1); |
2721 |
3
1. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 2. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 3. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(llx + 1f, ury - 1f); |
2722 |
3
1. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 2. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 3. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(urx - 1f, ury - 1f); |
2723 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
2724 | // black lines | |
2725 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(new Color(0x00, 0x00, 0x00)); |
2726 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2727 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(0); |
2728 |
3
1. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 2. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 3. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(llx + 2f, lly + 2f); |
2729 |
3
1. drawTextField : Replaced float addition with subtraction → NO_COVERAGE 2. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 3. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(llx + 2f, ury - 2f); |
2730 |
3
1. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 2. drawTextField : Replaced float subtraction with addition → NO_COVERAGE 3. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(urx - 2f, ury - 2f); |
2731 |
1
1. drawTextField : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
2732 | } | |
2733 | ||
2734 | /** | |
2735 | * Draws a button. | |
2736 | * @param llx | |
2737 | * @param lly | |
2738 | * @param urx | |
2739 | * @param ury | |
2740 | * @param text | |
2741 | * @param bf | |
2742 | * @param size | |
2743 | */ | |
2744 | public void drawButton(float llx, float lly, float urx, float ury, String text, BaseFont bf, float size) { | |
2745 |
2
1. drawButton : changed conditional boundary → NO_COVERAGE 2. drawButton : negated conditional → NO_COVERAGE |
if (llx > urx) { float x = llx; llx = urx; urx = x; } |
2746 |
2
1. drawButton : changed conditional boundary → NO_COVERAGE 2. drawButton : negated conditional → NO_COVERAGE |
if (lly > ury) { float y = lly; lly = ury; ury = y; } |
2747 | // black rectangle not filled | |
2748 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(new Color(0x00, 0x00, 0x00)); |
2749 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2750 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(0); |
2751 |
3
1. drawButton : Replaced float subtraction with addition → NO_COVERAGE 2. drawButton : Replaced float subtraction with addition → NO_COVERAGE 3. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
rectangle(llx, lly, urx - llx, ury - lly); |
2752 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
2753 | // silver rectangle filled | |
2754 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2755 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(0); |
2756 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
setColorFill(new Color(0xC0, 0xC0, 0xC0)); |
2757 |
7
1. drawButton : Replaced float addition with subtraction → NO_COVERAGE 2. drawButton : Replaced float addition with subtraction → NO_COVERAGE 3. drawButton : Replaced float subtraction with addition → NO_COVERAGE 4. drawButton : Replaced float subtraction with addition → NO_COVERAGE 5. drawButton : Replaced float subtraction with addition → NO_COVERAGE 6. drawButton : Replaced float subtraction with addition → NO_COVERAGE 7. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
rectangle(llx + 0.5f, lly + 0.5f, urx - llx - 1f, ury -lly - 1f); |
2758 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
fill(); |
2759 | // white lines | |
2760 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(new Color(0xFF, 0xFF, 0xFF)); |
2761 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2762 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(0); |
2763 |
3
1. drawButton : Replaced float addition with subtraction → NO_COVERAGE 2. drawButton : Replaced float addition with subtraction → NO_COVERAGE 3. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(llx + 1f, lly + 1f); |
2764 |
3
1. drawButton : Replaced float addition with subtraction → NO_COVERAGE 2. drawButton : Replaced float subtraction with addition → NO_COVERAGE 3. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(llx + 1f, ury - 1f); |
2765 |
3
1. drawButton : Replaced float subtraction with addition → NO_COVERAGE 2. drawButton : Replaced float subtraction with addition → NO_COVERAGE 3. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(urx - 1f, ury - 1f); |
2766 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
2767 | // dark grey lines | |
2768 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setColorStroke → NO_COVERAGE |
setColorStroke(new Color(0xA0, 0xA0, 0xA0)); |
2769 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setLineWidth → NO_COVERAGE |
setLineWidth(1); |
2770 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
setLineCap(0); |
2771 |
3
1. drawButton : Replaced float addition with subtraction → NO_COVERAGE 2. drawButton : Replaced float addition with subtraction → NO_COVERAGE 3. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
moveTo(llx + 1f, lly + 1f); |
2772 |
3
1. drawButton : Replaced float subtraction with addition → NO_COVERAGE 2. drawButton : Replaced float addition with subtraction → NO_COVERAGE 3. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(urx - 1f, lly + 1f); |
2773 |
3
1. drawButton : Replaced float subtraction with addition → NO_COVERAGE 2. drawButton : Replaced float subtraction with addition → NO_COVERAGE 3. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
lineTo(urx - 1f, ury - 1f); |
2774 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
stroke(); |
2775 | // text | |
2776 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::resetRGBColorFill → NO_COVERAGE |
resetRGBColorFill(); |
2777 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::beginText → NO_COVERAGE |
beginText(); |
2778 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::setFontAndSize → NO_COVERAGE |
setFontAndSize(bf, size); |
2779 |
8
1. drawButton : Replaced float subtraction with addition → NO_COVERAGE 2. drawButton : Replaced float division with multiplication → NO_COVERAGE 3. drawButton : Replaced float addition with subtraction → NO_COVERAGE 4. drawButton : Replaced float subtraction with addition → NO_COVERAGE 5. drawButton : Replaced float subtraction with addition → NO_COVERAGE 6. drawButton : Replaced float division with multiplication → NO_COVERAGE 7. drawButton : Replaced float addition with subtraction → NO_COVERAGE 8. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::showTextAligned → NO_COVERAGE |
showTextAligned(PdfContentByte.ALIGN_CENTER, text, llx + (urx - llx) / 2, lly + (ury - lly - size) / 2, 0); |
2780 |
1
1. drawButton : removed call to com/lowagie/text/pdf/PdfContentByte::endText → NO_COVERAGE |
endText(); |
2781 | } | |
2782 | ||
2783 | /** Gets a <CODE>Graphics2D</CODE> to write on. The graphics | |
2784 | * are translated to PDF commands as shapes. No PDF fonts will appear. | |
2785 | * @param width the width of the panel | |
2786 | * @param height the height of the panel | |
2787 | * @return a <CODE>Graphics2D</CODE> | |
2788 | */ | |
2789 | public java.awt.Graphics2D createGraphicsShapes(float width, float height) { | |
2790 |
1
1. createGraphicsShapes : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::createGraphicsShapes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new PdfGraphics2D(this, width, height, null, true, false, 0); |
2791 | } | |
2792 | ||
2793 | /** Gets a <CODE>Graphics2D</CODE> to print on. The graphics | |
2794 | * are translated to PDF commands as shapes. No PDF fonts will appear. | |
2795 | * @param width the width of the panel | |
2796 | * @param height the height of the panel | |
2797 | * @param printerJob a printer job | |
2798 | * @return a <CODE>Graphics2D</CODE> | |
2799 | */ | |
2800 | public java.awt.Graphics2D createPrinterGraphicsShapes(float width, float height, PrinterJob printerJob) { | |
2801 |
1
1. createPrinterGraphicsShapes : mutated return of Object value for com/lowagie/text/pdf/PdfContentByte::createPrinterGraphicsShapes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new PdfPrinterGraphics2D(this, width, height, null, true, false, 0, printerJob); |
2802 | } | |
2803 | ||
2804 | /** Gets a <CODE>Graphics2D</CODE> to write on. The graphics | |
2805 | * are translated to PDF commands. | |
2806 | * @param width the width of the panel | |
2807 | * @param height the height of the panel | |
2808 | * @return a <CODE>Graphics2D</CODE> | |
2809 | */ | |
2810 |