mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-22 21:15:09 +00:00
Merge pull request #689 from matthew16550/StringBounder-simplifications
StringBounder injection & some minor related tidyings
This commit is contained in:
commit
4ac9b7cd90
@ -46,6 +46,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
|
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
|
||||||
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
|
import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
@ -57,12 +58,13 @@ public class EmptyImageBuilder {
|
|||||||
private final BufferedImage im;
|
private final BufferedImage im;
|
||||||
private final Graphics2D g2d;
|
private final Graphics2D g2d;
|
||||||
private final Color background;
|
private final Color background;
|
||||||
|
private final StringBounder stringBounder;
|
||||||
|
|
||||||
public EmptyImageBuilder(String watermark, double width, double height, Color background) {
|
public EmptyImageBuilder(String watermark, double width, double height, Color background, StringBounder stringBounder) {
|
||||||
this(watermark, (int) width, (int) height, background);
|
this(watermark, (int) width, (int) height, background, stringBounder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmptyImageBuilder(String watermark, int width, int height, Color background) {
|
public EmptyImageBuilder(String watermark, int width, int height, Color background, StringBounder stringBounder) {
|
||||||
if (width > GraphvizUtils.getenvImageLimit()) {
|
if (width > GraphvizUtils.getenvImageLimit()) {
|
||||||
Log.info("Width too large " + width + ". You should set PLANTUML_LIMIT_SIZE");
|
Log.info("Width too large " + width + ". You should set PLANTUML_LIMIT_SIZE");
|
||||||
width = GraphvizUtils.getenvImageLimit();
|
width = GraphvizUtils.getenvImageLimit();
|
||||||
@ -72,6 +74,7 @@ public class EmptyImageBuilder {
|
|||||||
height = GraphvizUtils.getenvImageLimit();
|
height = GraphvizUtils.getenvImageLimit();
|
||||||
}
|
}
|
||||||
this.background = background;
|
this.background = background;
|
||||||
|
this.stringBounder = stringBounder;
|
||||||
Log.info("Creating image " + width + "x" + height);
|
Log.info("Creating image " + width + "x" + height);
|
||||||
im = new BufferedImage(width, height, getType(background));
|
im = new BufferedImage(width, height, getType(background));
|
||||||
g2d = im.createGraphics();
|
g2d = im.createGraphics();
|
||||||
@ -149,8 +152,8 @@ public class EmptyImageBuilder {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmptyImageBuilder(String watermark, int width, int height, Color background, double dpiFactor) {
|
public EmptyImageBuilder(String watermark, int width, int height, Color background, StringBounder stringBounder, double dpiFactor) {
|
||||||
this(watermark, width * dpiFactor, height * dpiFactor, background);
|
this(watermark, width * dpiFactor, height * dpiFactor, background, stringBounder);
|
||||||
if (dpiFactor != 1.0) {
|
if (dpiFactor != 1.0) {
|
||||||
g2d.setTransform(AffineTransform.getScaleInstance(dpiFactor, dpiFactor));
|
g2d.setTransform(AffineTransform.getScaleInstance(dpiFactor, dpiFactor));
|
||||||
}
|
}
|
||||||
@ -166,7 +169,7 @@ public class EmptyImageBuilder {
|
|||||||
|
|
||||||
public UGraphicG2d getUGraphicG2d() {
|
public UGraphicG2d getUGraphicG2d() {
|
||||||
final HColor back = new HColorSimple(background, false);
|
final HColor back = new HColorSimple(background, false);
|
||||||
final UGraphicG2d result = new UGraphicG2d(back, new ColorMapperIdentity(), g2d, 1.0);
|
final UGraphicG2d result = new UGraphicG2d(back, new ColorMapperIdentity(), stringBounder, g2d, 1.0);
|
||||||
result.setBufferedImage(im);
|
result.setBufferedImage(im);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -132,10 +132,6 @@ public enum FileFormat {
|
|||||||
return getDefaultStringBounder(TikzFontDistortion.getDefault(), SvgCharSizeHack.NO_HACK);
|
return getDefaultStringBounder(TikzFontDistortion.getDefault(), SvgCharSizeHack.NO_HACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringBounder getDefaultStringBounder(TikzFontDistortion tikzFontDistortion) {
|
|
||||||
return getDefaultStringBounder(tikzFontDistortion, SvgCharSizeHack.NO_HACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
public StringBounder getDefaultStringBounder(TikzFontDistortion tikzFontDistortion, SvgCharSizeHack charSizeHack) {
|
public StringBounder getDefaultStringBounder(TikzFontDistortion tikzFontDistortion, SvgCharSizeHack charSizeHack) {
|
||||||
if (this == LATEX || this == LATEX_NO_PREAMBLE) {
|
if (this == LATEX || this == LATEX_NO_PREAMBLE) {
|
||||||
return getTikzStringBounder(tikzFontDistortion);
|
return getTikzStringBounder(tikzFontDistortion);
|
||||||
|
@ -42,8 +42,10 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.EmptyImageBuilder;
|
import net.sourceforge.plantuml.EmptyImageBuilder;
|
||||||
|
import net.sourceforge.plantuml.FileFormat;
|
||||||
import net.sourceforge.plantuml.api.ImageDataSimple;
|
import net.sourceforge.plantuml.api.ImageDataSimple;
|
||||||
import net.sourceforge.plantuml.core.ImageData;
|
import net.sourceforge.plantuml.core.ImageData;
|
||||||
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.png.PngIO;
|
import net.sourceforge.plantuml.png.PngIO;
|
||||||
import net.sourceforge.plantuml.ugraphic.UChange;
|
import net.sourceforge.plantuml.ugraphic.UChange;
|
||||||
import net.sourceforge.plantuml.ugraphic.UMotif;
|
import net.sourceforge.plantuml.ugraphic.UMotif;
|
||||||
@ -68,11 +70,12 @@ public class GraphicsPath {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BufferedImage createImage() {
|
private BufferedImage createImage() {
|
||||||
final EmptyImageBuilder builder = new EmptyImageBuilder(null, 50, 50, Color.WHITE);
|
final StringBounder stringBounder = FileFormat.PNG.getDefaultStringBounder();
|
||||||
|
final EmptyImageBuilder builder = new EmptyImageBuilder(null, 50, 50, Color.WHITE, stringBounder);
|
||||||
final BufferedImage im = builder.getBufferedImage();
|
final BufferedImage im = builder.getBufferedImage();
|
||||||
final Graphics2D g2d = builder.getGraphics2D();
|
final Graphics2D g2d = builder.getGraphics2D();
|
||||||
|
|
||||||
final UGraphicG2d ug = new UGraphicG2d(HColorUtils.WHITE, colorMapper, g2d, 1.0);
|
final UGraphicG2d ug = new UGraphicG2d(HColorUtils.WHITE, colorMapper, stringBounder, g2d, 1.0);
|
||||||
ug.setBufferedImage(im);
|
ug.setBufferedImage(im);
|
||||||
final UMotif motif = new UMotif(path);
|
final UMotif motif = new UMotif(path);
|
||||||
motif.drawHorizontal(ug.apply((UChange) HColorUtils.BLACK), 20, 20, 1);
|
motif.drawHorizontal(ug.apply((UChange) HColorUtils.BLACK), 20, 20, 1);
|
||||||
|
@ -44,11 +44,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.AbstractPSystem;
|
import net.sourceforge.plantuml.AbstractPSystem;
|
||||||
import net.sourceforge.plantuml.EmptyImageBuilder;
|
import net.sourceforge.plantuml.EmptyImageBuilder;
|
||||||
|
import net.sourceforge.plantuml.FileFormat;
|
||||||
import net.sourceforge.plantuml.FileFormatOption;
|
import net.sourceforge.plantuml.FileFormatOption;
|
||||||
import net.sourceforge.plantuml.api.ImageDataSimple;
|
import net.sourceforge.plantuml.api.ImageDataSimple;
|
||||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||||
import net.sourceforge.plantuml.core.ImageData;
|
import net.sourceforge.plantuml.core.ImageData;
|
||||||
import net.sourceforge.plantuml.core.UmlSource;
|
import net.sourceforge.plantuml.core.UmlSource;
|
||||||
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.png.PngIO;
|
import net.sourceforge.plantuml.png.PngIO;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
||||||
@ -68,9 +70,10 @@ public class PSystemLogo extends AbstractPSystem {
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
final int width = 640;
|
final int width = 640;
|
||||||
final int height = 480;
|
final int height = 480;
|
||||||
final EmptyImageBuilder builder = new EmptyImageBuilder(fileFormat.getWatermark(), width, height, Color.WHITE);
|
final StringBounder stringBounder = FileFormat.PNG.getDefaultStringBounder();
|
||||||
|
final EmptyImageBuilder builder = new EmptyImageBuilder(fileFormat.getWatermark(), width, height, Color.WHITE, stringBounder);
|
||||||
final BufferedImage im = builder.getBufferedImage();
|
final BufferedImage im = builder.getBufferedImage();
|
||||||
final UGraphic ug = new UGraphicG2d(HColorUtils.WHITE, new ColorMapperIdentity(), builder.getGraphics2D(), 1.0);
|
final UGraphic ug = new UGraphicG2d(HColorUtils.WHITE, new ColorMapperIdentity(), stringBounder, builder.getGraphics2D(), 1.0);
|
||||||
((UGraphicG2d) ug).setBufferedImage(im);
|
((UGraphicG2d) ug).setBufferedImage(im);
|
||||||
|
|
||||||
final TurtleGraphicsPane turtleGraphicsPane = new TurtleGraphicsPane(width, height);
|
final TurtleGraphicsPane turtleGraphicsPane = new TurtleGraphicsPane(width, height);
|
||||||
|
@ -47,14 +47,13 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
|||||||
import net.sourceforge.plantuml.EmptyImageBuilder;
|
import net.sourceforge.plantuml.EmptyImageBuilder;
|
||||||
import net.sourceforge.plantuml.FileFormat;
|
import net.sourceforge.plantuml.FileFormat;
|
||||||
import net.sourceforge.plantuml.SpriteContainerEmpty;
|
import net.sourceforge.plantuml.SpriteContainerEmpty;
|
||||||
import net.sourceforge.plantuml.SvgCharSizeHack;
|
|
||||||
import net.sourceforge.plantuml.TikzFontDistortion;
|
|
||||||
import net.sourceforge.plantuml.api.ImageDataSimple;
|
import net.sourceforge.plantuml.api.ImageDataSimple;
|
||||||
import net.sourceforge.plantuml.core.ImageData;
|
import net.sourceforge.plantuml.core.ImageData;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.eps.EpsStrategy;
|
import net.sourceforge.plantuml.eps.EpsStrategy;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||||
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.png.PngIO;
|
import net.sourceforge.plantuml.png.PngIO;
|
||||||
import net.sourceforge.plantuml.svg.LengthAdjust;
|
import net.sourceforge.plantuml.svg.LengthAdjust;
|
||||||
@ -90,7 +89,7 @@ public class GraphicsSudoku {
|
|||||||
|
|
||||||
public ImageData writeImageSvg(OutputStream os) throws IOException {
|
public ImageData writeImageSvg(OutputStream os) throws IOException {
|
||||||
final UGraphicSvg ug = new UGraphicSvg(HColorUtils.WHITE, true, new Dimension2DDouble(0, 0),
|
final UGraphicSvg ug = new UGraphicSvg(HColorUtils.WHITE, true, new Dimension2DDouble(0, 0),
|
||||||
new ColorMapperIdentity(), false, 1.0, null, null, 0, "none", SvgCharSizeHack.NO_HACK,
|
new ColorMapperIdentity(), false, 1.0, null, null, 0, "none", FileFormat.SVG.getDefaultStringBounder(),
|
||||||
LengthAdjust.defaultValue());
|
LengthAdjust.defaultValue());
|
||||||
drawInternal(ug);
|
drawInternal(ug);
|
||||||
ug.writeToStream(os, null, -1); // dpi param is not used
|
ug.writeToStream(os, null, -1); // dpi param is not used
|
||||||
@ -98,20 +97,21 @@ public class GraphicsSudoku {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ImageData writeImageLatex(OutputStream os, FileFormat fileFormat) throws IOException {
|
public ImageData writeImageLatex(OutputStream os, FileFormat fileFormat) throws IOException {
|
||||||
final UGraphicTikz ug = new UGraphicTikz(HColorUtils.WHITE, new ColorMapperIdentity(), 1,
|
final UGraphicTikz ug = new UGraphicTikz(HColorUtils.WHITE, new ColorMapperIdentity(), FileFormat.LATEX.getDefaultStringBounder(), 1,
|
||||||
fileFormat == FileFormat.LATEX, TikzFontDistortion.getDefault());
|
fileFormat == FileFormat.LATEX);
|
||||||
drawInternal(ug);
|
drawInternal(ug);
|
||||||
ug.writeToStream(os, null, -1); // dpi param is not used
|
ug.writeToStream(os, null, -1); // dpi param is not used
|
||||||
return ImageDataSimple.ok();
|
return ImageDataSimple.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageData writeImagePng(OutputStream os) throws IOException {
|
public ImageData writeImagePng(OutputStream os) throws IOException {
|
||||||
|
final StringBounder stringBounder = FileFormat.PNG.getDefaultStringBounder();
|
||||||
final EmptyImageBuilder builder = new EmptyImageBuilder(null, sudoWidth, sudoHeight + textTotalHeight,
|
final EmptyImageBuilder builder = new EmptyImageBuilder(null, sudoWidth, sudoHeight + textTotalHeight,
|
||||||
Color.WHITE);
|
Color.WHITE, stringBounder);
|
||||||
final BufferedImage im = builder.getBufferedImage();
|
final BufferedImage im = builder.getBufferedImage();
|
||||||
final Graphics2D g3d = builder.getGraphics2D();
|
final Graphics2D g3d = builder.getGraphics2D();
|
||||||
|
|
||||||
final UGraphic ug = new UGraphicG2d(HColorUtils.WHITE, new ColorMapperIdentity(), g3d, 1.0);
|
final UGraphic ug = new UGraphicG2d(HColorUtils.WHITE, new ColorMapperIdentity(), stringBounder, g3d, 1.0);
|
||||||
|
|
||||||
drawInternal(ug);
|
drawInternal(ug);
|
||||||
g3d.dispose();
|
g3d.dispose();
|
||||||
|
@ -121,6 +121,7 @@ public class ImageBuilder {
|
|||||||
private String metadata;
|
private String metadata;
|
||||||
private long seed = 42;
|
private long seed = 42;
|
||||||
private ISkinParam skinParam;
|
private ISkinParam skinParam;
|
||||||
|
private StringBounder stringBounder;
|
||||||
private int status = 0;
|
private int status = 0;
|
||||||
private TitledDiagram titledDiagram;
|
private TitledDiagram titledDiagram;
|
||||||
private boolean randomPixel;
|
private boolean randomPixel;
|
||||||
@ -140,6 +141,7 @@ public class ImageBuilder {
|
|||||||
|
|
||||||
private ImageBuilder(FileFormatOption fileFormatOption) {
|
private ImageBuilder(FileFormatOption fileFormatOption) {
|
||||||
this.fileFormatOption = fileFormatOption;
|
this.fileFormatOption = fileFormatOption;
|
||||||
|
this.stringBounder = fileFormatOption.getDefaultStringBounder(SvgCharSizeHack.NO_HACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageBuilder annotations(boolean annotations) {
|
public ImageBuilder annotations(boolean annotations) {
|
||||||
@ -198,10 +200,6 @@ public class ImageBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SvgCharSizeHack getSvgCharSizeHack() {
|
|
||||||
return skinParam == null ? SvgCharSizeHack.NO_HACK : skinParam;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getSvgLinkTarget() {
|
private String getSvgLinkTarget() {
|
||||||
if (fileFormatOption.getSvgLinkTarget() != null) {
|
if (fileFormatOption.getSvgLinkTarget() != null) {
|
||||||
return fileFormatOption.getSvgLinkTarget();
|
return fileFormatOption.getSvgLinkTarget();
|
||||||
@ -219,6 +217,7 @@ public class ImageBuilder {
|
|||||||
|
|
||||||
public ImageBuilder styled(TitledDiagram diagram) {
|
public ImageBuilder styled(TitledDiagram diagram) {
|
||||||
skinParam = diagram.getSkinParam();
|
skinParam = diagram.getSkinParam();
|
||||||
|
stringBounder = fileFormatOption.getDefaultStringBounder(skinParam);
|
||||||
animation = diagram.getAnimation();
|
animation = diagram.getAnimation();
|
||||||
annotations = true;
|
annotations = true;
|
||||||
backcolor = diagram.calculateBackColor();
|
backcolor = diagram.calculateBackColor();
|
||||||
@ -235,8 +234,6 @@ public class ImageBuilder {
|
|||||||
if (annotations && titledDiagram != null) {
|
if (annotations && titledDiagram != null) {
|
||||||
if (!(udrawable instanceof TextBlock))
|
if (!(udrawable instanceof TextBlock))
|
||||||
throw new IllegalStateException("udrawable is not a TextBlock");
|
throw new IllegalStateException("udrawable is not a TextBlock");
|
||||||
final ISkinParam skinParam = titledDiagram.getSkinParam();
|
|
||||||
final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(skinParam);
|
|
||||||
final AnnotatedWorker annotatedWorker = new AnnotatedWorker(titledDiagram, skinParam, stringBounder);
|
final AnnotatedWorker annotatedWorker = new AnnotatedWorker(titledDiagram, skinParam, stringBounder);
|
||||||
udrawable = annotatedWorker.addAdd((TextBlock) udrawable);
|
udrawable = annotatedWorker.addAdd((TextBlock) udrawable);
|
||||||
}
|
}
|
||||||
@ -325,8 +322,7 @@ public class ImageBuilder {
|
|||||||
|
|
||||||
private Dimension2D getFinalDimension() {
|
private Dimension2D getFinalDimension() {
|
||||||
if (dimension == null) {
|
if (dimension == null) {
|
||||||
final LimitFinder limitFinder = new LimitFinder(
|
final LimitFinder limitFinder = new LimitFinder(stringBounder, true);
|
||||||
fileFormatOption.getDefaultStringBounder(getSvgCharSizeHack()), true);
|
|
||||||
udrawable.drawU(limitFinder);
|
udrawable.drawU(limitFinder);
|
||||||
dimension = new Dimension2DDouble(limitFinder.getMaxX() + 1 + margin.getLeft() + margin.getRight(),
|
dimension = new Dimension2DDouble(limitFinder.getMaxX() + 1 + margin.getLeft() + margin.getRight(),
|
||||||
limitFinder.getMaxY() + 1 + margin.getTop() + margin.getBottom());
|
limitFinder.getMaxY() + 1 + margin.getTop() + margin.getBottom());
|
||||||
@ -418,9 +414,9 @@ public class ImageBuilder {
|
|||||||
case VDX:
|
case VDX:
|
||||||
return new UGraphicVdx(backcolor, colorMapper);
|
return new UGraphicVdx(backcolor, colorMapper);
|
||||||
case LATEX:
|
case LATEX:
|
||||||
return new UGraphicTikz(backcolor, colorMapper, scaleFactor, true, option.getTikzFontDistortion());
|
return new UGraphicTikz(backcolor, colorMapper, stringBounder, scaleFactor, true);
|
||||||
case LATEX_NO_PREAMBLE:
|
case LATEX_NO_PREAMBLE:
|
||||||
return new UGraphicTikz(backcolor, colorMapper, scaleFactor, false, option.getTikzFontDistortion());
|
return new UGraphicTikz(backcolor, colorMapper, stringBounder, scaleFactor, false);
|
||||||
case BRAILLE_PNG:
|
case BRAILLE_PNG:
|
||||||
return new UGraphicBraille(backcolor, colorMapper);
|
return new UGraphicBraille(backcolor, colorMapper);
|
||||||
case UTXT:
|
case UTXT:
|
||||||
@ -438,11 +434,10 @@ public class ImageBuilder {
|
|||||||
final String hoverPathColorRGB = getHoverPathColorRGB();
|
final String hoverPathColorRGB = getHoverPathColorRGB();
|
||||||
final LengthAdjust lengthAdjust = skinParam == null ? LengthAdjust.defaultValue() : skinParam.getlengthAdjust();
|
final LengthAdjust lengthAdjust = skinParam == null ? LengthAdjust.defaultValue() : skinParam.getlengthAdjust();
|
||||||
final String preserveAspectRatio = getPreserveAspectRatio();
|
final String preserveAspectRatio = getPreserveAspectRatio();
|
||||||
final SvgCharSizeHack svgCharSizeHack = getSvgCharSizeHack();
|
|
||||||
final boolean svgDimensionStyle = skinParam == null || skinParam.svgDimensionStyle();
|
final boolean svgDimensionStyle = skinParam == null || skinParam.svgDimensionStyle();
|
||||||
final String svgLinkTarget = getSvgLinkTarget();
|
final String svgLinkTarget = getSvgLinkTarget();
|
||||||
final UGraphicSvg ug = new UGraphicSvg(backcolor, svgDimensionStyle, dim, colorMapper, false, scaleFactor,
|
final UGraphicSvg ug = new UGraphicSvg(backcolor, svgDimensionStyle, dim, colorMapper, false, scaleFactor,
|
||||||
svgLinkTarget, hoverPathColorRGB, seed, preserveAspectRatio, svgCharSizeHack, lengthAdjust);
|
svgLinkTarget, hoverPathColorRGB, seed, preserveAspectRatio, stringBounder, lengthAdjust);
|
||||||
return ug;
|
return ug;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -463,10 +458,10 @@ public class ImageBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final EmptyImageBuilder builder = new EmptyImageBuilder(watermark, (int) (dim.getWidth() * scaleFactor),
|
final EmptyImageBuilder builder = new EmptyImageBuilder(watermark, (int) (dim.getWidth() * scaleFactor),
|
||||||
(int) (dim.getHeight() * scaleFactor), backColor);
|
(int) (dim.getHeight() * scaleFactor), backColor, stringBounder);
|
||||||
final Graphics2D graphics2D = builder.getGraphics2D();
|
final Graphics2D graphics2D = builder.getGraphics2D();
|
||||||
|
|
||||||
final UGraphicG2d ug = new UGraphicG2d(backcolor, colorMapper, graphics2D, scaleFactor,
|
final UGraphicG2d ug = new UGraphicG2d(backcolor, colorMapper, stringBounder, graphics2D, scaleFactor,
|
||||||
affineTransforms == null ? null : affineTransforms.getFirst(), dx, dy);
|
affineTransforms == null ? null : affineTransforms.getFirst(), dx, dy);
|
||||||
ug.setBufferedImage(builder.getBufferedImage());
|
ug.setBufferedImage(builder.getBufferedImage());
|
||||||
final BufferedImage im = ug.getBufferedImage();
|
final BufferedImage im = ug.getBufferedImage();
|
||||||
|
@ -43,13 +43,11 @@ import java.awt.geom.PathIterator;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.FileFormat;
|
|
||||||
import net.sourceforge.plantuml.eps.EpsGraphics;
|
import net.sourceforge.plantuml.eps.EpsGraphics;
|
||||||
import net.sourceforge.plantuml.eps.EpsGraphicsMacroAndText;
|
import net.sourceforge.plantuml.eps.EpsGraphicsMacroAndText;
|
||||||
import net.sourceforge.plantuml.eps.EpsStrategy;
|
import net.sourceforge.plantuml.eps.EpsStrategy;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
import net.sourceforge.plantuml.graphic.FontStyle;
|
import net.sourceforge.plantuml.graphic.FontStyle;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.ClipContainer;
|
import net.sourceforge.plantuml.ugraphic.ClipContainer;
|
||||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||||
import net.sourceforge.plantuml.ugraphic.UClip;
|
import net.sourceforge.plantuml.ugraphic.UClip;
|
||||||
@ -63,12 +61,10 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
|||||||
|
|
||||||
public class DriverTextEps implements UDriver<EpsGraphics> {
|
public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||||
|
|
||||||
private final StringBounder stringBounder;
|
|
||||||
private final ClipContainer clipContainer;
|
private final ClipContainer clipContainer;
|
||||||
private final EpsStrategy strategy;
|
private final EpsStrategy strategy;
|
||||||
|
|
||||||
public DriverTextEps(ClipContainer clipContainer, EpsStrategy strategy) {
|
public DriverTextEps(ClipContainer clipContainer, EpsStrategy strategy) {
|
||||||
this.stringBounder = FileFormat.PNG.getDefaultStringBounder();
|
|
||||||
this.clipContainer = clipContainer;
|
this.clipContainer = clipContainer;
|
||||||
this.strategy = strategy;
|
this.strategy = strategy;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@ import java.awt.geom.Rectangle2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.EnsureVisible;
|
import net.sourceforge.plantuml.EnsureVisible;
|
||||||
import net.sourceforge.plantuml.FileFormat;
|
|
||||||
import net.sourceforge.plantuml.Log;
|
import net.sourceforge.plantuml.Log;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
import net.sourceforge.plantuml.graphic.FontStyle;
|
import net.sourceforge.plantuml.graphic.FontStyle;
|
||||||
@ -64,9 +63,11 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
|
|||||||
public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
|
public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
|
||||||
|
|
||||||
private final EnsureVisible visible;
|
private final EnsureVisible visible;
|
||||||
|
private final StringBounder stringBounder;
|
||||||
|
|
||||||
public DriverTextAsPathG2d(EnsureVisible visible) {
|
public DriverTextAsPathG2d(EnsureVisible visible, StringBounder stringBounder) {
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
|
this.stringBounder = stringBounder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void printFont() {
|
private static void printFont() {
|
||||||
@ -83,7 +84,7 @@ public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
|
|||||||
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
|
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
|
||||||
|
|
||||||
final UFont font = fontConfiguration.getFont().scaled(param.getScale());
|
final UFont font = fontConfiguration.getFont().scaled(param.getScale());
|
||||||
final Dimension2D dimBack = calculateDimension(FileFormat.PNG.getDefaultStringBounder(), font, shape.getText());
|
final Dimension2D dimBack = calculateDimension(font, shape.getText());
|
||||||
if (fontConfiguration.containsStyle(FontStyle.BACKCOLOR)) {
|
if (fontConfiguration.containsStyle(FontStyle.BACKCOLOR)) {
|
||||||
final Color extended = mapper.toColor(fontConfiguration.getExtendedColor());
|
final Color extended = mapper.toColor(fontConfiguration.getExtendedColor());
|
||||||
if (extended != null) {
|
if (extended != null) {
|
||||||
@ -108,14 +109,14 @@ public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
|
|||||||
if (extended != null) {
|
if (extended != null) {
|
||||||
g2d.setColor(mapper.toColor(extended));
|
g2d.setColor(mapper.toColor(extended));
|
||||||
}
|
}
|
||||||
final Dimension2D dim = calculateDimension(FileFormat.PNG.getDefaultStringBounder(), font, shape.getText());
|
final Dimension2D dim = calculateDimension(font, shape.getText());
|
||||||
final int ypos = (int) (y + 2.5);
|
final int ypos = (int) (y + 2.5);
|
||||||
g2d.setStroke(new BasicStroke((float) 1));
|
g2d.setStroke(new BasicStroke((float) 1));
|
||||||
g2d.drawLine((int) x, ypos, (int) (x + dim.getWidth()), ypos);
|
g2d.drawLine((int) x, ypos, (int) (x + dim.getWidth()), ypos);
|
||||||
g2d.setStroke(new BasicStroke());
|
g2d.setStroke(new BasicStroke());
|
||||||
}
|
}
|
||||||
if (fontConfiguration.containsStyle(FontStyle.WAVE)) {
|
if (fontConfiguration.containsStyle(FontStyle.WAVE)) {
|
||||||
final Dimension2D dim = calculateDimension(FileFormat.PNG.getDefaultStringBounder(), font, shape.getText());
|
final Dimension2D dim = calculateDimension(font, shape.getText());
|
||||||
final int ypos = (int) (y + 2.5) - 1;
|
final int ypos = (int) (y + 2.5) - 1;
|
||||||
final HColor extended = fontConfiguration.getExtendedColor();
|
final HColor extended = fontConfiguration.getExtendedColor();
|
||||||
if (extended != null) {
|
if (extended != null) {
|
||||||
@ -127,7 +128,7 @@ public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fontConfiguration.containsStyle(FontStyle.STRIKE)) {
|
if (fontConfiguration.containsStyle(FontStyle.STRIKE)) {
|
||||||
final Dimension2D dim = calculateDimension(FileFormat.PNG.getDefaultStringBounder(), font, shape.getText());
|
final Dimension2D dim = calculateDimension(font, shape.getText());
|
||||||
final FontMetrics fm = g2d.getFontMetrics(font.getUnderlayingFont());
|
final FontMetrics fm = g2d.getFontMetrics(font.getUnderlayingFont());
|
||||||
final int ypos = (int) (y - fm.getDescent() - 0.5);
|
final int ypos = (int) (y - fm.getDescent() - 0.5);
|
||||||
final HColor extended = fontConfiguration.getExtendedColor();
|
final HColor extended = fontConfiguration.getExtendedColor();
|
||||||
@ -140,7 +141,7 @@ public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public Dimension2D calculateDimension(StringBounder stringBounder, UFont font, String text) {
|
public Dimension2D calculateDimension(UFont font, String text) {
|
||||||
final Dimension2D rect = stringBounder.calculateDimension(font, text);
|
final Dimension2D rect = stringBounder.calculateDimension(font, text);
|
||||||
double h = rect.getHeight();
|
double h = rect.getHeight();
|
||||||
if (h < 10) {
|
if (h < 10) {
|
||||||
|
@ -48,7 +48,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.EnsureVisible;
|
import net.sourceforge.plantuml.EnsureVisible;
|
||||||
import net.sourceforge.plantuml.FileFormat;
|
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
import net.sourceforge.plantuml.graphic.FontStyle;
|
import net.sourceforge.plantuml.graphic.FontStyle;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
@ -66,9 +65,11 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
|||||||
public class DriverTextG2d implements UDriver<Graphics2D> {
|
public class DriverTextG2d implements UDriver<Graphics2D> {
|
||||||
|
|
||||||
private final EnsureVisible visible;
|
private final EnsureVisible visible;
|
||||||
|
private final StringBounder stringBounder;
|
||||||
|
|
||||||
public DriverTextG2d(EnsureVisible visible) {
|
public DriverTextG2d(EnsureVisible visible, StringBounder stringBounder) {
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
|
this.stringBounder = stringBounder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||||
@ -87,8 +88,7 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
|
|||||||
for (StyledString styledString : strings) {
|
for (StyledString styledString : strings) {
|
||||||
final FontConfiguration fc = styledString.getStyle() == FontStyle.BOLD ? fontConfiguration.bold()
|
final FontConfiguration fc = styledString.getStyle() == FontStyle.BOLD ? fontConfiguration.bold()
|
||||||
: fontConfiguration;
|
: fontConfiguration;
|
||||||
final Dimension2D dim = calculateDimension(FileFormat.PNG.getDefaultStringBounder(), fc.getFont(),
|
final Dimension2D dim = calculateDimension(fc.getFont(), styledString.getText());
|
||||||
styledString.getText());
|
|
||||||
printSingleText(g2d, fc, styledString.getText(), x, y, mapper, param);
|
printSingleText(g2d, fc, styledString.getText(), x, y, mapper, param);
|
||||||
x += dim.getWidth();
|
x += dim.getWidth();
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
|
|||||||
|
|
||||||
} else if (orientation == 0) {
|
} else if (orientation == 0) {
|
||||||
|
|
||||||
final Dimension2D dimBack = calculateDimension(FileFormat.PNG.getDefaultStringBounder(), font, text);
|
final Dimension2D dimBack = calculateDimension(font, text);
|
||||||
if (fontConfiguration.containsStyle(FontStyle.BACKCOLOR)) {
|
if (fontConfiguration.containsStyle(FontStyle.BACKCOLOR)) {
|
||||||
final Rectangle2D.Double area = new Rectangle2D.Double(x, y - dimBack.getHeight() + 1.5,
|
final Rectangle2D.Double area = new Rectangle2D.Double(x, y - dimBack.getHeight() + 1.5,
|
||||||
dimBack.getWidth(), dimBack.getHeight());
|
dimBack.getWidth(), dimBack.getHeight());
|
||||||
@ -143,14 +143,14 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
|
|||||||
if (extended != null) {
|
if (extended != null) {
|
||||||
g2d.setColor(mapper.toColor(extended));
|
g2d.setColor(mapper.toColor(extended));
|
||||||
}
|
}
|
||||||
final Dimension2D dim = calculateDimension(FileFormat.PNG.getDefaultStringBounder(), font, text);
|
final Dimension2D dim = calculateDimension(font, text);
|
||||||
final int ypos = (int) (y + 2.5);
|
final int ypos = (int) (y + 2.5);
|
||||||
g2d.setStroke(new BasicStroke((float) 1));
|
g2d.setStroke(new BasicStroke((float) 1));
|
||||||
g2d.drawLine((int) x, ypos, (int) (x + dim.getWidth()), ypos);
|
g2d.drawLine((int) x, ypos, (int) (x + dim.getWidth()), ypos);
|
||||||
g2d.setStroke(new BasicStroke());
|
g2d.setStroke(new BasicStroke());
|
||||||
}
|
}
|
||||||
if (fontConfiguration.containsStyle(FontStyle.WAVE)) {
|
if (fontConfiguration.containsStyle(FontStyle.WAVE)) {
|
||||||
final Dimension2D dim = calculateDimension(FileFormat.PNG.getDefaultStringBounder(), font, text);
|
final Dimension2D dim = calculateDimension(font, text);
|
||||||
final int ypos = (int) (y + 2.5) - 1;
|
final int ypos = (int) (y + 2.5) - 1;
|
||||||
if (extended != null) {
|
if (extended != null) {
|
||||||
g2d.setColor(mapper.toColor(extended));
|
g2d.setColor(mapper.toColor(extended));
|
||||||
@ -161,7 +161,7 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fontConfiguration.containsStyle(FontStyle.STRIKE)) {
|
if (fontConfiguration.containsStyle(FontStyle.STRIKE)) {
|
||||||
final Dimension2D dim = calculateDimension(FileFormat.PNG.getDefaultStringBounder(), font, text);
|
final Dimension2D dim = calculateDimension(font, text);
|
||||||
final FontMetrics fm = g2d.getFontMetrics(font.getUnderlayingFont());
|
final FontMetrics fm = g2d.getFontMetrics(font.getUnderlayingFont());
|
||||||
final int ypos = (int) (y - fm.getDescent() - 0.5);
|
final int ypos = (int) (y - fm.getDescent() - 0.5);
|
||||||
if (extended != null) {
|
if (extended != null) {
|
||||||
@ -174,7 +174,7 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public Dimension2D calculateDimension(StringBounder stringBounder, UFont font, String text) {
|
public Dimension2D calculateDimension(UFont font, String text) {
|
||||||
final Dimension2D rect = stringBounder.calculateDimension(font, text);
|
final Dimension2D rect = stringBounder.calculateDimension(font, text);
|
||||||
double h = rect.getHeight();
|
double h = rect.getHeight();
|
||||||
if (h < 10) {
|
if (h < 10) {
|
||||||
|
@ -50,9 +50,9 @@ import java.util.Objects;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.EnsureVisible;
|
import net.sourceforge.plantuml.EnsureVisible;
|
||||||
import net.sourceforge.plantuml.FileFormat;
|
|
||||||
import net.sourceforge.plantuml.Url;
|
import net.sourceforge.plantuml.Url;
|
||||||
import net.sourceforge.plantuml.anim.AffineTransformation;
|
import net.sourceforge.plantuml.anim.AffineTransformation;
|
||||||
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.png.PngIO;
|
import net.sourceforge.plantuml.png.PngIO;
|
||||||
import net.sourceforge.plantuml.posimo.DotPath;
|
import net.sourceforge.plantuml.posimo.DotPath;
|
||||||
import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic;
|
import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic;
|
||||||
@ -116,13 +116,13 @@ public class UGraphicG2d extends AbstractUGraphic<Graphics2D> implements EnsureV
|
|||||||
register(dpiFactor);
|
register(dpiFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UGraphicG2d(HColor defaultBackground, ColorMapper colorMapper, Graphics2D g2d, double dpiFactor) {
|
public UGraphicG2d(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder, Graphics2D g2d, double dpiFactor) {
|
||||||
this(defaultBackground, colorMapper, g2d, dpiFactor, null, 0, 0);
|
this(defaultBackground, colorMapper, stringBounder, g2d, dpiFactor, null, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UGraphicG2d(HColor defaultBackground, ColorMapper colorMapper, Graphics2D g2d, double dpiFactor,
|
public UGraphicG2d(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder, Graphics2D g2d, double dpiFactor,
|
||||||
AffineTransformation affineTransform, double dx, double dy) {
|
AffineTransformation affineTransform, double dx, double dy) {
|
||||||
super(defaultBackground, colorMapper, FileFormat.PNG.getDefaultStringBounder(), g2d);
|
super(defaultBackground, colorMapper, stringBounder, g2d);
|
||||||
this.hasAffineTransform = affineTransform != null;
|
this.hasAffineTransform = affineTransform != null;
|
||||||
this.dpiFactor = dpiFactor;
|
this.dpiFactor = dpiFactor;
|
||||||
if (dpiFactor != 1.0) {
|
if (dpiFactor != 1.0) {
|
||||||
@ -140,9 +140,9 @@ public class UGraphicG2d extends AbstractUGraphic<Graphics2D> implements EnsureV
|
|||||||
private void register(double dpiFactor) {
|
private void register(double dpiFactor) {
|
||||||
registerDriver(URectangle.class, new DriverRectangleG2d(dpiFactor, this));
|
registerDriver(URectangle.class, new DriverRectangleG2d(dpiFactor, this));
|
||||||
if (this.hasAffineTransform || dpiFactor != 1.0) {
|
if (this.hasAffineTransform || dpiFactor != 1.0) {
|
||||||
registerDriver(UText.class, new DriverTextAsPathG2d(this));
|
registerDriver(UText.class, new DriverTextAsPathG2d(this, getStringBounder()));
|
||||||
} else {
|
} else {
|
||||||
registerDriver(UText.class, new DriverTextG2d(this));
|
registerDriver(UText.class, new DriverTextG2d(this, getStringBounder()));
|
||||||
}
|
}
|
||||||
registerDriver(ULine.class, new DriverLineG2d(dpiFactor));
|
registerDriver(ULine.class, new DriverLineG2d(dpiFactor));
|
||||||
registerDriver(UPixel.class, new DriverPixelG2d());
|
registerDriver(UPixel.class, new DriverPixelG2d());
|
||||||
|
@ -40,10 +40,8 @@ import java.io.OutputStream;
|
|||||||
|
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.FileFormat;
|
|
||||||
import net.sourceforge.plantuml.SvgCharSizeHack;
|
|
||||||
import net.sourceforge.plantuml.TikzFontDistortion;
|
|
||||||
import net.sourceforge.plantuml.Url;
|
import net.sourceforge.plantuml.Url;
|
||||||
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.posimo.DotPath;
|
import net.sourceforge.plantuml.posimo.DotPath;
|
||||||
import net.sourceforge.plantuml.svg.LengthAdjust;
|
import net.sourceforge.plantuml.svg.LengthAdjust;
|
||||||
import net.sourceforge.plantuml.svg.SvgGraphics;
|
import net.sourceforge.plantuml.svg.SvgGraphics;
|
||||||
@ -89,10 +87,10 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
|
|||||||
|
|
||||||
public UGraphicSvg(HColor defaultBackground, boolean svgDimensionStyle, Dimension2D minDim, ColorMapper colorMapper,
|
public UGraphicSvg(HColor defaultBackground, boolean svgDimensionStyle, Dimension2D minDim, ColorMapper colorMapper,
|
||||||
boolean textAsPath, double scale, String linkTarget, String hover, long seed, String preserveAspectRatio,
|
boolean textAsPath, double scale, String linkTarget, String hover, long seed, String preserveAspectRatio,
|
||||||
SvgCharSizeHack charSizeHack, LengthAdjust lengthAdjust) {
|
StringBounder stringBounder, LengthAdjust lengthAdjust) {
|
||||||
this(defaultBackground, minDim, colorMapper, new SvgGraphics(colorMapper.toSvg(defaultBackground),
|
this(defaultBackground, minDim, colorMapper, new SvgGraphics(colorMapper.toSvg(defaultBackground),
|
||||||
svgDimensionStyle, minDim, scale, hover, seed, preserveAspectRatio, lengthAdjust), textAsPath,
|
svgDimensionStyle, minDim, scale, hover, seed, preserveAspectRatio, lengthAdjust), textAsPath,
|
||||||
linkTarget, charSizeHack);
|
linkTarget, stringBounder);
|
||||||
if (defaultBackground instanceof HColorGradient) {
|
if (defaultBackground instanceof HColorGradient) {
|
||||||
final SvgGraphics svg = getGraphicObject();
|
final SvgGraphics svg = getGraphicObject();
|
||||||
svg.paintBackcolorGradient(colorMapper, (HColorGradient) defaultBackground);
|
svg.paintBackcolorGradient(colorMapper, (HColorGradient) defaultBackground);
|
||||||
@ -115,8 +113,8 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private UGraphicSvg(HColor defaultBackground, Dimension2D minDim, ColorMapper colorMapper, SvgGraphics svg,
|
private UGraphicSvg(HColor defaultBackground, Dimension2D minDim, ColorMapper colorMapper, SvgGraphics svg,
|
||||||
boolean textAsPath, String linkTarget, SvgCharSizeHack charSizeHack) {
|
boolean textAsPath, String linkTarget, StringBounder stringBounder) {
|
||||||
super(defaultBackground, colorMapper, FileFormat.SVG.getDefaultStringBounder(TikzFontDistortion.getDefault(), charSizeHack), svg);
|
super(defaultBackground, colorMapper, stringBounder, svg);
|
||||||
this.textAsPath2 = textAsPath;
|
this.textAsPath2 = textAsPath;
|
||||||
this.target = linkTarget;
|
this.target = linkTarget;
|
||||||
register();
|
register();
|
||||||
|
@ -37,10 +37,9 @@ package net.sourceforge.plantuml.ugraphic.tikz;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.FileFormat;
|
|
||||||
import net.sourceforge.plantuml.TikzFontDistortion;
|
|
||||||
import net.sourceforge.plantuml.Url;
|
import net.sourceforge.plantuml.Url;
|
||||||
import net.sourceforge.plantuml.creole.legacy.AtomText;
|
import net.sourceforge.plantuml.creole.legacy.AtomText;
|
||||||
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.posimo.DotPath;
|
import net.sourceforge.plantuml.posimo.DotPath;
|
||||||
import net.sourceforge.plantuml.tikz.TikzGraphics;
|
import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||||
import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic;
|
import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic;
|
||||||
@ -60,20 +59,9 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
|
|||||||
|
|
||||||
public class UGraphicTikz extends AbstractUGraphic<TikzGraphics> implements ClipContainer {
|
public class UGraphicTikz extends AbstractUGraphic<TikzGraphics> implements ClipContainer {
|
||||||
|
|
||||||
private final TikzFontDistortion tikzFontDistortion;
|
public UGraphicTikz(HColor defaultBackground, ColorMapper colorMapper, StringBounder stringBounder, double scale, boolean withPreamble) {
|
||||||
|
super(defaultBackground, colorMapper, stringBounder, new TikzGraphics(scale, withPreamble));
|
||||||
private UGraphicTikz(HColor defaultBackground, ColorMapper colorMapper, TikzGraphics tikz,
|
|
||||||
TikzFontDistortion tikzFontDistortion) {
|
|
||||||
super(defaultBackground, colorMapper, FileFormat.LATEX.getDefaultStringBounder(tikzFontDistortion), tikz);
|
|
||||||
this.tikzFontDistortion = tikzFontDistortion;
|
|
||||||
register();
|
register();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public UGraphicTikz(HColor defaultBackground, ColorMapper colorMapper, double scale, boolean withPreamble,
|
|
||||||
TikzFontDistortion tikzFontDistortion) {
|
|
||||||
this(defaultBackground, colorMapper, new TikzGraphics(scale, withPreamble), tikzFontDistortion);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -83,7 +71,6 @@ public class UGraphicTikz extends AbstractUGraphic<TikzGraphics> implements Clip
|
|||||||
|
|
||||||
private UGraphicTikz(UGraphicTikz other) {
|
private UGraphicTikz(UGraphicTikz other) {
|
||||||
super(other);
|
super(other);
|
||||||
this.tikzFontDistortion = other.tikzFontDistortion;
|
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user