-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved team titles, borders, faults
- Loading branch information
1 parent
046b08a
commit 897b48b
Showing
5 changed files
with
97 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...tournament-pdf/src/main/java/com/softwaremagico/kt/pdf/events/FaultTriangleCellEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.softwaremagico.kt.pdf.events; | ||
|
||
/*- | ||
* #%L | ||
* Kendo Tournament Manager (PDF) | ||
* %% | ||
* Copyright (C) 2021 - 2024 Softwaremagico | ||
* %% | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* #L% | ||
*/ | ||
|
||
import com.lowagie.text.Rectangle; | ||
import com.lowagie.text.pdf.PdfContentByte; | ||
import com.lowagie.text.pdf.PdfPCell; | ||
import com.lowagie.text.pdf.PdfPCellEvent; | ||
import com.lowagie.text.pdf.PdfPTable; | ||
|
||
import java.awt.Color; | ||
|
||
/** | ||
* Event for creating a transparent cell. | ||
*/ | ||
public class FaultTriangleCellEvent implements PdfPCellEvent { | ||
|
||
private static final int TRIANGLE_MARGIN = 6; | ||
private static final int BOTTOM_MARGIN = 4; | ||
|
||
|
||
@Override | ||
public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvas) { | ||
final PdfContentByte cb = canvas[PdfPTable.BACKGROUNDCANVAS]; | ||
cb.setColorStroke(Color.BLACK); | ||
cb.setColorFill(Color.BLACK); | ||
cb.moveTo(rect.getLeft() + TRIANGLE_MARGIN, rect.getBottom() + BOTTOM_MARGIN); | ||
cb.lineTo(rect.getRight() - TRIANGLE_MARGIN, rect.getBottom() + BOTTOM_MARGIN); | ||
cb.lineTo(rect.getLeft() + (rect.getRight() - rect.getLeft()) / 2, rect.getTop() - TRIANGLE_MARGIN | ||
- (TRIANGLE_MARGIN - BOTTOM_MARGIN)); | ||
cb.closePathFillStroke(); | ||
cb.stroke(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters