@@ -179,7 +179,7 @@ public void drawCellBorder(PdfCanvas canvas, float x1, float y1, float x2, float
179
179
}
180
180
181
181
@ Override
182
- public void draw (PdfCanvas canvas , float x1 , float y1 , float x2 , float y2 , float outerRadius , Side side , float borderWidthBefore , float borderWidthAfter ) {
182
+ public void draw (PdfCanvas canvas , float x1 , float y1 , float x2 , float y2 , float horizontalRadius1 , float verticalRadius1 , float horizontalRadius2 , float verticalRadius2 , Side defaultSide , float borderWidthBefore , float borderWidthAfter ) {
183
183
float curv = 0.447f ;
184
184
float initialGap = width * GAP_MODIFIER ;
185
185
float dash = width * DASH_MODIFIER ;
@@ -194,10 +194,10 @@ public void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float
194
194
// Points (x0, y0) and (x3, y3) are used to produce Bezier curve
195
195
float x0 = x1 , y0 = y1 ,
196
196
x3 = x2 , y3 = y2 ;
197
-
198
- float innerRadiusBefore = Math . max ( 0 , outerRadius - borderWidthBefore ) ,
199
- innerRadius = Math . max ( 0 , outerRadius - width ) ,
200
- innerRadiusAfter = Math . max ( 0 , outerRadius - borderWidthAfter ) ;
197
+ float innerRadiusBefore ,
198
+ innerRadiusFirst ,
199
+ innerRadiusSecond ,
200
+ innerRadiusAfter ;
201
201
202
202
float widthHalf = width / 2 ;
203
203
@@ -209,14 +209,21 @@ public void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float
209
209
canvas .setLineDash (dash , adjustedGap , dash + adjustedGap / 2 );
210
210
211
211
Point clipPoint1 , clipPoint2 , clipPoint ;
212
- Border .Side borderSide = getBorderSide (x1 , y1 , x2 , y2 , side );
212
+ Border .Side borderSide = getBorderSide (x1 , y1 , x2 , y2 , defaultSide );
213
213
switch (borderSide ) {
214
214
case TOP :
215
+
216
+ innerRadiusBefore = Math .max (0 , horizontalRadius1 - borderWidthBefore );
217
+ innerRadiusFirst = Math .max (0 , verticalRadius1 - width );
218
+ innerRadiusSecond = Math .max (0 , verticalRadius2 - width );
219
+ innerRadiusAfter = Math .max (0 , horizontalRadius2 - borderWidthAfter );
220
+
221
+
215
222
x0 -= borderWidthBefore / 2 ;
216
- y0 -= innerRadius ;
223
+ y0 -= innerRadiusFirst ;
217
224
218
225
x3 += borderWidthAfter / 2 ;
219
- y3 -= innerRadius ;
226
+ y3 -= innerRadiusSecond ;
220
227
221
228
clipPoint1 = getIntersectionPoint (new Point (x1 - borderWidthBefore , y1 + width ), new Point (x1 , y1 ), new Point (x0 , y0 ), new Point (x0 + 10 , y0 ));
222
229
clipPoint2 = getIntersectionPoint (new Point (x2 + borderWidthAfter , y2 + width ), new Point (x2 , y2 ), new Point (x3 , y3 ), new Point (x3 - 10 , y3 ));
@@ -235,15 +242,20 @@ public void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float
235
242
y2 += widthHalf ;
236
243
237
244
canvas
238
- .moveTo (x0 , y0 ).curveTo (x0 , y0 + innerRadius * curv , x1 - innerRadiusBefore * curv , y1 , x1 , y1 )
245
+ .moveTo (x0 , y0 ).curveTo (x0 , y0 + innerRadiusFirst * curv , x1 - innerRadiusBefore * curv , y1 , x1 , y1 )
239
246
.lineTo (x2 , y2 )
240
- .curveTo (x2 + innerRadiusAfter * curv , y2 , x3 , y3 + innerRadius * curv , x3 , y3 );
247
+ .curveTo (x2 + innerRadiusAfter * curv , y2 , x3 , y3 + innerRadiusSecond * curv , x3 , y3 );
241
248
break ;
242
249
case RIGHT :
243
- x0 -= innerRadius ;
250
+ innerRadiusBefore = Math .max (0 , verticalRadius1 - borderWidthBefore );
251
+ innerRadiusFirst = Math .max (0 , horizontalRadius1 - width );
252
+ innerRadiusSecond = Math .max (0 , horizontalRadius2 - width );
253
+ innerRadiusAfter = Math .max (0 , verticalRadius2 - borderWidthAfter );
254
+
255
+ x0 -= innerRadiusFirst ;
244
256
y0 += borderWidthBefore / 2 ;
245
257
246
- x3 -= innerRadius ;
258
+ x3 -= innerRadiusSecond ;
247
259
y3 -= borderWidthAfter ;
248
260
249
261
clipPoint1 = getIntersectionPoint (new Point (x1 + width , y1 + borderWidthBefore ), new Point (x1 , y1 ), new Point (x0 , y0 ), new Point (x0 , y0 - 10 ));
@@ -263,17 +275,22 @@ public void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float
263
275
y2 += innerRadiusAfter ;
264
276
265
277
canvas
266
- .moveTo (x0 , y0 ).curveTo (x0 + innerRadius * curv , y0 , x1 , y1 + innerRadiusBefore * curv , x1 , y1 )
278
+ .moveTo (x0 , y0 ).curveTo (x0 + innerRadiusFirst * curv , y0 , x1 , y1 + innerRadiusBefore * curv , x1 , y1 )
267
279
.lineTo (x2 , y2 )
268
- .curveTo (x2 , y2 - innerRadiusAfter * curv , x3 + innerRadius * curv , y3 , x3 , y3 );
280
+ .curveTo (x2 , y2 - innerRadiusAfter * curv , x3 + innerRadiusSecond * curv , y3 , x3 , y3 );
269
281
270
282
break ;
271
283
case BOTTOM :
284
+ innerRadiusBefore = Math .max (0 , horizontalRadius1 - borderWidthBefore );
285
+ innerRadiusFirst = Math .max (0 , verticalRadius1 - width );
286
+ innerRadiusSecond = Math .max (0 , verticalRadius2 - width );
287
+ innerRadiusAfter = Math .max (0 , horizontalRadius2 - borderWidthAfter );
288
+
272
289
x0 += borderWidthBefore / 2 ;
273
- y0 += innerRadius ;
290
+ y0 += innerRadiusFirst ;
274
291
275
292
x3 -= borderWidthAfter / 2 ;
276
- y3 += innerRadius ;
293
+ y3 += innerRadiusSecond ;
277
294
278
295
clipPoint1 = getIntersectionPoint (new Point (x1 + borderWidthBefore , y1 - width ), new Point (x1 , y1 ), new Point (x0 , y0 ), new Point (x0 - 10 , y0 ));
279
296
clipPoint2 = getIntersectionPoint (new Point (x2 - borderWidthAfter , y2 - width ), new Point (x2 , y2 ), new Point (x3 , y3 ), new Point (x3 + 10 , y3 ));
@@ -292,16 +309,21 @@ public void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float
292
309
y2 -= widthHalf ;
293
310
294
311
canvas
295
- .moveTo (x0 , y0 ).curveTo (x0 , y0 - innerRadius * curv , x1 + innerRadiusBefore * curv , y1 , x1 , y1 )
312
+ .moveTo (x0 , y0 ).curveTo (x0 , y0 - innerRadiusFirst * curv , x1 + innerRadiusBefore * curv , y1 , x1 , y1 )
296
313
.lineTo (x2 , y2 )
297
- .curveTo (x2 - innerRadiusAfter * curv , y2 , x3 , y3 - innerRadius * curv , x3 , y3 );
314
+ .curveTo (x2 - innerRadiusAfter * curv , y2 , x3 , y3 - innerRadiusSecond * curv , x3 , y3 );
298
315
299
316
break ;
300
317
case LEFT :
301
- x0 += innerRadius ;
318
+ innerRadiusBefore = Math .max (0 , verticalRadius1 - borderWidthBefore );
319
+ innerRadiusFirst = Math .max (0 , horizontalRadius1 - width );
320
+ innerRadiusSecond = Math .max (0 , horizontalRadius2 - width );
321
+ innerRadiusAfter = Math .max (0 , verticalRadius2 - borderWidthAfter );
322
+
323
+ x0 += innerRadiusFirst ;
302
324
y0 -= borderWidthBefore / 2 ;
303
325
304
- x3 += innerRadius ;
326
+ x3 += innerRadiusSecond ;
305
327
y3 += borderWidthAfter ;
306
328
307
329
clipPoint1 = getIntersectionPoint (new Point (x1 - width , y1 - borderWidthBefore ), new Point (x1 , y1 ), new Point (x0 , y0 ), new Point (x0 , y0 + 10 ));
@@ -321,15 +343,16 @@ public void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float
321
343
y2 -= innerRadiusAfter ;
322
344
323
345
canvas
324
- .moveTo (x0 , y0 ).curveTo (x0 - innerRadius * curv , y0 , x1 , y1 - innerRadiusBefore * curv , x1 , y1 )
346
+ .moveTo (x0 , y0 ).curveTo (x0 - innerRadiusFirst * curv , y0 , x1 , y1 - innerRadiusBefore * curv , x1 , y1 )
325
347
.lineTo (x2 , y2 )
326
- .curveTo (x2 , y2 + innerRadiusAfter * curv , x3 - innerRadius * curv , y3 , x3 , y3 );
348
+ .curveTo (x2 , y2 + innerRadiusAfter * curv , x3 - innerRadiusSecond * curv , y3 , x3 , y3 );
327
349
break ;
328
350
}
329
351
canvas
330
352
.stroke ()
331
- .restoreState ();
332
- }
353
+ .restoreState (); }
354
+
355
+ /**
333
356
334
357
/**
335
358
* Adjusts the size of the gap between dots
0 commit comments