1 | /* | |
2 | * $Id: MetaDo.java 4065 2009-09-16 23:09:11Z psoares33 $ | |
3 | * $Name$ | |
4 | * | |
5 | * Copyright 2001, 2002 Paulo Soares | |
6 | * | |
7 | * The contents of this file are subject to the Mozilla Public License Version 1.1 | |
8 | * (the "License"); you may not use this file except in compliance with the License. | |
9 | * You may obtain a copy of the License at http://www.mozilla.org/MPL/ | |
10 | * | |
11 | * Software distributed under the License is distributed on an "AS IS" basis, | |
12 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
13 | * for the specific language governing rights and limitations under the License. | |
14 | * | |
15 | * The Original Code is 'iText, a free JAVA-PDF library'. | |
16 | * | |
17 | * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by | |
18 | * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie. | |
19 | * All Rights Reserved. | |
20 | * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer | |
21 | * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved. | |
22 | * | |
23 | * Contributor(s): all the names of the contributors are added in the source code | |
24 | * where applicable. | |
25 | * | |
26 | * Alternatively, the contents of this file may be used under the terms of the | |
27 | * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the | |
28 | * provisions of LGPL are applicable instead of those above. If you wish to | |
29 | * allow use of your version of this file only under the terms of the LGPL | |
30 | * License and not to allow others to use your version of this file under | |
31 | * the MPL, indicate your decision by deleting the provisions above and | |
32 | * replace them with the notice and other provisions required by the LGPL. | |
33 | * If you do not delete the provisions above, a recipient may use your version | |
34 | * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE. | |
35 | * | |
36 | * This library is free software; you can redistribute it and/or modify it | |
37 | * under the terms of the MPL as stated above or under the terms of the GNU | |
38 | * Library General Public License as published by the Free Software Foundation; | |
39 | * either version 2 of the License, or any later version. | |
40 | * | |
41 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
42 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
43 | * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more | |
44 | * details. | |
45 | * | |
46 | * If you didn't download this code from the following link, you should check if | |
47 | * you aren't using an obsolete version: | |
48 | * http://www.lowagie.com/iText/ | |
49 | */ | |
50 | ||
51 | package com.lowagie.text.pdf.codec.wmf; | |
52 | ||
53 | import java.awt.Color; | |
54 | import java.awt.Point; | |
55 | import java.io.ByteArrayOutputStream; | |
56 | import java.io.IOException; | |
57 | import java.io.InputStream; | |
58 | import java.io.OutputStream; | |
59 | import java.io.UnsupportedEncodingException; | |
60 | import java.util.List; | |
61 | ||
62 | import com.lowagie.text.DocumentException; | |
63 | import com.lowagie.text.Image; | |
64 | import com.lowagie.text.error_messages.MessageLocalization; | |
65 | import com.lowagie.text.pdf.BaseFont; | |
66 | import com.lowagie.text.pdf.PdfContentByte; | |
67 | ||
68 | public class MetaDo { | |
69 | | |
70 | public static final int META_SETBKCOLOR = 0x0201; | |
71 | public static final int META_SETBKMODE = 0x0102; | |
72 | public static final int META_SETMAPMODE = 0x0103; | |
73 | public static final int META_SETROP2 = 0x0104; | |
74 | public static final int META_SETRELABS = 0x0105; | |
75 | public static final int META_SETPOLYFILLMODE = 0x0106; | |
76 | public static final int META_SETSTRETCHBLTMODE = 0x0107; | |
77 | public static final int META_SETTEXTCHAREXTRA = 0x0108; | |
78 | public static final int META_SETTEXTCOLOR = 0x0209; | |
79 | public static final int META_SETTEXTJUSTIFICATION = 0x020A; | |
80 | public static final int META_SETWINDOWORG = 0x020B; | |
81 | public static final int META_SETWINDOWEXT = 0x020C; | |
82 | public static final int META_SETVIEWPORTORG = 0x020D; | |
83 | public static final int META_SETVIEWPORTEXT = 0x020E; | |
84 | public static final int META_OFFSETWINDOWORG = 0x020F; | |
85 | public static final int META_SCALEWINDOWEXT = 0x0410; | |
86 | public static final int META_OFFSETVIEWPORTORG = 0x0211; | |
87 | public static final int META_SCALEVIEWPORTEXT = 0x0412; | |
88 | public static final int META_LINETO = 0x0213; | |
89 | public static final int META_MOVETO = 0x0214; | |
90 | public static final int META_EXCLUDECLIPRECT = 0x0415; | |
91 | public static final int META_INTERSECTCLIPRECT = 0x0416; | |
92 | public static final int META_ARC = 0x0817; | |
93 | public static final int META_ELLIPSE = 0x0418; | |
94 | public static final int META_FLOODFILL = 0x0419; | |
95 | public static final int META_PIE = 0x081A; | |
96 | public static final int META_RECTANGLE = 0x041B; | |
97 | public static final int META_ROUNDRECT = 0x061C; | |
98 | public static final int META_PATBLT = 0x061D; | |
99 | public static final int META_SAVEDC = 0x001E; | |
100 | public static final int META_SETPIXEL = 0x041F; | |
101 | public static final int META_OFFSETCLIPRGN = 0x0220; | |
102 | public static final int META_TEXTOUT = 0x0521; | |
103 | public static final int META_BITBLT = 0x0922; | |
104 | public static final int META_STRETCHBLT = 0x0B23; | |
105 | public static final int META_POLYGON = 0x0324; | |
106 | public static final int META_POLYLINE = 0x0325; | |
107 | public static final int META_ESCAPE = 0x0626; | |
108 | public static final int META_RESTOREDC = 0x0127; | |
109 | public static final int META_FILLREGION = 0x0228; | |
110 | public static final int META_FRAMEREGION = 0x0429; | |
111 | public static final int META_INVERTREGION = 0x012A; | |
112 | public static final int META_PAINTREGION = 0x012B; | |
113 | public static final int META_SELECTCLIPREGION = 0x012C; | |
114 | public static final int META_SELECTOBJECT = 0x012D; | |
115 | public static final int META_SETTEXTALIGN = 0x012E; | |
116 | public static final int META_CHORD = 0x0830; | |
117 | public static final int META_SETMAPPERFLAGS = 0x0231; | |
118 | public static final int META_EXTTEXTOUT = 0x0a32; | |
119 | public static final int META_SETDIBTODEV = 0x0d33; | |
120 | public static final int META_SELECTPALETTE = 0x0234; | |
121 | public static final int META_REALIZEPALETTE = 0x0035; | |
122 | public static final int META_ANIMATEPALETTE = 0x0436; | |
123 | public static final int META_SETPALENTRIES = 0x0037; | |
124 | public static final int META_POLYPOLYGON = 0x0538; | |
125 | public static final int META_RESIZEPALETTE = 0x0139; | |
126 | public static final int META_DIBBITBLT = 0x0940; | |
127 | public static final int META_DIBSTRETCHBLT = 0x0b41; | |
128 | public static final int META_DIBCREATEPATTERNBRUSH = 0x0142; | |
129 | public static final int META_STRETCHDIB = 0x0f43; | |
130 | public static final int META_EXTFLOODFILL = 0x0548; | |
131 | public static final int META_DELETEOBJECT = 0x01f0; | |
132 | public static final int META_CREATEPALETTE = 0x00f7; | |
133 | public static final int META_CREATEPATTERNBRUSH = 0x01F9; | |
134 | public static final int META_CREATEPENINDIRECT = 0x02FA; | |
135 | public static final int META_CREATEFONTINDIRECT = 0x02FB; | |
136 | public static final int META_CREATEBRUSHINDIRECT = 0x02FC; | |
137 | public static final int META_CREATEREGION = 0x06FF; | |
138 | ||
139 | public PdfContentByte cb; | |
140 | public InputMeta in; | |
141 | int left; | |
142 | int top; | |
143 | int right; | |
144 | int bottom; | |
145 | int inch; | |
146 | MetaState state = new MetaState(); | |
147 | ||
148 | public MetaDo(InputStream in, PdfContentByte cb) { | |
149 | this.cb = cb; | |
150 | this.in = new InputMeta(in); | |
151 | } | |
152 | | |
153 | public void readAll() throws IOException, DocumentException{ | |
154 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (in.readInt() != 0x9AC6CDD7) { |
155 | throw new DocumentException(MessageLocalization.getComposedMessage("not.a.placeable.windows.metafile")); | |
156 | } | |
157 | in.readWord(); | |
158 | left = in.readShort(); | |
159 | top = in.readShort(); | |
160 | right = in.readShort(); | |
161 | bottom = in.readShort(); | |
162 | inch = in.readWord(); | |
163 |
4
1. readAll : Replaced integer subtraction with addition → NO_COVERAGE 2. readAll : Replaced float division with multiplication → NO_COVERAGE 3. readAll : Replaced float multiplication with division → NO_COVERAGE 4. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setScalingX → NO_COVERAGE |
state.setScalingX((float)(right - left) / (float)inch * 72f); |
164 |
4
1. readAll : Replaced integer subtraction with addition → NO_COVERAGE 2. readAll : Replaced float division with multiplication → NO_COVERAGE 3. readAll : Replaced float multiplication with division → NO_COVERAGE 4. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setScalingY → NO_COVERAGE |
state.setScalingY((float)(bottom - top) / (float)inch * 72f); |
165 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setOffsetWx → NO_COVERAGE |
state.setOffsetWx(left); |
166 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setOffsetWy → NO_COVERAGE |
state.setOffsetWy(top); |
167 |
2
1. readAll : Replaced integer subtraction with addition → NO_COVERAGE 2. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setExtentWx → NO_COVERAGE |
state.setExtentWx(right - left); |
168 |
2
1. readAll : Replaced integer subtraction with addition → NO_COVERAGE 2. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setExtentWy → NO_COVERAGE |
state.setExtentWy(bottom - top); |
169 | in.readInt(); | |
170 | in.readWord(); | |
171 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/InputMeta::skip → NO_COVERAGE |
in.skip(18); |
172 | | |
173 | int tsize; | |
174 | int function; | |
175 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
cb.setLineCap(1); |
176 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::setLineJoin → NO_COVERAGE |
cb.setLineJoin(1); |
177 | for (;;) { | |
178 | int lenMarker = in.getLength(); | |
179 | tsize = in.readInt(); | |
180 |
2
1. readAll : changed conditional boundary → NO_COVERAGE 2. readAll : negated conditional → NO_COVERAGE |
if (tsize < 3) |
181 | break; | |
182 | function = in.readWord(); | |
183 | switch (function) { | |
184 | case 0: | |
185 | break; | |
186 | case META_CREATEPALETTE: | |
187 | case META_CREATEREGION: | |
188 | case META_DIBCREATEPATTERNBRUSH: | |
189 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::addMetaObject → NO_COVERAGE |
state.addMetaObject(new MetaObject()); |
190 | break; | |
191 | case META_CREATEPENINDIRECT: | |
192 | { | |
193 | MetaPen pen = new MetaPen(); | |
194 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaPen::init → NO_COVERAGE |
pen.init(in); |
195 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::addMetaObject → NO_COVERAGE |
state.addMetaObject(pen); |
196 | break; | |
197 | } | |
198 | case META_CREATEBRUSHINDIRECT: | |
199 | { | |
200 | MetaBrush brush = new MetaBrush(); | |
201 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaBrush::init → NO_COVERAGE |
brush.init(in); |
202 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::addMetaObject → NO_COVERAGE |
state.addMetaObject(brush); |
203 | break; | |
204 | } | |
205 | case META_CREATEFONTINDIRECT: | |
206 | { | |
207 | MetaFont font = new MetaFont(); | |
208 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaFont::init → NO_COVERAGE |
font.init(in); |
209 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::addMetaObject → NO_COVERAGE |
state.addMetaObject(font); |
210 | break; | |
211 | } | |
212 | case META_SELECTOBJECT: | |
213 | { | |
214 | int idx = in.readWord(); | |
215 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::selectMetaObject → NO_COVERAGE |
state.selectMetaObject(idx, cb); |
216 | break; | |
217 | } | |
218 | case META_DELETEOBJECT: | |
219 | { | |
220 | int idx = in.readWord(); | |
221 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::deleteMetaObject → NO_COVERAGE |
state.deleteMetaObject(idx); |
222 | break; | |
223 | } | |
224 | case META_SAVEDC: | |
225 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::saveState → NO_COVERAGE |
state.saveState(cb); |
226 | break; | |
227 | case META_RESTOREDC: | |
228 | { | |
229 | int idx = in.readShort(); | |
230 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::restoreState → NO_COVERAGE |
state.restoreState(idx, cb); |
231 | break; | |
232 | } | |
233 | case META_SETWINDOWORG: | |
234 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setOffsetWy → NO_COVERAGE |
state.setOffsetWy(in.readShort()); |
235 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setOffsetWx → NO_COVERAGE |
state.setOffsetWx(in.readShort()); |
236 | break; | |
237 | case META_SETWINDOWEXT: | |
238 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setExtentWy → NO_COVERAGE |
state.setExtentWy(in.readShort()); |
239 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setExtentWx → NO_COVERAGE |
state.setExtentWx(in.readShort()); |
240 | break; | |
241 | case META_MOVETO: | |
242 | { | |
243 | int y = in.readShort(); | |
244 | Point p = new Point(in.readShort(), y); | |
245 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setCurrentPoint → NO_COVERAGE |
state.setCurrentPoint(p); |
246 | break; | |
247 | } | |
248 | case META_LINETO: | |
249 | { | |
250 | int y = in.readShort(); | |
251 | int x = in.readShort(); | |
252 | Point p = state.getCurrentPoint(); | |
253 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
cb.moveTo(state.transformX(p.x), state.transformY(p.y)); |
254 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
cb.lineTo(state.transformX(x), state.transformY(y)); |
255 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
cb.stroke(); |
256 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setCurrentPoint → NO_COVERAGE |
state.setCurrentPoint(new Point(x, y)); |
257 | break; | |
258 | } | |
259 | case META_POLYLINE: | |
260 | { | |
261 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setLineJoinPolygon → NO_COVERAGE |
state.setLineJoinPolygon(cb); |
262 | int len = in.readWord(); | |
263 | int x = in.readShort(); | |
264 | int y = in.readShort(); | |
265 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
cb.moveTo(state.transformX(x), state.transformY(y)); |
266 |
3
1. readAll : changed conditional boundary → NO_COVERAGE 2. readAll : Changed increment from 1 to -1 → NO_COVERAGE 3. readAll : negated conditional → NO_COVERAGE |
for (int k = 1; k < len; ++k) { |
267 | x = in.readShort(); | |
268 | y = in.readShort(); | |
269 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
cb.lineTo(state.transformX(x), state.transformY(y)); |
270 | } | |
271 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
cb.stroke(); |
272 | break; | |
273 | } | |
274 | case META_POLYGON: | |
275 | { | |
276 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (isNullStrokeFill(false)) |
277 | break; | |
278 | int len = in.readWord(); | |
279 | int sx = in.readShort(); | |
280 | int sy = in.readShort(); | |
281 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
cb.moveTo(state.transformX(sx), state.transformY(sy)); |
282 |
3
1. readAll : changed conditional boundary → NO_COVERAGE 2. readAll : Changed increment from 1 to -1 → NO_COVERAGE 3. readAll : negated conditional → NO_COVERAGE |
for (int k = 1; k < len; ++k) { |
283 | int x = in.readShort(); | |
284 | int y = in.readShort(); | |
285 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
cb.lineTo(state.transformX(x), state.transformY(y)); |
286 | } | |
287 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
cb.lineTo(state.transformX(sx), state.transformY(sy)); |
288 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::strokeAndFill → NO_COVERAGE |
strokeAndFill(); |
289 | break; | |
290 | } | |
291 | case META_POLYPOLYGON: | |
292 | { | |
293 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (isNullStrokeFill(false)) |
294 | break; | |
295 | int numPoly = in.readWord(); | |
296 | int[] lens = new int[numPoly]; | |
297 |
2
1. readAll : changed conditional boundary → NO_COVERAGE 2. readAll : negated conditional → NO_COVERAGE |
for (int k = 0; k < lens.length; ++k) |
298 | lens[k] = in.readWord(); | |
299 | for (int len : lens) { | |
300 | int sx = in.readShort(); | |
301 | int sy = in.readShort(); | |
302 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
cb.moveTo(state.transformX(sx), state.transformY(sy)); |
303 |
3
1. readAll : changed conditional boundary → NO_COVERAGE 2. readAll : Changed increment from 1 to -1 → NO_COVERAGE 3. readAll : negated conditional → NO_COVERAGE |
for (int k = 1; k < len; ++k) { |
304 | int x = in.readShort(); | |
305 | int y = in.readShort(); | |
306 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
cb.lineTo(state.transformX(x), state.transformY(y)); |
307 | } | |
308 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
cb.lineTo(state.transformX(sx), state.transformY(sy)); |
309 | } | |
310 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::strokeAndFill → NO_COVERAGE |
strokeAndFill(); |
311 | break; | |
312 | } | |
313 | case META_ELLIPSE: | |
314 | { | |
315 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (isNullStrokeFill(state.getLineNeutral())) |
316 | break; | |
317 | int b = in.readShort(); | |
318 | int r = in.readShort(); | |
319 | int t = in.readShort(); | |
320 | int l = in.readShort(); | |
321 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::arc → NO_COVERAGE |
cb.arc(state.transformX(l), state.transformY(b), state.transformX(r), state.transformY(t), 0, 360); |
322 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::strokeAndFill → NO_COVERAGE |
strokeAndFill(); |
323 | break; | |
324 | } | |
325 | case META_ARC: | |
326 | { | |
327 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (isNullStrokeFill(state.getLineNeutral())) |
328 | break; | |
329 | float yend = state.transformY(in.readShort()); | |
330 | float xend = state.transformX(in.readShort()); | |
331 | float ystart = state.transformY(in.readShort()); | |
332 | float xstart = state.transformX(in.readShort()); | |
333 | float b = state.transformY(in.readShort()); | |
334 | float r = state.transformX(in.readShort()); | |
335 | float t = state.transformY(in.readShort()); | |
336 | float l = state.transformX(in.readShort()); | |
337 |
2
1. readAll : Replaced float addition with subtraction → NO_COVERAGE 2. readAll : Replaced float division with multiplication → NO_COVERAGE |
float cx = (r + l) / 2; |
338 |
2
1. readAll : Replaced float addition with subtraction → NO_COVERAGE 2. readAll : Replaced float division with multiplication → NO_COVERAGE |
float cy = (t + b) / 2; |
339 | float arc1 = getArc(cx, cy, xstart, ystart); | |
340 | float arc2 = getArc(cx, cy, xend, yend); | |
341 |
1
1. readAll : Replaced float subtraction with addition → NO_COVERAGE |
arc2 -= arc1; |
342 |
2
1. readAll : changed conditional boundary → NO_COVERAGE 2. readAll : negated conditional → NO_COVERAGE |
if (arc2 <= 0) |
343 |
1
1. readAll : Replaced float addition with subtraction → NO_COVERAGE |
arc2 += 360; |
344 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::arc → NO_COVERAGE |
cb.arc(l, b, r, t, arc1, arc2); |
345 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::stroke → NO_COVERAGE |
cb.stroke(); |
346 | break; | |
347 | } | |
348 | case META_PIE: | |
349 | { | |
350 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (isNullStrokeFill(state.getLineNeutral())) |
351 | break; | |
352 | float yend = state.transformY(in.readShort()); | |
353 | float xend = state.transformX(in.readShort()); | |
354 | float ystart = state.transformY(in.readShort()); | |
355 | float xstart = state.transformX(in.readShort()); | |
356 | float b = state.transformY(in.readShort()); | |
357 | float r = state.transformX(in.readShort()); | |
358 | float t = state.transformY(in.readShort()); | |
359 | float l = state.transformX(in.readShort()); | |
360 |
2
1. readAll : Replaced float addition with subtraction → NO_COVERAGE 2. readAll : Replaced float division with multiplication → NO_COVERAGE |
float cx = (r + l) / 2; |
361 |
2
1. readAll : Replaced float addition with subtraction → NO_COVERAGE 2. readAll : Replaced float division with multiplication → NO_COVERAGE |
float cy = (t + b) / 2; |
362 | float arc1 = getArc(cx, cy, xstart, ystart); | |
363 | float arc2 = getArc(cx, cy, xend, yend); | |
364 |
1
1. readAll : Replaced float subtraction with addition → NO_COVERAGE |
arc2 -= arc1; |
365 |
2
1. readAll : changed conditional boundary → NO_COVERAGE 2. readAll : negated conditional → NO_COVERAGE |
if (arc2 <= 0) |
366 |
1
1. readAll : Replaced float addition with subtraction → NO_COVERAGE |
arc2 += 360; |
367 | List<float[]> ar = PdfContentByte.bezierArc(l, b, r, t, arc1, arc2); | |
368 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (ar.isEmpty()) |
369 | break; | |
370 | float[] pt = ar.get(0); | |
371 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
cb.moveTo(cx, cy); |
372 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
cb.lineTo(pt[0], pt[1]); |
373 | for (float[] anAr : ar) { | |
374 | pt = anAr; | |
375 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
cb.curveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]); |
376 | } | |
377 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
cb.lineTo(cx, cy); |
378 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::strokeAndFill → NO_COVERAGE |
strokeAndFill(); |
379 | break; | |
380 | } | |
381 | case META_CHORD: | |
382 | { | |
383 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (isNullStrokeFill(state.getLineNeutral())) |
384 | break; | |
385 | float yend = state.transformY(in.readShort()); | |
386 | float xend = state.transformX(in.readShort()); | |
387 | float ystart = state.transformY(in.readShort()); | |
388 | float xstart = state.transformX(in.readShort()); | |
389 | float b = state.transformY(in.readShort()); | |
390 | float r = state.transformX(in.readShort()); | |
391 | float t = state.transformY(in.readShort()); | |
392 | float l = state.transformX(in.readShort()); | |
393 |
2
1. readAll : Replaced float addition with subtraction → NO_COVERAGE 2. readAll : Replaced float division with multiplication → NO_COVERAGE |
float cx = (r + l) / 2; |
394 |
2
1. readAll : Replaced float addition with subtraction → NO_COVERAGE 2. readAll : Replaced float division with multiplication → NO_COVERAGE |
float cy = (t + b) / 2; |
395 | float arc1 = getArc(cx, cy, xstart, ystart); | |
396 | float arc2 = getArc(cx, cy, xend, yend); | |
397 |
1
1. readAll : Replaced float subtraction with addition → NO_COVERAGE |
arc2 -= arc1; |
398 |
2
1. readAll : changed conditional boundary → NO_COVERAGE 2. readAll : negated conditional → NO_COVERAGE |
if (arc2 <= 0) |
399 |
1
1. readAll : Replaced float addition with subtraction → NO_COVERAGE |
arc2 += 360; |
400 | List<float[]> ar = PdfContentByte.bezierArc(l, b, r, t, arc1, arc2); | |
401 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (ar.isEmpty()) |
402 | break; | |
403 | float[] pt = ar.get(0); | |
404 | cx = pt[0]; | |
405 | cy = pt[1]; | |
406 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::moveTo → NO_COVERAGE |
cb.moveTo(cx, cy); |
407 | for (float[] floats : ar) { | |
408 | pt = floats; | |
409 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::curveTo → NO_COVERAGE |
cb.curveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]); |
410 | } | |
411 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::lineTo → NO_COVERAGE |
cb.lineTo(cx, cy); |
412 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::strokeAndFill → NO_COVERAGE |
strokeAndFill(); |
413 | break; | |
414 | } | |
415 | case META_RECTANGLE: | |
416 | { | |
417 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (isNullStrokeFill(true)) |
418 | break; | |
419 | float b = state.transformY(in.readShort()); | |
420 | float r = state.transformX(in.readShort()); | |
421 | float t = state.transformY(in.readShort()); | |
422 | float l = state.transformX(in.readShort()); | |
423 |
3
1. readAll : Replaced float subtraction with addition → NO_COVERAGE 2. readAll : Replaced float subtraction with addition → NO_COVERAGE 3. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
cb.rectangle(l, b, r - l, t - b); |
424 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::strokeAndFill → NO_COVERAGE |
strokeAndFill(); |
425 | break; | |
426 | } | |
427 | case META_ROUNDRECT: | |
428 | { | |
429 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (isNullStrokeFill(true)) |
430 | break; | |
431 |
1
1. readAll : Replaced float subtraction with addition → NO_COVERAGE |
float h = state.transformY(0) - state.transformY(in.readShort()); |
432 |
1
1. readAll : Replaced float subtraction with addition → NO_COVERAGE |
float w = state.transformX(in.readShort()) - state.transformX(0); |
433 | float b = state.transformY(in.readShort()); | |
434 | float r = state.transformX(in.readShort()); | |
435 | float t = state.transformY(in.readShort()); | |
436 | float l = state.transformX(in.readShort()); | |
437 |
5
1. readAll : Replaced float subtraction with addition → NO_COVERAGE 2. readAll : Replaced float subtraction with addition → NO_COVERAGE 3. readAll : Replaced float addition with subtraction → NO_COVERAGE 4. readAll : Replaced float division with multiplication → NO_COVERAGE 5. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::roundRectangle → NO_COVERAGE |
cb.roundRectangle(l, b, r - l, t - b, (h + w) / 4); |
438 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::strokeAndFill → NO_COVERAGE |
strokeAndFill(); |
439 | break; | |
440 | } | |
441 | case META_INTERSECTCLIPRECT: | |
442 | { | |
443 | float b = state.transformY(in.readShort()); | |
444 | float r = state.transformX(in.readShort()); | |
445 | float t = state.transformY(in.readShort()); | |
446 | float l = state.transformX(in.readShort()); | |
447 |
3
1. readAll : Replaced float subtraction with addition → NO_COVERAGE 2. readAll : Replaced float subtraction with addition → NO_COVERAGE 3. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
cb.rectangle(l, b, r - l, t - b); |
448 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::eoClip → NO_COVERAGE |
cb.eoClip(); |
449 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::newPath → NO_COVERAGE |
cb.newPath(); |
450 | break; | |
451 | } | |
452 | case META_EXTTEXTOUT: | |
453 | { | |
454 | int y = in.readShort(); | |
455 | int x = in.readShort(); | |
456 | int count = in.readWord(); | |
457 | int flag = in.readWord(); | |
458 | int x1 = 0; | |
459 | int y1 = 0; | |
460 | int x2 = 0; | |
461 | int y2 = 0; | |
462 |
2
1. readAll : Replaced bitwise AND with OR → NO_COVERAGE 2. readAll : negated conditional → NO_COVERAGE |
if ((flag & (MetaFont.ETO_CLIPPED | MetaFont.ETO_OPAQUE)) != 0) { |
463 | x1 = in.readShort(); | |
464 | y1 = in.readShort(); | |
465 | x2 = in.readShort(); | |
466 | y2 = in.readShort(); | |
467 | } | |
468 | byte[] text = new byte[count]; | |
469 | int k; | |
470 |
3
1. readAll : changed conditional boundary → NO_COVERAGE 2. readAll : Changed increment from 1 to -1 → NO_COVERAGE 3. readAll : negated conditional → NO_COVERAGE |
for (k = 0; k < count; ++k) { |
471 | byte c = (byte)in.readByte(); | |
472 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (c == 0) |
473 | break; | |
474 | text[k] = c; | |
475 | } | |
476 | String s; | |
477 | try { | |
478 | s = new String(text, 0, k, "Cp1252"); | |
479 | } | |
480 | catch (UnsupportedEncodingException e) { | |
481 | s = new String(text, 0, k); | |
482 | } | |
483 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::outputText → NO_COVERAGE |
outputText(x, y, flag, x1, y1, x2, y2, s); |
484 | break; | |
485 | } | |
486 | case META_TEXTOUT: | |
487 | { | |
488 | int count = in.readWord(); | |
489 | byte[] text = new byte[count]; | |
490 | int k; | |
491 |
3
1. readAll : changed conditional boundary → NO_COVERAGE 2. readAll : Changed increment from 1 to -1 → NO_COVERAGE 3. readAll : negated conditional → NO_COVERAGE |
for (k = 0; k < count; ++k) { |
492 | byte c = (byte)in.readByte(); | |
493 |
1
1. readAll : negated conditional → NO_COVERAGE |
if (c == 0) |
494 | break; | |
495 | text[k] = c; | |
496 | } | |
497 | String s; | |
498 | try { | |
499 | s = new String(text, 0, k, "Cp1252"); | |
500 | } | |
501 | catch (UnsupportedEncodingException e) { | |
502 | s = new String(text, 0, k); | |
503 | } | |
504 |
2
1. readAll : Replaced integer addition with subtraction → NO_COVERAGE 2. readAll : Replaced bitwise AND with OR → NO_COVERAGE |
count = (count + 1) & 0xfffe; |
505 |
2
1. readAll : Replaced integer subtraction with addition → NO_COVERAGE 2. readAll : removed call to com/lowagie/text/pdf/codec/wmf/InputMeta::skip → NO_COVERAGE |
in.skip(count - k); |
506 | int y = in.readShort(); | |
507 | int x = in.readShort(); | |
508 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::outputText → NO_COVERAGE |
outputText(x, y, 0, 0, 0, 0, 0, s); |
509 | break; | |
510 | } | |
511 | case META_SETBKCOLOR: | |
512 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setCurrentBackgroundColor → NO_COVERAGE |
state.setCurrentBackgroundColor(in.readColor()); |
513 | break; | |
514 | case META_SETTEXTCOLOR: | |
515 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setCurrentTextColor → NO_COVERAGE |
state.setCurrentTextColor(in.readColor()); |
516 | break; | |
517 | case META_SETTEXTALIGN: | |
518 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setTextAlign → NO_COVERAGE |
state.setTextAlign(in.readWord()); |
519 | break; | |
520 | case META_SETBKMODE: | |
521 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setBackgroundMode → NO_COVERAGE |
state.setBackgroundMode(in.readWord()); |
522 | break; | |
523 | case META_SETPOLYFILLMODE: | |
524 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setPolyFillMode → NO_COVERAGE |
state.setPolyFillMode(in.readWord()); |
525 | break; | |
526 | case META_SETPIXEL: | |
527 | { | |
528 | Color color = in.readColor(); | |
529 | int y = in.readShort(); | |
530 | int x = in.readShort(); | |
531 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::saveState → NO_COVERAGE |
cb.saveState(); |
532 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
cb.setColorFill(color); |
533 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
cb.rectangle(state.transformX(x), state.transformY(y), .2f, .2f); |
534 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
cb.fill(); |
535 |
1
1. readAll : removed call to com/lowagie/text/pdf/PdfContentByte::restoreState → NO_COVERAGE |
cb.restoreState(); |
536 | break; | |
537 | } | |
538 | case META_DIBSTRETCHBLT: | |
539 | case META_STRETCHDIB: | |
540 | break; | |
541 | ||
542 | } | |
543 |
4
1. readAll : Replaced integer multiplication with division → NO_COVERAGE 2. readAll : Replaced integer subtraction with addition → NO_COVERAGE 3. readAll : Replaced integer subtraction with addition → NO_COVERAGE 4. readAll : removed call to com/lowagie/text/pdf/codec/wmf/InputMeta::skip → NO_COVERAGE |
in.skip((tsize * 2) - (in.getLength() - lenMarker)); |
544 | } | |
545 |
1
1. readAll : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::cleanup → NO_COVERAGE |
state.cleanup(cb); |
546 | } | |
547 | | |
548 | public void outputText(int x, int y, int flag, int x1, int y1, int x2, int y2, String text) { | |
549 | MetaFont font = state.getCurrentFont(); | |
550 | float refX = state.transformX(x); | |
551 | float refY = state.transformY(y); | |
552 | float angle = state.transformAngle(font.getAngle()); | |
553 | float sin = (float)Math.sin(angle); | |
554 | float cos = (float)Math.cos(angle); | |
555 | float fontSize = font.getFontSize(state); | |
556 | BaseFont bf = font.getFont(); | |
557 | int align = state.getTextAlign(); | |
558 | float textWidth = bf.getWidthPoint(text, fontSize); | |
559 | float tx = 0; | |
560 | float ty = 0; | |
561 | float descender = bf.getFontDescriptor(BaseFont.DESCENT, fontSize); | |
562 | float ury = bf.getFontDescriptor(BaseFont.BBOXURY, fontSize); | |
563 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::saveState → NO_COVERAGE |
cb.saveState(); |
564 |
2
1. outputText : removed negation → NO_COVERAGE 2. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::concatCTM → NO_COVERAGE |
cb.concatCTM(cos, sin, -sin, cos, refX, refY); |
565 |
2
1. outputText : Replaced bitwise AND with OR → NO_COVERAGE 2. outputText : negated conditional → NO_COVERAGE |
if ((align & MetaState.TA_CENTER) == MetaState.TA_CENTER) |
566 |
2
1. outputText : removed negation → NO_COVERAGE 2. outputText : Replaced float division with multiplication → NO_COVERAGE |
tx = -textWidth / 2; |
567 |
2
1. outputText : Replaced bitwise AND with OR → NO_COVERAGE 2. outputText : negated conditional → NO_COVERAGE |
else if ((align & MetaState.TA_RIGHT) == MetaState.TA_RIGHT) |
568 |
1
1. outputText : removed negation → NO_COVERAGE |
tx = -textWidth; |
569 |
2
1. outputText : Replaced bitwise AND with OR → NO_COVERAGE 2. outputText : negated conditional → NO_COVERAGE |
if ((align & MetaState.TA_BASELINE) == MetaState.TA_BASELINE) |
570 | ty = 0; | |
571 |
2
1. outputText : Replaced bitwise AND with OR → NO_COVERAGE 2. outputText : negated conditional → NO_COVERAGE |
else if ((align & MetaState.TA_BOTTOM) == MetaState.TA_BOTTOM) |
572 |
1
1. outputText : removed negation → NO_COVERAGE |
ty = -descender; |
573 | else | |
574 |
1
1. outputText : removed negation → NO_COVERAGE |
ty = -ury; |
575 | Color textColor; | |
576 |
1
1. outputText : negated conditional → NO_COVERAGE |
if (state.getBackgroundMode() == MetaState.OPAQUE) { |
577 | textColor = state.getCurrentBackgroundColor(); | |
578 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
cb.setColorFill(textColor); |
579 |
3
1. outputText : Replaced float addition with subtraction → NO_COVERAGE 2. outputText : Replaced float subtraction with addition → NO_COVERAGE 3. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
cb.rectangle(tx, ty + descender, textWidth, ury - descender); |
580 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
cb.fill(); |
581 | } | |
582 | textColor = state.getCurrentTextColor(); | |
583 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
cb.setColorFill(textColor); |
584 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::beginText → NO_COVERAGE |
cb.beginText(); |
585 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::setFontAndSize → NO_COVERAGE |
cb.setFontAndSize(bf, fontSize); |
586 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE |
cb.setTextMatrix(tx, ty); |
587 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE |
cb.showText(text); |
588 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::endText → NO_COVERAGE |
cb.endText(); |
589 |
1
1. outputText : negated conditional → NO_COVERAGE |
if (font.isUnderline()) { |
590 |
4
1. outputText : Replaced float division with multiplication → NO_COVERAGE 2. outputText : Replaced float subtraction with addition → NO_COVERAGE 3. outputText : Replaced float division with multiplication → NO_COVERAGE 4. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
cb.rectangle(tx, ty - fontSize / 4, textWidth, fontSize / 15); |
591 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
cb.fill(); |
592 | } | |
593 |
1
1. outputText : negated conditional → NO_COVERAGE |
if (font.isStrikeout()) { |
594 |
4
1. outputText : Replaced float division with multiplication → NO_COVERAGE 2. outputText : Replaced float addition with subtraction → NO_COVERAGE 3. outputText : Replaced float division with multiplication → NO_COVERAGE 4. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
cb.rectangle(tx, ty + fontSize / 3, textWidth, fontSize / 15); |
595 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
cb.fill(); |
596 | } | |
597 |
1
1. outputText : removed call to com/lowagie/text/pdf/PdfContentByte::restoreState → NO_COVERAGE |
cb.restoreState(); |
598 | } | |
599 | | |
600 | public boolean isNullStrokeFill(boolean isRectangle) { | |
601 | MetaPen pen = state.getCurrentPen(); | |
602 | MetaBrush brush = state.getCurrentBrush(); | |
603 |
1
1. isNullStrokeFill : negated conditional → NO_COVERAGE |
boolean noPen = (pen.getStyle() == MetaPen.PS_NULL); |
604 | int style = brush.getStyle(); | |
605 |
3
1. isNullStrokeFill : negated conditional → NO_COVERAGE 2. isNullStrokeFill : negated conditional → NO_COVERAGE 3. isNullStrokeFill : negated conditional → NO_COVERAGE |
boolean isBrush = (style == MetaBrush.BS_SOLID || (style == MetaBrush.BS_HATCHED && state.getBackgroundMode() == MetaState.OPAQUE)); |
606 |
2
1. isNullStrokeFill : negated conditional → NO_COVERAGE 2. isNullStrokeFill : negated conditional → NO_COVERAGE |
boolean result = noPen && !isBrush; |
607 |
1
1. isNullStrokeFill : negated conditional → NO_COVERAGE |
if (!noPen) { |
608 |
1
1. isNullStrokeFill : negated conditional → NO_COVERAGE |
if (isRectangle) |
609 |
1
1. isNullStrokeFill : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setLineJoinRectangle → NO_COVERAGE |
state.setLineJoinRectangle(cb); |
610 | else | |
611 |
1
1. isNullStrokeFill : removed call to com/lowagie/text/pdf/codec/wmf/MetaState::setLineJoinPolygon → NO_COVERAGE |
state.setLineJoinPolygon(cb); |
612 | } | |
613 |
1
1. isNullStrokeFill : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return result; |
614 | } | |
615 | ||
616 | public void strokeAndFill(){ | |
617 | MetaPen pen = state.getCurrentPen(); | |
618 | MetaBrush brush = state.getCurrentBrush(); | |
619 | int penStyle = pen.getStyle(); | |
620 | int brushStyle = brush.getStyle(); | |
621 |
1
1. strokeAndFill : negated conditional → NO_COVERAGE |
if (penStyle == MetaPen.PS_NULL) { |
622 |
1
1. strokeAndFill : removed call to com/lowagie/text/pdf/PdfContentByte::closePath → NO_COVERAGE |
cb.closePath(); |
623 |
1
1. strokeAndFill : negated conditional → NO_COVERAGE |
if (state.getPolyFillMode() == MetaState.ALTERNATE) { |
624 |
1
1. strokeAndFill : removed call to com/lowagie/text/pdf/PdfContentByte::eoFill → NO_COVERAGE |
cb.eoFill(); |
625 | } | |
626 | else { | |
627 |
1
1. strokeAndFill : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
cb.fill(); |
628 | } | |
629 | } | |
630 | else { | |
631 |
3
1. strokeAndFill : negated conditional → NO_COVERAGE 2. strokeAndFill : negated conditional → NO_COVERAGE 3. strokeAndFill : negated conditional → NO_COVERAGE |
boolean isBrush = (brushStyle == MetaBrush.BS_SOLID || (brushStyle == MetaBrush.BS_HATCHED && state.getBackgroundMode() == MetaState.OPAQUE)); |
632 |
1
1. strokeAndFill : negated conditional → NO_COVERAGE |
if (isBrush) { |
633 |
1
1. strokeAndFill : negated conditional → NO_COVERAGE |
if (state.getPolyFillMode() == MetaState.ALTERNATE) |
634 |
1
1. strokeAndFill : removed call to com/lowagie/text/pdf/PdfContentByte::closePathEoFillStroke → NO_COVERAGE |
cb.closePathEoFillStroke(); |
635 | else | |
636 |
1
1. strokeAndFill : removed call to com/lowagie/text/pdf/PdfContentByte::closePathFillStroke → NO_COVERAGE |
cb.closePathFillStroke(); |
637 | } | |
638 | else { | |
639 |
1
1. strokeAndFill : removed call to com/lowagie/text/pdf/PdfContentByte::closePathStroke → NO_COVERAGE |
cb.closePathStroke(); |
640 | } | |
641 | } | |
642 | } | |
643 | | |
644 | static float getArc(float xCenter, float yCenter, float xDot, float yDot) { | |
645 |
2
1. getArc : Replaced float subtraction with addition → NO_COVERAGE 2. getArc : Replaced float subtraction with addition → NO_COVERAGE |
double s = Math.atan2(yDot - yCenter, xDot - xCenter); |
646 |
2
1. getArc : changed conditional boundary → NO_COVERAGE 2. getArc : negated conditional → NO_COVERAGE |
if (s < 0) |
647 |
1
1. getArc : Replaced double addition with subtraction → NO_COVERAGE |
s += Math.PI * 2; |
648 |
3
1. getArc : Replaced double division with multiplication → NO_COVERAGE 2. getArc : Replaced double multiplication with division → NO_COVERAGE 3. getArc : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/codec/wmf/MetaDo::getArc → NO_COVERAGE |
return (float)(s / Math.PI * 180); |
649 | } | |
650 | | |
651 | public static byte[] wrapBMP(Image image) throws IOException { | |
652 |
1
1. wrapBMP : negated conditional → NO_COVERAGE |
if (image.getOriginalType() != Image.ORIGINAL_BMP) |
653 | throw new IOException(MessageLocalization.getComposedMessage("only.bmp.can.be.wrapped.in.wmf")); | |
654 | InputStream imgIn; | |
655 | byte[] data = null; | |
656 |
1
1. wrapBMP : negated conditional → NO_COVERAGE |
if (image.getOriginalData() == null) { |
657 | imgIn = image.getUrl().openStream(); | |
658 | ByteArrayOutputStream out = new ByteArrayOutputStream(); | |
659 | int b = 0; | |
660 |
1
1. wrapBMP : negated conditional → NO_COVERAGE |
while ((b = imgIn.read()) != -1) |
661 |
1
1. wrapBMP : removed call to java/io/ByteArrayOutputStream::write → NO_COVERAGE |
out.write(b); |
662 |
1
1. wrapBMP : removed call to java/io/InputStream::close → NO_COVERAGE |
imgIn.close(); |
663 | data = out.toByteArray(); | |
664 | } | |
665 | else | |
666 | data = image.getOriginalData(); | |
667 |
3
1. wrapBMP : Replaced integer subtraction with addition → NO_COVERAGE 2. wrapBMP : Replaced integer addition with subtraction → NO_COVERAGE 3. wrapBMP : Replaced Unsigned Shift Right with Shift Left → NO_COVERAGE |
int sizeBmpWords = (data.length - 14 + 1) >>> 1; |
668 | ByteArrayOutputStream os = new ByteArrayOutputStream(); | |
669 | // write metafile header | |
670 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 1); |
671 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 9); |
672 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 0x0300); |
673 |
4
1. wrapBMP : Replaced integer addition with subtraction → NO_COVERAGE 2. wrapBMP : Replaced integer addition with subtraction → NO_COVERAGE 3. wrapBMP : Replaced integer addition with subtraction → NO_COVERAGE 4. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeDWord → NO_COVERAGE |
writeDWord(os, 9 + 4 + 5 + 5 + (13 + sizeBmpWords) + 3); // total metafile size |
674 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 1); |
675 |
2
1. wrapBMP : Replaced integer addition with subtraction → NO_COVERAGE 2. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeDWord → NO_COVERAGE |
writeDWord(os, 14 + sizeBmpWords); // max record size |
676 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 0); |
677 | // write records | |
678 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeDWord → NO_COVERAGE |
writeDWord(os, 4); |
679 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, META_SETMAPMODE); |
680 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 8); |
681 | ||
682 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeDWord → NO_COVERAGE |
writeDWord(os, 5); |
683 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, META_SETWINDOWORG); |
684 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 0); |
685 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 0); |
686 | ||
687 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeDWord → NO_COVERAGE |
writeDWord(os, 5); |
688 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, META_SETWINDOWEXT); |
689 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, (int)image.getHeight()); |
690 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, (int)image.getWidth()); |
691 | ||
692 |
2
1. wrapBMP : Replaced integer addition with subtraction → NO_COVERAGE 2. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeDWord → NO_COVERAGE |
writeDWord(os, 13 + sizeBmpWords); |
693 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, META_DIBSTRETCHBLT); |
694 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeDWord → NO_COVERAGE |
writeDWord(os, 0x00cc0020); |
695 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, (int)image.getHeight()); |
696 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, (int)image.getWidth()); |
697 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 0); |
698 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 0); |
699 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, (int)image.getHeight()); |
700 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, (int)image.getWidth()); |
701 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 0); |
702 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 0); |
703 |
2
1. wrapBMP : Replaced integer subtraction with addition → NO_COVERAGE 2. wrapBMP : removed call to java/io/ByteArrayOutputStream::write → NO_COVERAGE |
os.write(data, 14, data.length - 14); |
704 |
2
1. wrapBMP : Replaced bitwise AND with OR → NO_COVERAGE 2. wrapBMP : negated conditional → NO_COVERAGE |
if ((data.length & 1) == 1) |
705 |
1
1. wrapBMP : removed call to java/io/ByteArrayOutputStream::write → NO_COVERAGE |
os.write(0); |
706 | // writeDWord(os, 14 + sizeBmpWords); | |
707 | // writeWord(os, META_STRETCHDIB); | |
708 | // writeDWord(os, 0x00cc0020); | |
709 | // writeWord(os, 0); | |
710 | // writeWord(os, (int)image.height()); | |
711 | // writeWord(os, (int)image.width()); | |
712 | // writeWord(os, 0); | |
713 | // writeWord(os, 0); | |
714 | // writeWord(os, (int)image.height()); | |
715 | // writeWord(os, (int)image.width()); | |
716 | // writeWord(os, 0); | |
717 | // writeWord(os, 0); | |
718 | // os.write(data, 14, data.length - 14); | |
719 | // if ((data.length & 1) == 1) | |
720 | // os.write(0); | |
721 | ||
722 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeDWord → NO_COVERAGE |
writeDWord(os, 3); |
723 |
1
1. wrapBMP : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, 0); |
724 |
1
1. wrapBMP : removed call to java/io/ByteArrayOutputStream::close → NO_COVERAGE |
os.close(); |
725 |
1
1. wrapBMP : mutated return of Object value for com/lowagie/text/pdf/codec/wmf/MetaDo::wrapBMP to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return os.toByteArray(); |
726 | } | |
727 | ||
728 | public static void writeWord(OutputStream os, int v) throws IOException { | |
729 |
2
1. writeWord : Replaced bitwise AND with OR → NO_COVERAGE 2. writeWord : removed call to java/io/OutputStream::write → NO_COVERAGE |
os.write(v & 0xff); |
730 |
3
1. writeWord : Replaced Unsigned Shift Right with Shift Left → NO_COVERAGE 2. writeWord : Replaced bitwise AND with OR → NO_COVERAGE 3. writeWord : removed call to java/io/OutputStream::write → NO_COVERAGE |
os.write((v >>> 8) & 0xff); |
731 | } | |
732 | | |
733 | public static void writeDWord(OutputStream os, int v) throws IOException { | |
734 |
2
1. writeDWord : Replaced bitwise AND with OR → NO_COVERAGE 2. writeDWord : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, v & 0xffff); |
735 |
3
1. writeDWord : Replaced Unsigned Shift Right with Shift Left → NO_COVERAGE 2. writeDWord : Replaced bitwise AND with OR → NO_COVERAGE 3. writeDWord : removed call to com/lowagie/text/pdf/codec/wmf/MetaDo::writeWord → NO_COVERAGE |
writeWord(os, (v >>> 16) & 0xffff); |
736 | } | |
737 | } | |
Mutations | ||
154 |
1.1 |
|
163 |
1.1 2.2 3.3 4.4 |
|
164 |
1.1 2.2 3.3 4.4 |
|
165 |
1.1 |
|
166 |
1.1 |
|
167 |
1.1 2.2 |
|
168 |
1.1 2.2 |
|
171 |
1.1 |
|
175 |
1.1 |
|
176 |
1.1 |
|
180 |
1.1 2.2 |
|
189 |
1.1 |
|
194 |
1.1 |
|
195 |
1.1 |
|
201 |
1.1 |
|
202 |
1.1 |
|
208 |
1.1 |
|
209 |
1.1 |
|
215 |
1.1 |
|
221 |
1.1 |
|
225 |
1.1 |
|
230 |
1.1 |
|
234 |
1.1 |
|
235 |
1.1 |
|
238 |
1.1 |
|
239 |
1.1 |
|
245 |
1.1 |
|
253 |
1.1 |
|
254 |
1.1 |
|
255 |
1.1 |
|
256 |
1.1 |
|
261 |
1.1 |
|
265 |
1.1 |
|
266 |
1.1 2.2 3.3 |
|
269 |
1.1 |
|
271 |
1.1 |
|
276 |
1.1 |
|
281 |
1.1 |
|
282 |
1.1 2.2 3.3 |
|
285 |
1.1 |
|
287 |
1.1 |
|
288 |
1.1 |
|
293 |
1.1 |
|
297 |
1.1 2.2 |
|
302 |
1.1 |
|
303 |
1.1 2.2 3.3 |
|
306 |
1.1 |
|
308 |
1.1 |
|
310 |
1.1 |
|
315 |
1.1 |
|
321 |
1.1 |
|
322 |
1.1 |
|
327 |
1.1 |
|
337 |
1.1 2.2 |
|
338 |
1.1 2.2 |
|
341 |
1.1 |
|
342 |
1.1 2.2 |
|
343 |
1.1 |
|
344 |
1.1 |
|
345 |
1.1 |
|
350 |
1.1 |
|
360 |
1.1 2.2 |
|
361 |
1.1 2.2 |
|
364 |
1.1 |
|
365 |
1.1 2.2 |
|
366 |
1.1 |
|
368 |
1.1 |
|
371 |
1.1 |
|
372 |
1.1 |
|
375 |
1.1 |
|
377 |
1.1 |
|
378 |
1.1 |
|
383 |
1.1 |
|
393 |
1.1 2.2 |
|
394 |
1.1 2.2 |
|
397 |
1.1 |
|
398 |
1.1 2.2 |
|
399 |
1.1 |
|
401 |
1.1 |
|
406 |
1.1 |
|
409 |
1.1 |
|
411 |
1.1 |
|
412 |
1.1 |
|
417 |
1.1 |
|
423 |
1.1 2.2 3.3 |
|
424 |
1.1 |
|
429 |
1.1 |
|
431 |
1.1 |
|
432 |
1.1 |
|
437 |
1.1 2.2 3.3 4.4 5.5 |
|
438 |
1.1 |
|
447 |
1.1 2.2 3.3 |
|
448 |
1.1 |
|
449 |
1.1 |
|
462 |
1.1 2.2 |
|
470 |
1.1 2.2 3.3 |
|
472 |
1.1 |
|
483 |
1.1 |
|
491 |
1.1 2.2 3.3 |
|
493 |
1.1 |
|
504 |
1.1 2.2 |
|
505 |
1.1 2.2 |
|
508 |
1.1 |
|
512 |
1.1 |
|
515 |
1.1 |
|
518 |
1.1 |
|
521 |
1.1 |
|
524 |
1.1 |
|
531 |
1.1 |
|
532 |
1.1 |
|
533 |
1.1 |
|
534 |
1.1 |
|
535 |
1.1 |
|
543 |
1.1 2.2 3.3 4.4 |
|
545 |
1.1 |
|
563 |
1.1 |
|
564 |
1.1 2.2 |
|
565 |
1.1 2.2 |
|
566 |
1.1 2.2 |
|
567 |
1.1 2.2 |
|
568 |
1.1 |
|
569 |
1.1 2.2 |
|
571 |
1.1 2.2 |
|
572 |
1.1 |
|
574 |
1.1 |
|
576 |
1.1 |
|
578 |
1.1 |
|
579 |
1.1 2.2 3.3 |
|
580 |
1.1 |
|
583 |
1.1 |
|
584 |
1.1 |
|
585 |
1.1 |
|
586 |
1.1 |
|
587 |
1.1 |
|
588 |
1.1 |
|
589 |
1.1 |
|
590 |
1.1 2.2 3.3 4.4 |
|
591 |
1.1 |
|
593 |
1.1 |
|
594 |
1.1 2.2 3.3 4.4 |
|
595 |
1.1 |
|
597 |
1.1 |
|
603 |
1.1 |
|
605 |
1.1 2.2 3.3 |
|
606 |
1.1 2.2 |
|
607 |
1.1 |
|
608 |
1.1 |
|
609 |
1.1 |
|
611 |
1.1 |
|
613 |
1.1 |
|
621 |
1.1 |
|
622 |
1.1 |
|
623 |
1.1 |
|
624 |
1.1 |
|
627 |
1.1 |
|
631 |
1.1 2.2 3.3 |
|
632 |
1.1 |
|
633 |
1.1 |
|
634 |
1.1 |
|
636 |
1.1 |
|
639 |
1.1 |
|
645 |
1.1 2.2 |
|
646 |
1.1 2.2 |
|
647 |
1.1 |
|
648 |
1.1 2.2 3.3 |
|
652 |
1.1 |
|
656 |
1.1 |
|
660 |
1.1 |
|
661 |
1.1 |
|
662 |
1.1 |
|
667 |
1.1 2.2 3.3 |
|
670 |
1.1 |
|
671 |
1.1 |
|
672 |
1.1 |
|
673 |
1.1 2.2 3.3 4.4 |
|
674 |
1.1 |
|
675 |
1.1 2.2 |
|
676 |
1.1 |
|
678 |
1.1 |
|
679 |
1.1 |
|
680 |
1.1 |
|
682 |
1.1 |
|
683 |
1.1 |
|
684 |
1.1 |
|
685 |
1.1 |
|
687 |
1.1 |
|
688 |
1.1 |
|
689 |
1.1 |
|
690 |
1.1 |
|
692 |
1.1 2.2 |
|
693 |
1.1 |
|
694 |
1.1 |
|
695 |
1.1 |
|
696 |
1.1 |
|
697 |
1.1 |
|
698 |
1.1 |
|
699 |
1.1 |
|
700 |
1.1 |
|
701 |
1.1 |
|
702 |
1.1 |
|
703 |
1.1 2.2 |
|
704 |
1.1 2.2 |
|
705 |
1.1 |
|
722 |
1.1 |
|
723 |
1.1 |
|
724 |
1.1 |
|
725 |
1.1 |
|
729 |
1.1 2.2 |
|
730 |
1.1 2.2 3.3 |
|
734 |
1.1 2.2 |
|
735 |
1.1 2.2 3.3 |