210 lw = userSpaceLineWidth(at, MIN_PEN_SIZE);
211 } else {
212 lw = userSpaceLineWidth(at, 1.0d);
213 }
214 } else {
215 lw = bs.getLineWidth();
216 }
217 strokeTo(rdrCtx,
218 src,
219 at,
220 lw,
221 normalize,
222 bs.getEndCap(),
223 bs.getLineJoin(),
224 bs.getMiterLimit(),
225 bs.getDashArray(),
226 bs.getDashPhase(),
227 pc2d);
228 }
229
230 private final double userSpaceLineWidth(AffineTransform at, double lw) {
231
232 double widthScale;
233
234 if (at == null) {
235 widthScale = 1.0d;
236 } else if ((at.getType() & (AffineTransform.TYPE_GENERAL_TRANSFORM |
237 AffineTransform.TYPE_GENERAL_SCALE)) != 0) {
238 widthScale = Math.sqrt(at.getDeterminant());
239 } else {
240 // First calculate the "maximum scale" of this transform.
241 double A = at.getScaleX(); // m00
242 double C = at.getShearX(); // m01
243 double B = at.getShearY(); // m10
244 double D = at.getScaleY(); // m11
245
246 /*
247 * Given a 2 x 2 affine matrix [ A B ] such that
248 * [ C D ]
249 * v' = [x' y'] = [Ax + Cy, Bx + Dy], we want to
250 * find the maximum magnitude (norm) of the vector v'
|
210 lw = userSpaceLineWidth(at, MIN_PEN_SIZE);
211 } else {
212 lw = userSpaceLineWidth(at, 1.0d);
213 }
214 } else {
215 lw = bs.getLineWidth();
216 }
217 strokeTo(rdrCtx,
218 src,
219 at,
220 lw,
221 normalize,
222 bs.getEndCap(),
223 bs.getLineJoin(),
224 bs.getMiterLimit(),
225 bs.getDashArray(),
226 bs.getDashPhase(),
227 pc2d);
228 }
229
230 private double userSpaceLineWidth(AffineTransform at, double lw) {
231
232 double widthScale;
233
234 if (at == null) {
235 widthScale = 1.0d;
236 } else if ((at.getType() & (AffineTransform.TYPE_GENERAL_TRANSFORM |
237 AffineTransform.TYPE_GENERAL_SCALE)) != 0) {
238 widthScale = Math.sqrt(at.getDeterminant());
239 } else {
240 // First calculate the "maximum scale" of this transform.
241 double A = at.getScaleX(); // m00
242 double C = at.getShearX(); // m01
243 double B = at.getShearY(); // m10
244 double D = at.getScaleY(); // m11
245
246 /*
247 * Given a 2 x 2 affine matrix [ A B ] such that
248 * [ C D ]
249 * v' = [x' y'] = [Ax + Cy, Bx + Dy], we want to
250 * find the maximum magnitude (norm) of the vector v'
|