mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 02:49:06 +00:00
version 1.2020.12
This commit is contained in:
parent
3192fa218c
commit
301fd18b2f
2
pom.xml
2
pom.xml
@ -35,7 +35,7 @@
|
||||
|
||||
<groupId>net.sourceforge.plantuml</groupId>
|
||||
<artifactId>plantuml</artifactId>
|
||||
<version>1.2020.12-SNAPSHOT</version>
|
||||
<version>1.2020.13-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PlantUML</name>
|
||||
|
@ -51,6 +51,8 @@ import net.sourceforge.plantuml.graphic.Line;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.preproc.Defines;
|
||||
import net.sourceforge.plantuml.security.ImageIO;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UImageSvg;
|
||||
@ -87,7 +89,7 @@ public class EmbeddedDiagram implements CharSequence {
|
||||
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
|
||||
throw new UnsupportedOperationException(getClass().toString());
|
||||
}
|
||||
|
||||
|
||||
private Draw(ISkinSimple skinParam) {
|
||||
this.skinParam = skinParam;
|
||||
}
|
||||
@ -118,7 +120,7 @@ public class EmbeddedDiagram implements CharSequence {
|
||||
return;
|
||||
}
|
||||
final BufferedImage im = getImage();
|
||||
final UShape image = new UImage(im);
|
||||
final UShape image = new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR));
|
||||
ug.draw(image);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -496,7 +496,7 @@ public class Run {
|
||||
sourceFileReader = new SourceFileReaderCopyCat(option.getDefaultDefines(f), f, outputDir,
|
||||
option.getConfig(), option.getCharset(), option.getFileFormatOption());
|
||||
} else {
|
||||
sourceFileReader = new SourceFileReader(option.getDefaultDefines(f), f, null, option.getConfig(),
|
||||
sourceFileReader = new SourceFileReader(option.getDefaultDefines(f), f, outputDir, option.getConfig(),
|
||||
option.getCharset(), option.getFileFormatOption());
|
||||
}
|
||||
} else {
|
||||
|
@ -76,6 +76,8 @@ import net.sourceforge.plantuml.sprite.Sprite;
|
||||
import net.sourceforge.plantuml.svek.EmptySvgException;
|
||||
import net.sourceforge.plantuml.svek.GraphvizCrash;
|
||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
@ -188,7 +190,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
|
||||
fileFormatOption = fileFormatOption.withPreserveAspectRatio(getSkinParam().getPreserveAspectRatio());
|
||||
fileFormatOption = fileFormatOption.withTikzFontDistortion(getSkinParam().getTikzFontDistortion());
|
||||
if (hover != null) {
|
||||
fileFormatOption = fileFormatOption.withHoverColor(getSkinParam().getColorMapper().toHtml(hover));
|
||||
fileFormatOption = fileFormatOption.withHoverColor(getSkinParam().getColorMapper().toRGB(hover));
|
||||
}
|
||||
|
||||
if (fileFormatOption.getFileFormat() == FileFormat.PDF) {
|
||||
@ -252,7 +254,8 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
|
||||
graphicStrings.drawU(ug);
|
||||
final double height = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight();
|
||||
ug = ug.apply(UTranslate.dy(height));
|
||||
ug.draw(new UImage(im).scaleNearestNeighbor(3));
|
||||
ug.draw(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR))
|
||||
.scale(3));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -61,6 +61,8 @@ import net.sourceforge.plantuml.security.SFile;
|
||||
import net.sourceforge.plantuml.security.SURL;
|
||||
import net.sourceforge.plantuml.security.SecurityProfile;
|
||||
import net.sourceforge.plantuml.security.SecurityUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
@ -86,7 +88,8 @@ public class AtomImg extends AbstractAtom implements Atom {
|
||||
if (im == null) {
|
||||
im = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
|
||||
}
|
||||
return new AtomImg(new UImage(null, im).scaleNearestNeighbor(scale).getImage(), 1, null, null);
|
||||
return new AtomImg(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR))
|
||||
.scale(scale).getImage(1), 1, null, null);
|
||||
}
|
||||
|
||||
public static Atom create(String src, ImgValign valign, int vspace, double scale, Url url) {
|
||||
@ -218,7 +221,8 @@ public class AtomImg extends AbstractAtom implements Atom {
|
||||
if (url != null) {
|
||||
ug.startUrl(url);
|
||||
}
|
||||
ug.draw(new UImage(rawFileName, image).scale(scale));
|
||||
ug.draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR))
|
||||
.withRawFileName(rawFileName).scale(scale));
|
||||
if (url != null) {
|
||||
ug.closeUrl();
|
||||
}
|
||||
|
@ -52,23 +52,20 @@ import net.sourceforge.plantuml.ugraphic.color.HColorSimple;
|
||||
|
||||
public class AtomMath extends AbstractAtom implements Atom {
|
||||
|
||||
private final double scale;
|
||||
private final ScientificEquationSafe math;
|
||||
private final HColor foreground;
|
||||
private final HColor background;
|
||||
private final ColorMapper colorMapper;
|
||||
|
||||
public AtomMath(ScientificEquationSafe math, HColor foreground, HColor background, double scale,
|
||||
ColorMapper colorMapper) {
|
||||
public AtomMath(ScientificEquationSafe math, HColor foreground, HColor background, ColorMapper colorMapper) {
|
||||
this.math = math;
|
||||
this.colorMapper = colorMapper;
|
||||
this.foreground = foreground;
|
||||
this.background = background;
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
private Dimension2D calculateDimensionSlow(StringBounder stringBounder) {
|
||||
final BufferedImage image = math.getImage(scale, Color.BLACK, Color.WHITE);
|
||||
final BufferedImage image = math.getImage(Color.BLACK, Color.WHITE).withScale(1).getImage();
|
||||
return new Dimension2DDouble(image.getWidth(), image.getHeight());
|
||||
}
|
||||
|
||||
@ -96,10 +93,10 @@ public class AtomMath extends AbstractAtom implements Atom {
|
||||
final Color fore = getColor(foreground, Color.BLACK);
|
||||
// final double dpiFactor = ug.dpiFactor();
|
||||
if (isSvg) {
|
||||
final SvgString svg = math.getSvg(scale, fore, back);
|
||||
final SvgString svg = math.getSvg(1, fore, back);
|
||||
ug.draw(new UImageSvg(svg));
|
||||
} else {
|
||||
final UImage image = new UImage(null, math.getImage(scale, fore, back), math.getFormula());
|
||||
final UImage image = new UImage(math.getImage(fore, back)).withFormula(math.getFormula());
|
||||
ug.draw(image);
|
||||
}
|
||||
}
|
||||
|
@ -45,15 +45,13 @@ import net.sourceforge.plantuml.math.ScientificEquationSafe;
|
||||
public class CommandCreoleLatex implements Command {
|
||||
|
||||
private final Pattern2 pattern;
|
||||
private final double scale;
|
||||
|
||||
private CommandCreoleLatex(String p, double scale) {
|
||||
private CommandCreoleLatex(String p) {
|
||||
this.pattern = MyPattern.cmpile(p);
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public static Command create(double scale) {
|
||||
return new CommandCreoleLatex("^(?i)(" + Splitter.latexPattern + ")", scale);
|
||||
public static Command create() {
|
||||
return new CommandCreoleLatex("^(?i)(" + Splitter.latexPattern + ")");
|
||||
}
|
||||
|
||||
public int matchingSize(String line) {
|
||||
@ -70,7 +68,7 @@ public class CommandCreoleLatex implements Command {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final String latex = m.group(2);
|
||||
stripe.addMath(ScientificEquationSafe.fromLatex(latex), scale);
|
||||
stripe.addMath(ScientificEquationSafe.fromLatex(latex));
|
||||
return line.substring(m.group(1).length());
|
||||
}
|
||||
|
||||
|
@ -45,15 +45,13 @@ import net.sourceforge.plantuml.math.ScientificEquationSafe;
|
||||
public class CommandCreoleMath implements Command {
|
||||
|
||||
private final Pattern2 pattern;
|
||||
private final double scale;
|
||||
|
||||
private CommandCreoleMath(String p, double scale) {
|
||||
private CommandCreoleMath(String p) {
|
||||
this.pattern = MyPattern.cmpile(p);
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public static Command create(double scale) {
|
||||
return new CommandCreoleMath("^(?i)(" + Splitter.mathPattern + ")", scale);
|
||||
public static Command create() {
|
||||
return new CommandCreoleMath("^(?i)(" + Splitter.mathPattern + ")");
|
||||
}
|
||||
|
||||
public int matchingSize(String line) {
|
||||
@ -70,7 +68,7 @@ public class CommandCreoleMath implements Command {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final String math = m.group(2);
|
||||
stripe.addMath(ScientificEquationSafe.fromAsciiMath(math), scale);
|
||||
stripe.addMath(ScientificEquationSafe.fromAsciiMath(math));
|
||||
return line.substring(m.group(1).length());
|
||||
}
|
||||
|
||||
|
@ -152,9 +152,8 @@ public class StripeSimple implements Stripe {
|
||||
this.commands.add(CommandCreoleImg.create());
|
||||
this.commands.add(CommandCreoleQrcode.create());
|
||||
this.commands.add(CommandCreoleOpenIcon.create(skinParam.getIHtmlColorSet()));
|
||||
final double scale = skinParam.getDpi() / 96.0;
|
||||
this.commands.add(CommandCreoleMath.create(scale));
|
||||
this.commands.add(CommandCreoleLatex.create(scale));
|
||||
this.commands.add(CommandCreoleMath.create());
|
||||
this.commands.add(CommandCreoleLatex.create());
|
||||
this.commands.add(CommandCreoleSprite.create(skinParam.getIHtmlColorSet()));
|
||||
this.commands.add(CommandCreoleSpace.create());
|
||||
this.commands.add(CommandCreoleFontFamilyChange.create());
|
||||
@ -248,8 +247,8 @@ public class StripeSimple implements Stripe {
|
||||
}
|
||||
}
|
||||
|
||||
public void addMath(ScientificEquationSafe math, double scale) {
|
||||
atoms.add(new AtomMath(math, fontConfiguration.getColor(), fontConfiguration.getExtendedColor(), scale,
|
||||
public void addMath(ScientificEquationSafe math) {
|
||||
atoms.add(new AtomMath(math, fontConfiguration.getColor(), fontConfiguration.getExtendedColor(),
|
||||
skinParam.getColorMapper()));
|
||||
}
|
||||
|
||||
|
@ -35,15 +35,15 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram.dot;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
|
||||
public class GraphvizVersionFinder {
|
||||
|
||||
final private SFile dotExe;
|
||||
final private File dotExe;
|
||||
final public static GraphvizVersion DEFAULT = new GraphvizVersion() {
|
||||
public boolean useShield() {
|
||||
return true;
|
||||
@ -66,7 +66,7 @@ public class GraphvizVersionFinder {
|
||||
}
|
||||
};
|
||||
|
||||
public GraphvizVersionFinder(SFile dotExe) {
|
||||
public GraphvizVersionFinder(File dotExe) {
|
||||
this.dotExe = dotExe;
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,6 @@ import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
|
||||
public class GraphvizVersions {
|
||||
|
||||
private final static GraphvizVersions singleton = new GraphvizVersions();
|
||||
@ -68,7 +66,7 @@ public class GraphvizVersions {
|
||||
}
|
||||
|
||||
static GraphvizVersion checkVersionSlow(String pathExecutable) {
|
||||
final GraphvizVersionFinder finder = new GraphvizVersionFinder(new SFile(pathExecutable));
|
||||
final GraphvizVersionFinder finder = new GraphvizVersionFinder(new File(pathExecutable));
|
||||
return finder.getVersion();
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.SkinParam;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Bodier;
|
||||
import net.sourceforge.plantuml.cucadiagram.BodierImpl;
|
||||
@ -125,12 +126,17 @@ public final class EntityFactory {
|
||||
if (g.getUrl99() != null) {
|
||||
folder.addUrl(g.getUrl99());
|
||||
}
|
||||
if (g.getColors(skinParam).getColor(ColorType.BACK) == null) {
|
||||
final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack();
|
||||
final HColor c1 = skinParam.getHtmlColor(param, g.getStereotype(), false);
|
||||
folder.setSpecificColorTOBEREMOVED(ColorType.BACK, c1 == null ? skinParam.getBackgroundColor(false) : c1);
|
||||
if (SkinParam.USE_STYLES()) {
|
||||
// System.err.println("Backcolor ?");
|
||||
} else {
|
||||
folder.setSpecificColorTOBEREMOVED(ColorType.BACK, g.getColors(skinParam).getColor(ColorType.BACK));
|
||||
if (g.getColors(skinParam).getColor(ColorType.BACK) == null) {
|
||||
final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack();
|
||||
final HColor c1 = skinParam.getHtmlColor(param, g.getStereotype(), false);
|
||||
folder.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
c1 == null ? skinParam.getBackgroundColor(false) : c1);
|
||||
} else {
|
||||
folder.setSpecificColorTOBEREMOVED(ColorType.BACK, g.getColors(skinParam).getColor(ColorType.BACK));
|
||||
}
|
||||
}
|
||||
emptyGroupsAsNode.put(g, folder);
|
||||
return folder;
|
||||
|
@ -44,6 +44,8 @@ import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
@ -63,13 +65,13 @@ public class PSystemDedication extends AbstractPSystem {
|
||||
@Override
|
||||
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)
|
||||
throws IOException {
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(),
|
||||
false, null, getMetadata(), null, 1.0, HColorUtils.WHITE);
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, getMetadata(),
|
||||
null, 1.0, HColorUtils.WHITE);
|
||||
imageBuilder.setUDrawable(new UDrawable() {
|
||||
public void drawU(UGraphic ug) {
|
||||
final BufferedImage bufferedImage = dedication.getBufferedImage(keepLetter);
|
||||
if (bufferedImage != null) {
|
||||
ug.draw(new UImage(bufferedImage));
|
||||
ug.draw(new UImage(new PixelImage(bufferedImage, AffineTransformType.TYPE_BILINEAR)));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -59,7 +59,9 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
@ -72,25 +74,26 @@ public class PSystemDonors extends AbstractPSystem {
|
||||
private static final int COLS = 6;
|
||||
private static final int FREE_LINES = 6;
|
||||
|
||||
public static final String DONORS = "6tOB0AmEUFDMA37HMBjrivhoM7AcIGJByuJYCB28fxi1yGUuTthSRwI_YAvqxvjcH5ksfZZF628M13sU"
|
||||
+ "9jSCszpR0s7EZ1V1dJc2dWyV88ghDl8ZTUGuzq0i5Tr_cRWztJekLC6nQeHoeBYruNrdR9wTnXUl7atG"
|
||||
+ "Hk37mBxwVrE7hCj3LPYbknNFOp4g6g4wB_GKSwnp_qSL5w9Wtw7gOSindRgu3eSgAk3L2O-1HPh1RUEy"
|
||||
+ "MZGP5PFOH4geDaeG4eCPEd9I-mBvGGQ9N-e5j6cjhY6HFQ2upXI9hjjo1xODDBzIugNW3xvWyy0SIZdS"
|
||||
+ "9oXnRiIGyFEWeMqLlR4rHvOySS1G3YtipH-Av4Zl8PbLXXQ9W1ee27aO1oIZK8Scd1rR3AYw1riCQ92g"
|
||||
+ "g_qct7qSbgTeRZJS1HO15fm5r13aVz0JFgEll6IopwUYbf2dIRogRKJzgdW_RJEYR_RH950-xA5PiLy5"
|
||||
+ "ojP3EbjUn_oheqFUDMJbqMz67TbSWxlivj8mlxH0_GXqsvoe9Bw-A0iBIGZNbdeXNUVcAxKNuOGDAHNh"
|
||||
+ "v5riUOt-eIjIsOHOpWuMyhH_NMrA1bleogKQUaEhEiqwdsX93VNtGnuTEjy5rrIRtJjCxv4s5_d_NRSq"
|
||||
+ "CnG7wCGKiw3h0aNdQ5hr5nk8uBJGXI4t0V84ofV9BNzPFiGVzG71MqW4eh1HqWd-_4Xvo8KBCx2gMrAC"
|
||||
+ "0EPFAUT98kY42FKw13sCAfb8cRj-XadFicLZRfdqmPKr62C_ffEAa_3TNE0HXjLgqKmtQnzXbU0Ll4xo"
|
||||
+ "gdkDzgiKiIsyProarWyPY3FC6H4fFwBOjhHBmaCTXLci9JTryJtT3WuUkdl16InQnOmsso5BGk5iCixK"
|
||||
+ "Mum-D1Z-Za8sQVVcfbv1-Awm4TpCQ0QtboOtrEGI2R_bBCV35e0IS_6ANL7XKaBLB2kLhMi9aoDMZqE6"
|
||||
+ "_4xq2IoLU-5fnuxcxiGpnAEW3kVTiUfKVqvftXPGGqmJPAI5CcT8auUj1J9mh4xFIXjWzrCx5enjVh9Y"
|
||||
+ "pQ7ujebOumODKs2wYF160v582kebUib9OW3VTVcLUgIlWu_lwcd5E4XQI6AW2bATyODJq_3v34rZlKR_"
|
||||
+ "jxMsMtR-_7iTsUJK6VUwYY1w3YBnRwS07UKa8dWQyFwMZv1t2gmQNNfGX2jtARqPI5YmczwPHJqwp6ZS"
|
||||
+ "yMAvERdevTk7glxkv3PSB0RViE8YaoQVVOcJrdRre8hQllkDnK4E7NyNLQPaSfLBQs14WzZMNfpqs6sc"
|
||||
+ "uYwh5U31xBXCOErNJy_DD5uovhfZgMvu7CWM8ZAa67ryiQQczN4Yi5awytjBsv3CwB_1Y7vHhUcnLm_z"
|
||||
+ "1-NtM15e-BQ5Ciw91CD5we61VdEVanbqyms7l30r9pfTBBvoqMt3pXUiiD_4ZyX2mWlRccaYhBLtgpdz"
|
||||
+ "QIwUi-t8qRUGVM8scbx8guWPoC9YWvwTM2ZbU215KZ1dRvae8ksWDxYiHm2Tec3yVnc4euNcHsHMcMTl" + "57FP9cC_bFBc_GC0";
|
||||
public static final String DONORS = "6vaB02mFUBXRGOc9nbfsvvsjZ9-86KqYM9ud58U1HJpT3OW_mBtJutuZ_KLqfNlVD2FQiZN5USOGiI3e"
|
||||
+ "yJIvPjZctXu8Sw9y2FxT21uW0qH9r4QrBFUas6sRAaDAyEyxN_abw1tUiK6YkKgZnP5xPFSBxs-6ytpJ"
|
||||
+ "-EYbPy0IgdwAxcl_Tqqhw_AcAWpfifenC-hqX2hcrgWHaIB-_rJhRgSsJgOw3IG1dSgvWflgLC2h4nu3"
|
||||
+ "YpI3MyPvDMaoAYQ-YPHWQvGGD3epjEMazZco8OF4B_K3jDbSOQd8cL0SeoJHzVNSlcq3pI-NU15y8HPi"
|
||||
+ "7fX3AOThWHBdHeo4JmGDBRFeZQqwikI97OPIQ64V_j18ZdYaCdCwMYJy7e62eATnGD8BjMd2sT75W2eZ"
|
||||
+ "sQBFabHT6G_XpkkmFCLge-5EiF2pu2oWXY3_Woxuz5ZrqUGSLqCjgQT9tggjH_rAl9Us6T4t_MYIA9_j"
|
||||
+ "JREYk0kKBLAThJx7UCqZ87TBhRpYowWZcoEuzzsx6jO_MY0_0jrM4vNapx8lB2GXhgtiWtIT6wyyUX6E"
|
||||
+ "sP1fOXs_YosliHUwmfMDoR82BFHf-xhIX0osq9NBmz0JMfLfrlb4IrfQlr_qwB9ndt1DfTczW_G-okOY"
|
||||
+ "_x_RlSmCnG4wLc8MT9sWQ5nDgzvY0n6S5hemv2OWLw2ykMx5pUiYl-e3WhUG4OZ2XgGTulMHSjT5YEbO"
|
||||
+ "rKqfHW3pfvHpaGXO4A5Mkw1RKIKJAUlT7gUhP_goCNUVzC5rky4OnJ6Tr5Y4xzu5zp2iL8rcjbaxXJa5"
|
||||
+ "B-Drd5VTQwHVnRAzXVUK3wdvHmRYJE-CY9GVqTYsye_2tJeAivXBRjRbkxeV73nqvu8pMBIC6MssGvQ0"
|
||||
+ "mjbadAbV6NvQClmTWMp2xurDNa7eJbWFOMOqWjjRasjgSec4ptIMusONW6ArUCMkY719eMgMcSeMDiNa"
|
||||
+ "6Qj78KD-ntm2I-LQUDgmrjoLUKRrAAZ3UNUiMjQlGytR0ghBOOACj51gf9eYVIsGWMjrUfPQ1zkV5bZG"
|
||||
+ "j_6eYbM7ujicsgxSe68AJ1SHVj4W4cb1hKGlEKaCy3z_VgKUxUlWupkZV38EaZqaCL05hKu_SMeQF8zX"
|
||||
+ "PQpNwFlrrdQluC-_rz4cf_PuvgS8ekSW6lys2k0e9p62fu6_BXybxoHODJgrKPGhroYz4KXOi1FlpA8U"
|
||||
+ "6MRKxyHakHcvw1NRXwhyxUGAN2o6sB3Y8fEc6B7afBVTUb15RD_vnk8WXuQ_YoeJChdAPJKmGY6sGYzE"
|
||||
+ "Ukmsod2NLGlme3ek4vZxrM-dMTuqvhnZgMvu3CWtH-HKqIEqiAQcjMCXi56C-Rsb_LIcntyoebz4QtRi"
|
||||
+ "rKFlGVaziWiqV5k3z3D6Wk4YPST0kxdFoGZSVCCXRqpDYKmNYwrSTCMmymOhx3Vs4bb8U65Rgrp2N7ju"
|
||||
+ "pUcNTtbMsv6ZRI7xM3MQNYYgY178XSKwNPrOAELu84LIC6TlcIWYxQ0tkAHd04vHSBo_sn2E5PeVqQnz"
|
||||
+ "FADHp6MTUt4FOYgSt4zxKhQRdfK7";
|
||||
|
||||
/*
|
||||
* Special thanks to our sponsors and donors:
|
||||
@ -127,7 +130,8 @@ public class PSystemDonors extends AbstractPSystem {
|
||||
x += dim.getWidth() + 10;
|
||||
y = Math.max(y, dim.getHeight());
|
||||
}
|
||||
final UImage logo = new UImage(PSystemVersion.getPlantumlImage());
|
||||
final UImage logo = new UImage(
|
||||
new PixelImage(PSystemVersion.getPlantumlImage(), AffineTransformType.TYPE_BILINEAR));
|
||||
ug.apply(new UTranslate(lastX, y - logo.getHeight())).draw(logo);
|
||||
}
|
||||
};
|
||||
|
@ -43,6 +43,8 @@ import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
@ -61,12 +63,12 @@ public class PSystemCharlie extends AbstractPSystem {
|
||||
@Override
|
||||
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)
|
||||
throws IOException {
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(),
|
||||
false, null, getMetadata(), null, 1.0, HColorUtils.BLACK);
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, getMetadata(),
|
||||
null, 1.0, HColorUtils.BLACK);
|
||||
imageBuilder.setUDrawable(new UDrawable() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final UImage im = new UImage(image);
|
||||
final UImage im = new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR));
|
||||
ug.draw(im);
|
||||
}
|
||||
});
|
||||
|
@ -77,6 +77,8 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.security.SecurityUtils;
|
||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
@ -301,7 +303,8 @@ public abstract class PSystemError extends AbstractPSystem {
|
||||
}
|
||||
|
||||
private TextBlock addMessageArecibo(final TextBlock source) throws IOException {
|
||||
final UImage message = new UImage(PSystemVersion.getArecibo());
|
||||
final UImage message = new UImage(
|
||||
new PixelImage(PSystemVersion.getArecibo(), AffineTransformType.TYPE_BILINEAR));
|
||||
TextBlock result = TextBlockUtils.mergeLR(source, TextBlockUtils.fromUImage(message), VerticalAlignment.TOP);
|
||||
return result;
|
||||
}
|
||||
@ -323,7 +326,8 @@ public abstract class PSystemError extends AbstractPSystem {
|
||||
if (qrcode == null) {
|
||||
result = text;
|
||||
} else {
|
||||
final UImage qr = new UImage(qrcode).scaleNearestNeighbor(3);
|
||||
final UImage qr = new UImage(
|
||||
new PixelImage(qrcode, AffineTransformType.TYPE_NEAREST_NEIGHBOR)).scale(3);
|
||||
result = TextBlockUtils.mergeLR(text, TextBlockUtils.fromUImage(qr), VerticalAlignment.CENTER);
|
||||
}
|
||||
return TextBlockUtils.addBackcolor(result, backColor);
|
||||
@ -347,8 +351,9 @@ public abstract class PSystemError extends AbstractPSystem {
|
||||
}
|
||||
|
||||
private TextBlockBackcolored getMessagePatreon() {
|
||||
final UImage message = new UImage(PSystemVersion.getTime01());
|
||||
final Color back = new Color(message.getImage().getRGB(0, 0));
|
||||
final UImage message = new UImage(
|
||||
new PixelImage(PSystemVersion.getTime01(), AffineTransformType.TYPE_BILINEAR));
|
||||
final Color back = new Color(message.getImage(1).getRGB(0, 0));
|
||||
final HColor backColor = new HColorSimple(back, false);
|
||||
|
||||
final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils();
|
||||
@ -366,7 +371,9 @@ public abstract class PSystemError extends AbstractPSystem {
|
||||
if (qrcode == null) {
|
||||
ug.apply(new UTranslate(1, 1)).draw(message);
|
||||
} else {
|
||||
final UImage qr = new UImage(qrcode).scaleNearestNeighbor(scale);
|
||||
final UImage qr = new UImage(
|
||||
new PixelImage(qrcode, AffineTransformType.TYPE_NEAREST_NEIGHBOR))
|
||||
.scale(scale);
|
||||
ug.apply(new UTranslate(1, (imHeight - message.getHeight()) / 2)).draw(message);
|
||||
ug.apply(new UTranslate(1 + message.getWidth(), (imHeight - qr.getHeight()) / 2)).draw(qr);
|
||||
}
|
||||
@ -392,8 +399,9 @@ public abstract class PSystemError extends AbstractPSystem {
|
||||
}
|
||||
|
||||
private TextBlockBackcolored getMessageLiberapay() {
|
||||
final UImage message = new UImage(PSystemVersion.getTime15());
|
||||
final Color back = new Color(message.getImage().getRGB(0, 0));
|
||||
final UImage message = new UImage(
|
||||
new PixelImage(PSystemVersion.getTime15(), AffineTransformType.TYPE_BILINEAR));
|
||||
final Color back = new Color(message.getImage(1).getRGB(0, 0));
|
||||
final HColor backColor = new HColorSimple(back, false);
|
||||
|
||||
final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils();
|
||||
@ -410,7 +418,9 @@ public abstract class PSystemError extends AbstractPSystem {
|
||||
if (qrcode == null) {
|
||||
ug.apply(new UTranslate(1, 1)).draw(message);
|
||||
} else {
|
||||
final UImage qr = new UImage(qrcode).scaleNearestNeighbor(scale);
|
||||
final UImage qr = new UImage(
|
||||
new PixelImage(qrcode, AffineTransformType.TYPE_NEAREST_NEIGHBOR))
|
||||
.scale(scale);
|
||||
ug.apply(new UTranslate(1, (imHeight - message.getHeight()) / 2)).draw(message);
|
||||
ug.apply(new UTranslate(1 + message.getWidth(), (imHeight - qr.getHeight()) / 2)).draw(qr);
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ import net.sourceforge.plantuml.svek.IEntityImage;
|
||||
import net.sourceforge.plantuml.svek.Margins;
|
||||
import net.sourceforge.plantuml.svek.ShapeType;
|
||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
@ -156,12 +158,13 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage {
|
||||
if (image != null) {
|
||||
if (position == GraphicPosition.BOTTOM) {
|
||||
ug.apply(new UTranslate((size.getWidth() - image.getWidth()) / 2, size.getHeight() - image.getHeight()))
|
||||
.draw(new UImage(image));
|
||||
.draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR)));
|
||||
} else if (position == GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT) {
|
||||
ug.apply(new UTranslate(size.getWidth() - image.getWidth(), size.getHeight() - image.getHeight()))
|
||||
.draw(new UImage(image));
|
||||
.draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR)));
|
||||
} else if (position == GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT) {
|
||||
ug.apply(new UTranslate(size.getWidth() - image.getWidth() - 1, 1)).draw(new UImage(image));
|
||||
ug.apply(new UTranslate(size.getWidth() - image.getWidth() - 1, 1))
|
||||
.draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ import java.awt.geom.Dimension2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
@ -61,7 +63,8 @@ public class TileImage extends AbstractTextBlock implements TextBlock {
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.apply(UTranslate.dy(vspace)).draw(new UImage(image));
|
||||
ug.apply(UTranslate.dy(vspace))
|
||||
.draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,9 @@ package net.sourceforge.plantuml.graphic;
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.SkinParam;
|
||||
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
|
||||
import net.sourceforge.plantuml.ugraphic.UEmpty;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UHorizontalLine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
@ -70,6 +72,11 @@ class USymbolDatabase extends USymbol {
|
||||
final UPath closing = getClosingPath(width);
|
||||
ug.apply(new HColorNone().bg()).draw(closing);
|
||||
|
||||
if (SkinParam.USE_STYLES()) {
|
||||
ug.apply(new UTranslate(width, height)).draw(new UEmpty(10, 10));
|
||||
// ug.apply(HColorUtils.BLACK).apply(new UTranslate(width, height)).draw(new URectangle(10, 10));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private UPath getClosingPath(double width) {
|
||||
@ -100,8 +107,7 @@ class USymbolDatabase extends USymbol {
|
||||
ug = ug.apply(translate);
|
||||
ug.apply(line.getStroke()).apply(new HColorNone().bg()).apply(UTranslate.dy(-15)).draw(closing);
|
||||
if (line.isDouble()) {
|
||||
ug.apply(line.getStroke()).apply(new HColorNone().bg()).apply(UTranslate.dy(-15 + 2))
|
||||
.draw(closing);
|
||||
ug.apply(line.getStroke()).apply(new HColorNone().bg()).apply(UTranslate.dy(-15 + 2)).draw(closing);
|
||||
}
|
||||
line.drawTitleInternal(ug, 0, endingX, 0, true);
|
||||
}
|
||||
@ -137,7 +143,8 @@ class USymbolDatabase extends USymbol {
|
||||
|
||||
@Override
|
||||
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
|
||||
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
|
||||
final double width, final double height, final SymbolContext symbolContext,
|
||||
final HorizontalAlignment stereoAlignment) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -38,7 +38,9 @@ package net.sourceforge.plantuml.graphic;
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.SkinParam;
|
||||
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
|
||||
import net.sourceforge.plantuml.ugraphic.UEmpty;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UHorizontalLine;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
@ -81,6 +83,9 @@ class USymbolNode extends USymbol {
|
||||
ug.apply(new UTranslate(width - 10, 10)).draw(new ULine(9, -9));
|
||||
ug.apply(UTranslate.dy(10)).draw(ULine.hline(width - 10));
|
||||
ug.apply(new UTranslate(width - 10, 10)).draw(ULine.vline(height - 10));
|
||||
if (SkinParam.USE_STYLES()) {
|
||||
ug.apply(new UTranslate(0, height)).draw(new UEmpty(10, 10));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,6 @@ package net.sourceforge.plantuml.math;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@ -50,6 +49,7 @@ import javax.script.ScriptException;
|
||||
|
||||
import net.sourceforge.plantuml.BackSlash;
|
||||
import net.sourceforge.plantuml.SvgString;
|
||||
import net.sourceforge.plantuml.ugraphic.MutableImage;
|
||||
|
||||
public class AsciiMath implements ScientificEquation {
|
||||
|
||||
@ -94,16 +94,16 @@ public class AsciiMath implements ScientificEquation {
|
||||
return builder.getDimension();
|
||||
}
|
||||
|
||||
public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) throws ClassNotFoundException,
|
||||
IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
|
||||
SecurityException, InstantiationException, IOException {
|
||||
public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor)
|
||||
throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
|
||||
NoSuchMethodException, SecurityException, InstantiationException, IOException {
|
||||
return builder.getSvg(scale, foregroundColor, backgroundColor);
|
||||
}
|
||||
|
||||
public BufferedImage getImage(double scale, Color foregroundColor, Color backgroundColor)
|
||||
public MutableImage getImage(Color foregroundColor, Color backgroundColor)
|
||||
throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException,
|
||||
IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
||||
return builder.getImage(scale, foregroundColor, backgroundColor);
|
||||
return builder.getImage(foregroundColor, backgroundColor);
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
|
@ -45,6 +45,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import javax.swing.Icon;
|
||||
|
||||
import net.sourceforge.plantuml.SvgString;
|
||||
import net.sourceforge.plantuml.ugraphic.MutableImage;
|
||||
|
||||
public class LatexBuilder implements ScientificEquation {
|
||||
|
||||
@ -60,15 +61,15 @@ public class LatexBuilder implements ScientificEquation {
|
||||
return dimension;
|
||||
}
|
||||
|
||||
private Icon buildIcon(Color foregroundColor) throws ClassNotFoundException, NoSuchMethodException,
|
||||
SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException,
|
||||
InvocationTargetException {
|
||||
private Icon buildIcon(Color foregroundColor)
|
||||
throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException,
|
||||
IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
||||
return new TeXIconBuilder(tex, foregroundColor).getIcon();
|
||||
}
|
||||
|
||||
public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) throws ClassNotFoundException,
|
||||
IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
|
||||
SecurityException, InstantiationException, IOException {
|
||||
public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor)
|
||||
throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
|
||||
NoSuchMethodException, SecurityException, InstantiationException, IOException {
|
||||
final Icon icon = buildIcon(foregroundColor);
|
||||
final ConverterSvg converterSvg = new ConverterSvg(icon);
|
||||
final String svg = converterSvg.getSvg(scale, true, backgroundColor);
|
||||
@ -76,20 +77,55 @@ public class LatexBuilder implements ScientificEquation {
|
||||
return new SvgString(svg, scale);
|
||||
}
|
||||
|
||||
public BufferedImage getImage(double scale, Color foregroundColor, Color backgroundColor)
|
||||
public MutableImage getImage(Color foregroundColor, Color backgroundColor)
|
||||
throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException,
|
||||
IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
||||
final Icon icon = buildIcon(foregroundColor);
|
||||
final BufferedImage image = new BufferedImage((int) (icon.getIconWidth() * scale),
|
||||
(int) (icon.getIconHeight() * scale), BufferedImage.TYPE_INT_ARGB);
|
||||
final Graphics2D g2 = image.createGraphics();
|
||||
g2.scale(scale, scale);
|
||||
if (backgroundColor != null) {
|
||||
g2.setColor(backgroundColor);
|
||||
g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight());
|
||||
return new LatexImage(icon, 1, foregroundColor, backgroundColor);
|
||||
}
|
||||
|
||||
class LatexImage implements MutableImage {
|
||||
|
||||
private final double scale;
|
||||
private final Icon icon;
|
||||
private final Color foregroundColor;
|
||||
private final Color backgroundColor;
|
||||
private BufferedImage cache = null;
|
||||
|
||||
public LatexImage(Icon icon, double scale, Color foregroundColor, Color backgroundColor) {
|
||||
this.scale = scale;
|
||||
this.foregroundColor = foregroundColor;
|
||||
this.backgroundColor = backgroundColor;
|
||||
this.icon = icon;
|
||||
}
|
||||
icon.paintIcon(null, g2, 0, 0);
|
||||
return image;
|
||||
|
||||
public BufferedImage getImage() {
|
||||
if (cache == null) {
|
||||
cache = new BufferedImage((int) (icon.getIconWidth() * scale), (int) (icon.getIconHeight() * scale),
|
||||
BufferedImage.TYPE_INT_ARGB);
|
||||
final Graphics2D g2 = cache.createGraphics();
|
||||
g2.scale(scale, scale);
|
||||
if (backgroundColor != null) {
|
||||
g2.setColor(backgroundColor);
|
||||
g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight());
|
||||
}
|
||||
icon.paintIcon(null, g2, 0, 0);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
public MutableImage withScale(double scale) {
|
||||
return new LatexImage(icon, this.scale * scale, foregroundColor, backgroundColor);
|
||||
}
|
||||
|
||||
public MutableImage muteColor(Color newColor) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public MutableImage muteTransparentColor(Color newColor) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
|
@ -41,12 +41,19 @@ import java.io.OutputStream;
|
||||
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
||||
|
||||
public class PSystemLatex extends AbstractPSystem {
|
||||
|
||||
private String latex = "";
|
||||
private float scale = 1;
|
||||
private Color color = Color.BLACK;
|
||||
private Color backColor = Color.WHITE;
|
||||
|
||||
public PSystemLatex() {
|
||||
}
|
||||
@ -59,11 +66,52 @@ public class PSystemLatex extends AbstractPSystem {
|
||||
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)
|
||||
throws IOException {
|
||||
final ScientificEquationSafe asciiMath = ScientificEquationSafe.fromLatex(latex);
|
||||
return asciiMath.export(os, fileFormat, 1, Color.BLACK, Color.WHITE);
|
||||
return asciiMath.export(os, fileFormat, scale, color, backColor);
|
||||
}
|
||||
|
||||
public void doCommandLine(String line) {
|
||||
this.latex = line;
|
||||
final String lineLower = StringUtils.trin(StringUtils.goLowerCase(line));
|
||||
final String colorParam = "color ";
|
||||
final String backParam = "backgroundcolor ";
|
||||
if (lineLower.startsWith(colorParam)) {
|
||||
final Color col3 = getColor(line.substring(colorParam.length()));
|
||||
if (col3 != null) {
|
||||
color = col3;
|
||||
}
|
||||
} else if (lineLower.startsWith(backParam)) {
|
||||
final Color col3 = getColor(line.substring(backParam.length()));
|
||||
if (col3 != null) {
|
||||
backColor = col3;
|
||||
}
|
||||
} else if (lineLower.startsWith("scale ")) {
|
||||
final String value = line.substring("scale ".length());
|
||||
try {
|
||||
final float scale1 = Float.parseFloat(value);
|
||||
if (scale1 > 0) {
|
||||
scale = scale1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (lineLower.startsWith("dpi ")) {
|
||||
final String value = line.substring("dpi ".length());
|
||||
try {
|
||||
final float dpi1 = Float.parseFloat(value);
|
||||
if (dpi1 > 0) {
|
||||
scale = dpi1 / 96;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
this.latex = line;
|
||||
}
|
||||
}
|
||||
|
||||
private Color getColor(final String col) {
|
||||
final HColor col2 = HColorSet.instance().getColorIfValid(col);
|
||||
final Color col3 = new ColorMapperIdentity().toColor(col2);
|
||||
return col3;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,21 +37,21 @@ package net.sourceforge.plantuml.math;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import net.sourceforge.plantuml.SvgString;
|
||||
import net.sourceforge.plantuml.ugraphic.MutableImage;
|
||||
|
||||
public interface ScientificEquation {
|
||||
|
||||
public Dimension2D getDimension();
|
||||
|
||||
public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) throws ClassNotFoundException,
|
||||
IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
|
||||
SecurityException, InstantiationException, IOException;
|
||||
public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor)
|
||||
throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
|
||||
NoSuchMethodException, SecurityException, InstantiationException, IOException;
|
||||
|
||||
public BufferedImage getImage(double scale, Color foregroundColor, Color backgroundColor)
|
||||
public MutableImage getImage(Color foregroundColor, Color backgroundColor)
|
||||
throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException,
|
||||
IllegalAccessException, IllegalArgumentException, InvocationTargetException;
|
||||
|
||||
|
@ -53,6 +53,9 @@ import net.sourceforge.plantuml.eps.EpsGraphics;
|
||||
import net.sourceforge.plantuml.graphic.GraphicStrings;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.security.ImageIO;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.MutableImage;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
||||
|
||||
@ -89,7 +92,6 @@ public class ScientificEquationSafe {
|
||||
private ImageData dimSvg;
|
||||
|
||||
public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) {
|
||||
|
||||
try {
|
||||
final SvgString svg = equation.getSvg(scale, foregroundColor, backgroundColor);
|
||||
dimSvg = new ImageDataSimple(equation.getDimension());
|
||||
@ -107,16 +109,17 @@ public class ScientificEquationSafe {
|
||||
}
|
||||
}
|
||||
|
||||
public BufferedImage getImage(double scale, Color foregroundColor, Color backgroundColor) {
|
||||
public MutableImage getImage(Color foregroundColor, Color backgroundColor) {
|
||||
try {
|
||||
return equation.getImage(scale, foregroundColor, backgroundColor);
|
||||
return equation.getImage(foregroundColor, backgroundColor);
|
||||
} catch (Exception e) {
|
||||
printTrace(e);
|
||||
final ImageBuilder imageBuilder = getRollback();
|
||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
imageBuilder.writeImageTOBEMOVED(new FileFormatOption(FileFormat.PNG), 42, baos);
|
||||
return ImageIO.read(new ByteArrayInputStream(baos.toByteArray()));
|
||||
return new PixelImage(ImageIO.read(new ByteArrayInputStream(baos.toByteArray())),
|
||||
AffineTransformType.TYPE_BILINEAR);
|
||||
} catch (IOException e1) {
|
||||
return null;
|
||||
}
|
||||
@ -133,8 +136,8 @@ public class ScientificEquationSafe {
|
||||
|
||||
private ImageBuilder getRollback() {
|
||||
final TextBlock block = GraphicStrings.createBlackOnWhiteMonospaced(Arrays.asList(formula));
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, null, null,
|
||||
1.0, null);
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, null, null, 1.0,
|
||||
null);
|
||||
imageBuilder.setUDrawable(block);
|
||||
return imageBuilder;
|
||||
}
|
||||
@ -142,7 +145,7 @@ public class ScientificEquationSafe {
|
||||
public ImageData export(OutputStream os, FileFormatOption fileFormat, float scale, Color foregroundColor,
|
||||
Color backgroundColor) throws IOException {
|
||||
if (fileFormat.getFileFormat() == FileFormat.PNG) {
|
||||
final BufferedImage image = getImage(scale, foregroundColor, backgroundColor);
|
||||
final BufferedImage image = getImage(foregroundColor, backgroundColor).withScale(scale).getImage();
|
||||
ImageIO.write(image, "png", os);
|
||||
return new ImageDataSimple(image.getWidth(), image.getHeight());
|
||||
}
|
||||
@ -151,7 +154,7 @@ public class ScientificEquationSafe {
|
||||
return dimSvg;
|
||||
}
|
||||
if (fileFormat.getFileFormat() == FileFormat.EPS) {
|
||||
final BufferedImage image = getImage(scale, foregroundColor, backgroundColor);
|
||||
final BufferedImage image = getImage(foregroundColor, backgroundColor).withScale(scale).getImage();
|
||||
final EpsGraphics out = new EpsGraphics();
|
||||
out.drawImage(image, 0, 0);
|
||||
out.close();
|
||||
|
@ -64,8 +64,13 @@ public class ReadFilterMergeLines implements ReadFilter {
|
||||
this.manageEndingBackslash = true;
|
||||
}
|
||||
|
||||
ReadLine sourceWithoutComment = null;
|
||||
|
||||
while (result != null && manageEndingBackslash && StringUtils.endsWithBackslash(result.getString())) {
|
||||
final StringLocated next = source.readLine();
|
||||
if (sourceWithoutComment == null) {
|
||||
sourceWithoutComment = new ReadFilterQuoteComment().applyFilter(source);
|
||||
}
|
||||
final StringLocated next = sourceWithoutComment.readLine();
|
||||
if (next == null) {
|
||||
break;
|
||||
} else {
|
||||
|
@ -78,8 +78,7 @@ public class GanttArrow implements UDrawable {
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
ug = ug.apply(HColorUtils.RED_DARK.bg()).apply(HColorUtils.RED_DARK)
|
||||
.apply(new UStroke(1.5));
|
||||
ug = ug.apply(HColorUtils.RED_DARK.bg()).apply(HColorUtils.RED_DARK).apply(new UStroke(1.5));
|
||||
|
||||
final Task draw1 = (Task) source.getMoment();
|
||||
final Task draw2 = (Task) dest.getMoment();
|
||||
@ -96,6 +95,9 @@ public class GanttArrow implements UDrawable {
|
||||
|
||||
if (this.atStart == Direction.DOWN && this.atEnd == Direction.RIGHT) {
|
||||
if (x2 > x1) {
|
||||
if (x2 - x1 < 8) {
|
||||
x1 = x2 - 8;
|
||||
}
|
||||
drawLine(ug, x1, y1, x1, y2, x2, y2);
|
||||
} else {
|
||||
x1 = getX(source.withDelta(0), Direction.RIGHT);
|
||||
|
@ -130,6 +130,16 @@ public class Day implements Complement, Comparable<Day>, Subject {
|
||||
return DayOfWeek.fromH(h);
|
||||
}
|
||||
|
||||
public static int DOW(int y_, int m_, int d_) {
|
||||
final int q = d_;
|
||||
final int m = 3 + (m_ - 1 + 10) % 12;
|
||||
final int y = m >= 13 ? y_ - 1 : y_;
|
||||
final int k = y % 100;
|
||||
final int j = y / 100;
|
||||
final int h = ((q + 13 * (m + 1) / 5) + k + k / 4 + j / 4 + 5 * j) % 7;
|
||||
return h;
|
||||
}
|
||||
|
||||
public Wink asInstantDay(Day reference) {
|
||||
// if (this.compareTo(reference) < 0) {
|
||||
// throw new IllegalArgumentException();
|
||||
@ -143,6 +153,8 @@ public class Day implements Complement, Comparable<Day>, Subject {
|
||||
return new Wink(cmp);
|
||||
}
|
||||
|
||||
// https://www.staff.science.uu.nl/~gent0113/calendar/isocalendar_text_5.htm
|
||||
// https://en.wikipedia.org/wiki/ISO_week_date
|
||||
// http://www.proesite.com/timex/wkcalc.htm
|
||||
public int ISO_WN() {
|
||||
final int y = year();
|
||||
@ -170,11 +182,6 @@ public class Day implements Complement, Comparable<Day>, Subject {
|
||||
|
||||
}
|
||||
|
||||
private int DOW(int y, int m, int d) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(Day other) {
|
||||
return this.internalNumber() - other.internalNumber();
|
||||
}
|
||||
|
@ -261,10 +261,8 @@ public class SFile implements Comparable<SFile> {
|
||||
if (SecurityUtils.getSecurityProfile() != SecurityProfile.UNSECURE) {
|
||||
// For UNSECURE, we did not do those checks
|
||||
final String path = getCleanPathSecure();
|
||||
if (path.startsWith("/etc/")) {
|
||||
return false;
|
||||
}
|
||||
if (path.startsWith("/dev/")) {
|
||||
if (path.startsWith("/etc/") || path.startsWith("/dev/") || path.startsWith("/boot/")
|
||||
|| path.startsWith("/proc/") || path.startsWith("/sys/")) {
|
||||
return false;
|
||||
}
|
||||
if (path.startsWith("//")) {
|
||||
|
@ -43,6 +43,8 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
@ -119,7 +121,7 @@ public class SpriteColor implements Sprite {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new UImage(im);
|
||||
return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR));
|
||||
}
|
||||
|
||||
public TextBlock asTextBlock(final HColor color, final double scale) {
|
||||
|
@ -45,6 +45,8 @@ import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.security.ImageIO;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
@ -58,7 +60,7 @@ public class SpriteImage implements Sprite {
|
||||
if (img == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.img = new UImage(img);
|
||||
this.img = new UImage(new PixelImage(img, AffineTransformType.TYPE_BILINEAR));
|
||||
}
|
||||
|
||||
public TextBlock asTextBlock(final HColor color, final double scale) {
|
||||
|
@ -45,6 +45,8 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
@ -201,22 +203,22 @@ public class SpriteMonochrome implements Sprite {
|
||||
im.setRGB(col, line, c.getRGB());
|
||||
}
|
||||
}
|
||||
return new UImage(im);
|
||||
return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR));
|
||||
}
|
||||
|
||||
private UImage special(ColorMapper colorMapper, HColorGradient backcolor, HColor color) {
|
||||
final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
for (int col = 0; col < width; col++) {
|
||||
for (int line = 0; line < height; line++) {
|
||||
final HColor backColorLocal = new HColorSimple(backcolor.getColor(colorMapper, 1.0 * line
|
||||
/ height), false);
|
||||
final HColor backColorLocal = new HColorSimple(backcolor.getColor(colorMapper, 1.0 * line / height),
|
||||
false);
|
||||
final HColorGradient gradient = new HColorGradient(backColorLocal, color, '\0');
|
||||
final double coef = 1.0 * grey[line][col] / (grayLevel - 1);
|
||||
final Color c = gradient.getColor(colorMapper, coef);
|
||||
im.setRGB(col, line, c.getRGB());
|
||||
}
|
||||
}
|
||||
return new UImage(im);
|
||||
return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR));
|
||||
}
|
||||
|
||||
public TextBlock asTextBlock(final HColor color, final double scale) {
|
||||
|
@ -40,6 +40,7 @@ import java.awt.Font;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
|
||||
public class ValueImpl implements Value {
|
||||
|
||||
@ -61,9 +62,12 @@ public class ValueImpl implements Value {
|
||||
}
|
||||
|
||||
public HColor asColor(HColorSet set) {
|
||||
if ("none".equalsIgnoreCase(value) || "transparent".equalsIgnoreCase(value)) {
|
||||
if ("none".equalsIgnoreCase(value)) {
|
||||
return null;
|
||||
}
|
||||
if ("transparent".equalsIgnoreCase(value)) {
|
||||
return HColorUtils.transparent();
|
||||
}
|
||||
return set.getColorIfValid(value);
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ public class DotStringFactory implements Moveable {
|
||||
return graphviz.getDotExe();
|
||||
}
|
||||
|
||||
public ClusterPosition solve(boolean mergeIntricated, EntityFactory entityFactory, final String svg)
|
||||
public void solve(boolean mergeIntricated, EntityFactory entityFactory, final String svg)
|
||||
throws IOException, InterruptedException {
|
||||
if (svg.length() == 0) {
|
||||
throw new EmptySvgException();
|
||||
@ -356,10 +356,10 @@ public class DotStringFactory implements Moveable {
|
||||
if (mGraph.find() == false) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final int fullWidth = Integer.parseInt(mGraph.group(1));
|
||||
// final int fullWidth = Integer.parseInt(mGraph.group(1));
|
||||
final int fullHeight = Integer.parseInt(mGraph.group(2));
|
||||
|
||||
final MinFinder corner1 = new MinFinder();
|
||||
// final MinFinder corner1 = new MinFinder();
|
||||
|
||||
final Point2DFunction move = new YDelta(fullHeight);
|
||||
final SvgResult svgResult = new SvgResult(svg, move);
|
||||
@ -372,7 +372,7 @@ public class DotStringFactory implements Moveable {
|
||||
final double minY = SvekUtils.getMinY(points);
|
||||
final double overscanX = node.getOverscanX(stringBounder);
|
||||
final double minX = SvekUtils.getMinX(points);
|
||||
corner1.manage(minX - overscanX, minY);
|
||||
// corner1.manage(minX - overscanX, minY);
|
||||
node.moveSvek(minX, minY);
|
||||
} else if (node.getType() == ShapeType.ROUND_RECTANGLE) {
|
||||
final int idx2 = svg.indexOf("d=\"", idx + 1);
|
||||
@ -390,7 +390,7 @@ public class DotStringFactory implements Moveable {
|
||||
}
|
||||
final double minX = SvekUtils.getMinX(points);
|
||||
final double minY = SvekUtils.getMinY(points);
|
||||
corner1.manage(minX, minY);
|
||||
// corner1.manage(minX, minY);
|
||||
node.moveSvek(minX, minY);
|
||||
} else if (node.getType() == ShapeType.OCTAGON) {
|
||||
idx = svg.indexOf("points=\"", idx + 1);
|
||||
@ -398,7 +398,7 @@ public class DotStringFactory implements Moveable {
|
||||
final List<Point2D.Double> points = svgResult.substring(starting).extractList(SvgResult.POINTS_EQUALS);
|
||||
final double minX = SvekUtils.getMinX(points);
|
||||
final double minY = SvekUtils.getMinY(points);
|
||||
corner1.manage(minX, minY);
|
||||
// corner1.manage(minX, minY);
|
||||
node.moveSvek(minX, minY);
|
||||
node.setOctagon(minX, minY, points);
|
||||
} else if (node.getType() == ShapeType.CIRCLE || node.getType() == ShapeType.CIRCLE_IN_RECT
|
||||
@ -428,7 +428,7 @@ public class DotStringFactory implements Moveable {
|
||||
final double maxX = SvekUtils.getMaxX(points);
|
||||
final double maxY = SvekUtils.getMaxY(points);
|
||||
cluster.setPosition(minX, minY, maxX, maxY);
|
||||
corner1.manage(minX, minY);
|
||||
// corner1.manage(minX, minY);
|
||||
|
||||
if (cluster.getTitleAndAttributeWidth() == 0 || cluster.getTitleAndAttributeHeight() == 0) {
|
||||
continue;
|
||||
@ -443,15 +443,15 @@ public class DotStringFactory implements Moveable {
|
||||
}
|
||||
|
||||
for (Line line : bibliotekon.allLines()) {
|
||||
line.solveLine(svgResult, corner1);
|
||||
line.solveLine(svgResult);
|
||||
}
|
||||
|
||||
for (Line line : bibliotekon.allLines()) {
|
||||
line.manageCollision(bibliotekon.allNodes());
|
||||
}
|
||||
corner1.manage(0, 0);
|
||||
return new ClusterPosition(corner1.getMinX(), corner1.getMinY(), fullWidth, fullHeight);
|
||||
// return new ClusterPosition(0, 0, fullWidth, fullHeight);
|
||||
// corner1.manage(0, 0);
|
||||
// return new ClusterPosition(corner1.getMinX(), corner1.getMinY(), fullWidth, fullHeight);
|
||||
// // return new ClusterPosition(0, 0, fullWidth, fullHeight);
|
||||
}
|
||||
|
||||
private int getClusterIndex(final String svg, int colorInt) {
|
||||
@ -475,13 +475,6 @@ public class DotStringFactory implements Moveable {
|
||||
return "#" + s;
|
||||
}
|
||||
|
||||
public static String sharpAlpha(int color) {
|
||||
final int v = color;
|
||||
String s = "00000000" + Integer.toHexString(v).toUpperCase();
|
||||
s = s.substring(s.length() - 8);
|
||||
return "#" + s;
|
||||
}
|
||||
|
||||
public void openCluster(int titleAndAttributeWidth, int titleAndAttributeHeight, TextBlock title, TextBlock stereo,
|
||||
IGroup g) {
|
||||
this.current = current.createChild(titleAndAttributeWidth, titleAndAttributeHeight, title, stereo,
|
||||
|
@ -39,20 +39,24 @@ import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.SkinParam;
|
||||
import net.sourceforge.plantuml.graphic.InnerStrategy;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UEmpty;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
|
||||
public class IEntityImageMoved implements IEntityImage {
|
||||
public class EntityImageDegenerated implements IEntityImage {
|
||||
|
||||
private final IEntityImage orig;
|
||||
private final double delta = 7;
|
||||
private final HColor backcolor;
|
||||
|
||||
public IEntityImageMoved(IEntityImage orig) {
|
||||
public EntityImageDegenerated(IEntityImage orig, HColor backcolor) {
|
||||
this.orig = orig;
|
||||
this.backcolor = backcolor;
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
@ -60,7 +64,8 @@ public class IEntityImageMoved implements IEntityImage {
|
||||
}
|
||||
|
||||
public HColor getBackcolor() {
|
||||
return orig.getBackcolor();
|
||||
// return orig.getBackcolor();
|
||||
return backcolor;
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
@ -79,6 +84,10 @@ public class IEntityImageMoved implements IEntityImage {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
orig.drawU(ug.apply(new UTranslate(delta, delta)));
|
||||
if (SkinParam.USE_STYLES()) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug.apply(new UTranslate(dim.getWidth() - delta, dim.getHeight() - delta)).draw(new UEmpty(delta, delta));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -101,6 +101,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockWidth;
|
||||
import net.sourceforge.plantuml.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.graphic.USymbolInterface;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
@ -361,6 +362,16 @@ public final class GeneralImageBuilder {
|
||||
|
||||
}
|
||||
|
||||
// Duplicate SvekResult / GeneralImageBuilder
|
||||
private HColor getBackcolor() {
|
||||
if (SkinParam.USE_STYLES()) {
|
||||
final Style style = StyleSignature.of(SName.root, SName.document)
|
||||
.getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder());
|
||||
return style.value(PName.BackGroundColor).asColor(dotData.getSkinParam().getIHtmlColorSet());
|
||||
}
|
||||
return dotData.getSkinParam().getBackgroundColor(false);
|
||||
}
|
||||
|
||||
public IEntityImage buildImage(BaseFile basefile, String dotStrings[]) {
|
||||
if (dotData.isDegeneratedWithFewEntities(0)) {
|
||||
return new EntityImageSimpleEmpty(dotData.getSkinParam().getBackgroundColor(false));
|
||||
@ -369,9 +380,10 @@ public final class GeneralImageBuilder {
|
||||
final ILeaf single = dotData.getLeafs().iterator().next();
|
||||
final IGroup group = single.getParentContainer();
|
||||
if (group instanceof GroupRoot) {
|
||||
return new IEntityImageMoved(GeneralImageBuilder.createEntityImageBlock(single, dotData.getSkinParam(),
|
||||
final IEntityImage tmp = GeneralImageBuilder.createEntityImageBlock(single, dotData.getSkinParam(),
|
||||
dotData.isHideEmptyDescriptionForState(), dotData, null, null, dotData.getUmlDiagramType(),
|
||||
dotData.getLinks()));
|
||||
dotData.getLinks());
|
||||
return new EntityImageDegenerated(tmp, getBackcolor());
|
||||
}
|
||||
}
|
||||
dotData.removeIrrelevantSametail();
|
||||
@ -439,15 +451,8 @@ public final class GeneralImageBuilder {
|
||||
}
|
||||
final String graphvizVersion = extractGraphvizVersion(svg);
|
||||
try {
|
||||
final ClusterPosition position = dotStringFactory.solve(mergeIntricated, dotData.getEntityFactory(), svg)
|
||||
.delta(10, 10);
|
||||
final double minY = position.getMinY();
|
||||
final double minX = position.getMinX();
|
||||
if (minX > 0 || minY > 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final SvekResult result = new SvekResult(position, dotData, dotStringFactory);
|
||||
result.moveSvek(6 - minX, -minY);
|
||||
dotStringFactory.solve(mergeIntricated, dotData.getEntityFactory(), svg);
|
||||
final SvekResult result = new SvekResult(dotData, dotStringFactory);
|
||||
this.maxX = dotStringFactory.getBibliotekon().getMaxX();
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
|
@ -54,6 +54,8 @@ import net.sourceforge.plantuml.graphic.GraphicPosition;
|
||||
import net.sourceforge.plantuml.graphic.GraphicStrings;
|
||||
import net.sourceforge.plantuml.graphic.QuoteUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
@ -159,7 +161,8 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage {
|
||||
strings.addAll(OptionPrint.interestingValues());
|
||||
}
|
||||
|
||||
// private static void addTextProperty(final List<String> strings, String prop) {
|
||||
// private static void addTextProperty(final List<String> strings, String prop)
|
||||
// {
|
||||
// strings.add(prop + ": " + System.getProperty(prop));
|
||||
// }
|
||||
|
||||
@ -185,7 +188,8 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage {
|
||||
if (flashCode != null) {
|
||||
final double h = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight();
|
||||
ug = ug.apply(UTranslate.dy(h));
|
||||
ug.draw(new UImage(flashCode).scaleNearestNeighbor(3));
|
||||
ug.draw(new UImage(new PixelImage(flashCode, AffineTransformType.TYPE_NEAREST_NEIGHBOR))
|
||||
.scale(3));
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,10 +200,9 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage {
|
||||
public Margins getShield(StringBounder stringBounder) {
|
||||
return Margins.NONE;
|
||||
}
|
||||
|
||||
|
||||
public double getOverscanX(StringBounder stringBounder) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ public class Line implements Moveable, Hideable, GuideLine {
|
||||
|
||||
}
|
||||
|
||||
public void solveLine(SvgResult fullSvg, MinFinder corner1) {
|
||||
public void solveLine(SvgResult fullSvg) {
|
||||
if (this.link.isInvis()) {
|
||||
return;
|
||||
}
|
||||
@ -560,7 +560,7 @@ public class Line implements Moveable, Hideable, GuideLine {
|
||||
if (hasNoteLabelText() || link.getLinkConstraint() != null) {
|
||||
final Point2D pos = getXY(fullSvg, this.noteLabelColor);
|
||||
if (pos != null) {
|
||||
corner1.manage(pos);
|
||||
// corner1.manage(pos);
|
||||
this.labelXY = hasNoteLabelText() ? TextBlockUtils.asPositionable(labelText, stringBounder, pos)
|
||||
: TextBlockUtils.asPositionable(CONSTRAINT_SPOT, stringBounder, pos);
|
||||
}
|
||||
@ -569,7 +569,7 @@ public class Line implements Moveable, Hideable, GuideLine {
|
||||
if (this.startTailText != null) {
|
||||
final Point2D pos = getXY(fullSvg, this.startTailColor);
|
||||
if (pos != null) {
|
||||
corner1.manage(pos);
|
||||
// corner1.manage(pos);
|
||||
this.startTailLabelXY = TextBlockUtils.asPositionable(startTailText, stringBounder, pos);
|
||||
}
|
||||
}
|
||||
@ -577,9 +577,9 @@ public class Line implements Moveable, Hideable, GuideLine {
|
||||
if (this.endHeadText != null) {
|
||||
final Point2D pos = getXY(fullSvg, this.endHeadColor);
|
||||
if (pos != null) {
|
||||
corner1.manage(pos);
|
||||
// corner1.manage(pos);
|
||||
this.endHeadLabelXY = TextBlockUtils.asPositionable(endHeadText, stringBounder, pos);
|
||||
corner1.manage(pos.getX() - 15, pos.getY());
|
||||
// corner1.manage(pos.getX() - 15, pos.getY());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,17 +40,19 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.SkinParam;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.posimo.Moveable;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UHidden;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
@ -58,16 +60,14 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
|
||||
public final class SvekResult extends AbstractTextBlock implements IEntityImage, Moveable {
|
||||
public final class SvekResult extends AbstractTextBlock implements IEntityImage {
|
||||
|
||||
private final Rose rose = new Rose();
|
||||
|
||||
private ClusterPosition dim;
|
||||
private final DotData dotData;
|
||||
private final DotStringFactory dotStringFactory;
|
||||
|
||||
public SvekResult(ClusterPosition dim, DotData dotData, DotStringFactory dotStringFactory) {
|
||||
this.dim = dim;
|
||||
public SvekResult(DotData dotData, DotStringFactory dotStringFactory) {
|
||||
this.dotData = dotData;
|
||||
this.dotStringFactory = dotStringFactory;
|
||||
}
|
||||
@ -126,6 +126,7 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage,
|
||||
return StyleSignature.of(SName.root, SName.element, dotData.getUmlDiagramType().getStyleName(), SName.arrow);
|
||||
}
|
||||
|
||||
// Duplicate SvekResult / GeneralImageBuilder
|
||||
public HColor getBackcolor() {
|
||||
if (SkinParam.USE_STYLES()) {
|
||||
final Style style = StyleSignature.of(SName.root, SName.document)
|
||||
@ -135,8 +136,14 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage,
|
||||
return dotData.getSkinParam().getBackgroundColor(false);
|
||||
}
|
||||
|
||||
private MinMax minMax;
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
return dim.getDimension();
|
||||
if (minMax == null) {
|
||||
minMax = TextBlockUtils.getMinMax(this, stringBounder, false);
|
||||
dotStringFactory.moveSvek(6 - minMax.getMinX(), 6 - minMax.getMinY());
|
||||
}
|
||||
return Dimension2DDouble.delta(minMax.getDimension(), 0, 12);
|
||||
}
|
||||
|
||||
public ShapeType getShapeType() {
|
||||
@ -147,11 +154,6 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage,
|
||||
return Margins.NONE;
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
dotStringFactory.moveSvek(deltaX, deltaY);
|
||||
dim = dim.delta(deltaX > 0 ? deltaX : 0, deltaY > 0 ? deltaY : 0);
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
return false;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class EntityImageState extends AbstractEntityImage {
|
||||
}
|
||||
|
||||
final public void drawU(UGraphic ug) {
|
||||
ug.startGroup(getEntity().getIdent().getName());
|
||||
ug.startGroup(getEntity().getIdent().toString("."));
|
||||
if (url != null) {
|
||||
ug.startUrl(url);
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public class SvgGraphics {
|
||||
private Element pendingBackground;
|
||||
|
||||
public void paintBackcolorGradient(ColorMapper mapper, HColorGradient gr) {
|
||||
final String id = createSvgGradient(mapper.toHtml(gr.getColor1()), mapper.toHtml(gr.getColor2()),
|
||||
final String id = createSvgGradient(mapper.toRGB(gr.getColor1()), mapper.toRGB(gr.getColor2()),
|
||||
gr.getPolicy());
|
||||
setFillColor("url(#" + id + ")");
|
||||
setStrokeColor(null);
|
||||
|
@ -83,7 +83,6 @@ import net.sourceforge.plantuml.DirWatcher2;
|
||||
import net.sourceforge.plantuml.GeneratedImage;
|
||||
import net.sourceforge.plantuml.Log;
|
||||
import net.sourceforge.plantuml.Option;
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
import net.sourceforge.plantuml.version.PSystemVersion;
|
||||
|
||||
public class MainWindow2 extends JFrame {
|
||||
@ -158,6 +157,7 @@ public class MainWindow2 extends JFrame {
|
||||
|
||||
public MainWindow2(Option option, File arg) {
|
||||
super(getDirectory(arg).getAbsolutePath());
|
||||
System.setProperty("PLANTUML_SECURITY_PROFILE", "UNSECURE");
|
||||
final File dir = getDirectory(arg);
|
||||
setIconImage(PSystemVersion.getPlantumlSmallIcon2());
|
||||
this.option = option;
|
||||
@ -356,7 +356,7 @@ public class MainWindow2 extends JFrame {
|
||||
final File file = ent.getKey();
|
||||
removeAllThatUseThisFile(file);
|
||||
final Future<List<GeneratedImage>> future = ent.getValue();
|
||||
final SimpleLine2 simpleLine = SimpleLine2.fromFuture(SFile.fromFile(file), future);
|
||||
final SimpleLine2 simpleLine = SimpleLine2.fromFuture(file, future);
|
||||
currentDirectoryListing2.add(simpleLine);
|
||||
changed = true;
|
||||
}
|
||||
|
@ -35,33 +35,33 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.swing;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import net.sourceforge.plantuml.GeneratedImage;
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
|
||||
class SimpleLine2 implements Comparable<SimpleLine2> {
|
||||
|
||||
private final SFile file;
|
||||
private final File file;
|
||||
private final GeneratedImage generatedImage;
|
||||
private final Future<List<GeneratedImage>> future;
|
||||
|
||||
public static SimpleLine2 fromFuture(SFile file, Future<List<GeneratedImage>> future) {
|
||||
public static SimpleLine2 fromFuture(File file, Future<List<GeneratedImage>> future) {
|
||||
return new SimpleLine2(file, null, future);
|
||||
}
|
||||
|
||||
public static SimpleLine2 fromGeneratedImage(SFile file, GeneratedImage generatedImage) {
|
||||
public static SimpleLine2 fromGeneratedImage(File file, GeneratedImage generatedImage) {
|
||||
return new SimpleLine2(file, generatedImage, null);
|
||||
}
|
||||
|
||||
private SimpleLine2(SFile file, GeneratedImage generatedImage, Future<List<GeneratedImage>> future) {
|
||||
private SimpleLine2(File file, GeneratedImage generatedImage, Future<List<GeneratedImage>> future) {
|
||||
this.generatedImage = generatedImage;
|
||||
this.file = file;
|
||||
this.future = future;
|
||||
}
|
||||
|
||||
public SFile getFile() {
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,53 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML 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 General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import java.awt.image.AffineTransformOp;
|
||||
|
||||
public enum AffineTransformType {
|
||||
TYPE_NEAREST_NEIGHBOR, TYPE_BILINEAR;
|
||||
|
||||
public int toLegacyInt() {
|
||||
switch (this) {
|
||||
case TYPE_BILINEAR:
|
||||
return AffineTransformOp.TYPE_BILINEAR;
|
||||
case TYPE_NEAREST_NEIGHBOR:
|
||||
return AffineTransformOp.TYPE_NEAREST_NEIGHBOR;
|
||||
}
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
}
|
@ -466,7 +466,8 @@ public class ImageBuilder {
|
||||
ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, false, scale, svgLinkTarget, hover, seed,
|
||||
preserveAspectRatio);
|
||||
} else {
|
||||
ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, colorMapper.toSvg(backColor), false, scale,
|
||||
final String tmp = colorMapper.toSvg(backColor);
|
||||
ug = new UGraphicSvg(svgDimensionStyle, dim, colorMapper, tmp, false, scale,
|
||||
svgLinkTarget, hover, seed, preserveAspectRatio);
|
||||
}
|
||||
return ug;
|
||||
|
51
src/net/sourceforge/plantuml/ugraphic/MutableImage.java
Normal file
51
src/net/sourceforge/plantuml/ugraphic/MutableImage.java
Normal file
@ -0,0 +1,51 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML 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 General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public interface MutableImage {
|
||||
|
||||
public BufferedImage getImage();
|
||||
|
||||
public MutableImage withScale(double scale);
|
||||
|
||||
public MutableImage muteColor(Color newColor);
|
||||
|
||||
public MutableImage muteTransparentColor(Color newColor);
|
||||
|
||||
}
|
174
src/net/sourceforge/plantuml/ugraphic/PixelImage.java
Normal file
174
src/net/sourceforge/plantuml/ugraphic/PixelImage.java
Normal file
@ -0,0 +1,174 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML 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 General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.AffineTransformOp;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorChangerMonochrome;
|
||||
|
||||
public class PixelImage implements MutableImage {
|
||||
|
||||
private final BufferedImage bufferedImageScale1;
|
||||
private final double scale;
|
||||
private final AffineTransformType type;
|
||||
private BufferedImage cache = null;
|
||||
|
||||
public PixelImage(BufferedImage bufferedImage, AffineTransformType type) {
|
||||
this(bufferedImage, type, 1);
|
||||
}
|
||||
|
||||
private PixelImage(BufferedImage bufferedImage, AffineTransformType type, double scale) {
|
||||
if (type == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.bufferedImageScale1 = bufferedImage;
|
||||
this.scale = scale;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public MutableImage withScale(double scale) {
|
||||
return new PixelImage(bufferedImageScale1, type, this.scale * scale);
|
||||
}
|
||||
|
||||
public final BufferedImage getImage() {
|
||||
if (scale == 1) {
|
||||
return bufferedImageScale1;
|
||||
}
|
||||
if (cache == null) {
|
||||
final int w = (int) Math.round(bufferedImageScale1.getWidth() * scale);
|
||||
final int h = (int) Math.round(bufferedImageScale1.getHeight() * scale);
|
||||
final BufferedImage after = new BufferedImage(w, h, bufferedImageScale1.getType());
|
||||
final AffineTransform at = new AffineTransform();
|
||||
at.scale(scale, scale);
|
||||
final AffineTransformOp scaleOp = new AffineTransformOp(at, type.toLegacyInt());
|
||||
this.cache = scaleOp.filter(bufferedImageScale1, after);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
public MutableImage muteColor(Color newColor) {
|
||||
if (newColor == null) {
|
||||
return this;
|
||||
}
|
||||
int darkerRgb = getDarkerRgb();
|
||||
final BufferedImage copy = deepCopy();
|
||||
for (int i = 0; i < bufferedImageScale1.getWidth(); i++) {
|
||||
for (int j = 0; j < bufferedImageScale1.getHeight(); j++) {
|
||||
final int color = bufferedImageScale1.getRGB(i, j);
|
||||
final int rgb = getRgb(color);
|
||||
final int a = getA(color);
|
||||
if (a != 0 && rgb == darkerRgb) {
|
||||
copy.setRGB(i, j, newColor.getRGB() + a);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new PixelImage(copy, type, scale);
|
||||
}
|
||||
|
||||
public MutableImage muteTransparentColor(Color newColor) {
|
||||
if (newColor == null) {
|
||||
newColor = Color.WHITE;
|
||||
}
|
||||
final BufferedImage copy = deepCopy();
|
||||
for (int i = 0; i < bufferedImageScale1.getWidth(); i++) {
|
||||
for (int j = 0; j < bufferedImageScale1.getHeight(); j++) {
|
||||
final int color = bufferedImageScale1.getRGB(i, j);
|
||||
final int a = getA(color);
|
||||
if (a == 0) {
|
||||
copy.setRGB(i, j, newColor.getRGB());
|
||||
}
|
||||
}
|
||||
}
|
||||
return new PixelImage(copy, type, scale);
|
||||
}
|
||||
|
||||
private int getDarkerRgb() {
|
||||
int darkerRgb = -1;
|
||||
for (int i = 0; i < bufferedImageScale1.getWidth(); i++) {
|
||||
for (int j = 0; j < bufferedImageScale1.getHeight(); j++) {
|
||||
final int color = bufferedImageScale1.getRGB(i, j);
|
||||
final int rgb = getRgb(color);
|
||||
final int a = getA(color);
|
||||
if (a != mask_a__) {
|
||||
continue;
|
||||
}
|
||||
// if (isTransparent(color)) {
|
||||
// continue;
|
||||
// }
|
||||
final int grey = ColorChangerMonochrome.getGrayScale(rgb);
|
||||
if (darkerRgb == -1 || grey < ColorChangerMonochrome.getGrayScale(darkerRgb)) {
|
||||
darkerRgb = rgb;
|
||||
}
|
||||
}
|
||||
}
|
||||
return darkerRgb;
|
||||
}
|
||||
|
||||
private static final int mask_a__ = 0xFF000000;
|
||||
private static final int mask_rgb = 0x00FFFFFF;
|
||||
|
||||
private int getRgb(int color) {
|
||||
return color & mask_rgb;
|
||||
}
|
||||
|
||||
private int getA(int color) {
|
||||
return color & mask_a__;
|
||||
}
|
||||
|
||||
// From
|
||||
// https://stackoverflow.com/questions/3514158/how-do-you-clone-a-bufferedimage
|
||||
// private static BufferedImage deepCopyOld(BufferedImage bi) {
|
||||
// final ColorModel cm = bi.getColorModel();
|
||||
// final boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
|
||||
// final WritableRaster raster = bi.copyData(bi.getRaster().createCompatibleWritableRaster());
|
||||
// return new BufferedImage(cm, raster, isAlphaPremultiplied, null);
|
||||
// }
|
||||
|
||||
private BufferedImage deepCopy() {
|
||||
final BufferedImage result = new BufferedImage(bufferedImageScale1.getWidth(), bufferedImageScale1.getHeight(),
|
||||
BufferedImage.TYPE_INT_ARGB);
|
||||
for (int i = 0; i < this.bufferedImageScale1.getWidth(); i++) {
|
||||
for (int j = 0; j < this.bufferedImageScale1.getHeight(); j++) {
|
||||
result.setRGB(i, j, bufferedImageScale1.getRGB(i, j));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -64,7 +64,7 @@ public abstract class UGraphicUtils {
|
||||
} else if (fileFormat == FileFormat.SVG) {
|
||||
final Dimension2D size = computeSize(colorMapper, background, image);
|
||||
final UGraphicSvg svg = new UGraphicSvg(true, size, colorMapper,
|
||||
colorMapper.toHtml(background), false, 1.0, fileFormatOption.getSvgLinkTarget(),
|
||||
colorMapper.toRGB(background), false, 1.0, fileFormatOption.getSvgLinkTarget(),
|
||||
fileFormatOption.getHoverColor(), seed, fileFormatOption.getPreserveAspectRatio());
|
||||
image.drawU(svg);
|
||||
svg.createXml(os, fileFormatOption.isWithMetadata() ? metadata : null);
|
||||
|
@ -36,172 +36,63 @@
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.AffineTransformOp;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.WritableRaster;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorChangerMonochrome;
|
||||
|
||||
public class UImage implements UShape {
|
||||
|
||||
private final BufferedImage image;
|
||||
private final MutableImage image;
|
||||
private final String formula;
|
||||
private final String rawFileName;
|
||||
|
||||
public String getRawFileName() {
|
||||
return rawFileName;
|
||||
public UImage(MutableImage image) {
|
||||
this(image, null, null);
|
||||
}
|
||||
|
||||
public UImage(BufferedImage image) {
|
||||
this(null, image, null);
|
||||
}
|
||||
|
||||
public UImage(String rawFileName, BufferedImage image) {
|
||||
this(rawFileName, image, null);
|
||||
}
|
||||
|
||||
public UImage(String rawFileName, BufferedImage image, String formula) {
|
||||
private UImage(MutableImage image, String rawFileName, String formula) {
|
||||
this.image = image;
|
||||
this.formula = formula;
|
||||
this.rawFileName = rawFileName;
|
||||
}
|
||||
|
||||
public UImage scale(double scale) {
|
||||
return scale(scale, AffineTransformOp.TYPE_BILINEAR);
|
||||
public final UImage withRawFileName(String rawFileName) {
|
||||
return new UImage(image, rawFileName, formula);
|
||||
}
|
||||
|
||||
public UImage scaleNearestNeighbor(double scale) {
|
||||
return scale(scale, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
|
||||
public final UImage withFormula(String formula) {
|
||||
return new UImage(image, rawFileName, formula);
|
||||
}
|
||||
|
||||
private UImage scale(double scale, final int type) {
|
||||
if (scale == 1) {
|
||||
return this;
|
||||
}
|
||||
final int w = (int) Math.round(image.getWidth() * scale);
|
||||
final int h = (int) Math.round(image.getHeight() * scale);
|
||||
final BufferedImage after = new BufferedImage(w, h, image.getType());
|
||||
final AffineTransform at = new AffineTransform();
|
||||
at.scale(scale, scale);
|
||||
final AffineTransformOp scaleOp = new AffineTransformOp(at, type);
|
||||
return new UImage(rawFileName, scaleOp.filter(image, after), formula);
|
||||
}
|
||||
|
||||
public final BufferedImage getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return image.getWidth() - 1;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return image.getHeight() - 1;
|
||||
public final String getRawFileName() {
|
||||
return rawFileName;
|
||||
}
|
||||
|
||||
public final String getFormula() {
|
||||
return formula;
|
||||
}
|
||||
|
||||
public UImage scale(double scale) {
|
||||
return new UImage(image.withScale(scale), rawFileName, formula);
|
||||
}
|
||||
|
||||
public final BufferedImage getImage(double withScale) {
|
||||
return image.withScale(withScale).getImage();
|
||||
// return bufferedImage.getImage();
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return image.getImage().getWidth() - 1;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return image.getImage().getHeight() - 1;
|
||||
}
|
||||
|
||||
public UImage muteColor(Color newColor) {
|
||||
if (newColor == null) {
|
||||
return this;
|
||||
}
|
||||
int darkerRgb = getDarkerRgb();
|
||||
final BufferedImage copy = deepCopy2();
|
||||
for (int i = 0; i < image.getWidth(); i++) {
|
||||
for (int j = 0; j < image.getHeight(); j++) {
|
||||
final int color = image.getRGB(i, j);
|
||||
final int rgb = getRgb(color);
|
||||
final int a = getA(color);
|
||||
if (a != 0 && rgb == darkerRgb) {
|
||||
copy.setRGB(i, j, newColor.getRGB() + a);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new UImage(rawFileName, copy, formula);
|
||||
return new UImage(image.muteColor(newColor), rawFileName, formula);
|
||||
}
|
||||
|
||||
public UImage muteTransparentColor(Color newColor) {
|
||||
if (newColor == null) {
|
||||
newColor = Color.WHITE;
|
||||
}
|
||||
final BufferedImage copy = deepCopy2();
|
||||
for (int i = 0; i < image.getWidth(); i++) {
|
||||
for (int j = 0; j < image.getHeight(); j++) {
|
||||
final int color = image.getRGB(i, j);
|
||||
// final int rgb = getRgb(color);
|
||||
final int a = getA(color);
|
||||
if (a == 0) {
|
||||
copy.setRGB(i, j, newColor.getRGB());
|
||||
}
|
||||
}
|
||||
}
|
||||
return new UImage(rawFileName, copy, formula);
|
||||
}
|
||||
|
||||
private int getDarkerRgb() {
|
||||
int darkerRgb = -1;
|
||||
for (int i = 0; i < image.getWidth(); i++) {
|
||||
for (int j = 0; j < image.getHeight(); j++) {
|
||||
final int color = image.getRGB(i, j);
|
||||
// System.err.println("i="+i+" j="+j+" "+Integer.toHexString(color)+"
|
||||
// "+isTransparent(color));
|
||||
final int rgb = getRgb(color);
|
||||
final int a = getA(color);
|
||||
if (a != mask_a__) {
|
||||
continue;
|
||||
}
|
||||
// if (isTransparent(color)) {
|
||||
// continue;
|
||||
// }
|
||||
final int grey = ColorChangerMonochrome.getGrayScale(rgb);
|
||||
if (darkerRgb == -1 || grey < ColorChangerMonochrome.getGrayScale(darkerRgb)) {
|
||||
darkerRgb = rgb;
|
||||
}
|
||||
}
|
||||
}
|
||||
return darkerRgb;
|
||||
}
|
||||
|
||||
private static final int mask_a__ = 0xFF000000;
|
||||
private static final int mask_rgb = 0x00FFFFFF;
|
||||
|
||||
private int getRgb(int color) {
|
||||
return color & mask_rgb;
|
||||
}
|
||||
|
||||
private int getA(int color) {
|
||||
return color & mask_a__;
|
||||
}
|
||||
|
||||
// private boolean isTransparent(int argb) {
|
||||
// if ((argb & mask) == mask) {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// From
|
||||
// https://stackoverflow.com/questions/3514158/how-do-you-clone-a-bufferedimage
|
||||
private static BufferedImage deepCopyOld(BufferedImage bi) {
|
||||
final ColorModel cm = bi.getColorModel();
|
||||
final boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
|
||||
final WritableRaster raster = bi.copyData(bi.getRaster().createCompatibleWritableRaster());
|
||||
return new BufferedImage(cm, raster, isAlphaPremultiplied, null);
|
||||
}
|
||||
|
||||
private BufferedImage deepCopy2() {
|
||||
final BufferedImage result = new BufferedImage(image.getWidth(), image.getHeight(),
|
||||
BufferedImage.TYPE_INT_ARGB);
|
||||
for (int i = 0; i < this.image.getWidth(); i++) {
|
||||
for (int j = 0; j < this.image.getHeight(); j++) {
|
||||
result.setRGB(i, j, image.getRGB(i, j));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return new UImage(image.muteTransparentColor(newColor), rawFileName, formula);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ import net.sourceforge.plantuml.svek.DotStringFactory;
|
||||
|
||||
public abstract class AbstractColorMapper implements ColorMapper {
|
||||
|
||||
final public String toHtml(HColor hcolor) {
|
||||
final public String toRGB(HColor hcolor) {
|
||||
if (hcolor == null) {
|
||||
return null;
|
||||
}
|
||||
@ -54,17 +54,31 @@ public abstract class AbstractColorMapper implements ColorMapper {
|
||||
return "none";
|
||||
}
|
||||
if (hcolor instanceof HColorBackground) {
|
||||
final HColor result = ((HColorBackground) hcolor).getBack();
|
||||
hcolor = ((HColorBackground) hcolor).getBack();
|
||||
// Thread.dumpStack();
|
||||
// System.exit(0);
|
||||
// return toHtml(result);
|
||||
}
|
||||
if (HColorUtils.isTransparent(hcolor)) {
|
||||
return "#00000000";
|
||||
}
|
||||
final Color color = toColor(hcolor);
|
||||
final int alpha = color.getAlpha();
|
||||
if (alpha != 255) {
|
||||
return DotStringFactory.sharpAlpha(color.getRGB());
|
||||
if (alpha == 255) {
|
||||
return toRGB(hcolor);
|
||||
}
|
||||
return toHtml(hcolor);
|
||||
String s = "0" + Integer.toHexString(alpha).toUpperCase();
|
||||
s = s.substring(s.length() - 2);
|
||||
return toRGB(hcolor) + s;
|
||||
}
|
||||
|
||||
private static String sharpAlpha(int color) {
|
||||
final int v = color & 0xFFFFFF;
|
||||
String s = "00000" + Integer.toHexString(v).toUpperCase();
|
||||
s = s.substring(s.length() - 6);
|
||||
final int alpha = (int) (((long) color) & 0x000000FF) << 24;
|
||||
final String s2 = "0" + Integer.toHexString(alpha).toUpperCase();
|
||||
return "#" + s + s2.substring(0, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,5 +43,5 @@ public interface ColorMapper {
|
||||
|
||||
public String toSvg(HColor color);
|
||||
|
||||
public String toHtml(HColor color);
|
||||
public String toRGB(HColor color);
|
||||
}
|
||||
|
@ -257,7 +257,6 @@ public class HColorSet {
|
||||
}
|
||||
|
||||
private HColor build(String s, HColor background) {
|
||||
|
||||
s = removeFirstDieseAndgoLowerCase(s);
|
||||
final Color color;
|
||||
if (s.equalsIgnoreCase("transparent") || s.equalsIgnoreCase("background")) {
|
||||
@ -270,8 +269,7 @@ public class HColorSet {
|
||||
} else if (s.matches("[0-9A-Fa-f]{6}")) {
|
||||
color = new Color(Integer.parseInt(s, 16));
|
||||
} else if (s.matches("[0-9A-Fa-f]{8}")) {
|
||||
final long parse = Long.parseLong(s, 16);
|
||||
color = new Color((int) parse, true);
|
||||
color = fromRGBa(s);
|
||||
} else {
|
||||
final String value = htmlNames.get(s);
|
||||
if (value == null) {
|
||||
@ -282,6 +280,18 @@ public class HColorSet {
|
||||
return new HColorSimple(color, false);
|
||||
}
|
||||
|
||||
private Color fromRGBa(String s) {
|
||||
// https://forum.plantuml.net/11606/full-opacity-alpha-compositing-support-for-svg-and-png
|
||||
if (s.length() != 8) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final int red = Integer.parseInt(s.substring(0, 2), 16);
|
||||
final int green = Integer.parseInt(s.substring(2, 4), 16);
|
||||
final int blue = Integer.parseInt(s.substring(4, 6), 16);
|
||||
final int alpha = Integer.parseInt(s.substring(6, 8), 16);
|
||||
return new Color(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
private boolean isValid(String s, boolean acceptTransparent) {
|
||||
s = removeFirstDieseAndgoLowerCase(s);
|
||||
if (s.matches("[0-9A-Fa-f]{3}")) {
|
||||
|
@ -65,7 +65,7 @@ public class DriverImageEps implements UDriver<EpsGraphics> {
|
||||
}
|
||||
}
|
||||
|
||||
eps.drawImage(shape.muteTransparentColor(mapper.toColor(param.getBackcolor())).getImage(), x, y);
|
||||
eps.drawImage(shape.muteTransparentColor(mapper.toColor(param.getBackcolor())).getImage(1), x, y);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
package net.sourceforge.plantuml.ugraphic.g2d;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.AffineTransform;
|
||||
|
||||
import net.sourceforge.plantuml.EnsureVisible;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
@ -49,11 +50,11 @@ public class DriverImageG2d implements UDriver<Graphics2D> {
|
||||
|
||||
private final EnsureVisible visible;
|
||||
|
||||
// private final double dpiFactor;
|
||||
private final double dpiFactor;
|
||||
|
||||
public DriverImageG2d(double dpiFactor, EnsureVisible visible) {
|
||||
this.visible = visible;
|
||||
// this.dpiFactor = dpiFactor;
|
||||
this.dpiFactor = dpiFactor;
|
||||
}
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
@ -63,11 +64,14 @@ public class DriverImageG2d implements UDriver<Graphics2D> {
|
||||
final UImage shape = ((UImage) ushape);
|
||||
visible.ensureVisible(x, y);
|
||||
visible.ensureVisible(x + shape.getWidth(), y + shape.getHeight());
|
||||
// final AffineTransform back = g2d.getTransform();
|
||||
// System.err.println("dpiFactor=" + dpiFactor);
|
||||
// g2d.scale(1 / dpiFactor, 1 / dpiFactor);
|
||||
g2d.drawImage(shape.getImage(), (int) (x), (int) (y), null);
|
||||
// g2d.setTransform(back);
|
||||
if (dpiFactor == 1) {
|
||||
g2d.drawImage(shape.getImage(1), (int) (x), (int) (y), null);
|
||||
} else {
|
||||
final AffineTransform back = g2d.getTransform();
|
||||
g2d.scale(1 / dpiFactor, 1 / dpiFactor);
|
||||
g2d.drawImage(shape.getImage(dpiFactor), (int) (x * dpiFactor), (int) (y * dpiFactor), null);
|
||||
g2d.setTransform(back);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class DriverLineHtml5 implements UDriver<Html5Drawer> {
|
||||
y2 = line.y2;
|
||||
}
|
||||
|
||||
final String color = param.getColor() == null ? null : mapper.toHtml(param.getColor());
|
||||
final String color = param.getColor() == null ? null : mapper.toRGB(param.getColor());
|
||||
html.setStrokeColor(color);
|
||||
|
||||
html.htmlLine(x, y, x2, y2, 0);
|
||||
|
@ -82,8 +82,8 @@ public class DriverRectangleHtml5 implements UDriver<Html5Drawer> {
|
||||
// eps.setStrokeColor(mapper.getMappedColor(param.getColor()));
|
||||
// eps.epsRectangle(x, y, width, height, rx / 2, ry / 2, (HtmlColorGradient) back, mapper);
|
||||
} else {
|
||||
final String color = param.getColor() == null ? null : mapper.toHtml(param.getColor());
|
||||
final String backcolor = param.getColor() == null ? null : mapper.toHtml(param.getBackcolor());
|
||||
final String color = param.getColor() == null ? null : mapper.toRGB(param.getColor());
|
||||
final String backcolor = param.getColor() == null ? null : mapper.toRGB(param.getBackcolor());
|
||||
|
||||
html.setStrokeColor(color);
|
||||
html.setFillColor(backcolor);
|
||||
|
@ -58,7 +58,7 @@ public class DriverCenteredCharacterSvg implements UDriver<SvgGraphics> {
|
||||
final double ypos = y - unusedSpace.getCenterY() - 0.5;
|
||||
|
||||
final TextLayout t = new TextLayout("" + c, font.getFont(), TextBlockUtils.getFontRenderContext());
|
||||
svg.setStrokeColor(mapper.toHtml(param.getColor()));
|
||||
svg.setStrokeColor(mapper.toRGB(param.getColor()));
|
||||
DriverTextAsPathSvg.drawPathIterator(svg, xpos, ypos, t.getOutline(null).getPathIterator(null));
|
||||
|
||||
}
|
||||
|
@ -72,8 +72,8 @@ public class DriverEllipseSvg implements UDriver<SvgGraphics> {
|
||||
final HColor back = param.getBackcolor();
|
||||
if (back instanceof HColorGradient) {
|
||||
final HColorGradient gr = (HColorGradient) back;
|
||||
final String id = svg.createSvgGradient(mapper.toHtml(gr.getColor1()),
|
||||
mapper.toHtml(gr.getColor2()), gr.getPolicy());
|
||||
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()),
|
||||
mapper.toRGB(gr.getColor2()), gr.getPolicy());
|
||||
svg.setFillColor("url(#" + id + ")");
|
||||
} else if (back == null || back instanceof HColorBackground) {
|
||||
svg.setFillColor("none");
|
||||
|
@ -68,7 +68,7 @@ public class DriverImagePng implements UDriver<SvgGraphics> {
|
||||
}
|
||||
|
||||
try {
|
||||
svg.svgImage(image.getImage(), x, y);
|
||||
svg.svgImage(image.getImage(1), x, y);
|
||||
} catch (IOException e) {
|
||||
Log.error("Error in svg for image " + e);
|
||||
}
|
||||
|
@ -71,8 +71,8 @@ public class DriverPathSvg extends DriverShadowedG2d implements UDriver<SvgGraph
|
||||
final HColor back = param.getBackcolor();
|
||||
if (back instanceof HColorGradient) {
|
||||
final HColorGradient gr = (HColorGradient) back;
|
||||
final String id = svg.createSvgGradient(mapper.toHtml(gr.getColor1()),
|
||||
mapper.toHtml(gr.getColor2()), gr.getPolicy());
|
||||
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()),
|
||||
mapper.toRGB(gr.getColor2()), gr.getPolicy());
|
||||
svg.setFillColor("url(#" + id + ")");
|
||||
} else {
|
||||
final String backcolor = mapper.toSvg(back);
|
||||
|
@ -71,8 +71,8 @@ public class DriverPolygonSvg implements UDriver<SvgGraphics> {
|
||||
final HColor back = param.getBackcolor();
|
||||
if (back instanceof HColorGradient) {
|
||||
final HColorGradient gr = (HColorGradient) back;
|
||||
final String id = svg.createSvgGradient(mapper.toHtml(gr.getColor1()),
|
||||
mapper.toHtml(gr.getColor2()), gr.getPolicy());
|
||||
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()),
|
||||
mapper.toRGB(gr.getColor2()), gr.getPolicy());
|
||||
svg.setFillColor("url(#" + id + ")");
|
||||
} else {
|
||||
final String backcolorString = mapper.toSvg(back);
|
||||
|
@ -66,8 +66,8 @@ public class DriverRectangleSvg implements UDriver<SvgGraphics> {
|
||||
final HColor back = param.getBackcolor();
|
||||
if (back instanceof HColorGradient) {
|
||||
final HColorGradient gr = (HColorGradient) back;
|
||||
final String id = svg.createSvgGradient(mapper.toHtml(gr.getColor1()),
|
||||
mapper.toHtml(gr.getColor2()), gr.getPolicy());
|
||||
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()),
|
||||
mapper.toRGB(gr.getColor2()), gr.getPolicy());
|
||||
svg.setFillColor("url(#" + id + ")");
|
||||
applyColor(svg, mapper, param);
|
||||
} else {
|
||||
@ -96,8 +96,8 @@ public class DriverRectangleSvg implements UDriver<SvgGraphics> {
|
||||
final HColor color = param.getColor();
|
||||
if (color instanceof HColorGradient) {
|
||||
final HColorGradient gr = (HColorGradient) color;
|
||||
final String id = svg.createSvgGradient(mapper.toHtml(gr.getColor1()),
|
||||
mapper.toHtml(gr.getColor2()), gr.getPolicy());
|
||||
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()),
|
||||
mapper.toRGB(gr.getColor2()), gr.getPolicy());
|
||||
svg.setStrokeColor("url(#" + id + ")");
|
||||
} else {
|
||||
svg.setStrokeColor(mapper.toSvg(color));
|
||||
|
@ -106,19 +106,19 @@ public class DriverTextSvg implements UDriver<SvgGraphics> {
|
||||
final HColor back = fontConfiguration.getExtendedColor();
|
||||
if (back instanceof HColorGradient) {
|
||||
final HColorGradient gr = (HColorGradient) back;
|
||||
final String id = svg.createSvgGradient(mapper.toHtml(gr.getColor1()),
|
||||
mapper.toHtml(gr.getColor2()), gr.getPolicy());
|
||||
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()),
|
||||
mapper.toRGB(gr.getColor2()), gr.getPolicy());
|
||||
svg.setFillColor("url(#" + id + ")");
|
||||
svg.setStrokeColor(null);
|
||||
final double deltaPatch = 2;
|
||||
svg.svgRectangle(x, y - height + deltaPatch, width, height, 0, 0, 0, null);
|
||||
|
||||
} else {
|
||||
backColor = mapper.toHtml(back);
|
||||
backColor = mapper.toRGB(back);
|
||||
}
|
||||
}
|
||||
|
||||
svg.setFillColor(mapper.toHtml(fontConfiguration.getColor()));
|
||||
svg.setFillColor(mapper.toRGB(fontConfiguration.getColor()));
|
||||
svg.text(text, x, y, font.getFamily(UFontContext.SVG), font.getSize(), fontWeight, fontStyle, textDecoration,
|
||||
width, fontConfiguration.getAttributes(), backColor);
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ import net.sourceforge.plantuml.flashcode.FlashCodeUtils;
|
||||
import net.sourceforge.plantuml.graphic.GraphicStrings;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
@ -73,8 +75,8 @@ public class PSystemKeycheck extends AbstractPSystem {
|
||||
@Override
|
||||
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)
|
||||
throws IOException {
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(),
|
||||
false, null, getMetadata(), null, 1.0, HColorUtils.WHITE);
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, getMetadata(),
|
||||
null, 1.0, HColorUtils.WHITE);
|
||||
|
||||
imageBuilder.setUDrawable(new UDrawable() {
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -133,7 +135,8 @@ public class PSystemKeycheck extends AbstractPSystem {
|
||||
Version.versionString() + "\n" + SignatureUtils.toHexString(PLSSignature.signature()), Color.BLACK,
|
||||
Color.WHITE);
|
||||
if (im != null) {
|
||||
final UImage flash = new UImage(im).scaleNearestNeighbor(4);
|
||||
final UImage flash = new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR))
|
||||
.scale(4);
|
||||
ug.draw(flash);
|
||||
ug = ug.apply(UTranslate.dy(flash.getHeight()));
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ import net.sourceforge.plantuml.graphic.GraphicStrings;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
@ -71,8 +73,8 @@ public class PSystemKeygen extends AbstractPSystem {
|
||||
@Override
|
||||
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)
|
||||
throws IOException {
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(),
|
||||
false, null, getMetadata(), null, 1.0, HColorUtils.WHITE);
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, getMetadata(),
|
||||
null, 1.0, HColorUtils.WHITE);
|
||||
|
||||
imageBuilder.setUDrawable(new UDrawable() {
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -152,9 +154,11 @@ public class PSystemKeygen extends AbstractPSystem {
|
||||
ug = ug.apply(UTranslate.dy(disp.calculateDimension(ug.getStringBounder()).getHeight()));
|
||||
final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils();
|
||||
final BufferedImage im = utils.exportFlashcode(
|
||||
Version.versionString() + "\n" + SignatureUtils.toHexString(PLSSignature.signature()), Color.BLACK, Color.WHITE);
|
||||
Version.versionString() + "\n" + SignatureUtils.toHexString(PLSSignature.signature()), Color.BLACK,
|
||||
Color.WHITE);
|
||||
if (im != null) {
|
||||
final UImage flash = new UImage(im).scaleNearestNeighbor(4);
|
||||
final UImage flash = new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR))
|
||||
.scale(4);
|
||||
ug.draw(flash);
|
||||
ug = ug.apply(UTranslate.dy(flash.getHeight()));
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.graphic.GraphicStrings;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
|
||||
import net.sourceforge.plantuml.ugraphic.PixelImage;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
@ -58,8 +60,8 @@ public class PSystemLicense extends AbstractPSystem implements UDrawable {
|
||||
@Override
|
||||
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)
|
||||
throws IOException {
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null,
|
||||
getMetadata(), null, 1.0, null);
|
||||
final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, getMetadata(),
|
||||
null, 1.0, null);
|
||||
imageBuilder.setUDrawable(this);
|
||||
return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os);
|
||||
}
|
||||
@ -96,7 +98,7 @@ public class PSystemLicense extends AbstractPSystem implements UDrawable {
|
||||
final TextBlockBackcolored result1 = getGraphicStrings(strings1);
|
||||
result1.drawU(ug);
|
||||
ug = ug.apply(UTranslate.dy(4 + result1.calculateDimension(ug.getStringBounder()).getHeight()));
|
||||
UImage im = new UImage(logo);
|
||||
UImage im = new UImage(new PixelImage(logo, AffineTransformType.TYPE_BILINEAR));
|
||||
ug.apply(UTranslate.dx(20)).draw(im);
|
||||
|
||||
ug = ug.apply(UTranslate.dy(im.getHeight()));
|
||||
|
@ -44,7 +44,7 @@ public class Version {
|
||||
private static final int MAJOR_SEPARATOR = 1000000;
|
||||
|
||||
public static int version() {
|
||||
return 1202011;
|
||||
return 1202012;
|
||||
}
|
||||
|
||||
public static int versionPatched() {
|
||||
@ -93,7 +93,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static long compileTime() {
|
||||
return 1590833623475L;
|
||||
return 1591440855351L;
|
||||
}
|
||||
|
||||
public static String compileTimeString() {
|
||||
|
Loading…
Reference in New Issue
Block a user