1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 02:49:06 +00:00
This commit is contained in:
Arnaud Roques 2022-09-20 22:35:41 +02:00
parent 06afc26207
commit 9bdc69ecee
94 changed files with 365 additions and 397 deletions

View File

@ -477,7 +477,7 @@ root {
HyperLinkColor blue
FontColor white
LineColor #e7e7e7
BackGroundColor #070707
BackGroundColor #303030
}
document {
@ -537,6 +537,11 @@ sequenceDiagram {
LineColor white
BackGroundColor #1
}
participant,actor,boundary,control,entity,queue,database,collections {
BackgroundColor: #2;
HorizontalAlignment center
}
}
@ -570,7 +575,7 @@ swimlane {
}
note {
BackGroundColor #3
BackGroundColor #714137
}
@ -632,6 +637,9 @@ timingDiagram {
ganttDiagram {
task {
BackGroundColor #555
}
timeline {
LineColor #3f3f3f
}
@ -653,9 +661,12 @@ yamlDiagram,jsonDiagram {
BackGroundColor #ccff02
}
}
}
nwdiagDiagram {
network {
BackGroundColor #555
}
group {
BackGroundColor #2
}

View File

@ -56,6 +56,7 @@ import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.stats.StatsUtilsIncrement;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.version.License;
import net.sourceforge.plantuml.version.Version;
@ -193,7 +194,13 @@ public abstract class AbstractPSystem implements Diagram {
}
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
return imageBuilder(fileFormatOption);
final ColorMapper init = fileFormatOption.getColorMapper();
final ColorMapper newColorMappter = muteColorMapper(init);
return imageBuilder(fileFormatOption.withColorMapper(newColorMappter));
}
protected ColorMapper muteColorMapper(ColorMapper init) {
return init;
}
// TODO "index" isnt really being used
@ -203,7 +210,7 @@ public abstract class AbstractPSystem implements Diagram {
public ClockwiseTopRightBottomLeft getDefaultMargins() {
return ClockwiseTopRightBottomLeft.same(0);
}
@Override
public Display getTitleDisplay() {
return null;

View File

@ -175,8 +175,10 @@ public class BlockUml {
if (system == null) {
if (preprocessorError)
system = new PSystemErrorPreprocessor(data, debug);
else
system = new PSystemBuilder().createPSystem(skinParam, data, rawSource);
else {
system = new PSystemBuilder().createPSystem(data, rawSource,
skinParam == null ? Collections.<String, String>emptyMap() : skinParam.values());
}
}
return system;
}

View File

@ -85,8 +85,8 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
this(config, charset, defines, reader, null, null);
}
public BlockUmlBuilder(List<String> config, Charset charset, Defines defines, Reader readerInit, SFile newCurrentDir,
String desc) throws IOException {
public BlockUmlBuilder(List<String> config, Charset charset, Defines defines, Reader readerInit,
SFile newCurrentDir, String desc) throws IOException {
this.defines = defines;
this.charset = requireNonNull(charset);

View File

@ -57,7 +57,7 @@ public interface ISkinSimple extends SpriteContainer {
public LineBreakStrategy wrapWidth();
public void copyAllFrom(ISkinSimple other);
public void copyAllFrom(Map<String, String> other);
public double minClassWidth();

View File

@ -46,7 +46,7 @@ public interface ISourceFileReader {
public boolean hasError();
public void setFileFormatOption(FileFormatOption fileFormatOption);
public ISourceFileReader setFileFormatOption(FileFormatOption fileFormatOption);
public void setCheckMetadata(boolean checkMetadata);

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.acearth.PSystemXearthFactory;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory;
@ -105,7 +106,7 @@ public class PSystemBuilder {
public static final long startTime = System.currentTimeMillis();
final public Diagram createPSystem(ISkinSimple skinParam, List<StringLocated> source, List<StringLocated> rawSource) {
final public Diagram createPSystem(List<StringLocated> source, List<StringLocated> rawSource, Map<String, String> skinParam) {
final long now = System.currentTimeMillis();

View File

@ -76,26 +76,27 @@ public class Pipe {
public void managePipe(ErrorStatus error) throws IOException {
final boolean noStdErr = option.isPipeNoStdErr();
for(String source = readFirstDiagram(); source != null; source = readSubsequentDiagram()) {
for (String source = readFirstDiagram(); source != null; source = readSubsequentDiagram()) {
final Defines defines = option.getDefaultDefines();
final SFile newCurrentDir = option.getFileDir() == null ? null : new SFile(option.getFileDir());
final SourceStringReader sourceStringReader = new SourceStringReader(defines, source, UTF_8,
option.getConfig(), newCurrentDir);
if (option.isComputeurl()) {
if (option.isComputeurl())
computeUrlForDiagram(sourceStringReader);
} else if (option.isSyntax()) {
else if (option.isSyntax())
syntaxCheckDiagram(sourceStringReader, error);
} else if (option.isPipeMap()) {
else if (option.isPipeMap())
createPipeMapForDiagram(sourceStringReader, error);
} else {
else
generateDiagram(sourceStringReader, error, noStdErr);
}
ps.flush();
}
}
private void generateDiagram(SourceStringReader sourceStringReader, ErrorStatus error, boolean noStdErr) throws IOException {
private void generateDiagram(SourceStringReader sourceStringReader, ErrorStatus error, boolean noStdErr)
throws IOException {
final OutputStream os = noStdErr ? new ByteArrayOutputStream() : ps;
final DiagramDescription result = sourceStringReader.outputImage(os, option.getImageIndex(),
option.getFileFormatOption());
@ -111,28 +112,27 @@ public class Pipe {
ps.write(baos.toByteArray());
}
}
if (option.getPipeDelimitor() != null) {
if (option.getPipeDelimitor() != null)
ps.println(option.getPipeDelimitor());
}
}
private void createPipeMapForDiagram(SourceStringReader sourceStringReader, ErrorStatus error) throws IOException {
final String result = sourceStringReader.getCMapData(option.getImageIndex(),
option.getFileFormatOption());
final String result = sourceStringReader.getCMapData(option.getImageIndex(), option.getFileFormatOption());
// https://forum.plantuml.net/10049/2019-pipemap-diagrams-containing-links-give-zero-exit-code
// We don't check errors
error.goOk();
if (result == null) {
if (result == null)
ps.println();
} else {
else
ps.println(result);
}
}
private void computeUrlForDiagram(SourceStringReader sourceStringReader) throws IOException {
for (BlockUml s : sourceStringReader.getBlocks()) {
for (BlockUml s : sourceStringReader.getBlocks())
ps.println(s.getEncodedUrl());
}
}
private void syntaxCheckDiagram(SourceStringReader sourceStringReader, ErrorStatus error) {
@ -153,11 +153,11 @@ public class Pipe {
private void printInfo(final PrintStream output, final SourceStringReader sourceStringReader) {
final List<BlockUml> blocks = sourceStringReader.getBlocks();
if (blocks.size() == 0) {
if (blocks.size() == 0)
stdrpt.printInfo(output, null);
} else {
else
stdrpt.printInfo(output, blocks.get(0).getDiagram());
}
}
String readFirstDiagram() throws IOException {
@ -174,14 +174,13 @@ public class Pipe {
final StringBuilder sb = new StringBuilder();
String line;
while(state != State.COMPLETE && (line = br.readLine()) != null) {
while (state != State.COMPLETE && (line = br.readLine()) != null) {
if(line.startsWith("@@@format ")) {
if (line.startsWith("@@@format ")) {
manageFormat(line);
} else {
if (state == State.NO_CONTENT && line.trim().length() > 0) {
if (state == State.NO_CONTENT && line.trim().length() > 0)
state = State.START_MARK_NOT_FOUND;
}
if (state == State.START_MARK_NOT_FOUND && line.startsWith("@start")) {
sb.setLength(0); // discard any previous input
@ -191,38 +190,35 @@ public class Pipe {
state = State.COMPLETE;
}
if (state != State.NO_CONTENT) {
if (state != State.NO_CONTENT)
sb.append(line).append("\n");
}
}
}
switch(state) {
case NO_CONTENT:
return null;
case START_MARK_NOT_FOUND:
return (unmarkedAllowed) ? "@startuml\n" + sb.toString() + "@enduml\n" : null;
case START_MARK_FOUND:
return sb.toString() + expectedEnd;
case COMPLETE:
return sb.toString();
default:
throw new IllegalStateException("Unexpected value: " + state);
switch (state) {
case NO_CONTENT:
return null;
case START_MARK_NOT_FOUND:
return (unmarkedAllowed) ? "@startuml\n" + sb.toString() + "@enduml\n" : null;
case START_MARK_FOUND:
return sb.toString() + expectedEnd;
case COMPLETE:
return sb.toString();
default:
throw new IllegalStateException("Unexpected value: " + state);
}
}
void manageFormat(String s) {
if (s.contains("png")) {
if (s.contains("png"))
option.setFileFormatOption(new FileFormatOption(FileFormat.PNG));
} else if (s.contains("svg")) {
else if (s.contains("svg"))
option.setFileFormatOption(new FileFormatOption(FileFormat.SVG));
}
}
enum State {
NO_CONTENT,
START_MARK_NOT_FOUND,
START_MARK_FOUND,
COMPLETE
enum State {
NO_CONTENT, START_MARK_NOT_FOUND, START_MARK_FOUND, COMPLETE
}
}

View File

@ -79,8 +79,6 @@ import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.ColorOrder;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColors;
@ -145,8 +143,8 @@ public class SkinParam implements ISkinParam {
private final UmlDiagramType type;
private boolean useVizJs;
public void copyAllFrom(ISkinSimple other) {
this.params.putAll(other.values());
public void copyAllFrom(Map<String, String> other) {
this.params.putAll(other);
}
public Map<String, String> values() {
@ -660,31 +658,6 @@ public class SkinParam implements ISkinParam {
return split[i];
}
public ColorMapper getColorMapper() {
if ("dark".equalsIgnoreCase(getValue("mode")))
return ColorMapper.FORCE_DARK;
final String monochrome = getValue("monochrome");
if ("true".equals(monochrome))
return ColorMapper.MONOCHROME;
if ("reverse".equals(monochrome))
return ColorMapper.MONOCHROME_REVERSE;
final String value = getValue("reversecolor");
if (value == null)
return ColorMapper.IDENTITY;
if ("dark".equalsIgnoreCase(value))
return ColorMapper.LIGTHNESS_INVERSE;
final ColorOrder order = ColorOrder.fromString(value);
if (order == null)
return ColorMapper.IDENTITY;
return ColorMapper.reverse(order);
}
public boolean shadowing(Stereotype stereotype) {
if (stereotype != null) {
checkStereotype(stereotype);

View File

@ -55,7 +55,6 @@ import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
@ -124,11 +123,6 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getHorizontalAlignment(param, arrowDirection, isReverseDefine, overrideDefault);
}
@Override
public ColorMapper getColorMapper() {
return skinParam.getColorMapper();
}
@Override
public boolean shadowing(Stereotype stereotype) {
return skinParam.shadowing(stereotype);
@ -385,7 +379,7 @@ public class SkinParamDelegator implements ISkinParam {
}
@Override
public void copyAllFrom(ISkinSimple other) {
public void copyAllFrom(Map<String, String> other) {
skinParam.copyAllFrom(other);
}

View File

@ -48,6 +48,8 @@ import net.sourceforge.plantuml.security.SFile;
@HaxeIgnored
public class SourceFileReader extends SourceFileReaderAbstract implements ISourceFileReader {
private File outputDirectory;
public SourceFileReader(File file) throws IOException {
this(file, file.getAbsoluteFile().getParentFile());
}
@ -72,14 +74,14 @@ public class SourceFileReader extends SourceFileReaderAbstract implements ISourc
FileFormatOption fileFormatOption) throws IOException {
super(file, fileFormatOption, defines, config, charset);
FileSystem.getInstance().setCurrentDir(SFile.fromFile(file.getAbsoluteFile().getParentFile()));
if (outputDirectory == null) {
if (outputDirectory == null)
outputDirectory = file.getAbsoluteFile().getParentFile();
} else if (outputDirectory.isAbsolute() == false) {
else if (outputDirectory.isAbsolute() == false)
outputDirectory = FileSystem.getInstance().getFile(outputDirectory.getPath()).conv();
}
if (outputDirectory.exists() == false) {
if (outputDirectory.exists() == false)
outputDirectory.mkdirs();
}
this.outputDirectory = outputDirectory;
}
@ -141,18 +143,17 @@ public class SourceFileReader extends SourceFileReaderAbstract implements ISourc
if (dir == null) {
Log.info(newName + " is not taken as a directory");
suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, newName),
fileFormatOption.getFileFormat(), 0);
getFileFormatOption().getFileFormat(), 0);
} else {
Log.info("We are going to create files in directory " + dir);
suggested = SuggestedFile.fromOutputFile(new File(dir, file.getName()),
fileFormatOption.getFileFormat(), 0);
suggested = SuggestedFile.fromOutputFile(new File(dir, getFileName()),
getFileFormatOption().getFileFormat(), 0);
}
Log.info("We are going to put data in " + suggested);
}
if (suggested == null) {
suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, file.getName()),
fileFormatOption.getFileFormat(), cpt++);
}
if (suggested == null)
suggested = getSuggestedFile(outputDirectory, getFileName());
suggested.getParentFile().mkdirs();
return suggested;
}

View File

@ -65,28 +65,37 @@ import net.sourceforge.plantuml.security.SecurityUtils;
public abstract class SourceFileReaderAbstract implements ISourceFileReader {
protected File file;
protected File outputDirectory;
protected File outputFile;
final private File file;
protected final BlockUmlBuilder builder;
protected /* final */ FileFormatOption fileFormatOption;
private FileFormatOption fileFormatOption;
private boolean checkMetadata;
private boolean noerror;
final private Charset charset;
private final BlockUmlBuilder builder;
private int cpt;
protected final SuggestedFile getSuggestedFile(File outputDirectory, String newName) {
final File outFile = new File(outputDirectory, newName);
return SuggestedFile.fromOutputFile(outFile, getFileFormatOption().getFileFormat(), cpt++);
}
public SourceFileReaderAbstract(File file, FileFormatOption fileFormatOption, Defines defines, List<String> config,
String charsetName) throws IOException {
if (!file.exists()) {
if (file.exists() == false)
throw new IllegalArgumentException();
}
final Charset charset = charsetOrDefault(charsetName);
this.file = file;
this.charset = charsetOrDefault(charsetName);
this.fileFormatOption = fileFormatOption;
this.builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), SFile.fromFile(file.getAbsoluteFile().getParentFile()),
FileWithSuffix.getFileName(file));
this.builder = new BlockUmlBuilder(config, charset, defines, getReader(charset),
SFile.fromFile(file.getAbsoluteFile().getParentFile()), FileWithSuffix.getFileName(file));
}
protected final FileFormatOption getFileFormatOption() {
return fileFormatOption;
}
public void setCheckMetadata(boolean checkMetadata) {
@ -94,11 +103,9 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
}
public boolean hasError() {
for (final BlockUml b : builder.getBlockUmls()) {
if (b.getDiagram() instanceof PSystemError) {
for (final BlockUml b : builder.getBlockUmls())
if (b.getDiagram() instanceof PSystemError)
return true;
}
}
return false;
}
@ -110,13 +117,14 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
return new InputStreamReader(new BufferedInputStream(new FileInputStream(file)), charset);
}
public final Set<FileWithSuffix> getIncludedFiles() {
public final Set<FileWithSuffix> getIncludedFiles() throws IOException {
return builder.getIncludedFiles();
}
@Deprecated
public final void setFileFormatOption(FileFormatOption fileFormatOption) {
@Override
public final ISourceFileReader setFileFormatOption(FileFormatOption fileFormatOption) {
this.fileFormatOption = fileFormatOption;
return this;
}
protected boolean endsWithSlashOrAntislash(String newName) {
@ -145,8 +153,6 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
}
}
protected int cpt;
final public List<GeneratedImage> getGeneratedImages() throws IOException {
Log.info("Reading file: " + file);
@ -161,28 +167,26 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
system = blockUml.getDiagram();
} catch (Throwable t) {
Logme.error(t);
if (OptionFlags.getInstance().isSilentlyCompletelyIgnoreErrors() || noerror) {
if (OptionFlags.getInstance().isSilentlyCompletelyIgnoreErrors() || noerror)
continue;
}
return getCrashedImage(blockUml, t, suggested.getFile(0));
}
if (OptionFlags.getInstance().isSilentlyCompletelyIgnoreErrors() && system instanceof PSystemError) {
if (OptionFlags.getInstance().isSilentlyCompletelyIgnoreErrors() && system instanceof PSystemError)
continue;
}
OptionFlags.getInstance().logData(SFile.fromFile(file), system);
final List<FileImageData> exportDiagrams;
if (noerror && system instanceof PSystemError) {
exportDiagrams = new ArrayList<FileImageData>();
exportDiagrams.add(
new FileImageData(null, new ImageDataSimple(new XDimension2D(0, 0), FileImageData.ERROR)));
exportDiagrams
.add(new FileImageData(null, new ImageDataSimple(new XDimension2D(0, 0), FileImageData.ERROR)));
} else
exportDiagrams = PSystemUtils.exportDiagrams(system, suggested, fileFormatOption, checkMetadata);
if (exportDiagrams.size() > 1) {
if (exportDiagrams.size() > 1)
cpt += exportDiagrams.size() - 1;
}
for (FileImageData fdata : exportDiagrams) {
final String desc = "[" + file.getName() + "] " + system.getDescription();
@ -206,4 +210,8 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
}
final protected String getFileName() {
return file.getName();
}
}

View File

@ -43,34 +43,23 @@ import net.sourceforge.plantuml.preproc.Defines;
public class SourceFileReaderCopyCat extends SourceFileReaderAbstract implements ISourceFileReader {
private final File outputDirectory;
public SourceFileReaderCopyCat(Defines defines, final File file, File outputDirectory, List<String> config,
String charset, FileFormatOption fileFormatOption) throws IOException {
super(file, fileFormatOption, defines, config, charset);
final String path = file.getParentFile().getPath();
// System.err.println("SourceFileReaderCopyCat::path=" + path);
// System.err.println("SourceFileReaderCopyCat::outputDirectory=" +
// outputDirectory);
this.outputDirectory = new File(outputDirectory, path).getAbsoluteFile();
if (outputDirectory.exists() == false) {
if (outputDirectory.exists() == false)
outputDirectory.mkdirs();
}
// System.err.println("SourceFileReaderCopyCat=" +
// this.outputDirectory.getPath() + " "
// + this.outputDirectory.getAbsolutePath());
}
@Override
protected SuggestedFile getSuggestedFile(BlockUml blockUml) {
final String newName = blockUml.getFileOrDirname();
SuggestedFile suggested = null;
if (newName == null) {
suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, file.getName()),
fileFormatOption.getFileFormat(), cpt++);
} else {
suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, newName),
fileFormatOption.getFileFormat(), cpt++);
}
// System.err.println("SourceFileReaderCopyCat::suggested=" + suggested);
String newName = blockUml.getFileOrDirname();
if (newName == null)
newName = getFileName();
final SuggestedFile suggested = getSuggestedFile(outputDirectory, newName);
suggested.getParentFile().mkdirs();
return suggested;
}

View File

@ -44,6 +44,8 @@ import net.sourceforge.plantuml.security.SFile;
public class SourceFileReaderHardFile extends SourceFileReaderAbstract implements ISourceFileReader {
private final File outputFile;
public SourceFileReaderHardFile(Defines defines, final File file, File outputFile, List<String> config,
String charset, FileFormatOption fileFormatOption) throws IOException {
super(file, fileFormatOption, defines, config, charset);
@ -53,7 +55,7 @@ public class SourceFileReaderHardFile extends SourceFileReaderAbstract implement
@Override
protected SuggestedFile getSuggestedFile(BlockUml blockUml) {
final SuggestedFile suggested = SuggestedFile.fromOutputFile(outputFile, fileFormatOption.getFileFormat());
final SuggestedFile suggested = SuggestedFile.fromOutputFile(outputFile, getFileFormatOption().getFileFormat());
return suggested;
}

View File

@ -151,7 +151,6 @@ public class SourceStringReader {
public DiagramDescription outputImage(OutputStream os, int numImage, FileFormatOption fileFormatOption)
throws IOException {
fileFormatOption = fileFormatOption;
if (blocks.size() == 0) {
noStartumlFound(os, fileFormatOption);
return null;
@ -176,10 +175,9 @@ public class SourceStringReader {
}
public DiagramDescription generateDiagramDescription(int numImage, FileFormatOption fileFormatOption) {
fileFormatOption = fileFormatOption;
if (blocks.size() == 0) {
if (blocks.size() == 0)
return null;
}
for (BlockUml b : blocks) {
final Diagram system = b.getDiagram();
final int nbInSystem = system.getNbImages();
@ -211,18 +209,17 @@ public class SourceStringReader {
}
public String getCMapData(int numImage, FileFormatOption fileFormatOption) throws IOException {
fileFormatOption = fileFormatOption;
if (blocks.size() == 0) {
if (blocks.size() == 0)
return null;
}
for (BlockUml b : blocks) {
final Diagram system = b.getDiagram();
final int nbInSystem = system.getNbImages();
if (numImage < nbInSystem) {
final ImageData imageData = system.exportDiagram(new NullOutputStream(), numImage, fileFormatOption);
if (imageData.containsCMapData()) {
if (imageData.containsCMapData())
return imageData.getCMapData("plantuml");
}
return null;
}
numImage -= nbInSystem;
@ -232,7 +229,6 @@ public class SourceStringReader {
}
public ImageData noStartumlFound(OutputStream os, FileFormatOption fileFormatOption) throws IOException {
fileFormatOption = fileFormatOption;
final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"),
fileFormatOption.isUseRedForError());

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
public interface SpriteContainer extends SvgCharSizeHack {
@ -44,6 +43,4 @@ public interface SpriteContainer extends SvgCharSizeHack {
public Guillemet guillemet();
public ColorMapper getColorMapper();
}

View File

@ -40,7 +40,6 @@ import java.util.Map;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.sprite.SpriteImage;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
@ -81,11 +80,7 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
return LineBreakStrategy.NONE;
}
public ColorMapper getColorMapper() {
return ColorMapper.IDENTITY;
}
public void copyAllFrom(ISkinSimple other) {
public void copyAllFrom(Map<String, String> other) {
throw new UnsupportedOperationException();
}

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import net.sourceforge.plantuml.anim.Animation;
import net.sourceforge.plantuml.anim.AnimationDecoder;
@ -59,6 +60,8 @@ import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleLoader;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.ColorOrder;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColors;
@ -86,7 +89,7 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return pragma;
}
public TitledDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) {
public TitledDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source);
this.type = type;
this.skinParam = SkinParam.create(type);
@ -278,4 +281,29 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return backgroundColor;
}
@Override
protected ColorMapper muteColorMapper(ColorMapper init) {
if ("dark".equalsIgnoreCase(getSkinParam().getValue("mode")))
return ColorMapper.FORCE_DARK;
final String monochrome = getSkinParam().getValue("monochrome");
if ("true".equals(monochrome))
return ColorMapper.MONOCHROME;
if ("reverse".equals(monochrome))
return ColorMapper.MONOCHROME_REVERSE;
final String value = getSkinParam().getValue("reversecolor");
if (value == null)
return init;
if ("dark".equalsIgnoreCase(value))
return ColorMapper.LIGTHNESS_INVERSE;
final ColorOrder order = ColorOrder.fromString(value);
if (order == null)
return init;
return ColorMapper.reverse(order);
}
}

View File

@ -49,6 +49,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
@ -91,7 +92,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
// super(style, source, type);
// }
public UmlDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) {
public UmlDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig);
}

View File

@ -37,10 +37,10 @@ package net.sourceforge.plantuml.activitydiagram;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource;
@ -61,7 +61,7 @@ public class ActivityDiagram extends CucaDiagram {
private IEntity lastEntityBrancheConsulted;
private ConditionalContext currentContext;
public ActivityDiagram(UmlSource source, ISkinSimple skinParam) {
public ActivityDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.ACTIVITY, skinParam);
setNamespaceSeparator(null);
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.activitydiagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.activitydiagram.command.CommandElse;
import net.sourceforge.plantuml.activitydiagram.command.CommandEndPartition;
import net.sourceforge.plantuml.activitydiagram.command.CommandEndif;
@ -59,7 +59,7 @@ import net.sourceforge.plantuml.core.UmlSource;
public class ActivityDiagramFactory extends PSystemCommandFactory {
@Override
public ActivityDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public ActivityDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new ActivityDiagram(source, skinParam);
}

View File

@ -37,10 +37,10 @@ package net.sourceforge.plantuml.activitydiagram3;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;
import java.util.Objects;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.Url;
@ -74,7 +74,7 @@ public class ActivityDiagram3 extends UmlDiagram {
private final Swimlanes swinlanes = new Swimlanes(getSkinParam(), getPragma());
public ActivityDiagram3(UmlSource source, ISkinSimple skinParam) {
public ActivityDiagram3(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.ACTIVITY, skinParam);
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.activitydiagram3;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivity3;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLegacy1;
import net.sourceforge.plantuml.activitydiagram3.command.CommandActivityLong3;
@ -160,7 +160,7 @@ public class ActivityDiagramFactory3 extends PSystemCommandFactory {
}
@Override
public ActivityDiagram3 createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public ActivityDiagram3 createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new ActivityDiagram3(source, skinParam);
}

View File

@ -54,9 +54,7 @@ import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColors;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;

View File

@ -35,14 +35,15 @@
*/
package net.sourceforge.plantuml.api;
import net.sourceforge.plantuml.ISkinSimple;
import java.util.Map;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
public interface PSystemFactory {
Diagram createSystem(UmlSource source, ISkinSimple skinParam);
Diagram createSystem(UmlSource source, Map<String, String> skinParam);
DiagramType getDiagramType();

View File

@ -38,6 +38,8 @@ package net.sourceforge.plantuml.api;
import java.util.List;
import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.core.Diagram;

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.board;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -68,7 +68,7 @@ public class BoardDiagramFactory extends PSystemCommandFactory {
}
@Override
public BoardDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public BoardDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new BoardDiagram(source);
}

View File

@ -37,9 +37,9 @@ package net.sourceforge.plantuml.bpm;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType;
@ -65,7 +65,7 @@ public class BpmDiagramFactory extends PSystemCommandFactory {
}
@Override
public AbstractPSystem createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public AbstractPSystem createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new BpmDiagram(source);
}

View File

@ -39,8 +39,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource;
@ -48,7 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public abstract class AbstractEntityDiagram extends CucaDiagram {
public AbstractEntityDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) {
public AbstractEntityDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig);
}

View File

@ -37,10 +37,10 @@ package net.sourceforge.plantuml.classdiagram;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;
import java.util.Objects;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
@ -61,7 +61,7 @@ import net.sourceforge.plantuml.svek.image.EntityImageClass;
public class ClassDiagram extends AbstractClassOrObjectDiagram {
public ClassDiagram(UmlSource source, ISkinSimple skinParam) {
public ClassDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.CLASS, skinParam);
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.classdiagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod;
import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing;
@ -86,7 +86,7 @@ import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap;
public class ClassDiagramFactory extends PSystemCommandFactory {
@Override
public ClassDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public ClassDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new ClassDiagram(source, skinParam);
}

View File

@ -35,10 +35,11 @@
*/
package net.sourceforge.plantuml.command;
import java.util.Map;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.annotation.HaxeIgnored;
import net.sourceforge.plantuml.core.Diagram;
@ -68,7 +69,7 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
}
@Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
final public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
source = source.removeInitialSkinparam();
final IteratorCounter2 it = source.iterator2();
final StringLocated startLine = it.next();

View File

@ -36,11 +36,11 @@
package net.sourceforge.plantuml.command;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.annotation.HaxeIgnored;
@ -58,7 +58,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
protected abstract List<Command> createCommands();
public abstract AbstractPSystem createEmptyDiagram(UmlSource source, ISkinSimple skinParam);
public abstract AbstractPSystem createEmptyDiagram(UmlSource source, Map<String, String> skinParam);
@HaxeIgnored
protected PSystemCommandFactory() {
@ -70,7 +70,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
}
@Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
final public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
final IteratorCounter2 it = source.iterator2();
final StringLocated startLine = it.next();
if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false)

View File

@ -35,10 +35,11 @@
*/
package net.sourceforge.plantuml.command;
import java.util.Map;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.core.Diagram;
@ -57,7 +58,7 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
}
@Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
final public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
if (source.getTotalLineCount() != 3)
return null;

View File

@ -35,9 +35,9 @@
*/
package net.sourceforge.plantuml.compositediagram;
import java.util.Map;
import java.util.Objects;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.core.UmlSource;
@ -49,7 +49,7 @@ import net.sourceforge.plantuml.graphic.USymbol;
public class CompositeDiagram extends AbstractEntityDiagram {
public CompositeDiagram(UmlSource source, ISkinSimple skinParam) {
public CompositeDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.COMPOSITE, skinParam);
}

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml.compositediagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
@ -69,7 +70,7 @@ public class CompositeDiagramFactory extends PSystemCommandFactory {
}
@Override
public CompositeDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public CompositeDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new CompositeDiagram(source, skinParam);
}
}

View File

@ -53,11 +53,9 @@ public class AtomMath extends AbstractAtom implements Atom {
private final ScientificEquationSafe math;
private final HColor foreground;
private final HColor background;
private final ColorMapper colorMapper;
public AtomMath(ScientificEquationSafe math, HColor foreground, HColor background, ColorMapper colorMapper) {
public AtomMath(ScientificEquationSafe math, HColor foreground, HColor background) {
this.math = math;
this.colorMapper = colorMapper;
this.foreground = foreground;
this.background = background;
}
@ -81,14 +79,15 @@ public class AtomMath extends AbstractAtom implements Atom {
}
public void drawU(UGraphic ug) {
final ColorMapper colorMapper = ug.getColorMapper();
final boolean isSvg = ug.matchesProperty("SVG");
final Color back;
if (background == null) {
if (background == null)
back = null;
} else {
back = getColor(background, Color.WHITE);
}
final Color fore = getColor(foreground, Color.BLACK);
else
back = getColor(colorMapper, background, Color.WHITE);
final Color fore = getColor(colorMapper, foreground, Color.BLACK);
// final double dpiFactor = ug.dpiFactor();
if (isSvg) {
final UImageSvg svg = math.getSvg(1, fore, back);
@ -99,7 +98,7 @@ public class AtomMath extends AbstractAtom implements Atom {
}
}
private Color getColor(HColor color, Color defaultValue) {
private Color getColor(ColorMapper colorMapper, HColor color, Color defaultValue) {
if (color instanceof HColorSimple)
return color.toColor(colorMapper);

View File

@ -41,7 +41,6 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class AtomSprite extends AbstractAtom implements Atom {
@ -50,11 +49,8 @@ public class AtomSprite extends AbstractAtom implements Atom {
private final double scale;
private final Url url;
private final HColor color;
private final ColorMapper colorMapper;
public AtomSprite(HColor newColor, double scale, FontConfiguration fontConfiguration, Sprite sprite, Url url,
ColorMapper colorMapper) {
this.colorMapper = colorMapper;
public AtomSprite(HColor newColor, double scale, FontConfiguration fontConfiguration, Sprite sprite, Url url) {
this.scale = scale;
this.sprite = sprite;
this.url = url;
@ -62,7 +58,7 @@ public class AtomSprite extends AbstractAtom implements Atom {
}
public XDimension2D calculateDimension(StringBounder stringBounder) {
return sprite.asTextBlock(color, scale, colorMapper).calculateDimension(stringBounder);
return sprite.asTextBlock(color, scale).calculateDimension(stringBounder);
}
public double getStartingAltitude(StringBounder stringBounder) {
@ -70,13 +66,13 @@ public class AtomSprite extends AbstractAtom implements Atom {
}
public void drawU(UGraphic ug) {
if (url != null) {
if (url != null)
ug.startUrl(url);
}
sprite.asTextBlock(color, scale, colorMapper).drawU(ug);
if (url != null) {
sprite.asTextBlock(color, scale).drawU(ug);
if (url != null)
ug.closeUrl();
}
}
}

View File

@ -119,8 +119,7 @@ public class AtomTextUtils {
final Sprite sprite = skinSimple.getSprite(valSprite);
if (sprite != null) {
final double scale = Parser.getScale(m.group(4), 1);
result.add(
new AtomSprite(null, scale, fontConfiguration, sprite, url, skinSimple.getColorMapper()));
result.add(new AtomSprite(null, scale, fontConfiguration, sprite, url));
}
} else if (valImg != null) {
final double scale = Parser.getScale(m.group(6), 1);

View File

@ -255,7 +255,7 @@ public class StripeSimple implements Stripe {
public void addSprite(String src, double scale, HColor color) {
final Sprite sprite = skinParam.getSprite(src);
if (sprite != null)
atoms.add(new AtomSprite(color, scale, fontConfiguration, sprite, null, skinParam.getColorMapper()));
atoms.add(new AtomSprite(color, scale, fontConfiguration, sprite, null));
}
public void addOpenIcon(String src, double scale, HColor color) {
@ -285,8 +285,7 @@ public class StripeSimple implements Stripe {
}
public void addMath(ScientificEquationSafe math) {
atoms.add(new AtomMath(math, fontConfiguration.getColor(), fontConfiguration.getExtendedColor(),
skinParam.getColorMapper()));
atoms.add(new AtomMath(math, fontConfiguration.getColor(), fontConfiguration.getExtendedColor()));
}
private void modifyStripe(String line) {

View File

@ -42,6 +42,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@ -49,7 +50,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
@ -70,7 +70,6 @@ import net.sourceforge.plantuml.statediagram.StateDiagram;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.xmi.CucaDiagramXmiMaker;
import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker;
@ -121,7 +120,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return ident;
}
public CucaDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) {
public CucaDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig);
this.stacks2.add(Ident.empty());
}
@ -788,10 +787,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return Collections.unmodifiableSet(hides);
}
public ColorMapper getColorMapper() {
return getSkinParam().getColorMapper();
}
final public boolean isStandalone(IEntity ent) {
for (final Link link : getLinks())
if (link.getEntity1() == ent || link.getEntity2() == ent)

View File

@ -110,7 +110,7 @@ public class Stereotype implements CharSequence {
if (tmp == null)
return null;
return tmp.asTextBlock(getHtmlColor(), decoration.spriteScale, container.getColorMapper());
return tmp.asTextBlock(getHtmlColor(), decoration.spriteScale);
}
public boolean isWithOOSymbol() {

View File

@ -55,7 +55,6 @@ import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.PortionShower;
import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
import net.sourceforge.plantuml.svek.DotMode;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
final public class DotData implements PortionShower {
@ -72,7 +71,6 @@ final public class DotData implements PortionShower {
final private String namespaceSeparator;
final private Pragma pragma;
private final ColorMapper colorMapper;
private final EntityFactory entityFactory;
public EntityFactory getEntityFactory() {
@ -80,7 +78,7 @@ final public class DotData implements PortionShower {
}
public DotData(IGroup topParent, List<Link> links, Collection<ILeaf> leafs, UmlDiagramType umlDiagramType,
ISkinParam skinParam, GroupHierarchy groupHierarchy, PortionShower portionShower, ColorMapper colorMapper,
ISkinParam skinParam, GroupHierarchy groupHierarchy, PortionShower portionShower,
EntityFactory entityFactory, boolean isHideEmptyDescriptionForState, DotMode dotMode,
String namespaceSeparator, Pragma pragma) {
this.namespaceSeparator = namespaceSeparator;
@ -88,7 +86,6 @@ final public class DotData implements PortionShower {
this.topParent = Objects.requireNonNull(topParent);
this.dotMode = dotMode;
this.isHideEmptyDescriptionForState = isHideEmptyDescriptionForState;
this.colorMapper = colorMapper;
this.links = links;
this.leafs = leafs;
this.umlDiagramType = umlDiagramType;
@ -100,13 +97,13 @@ final public class DotData implements PortionShower {
}
public DotData(IGroup topParent, List<Link> links, Collection<ILeaf> leafs, UmlDiagramType umlDiagramType,
ISkinParam skinParam, GroupHierarchy groupHierarchy, ColorMapper colorMapper, EntityFactory entityFactory,
ISkinParam skinParam, GroupHierarchy groupHierarchy, EntityFactory entityFactory,
boolean isHideEmptyDescriptionForState, DotMode dotMode, String namespaceSeparator, Pragma pragma) {
this(topParent, links, leafs, umlDiagramType, skinParam, groupHierarchy, new PortionShower() {
public boolean showPortion(EntityPortion portion, IEntity entity) {
return true;
}
}, colorMapper, entityFactory, isHideEmptyDescriptionForState, dotMode, namespaceSeparator, pragma);
}, entityFactory, isHideEmptyDescriptionForState, dotMode, namespaceSeparator, pragma);
}
public UmlDiagramType getUmlDiagramType() {
@ -141,10 +138,6 @@ final public class DotData implements PortionShower {
return portionShower.showPortion(portion, entity);
}
public final ColorMapper getColorMapper() {
return colorMapper;
}
public IGroup getRootGroup() {
return entityFactory.getRootGroup();
}

View File

@ -84,9 +84,7 @@ import net.sourceforge.plantuml.graphic.USymbols;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.Kal;
import net.sourceforge.plantuml.svek.Margins;

View File

@ -35,9 +35,9 @@
*/
package net.sourceforge.plantuml.descdiagram;
import java.util.Map;
import java.util.Objects;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
@ -51,7 +51,7 @@ import net.sourceforge.plantuml.graphic.USymbols;
public class DescriptionDiagram extends AbstractEntityDiagram {
public DescriptionDiagram(UmlSource source, ISkinSimple skinParam) {
public DescriptionDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.DESCRIPTION, skinParam);
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.descdiagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator;
import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore;
@ -69,7 +69,7 @@ import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap;
public class DescriptionDiagramFactory extends PSystemCommandFactory {
@Override
public DescriptionDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public DescriptionDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new DescriptionDiagram(source, skinParam);
}

View File

@ -64,7 +64,7 @@ public class CommandNewpage extends SingleLineCommand2<UmlDiagram> {
protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
final int dpi = diagram.getSkinParam().getDpi();
final UmlDiagram emptyDiagram = (UmlDiagram) factory.createEmptyDiagram(diagram.getSource(),
diagram.getSkinParam());
diagram.getSkinParam().values());
if (dpi != 96)
emptyDiagram.setParam("dpi", "" + dpi);

View File

@ -35,7 +35,8 @@
*/
package net.sourceforge.plantuml.eggs;
import net.sourceforge.plantuml.ISkinSimple;
import java.util.Map;
import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
@ -45,7 +46,7 @@ import net.sourceforge.plantuml.graphic.GraphicPosition;
public class PSystemWelcomeFactory implements PSystemFactory {
@Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
if (source.getTotalLineCount() == 2)
return new PSystemWelcome(source, GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT);

View File

@ -62,10 +62,11 @@ public class SpriteSvgNanoParser implements Sprite {
this.img = new UImage(new PixelImage(Objects.requireNonNull(img), AffineTransformType.TYPE_BILINEAR));
}
public TextBlock asTextBlock(final HColor color, final double scale, final ColorMapper colorMapper) {
public TextBlock asTextBlock(final HColor color, final double scale) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
final ColorMapper colorMapper = ug.getColorMapper();
if (colorMapper == ColorMapper.MONOCHROME) {
ug.draw(img.monochrome().scale(scale));
} else if (color == null)

View File

@ -337,7 +337,7 @@ public class SvgNanoParser implements Sprite {
}
@Override
public TextBlock asTextBlock(final HColor color, final double scale, final ColorMapper colorMapper) {
public TextBlock asTextBlock(final HColor color, final double scale) {
final UImageSvg data = new UImageSvg(svgStart, scale);
final double width = data.getWidth();

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.flowdiagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType;
@ -51,7 +51,7 @@ public class FlowDiagramFactory extends PSystemCommandFactory {
}
@Override
public FlowDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public FlowDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new FlowDiagram(source);
}

View File

@ -67,9 +67,9 @@ public class FtpConnexion {
}
public synchronized void addIncoming(String fileName, String data) {
if (fileName.startsWith("/")) {
if (fileName.startsWith("/"))
throw new IllegalArgumentException();
}
incoming.put(fileName, data);
}
@ -86,81 +86,74 @@ public class FtpConnexion {
}
public synchronized boolean willExist(String fileName) {
if (incoming.containsKey(fileName)) {
if (incoming.containsKey(fileName))
return true;
}
if (outgoing.containsKey(fileName)) {
if (outgoing.containsKey(fileName))
return true;
}
if (futureOutgoing.contains(fileName)) {
if (futureOutgoing.contains(fileName))
return true;
}
return false;
}
public synchronized boolean doesExist(String fileName) {
if (incoming.containsKey(fileName)) {
if (incoming.containsKey(fileName))
return true;
}
if (outgoing.containsKey(fileName)) {
if (outgoing.containsKey(fileName))
return true;
}
return false;
}
public synchronized byte[] getData(String fileName) throws InterruptedException {
if (fileName.startsWith("/")) {
if (fileName.startsWith("/"))
throw new IllegalArgumentException();
}
final String data = incoming.get(fileName);
if (data != null) {
if (data != null)
return data.getBytes();
}
// do {
// if (willExist(fileName) == false) {
// return null;
// }
final byte data2[] = outgoing.get(fileName);
if (data2 == null) {
if (data2 == null)
return new byte[1];
}
// if (data2 != null) {
return data2;
// }
// Thread.sleep(200L);
// } while (true);
}
public synchronized int getSize(String fileName) {
if (fileName.startsWith("/")) {
if (fileName.startsWith("/"))
throw new IllegalArgumentException();
}
final String data = incoming.get(fileName);
if (data != null) {
if (data != null)
return data.length();
}
final byte data2[] = outgoing.get(fileName);
if (data2 != null) {
if (data2 != null)
return data2.length;
}
return 0;
}
public void processImage(String fileName) throws IOException {
if (fileName.startsWith("/")) {
if (fileName.startsWith("/"))
throw new IllegalArgumentException();
}
final String pngFileName = getFutureFileName(fileName);
boolean done = false;
try {
final SourceStringReader sourceStringReader = new SourceStringReader(incoming.get(fileName));
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final FileFormat format = getFileFormat();
final DiagramDescription desc = sourceStringReader.generateDiagramDescription(new FileFormatOption(format));
final FileFormatOption fileFormatOption = new FileFormatOption(format);
final DiagramDescription desc = sourceStringReader.generateDiagramDescription(fileFormatOption);
final List<BlockUml> blocks = sourceStringReader.getBlocks();
if (blocks.size() > 0) {
blocks.get(0).getDiagram().exportDiagram(baos, 0, new FileFormatOption(format));
}
if (blocks.size() > 0)
blocks.get(0).getDiagram().exportDiagram(baos, 0, fileFormatOption);
final String errorFileName = pngFileName.substring(0, pngFileName.length() - 4) + ".err";
synchronized (this) {
outgoing.remove(pngFileName);
@ -178,9 +171,9 @@ public class FtpConnexion {
}
}
} finally {
if (done == false) {
if (done == false)
outgoing.put(pngFileName, new byte[0]);
}
}
}

View File

@ -36,8 +36,8 @@
package net.sourceforge.plantuml.gitlog;
import java.util.Iterator;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram;
@ -51,7 +51,7 @@ public class GitDiagramFactory extends PSystemAbstractFactory {
}
@Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
final GitTextArea textArea = new GitTextArea();
final Iterator<StringLocated> it = source.iterator2();

View File

@ -74,7 +74,7 @@ class SingleLine extends AbstractTextBlock implements Line {
final Sprite sprite = spriteContainer.getSprite(((SpriteCommand) cmd).getSprite());
if (sprite != null)
result.blocs
.add(sprite.asTextBlock(fontConfiguration.getColor(), 1, spriteContainer.getColorMapper()));
.add(sprite.asTextBlock(fontConfiguration.getColor(), 1));
} else if (cmd instanceof FontChange) {
fontConfiguration = ((FontChange) cmd).apply(fontConfiguration);

View File

@ -38,8 +38,8 @@ package net.sourceforge.plantuml.hcl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram;
@ -57,7 +57,7 @@ public class HclDiagramFactory extends PSystemAbstractFactory {
}
@Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
final List<String> highlighted = new ArrayList<>();
JsonValue data = null;
StyleExtractor styleExtractor = null;

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.help;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.UmlSource;
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.core.UmlSource;
public class HelpFactory extends PSystemCommandFactory {
@Override
public Help createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public Help createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new Help(source);
}

View File

@ -38,9 +38,9 @@ package net.sourceforge.plantuml.jsondiagram;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram;
@ -57,7 +57,7 @@ public class JsonDiagramFactory extends PSystemAbstractFactory {
}
@Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
final List<String> highlighted = new ArrayList<>();
StyleExtractor styleExtractor = null;
JsonValue json;

View File

@ -41,6 +41,8 @@ import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.api.mda.option2.MDADiagram;
import net.sourceforge.plantuml.api.mda.option2.MDAPackage;

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.mindmap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandRankDir;
import net.sourceforge.plantuml.command.CommonCommands;
@ -69,7 +69,7 @@ public class MindMapDiagramFactory extends PSystemCommandFactory {
}
@Override
public MindMapDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public MindMapDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new MindMapDiagram(source);
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.nwdiag;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.CommonCommands;
@ -53,7 +53,7 @@ public class NwDiagramFactory extends PSystemCommandFactory {
}
@Override
public NwDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public NwDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new NwDiagram(source);
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.objectdiagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -59,7 +59,7 @@ import net.sourceforge.plantuml.cucadiagram.NoteLinkStrategy;
public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram {
public AbstractClassOrObjectDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) {
public AbstractClassOrObjectDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig);
}

View File

@ -223,9 +223,9 @@ public class PicoWebServer implements Runnable {
final String source = transcoder.decode(compressed);
final SourceStringReader ssr = new SourceStringReader(source);
final FileFormatOption fileFormatOption = new FileFormatOption(format);
final List<BlockUml> blocks = ssr.getBlocks();
if (blocks.size() > 0) {
final FileFormatOption fileFormatOption = new FileFormatOption(format);
final Diagram system = blocks.get(0).getDiagram();
final ByteArrayOutputStream os = new ByteArrayOutputStream();
final ImageData imageData = system.exportDiagram(os, 0, fileFormatOption);

View File

@ -39,8 +39,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandNope;
import net.sourceforge.plantuml.command.CommonCommands;
@ -165,7 +165,7 @@ public class GanttDiagramFactory extends PSystemCommandFactory {
}
@Override
public GanttDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public GanttDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new GanttDiagram(source);
}

View File

@ -47,7 +47,6 @@ import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.salt.element.Element;
import net.sourceforge.plantuml.salt.element.WrappedElement;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
public class Dictionary implements SpriteContainer, ISkinSimple {
@ -106,11 +105,7 @@ public class Dictionary implements SpriteContainer, ISkinSimple {
return LineBreakStrategy.NONE;
}
public ColorMapper getColorMapper() {
return ColorMapper.IDENTITY;
}
public void copyAllFrom(ISkinSimple other) {
public void copyAllFrom(Map<String, String> other) {
throw new UnsupportedOperationException();
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.salt;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -66,7 +66,7 @@ public class PSystemSaltFactory2 extends PSystemCommandFactory {
}
@Override
public PSystemSalt createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public PSystemSalt createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
final PSystemSalt result = new PSystemSalt(source);
if (getDiagramType() == DiagramType.SALT) {
result.setIamSalt(true);

View File

@ -51,7 +51,6 @@ import java.util.Stack;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
@ -94,7 +93,7 @@ public class SequenceDiagram extends UmlDiagram {
private final Rose skin2 = new Rose();
public SequenceDiagram(UmlSource source, ISkinSimple skinParam) {
public SequenceDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.SEQUENCE, skinParam);
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.sequencediagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -84,7 +84,7 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandUrl;
public class SequenceDiagramFactory extends PSystemCommandFactory {
@Override
public SequenceDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public SequenceDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new SequenceDiagram(source, skinParam);
}

View File

@ -37,9 +37,9 @@ package net.sourceforge.plantuml.sprite;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
@ -61,7 +61,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColors;
public class ListSpriteDiagram extends UmlDiagram {
public ListSpriteDiagram(UmlSource source, ISkinSimple skinParam) {
public ListSpriteDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.HELP, skinParam);
}
@ -92,7 +92,7 @@ public class ListSpriteDiagram extends UmlDiagram {
final Sprite sprite = getSkinParam().getSprite(n);
TextBlock blockName = Display.create(n).create(FontConfiguration.blackBlueTrue(UFont.sansSerif(14)),
HorizontalAlignment.LEFT, getSkinParam());
TextBlock tb = sprite.asTextBlock(HColors.BLACK, 1.0, getSkinParam().getColorMapper());
TextBlock tb = sprite.asTextBlock(HColors.BLACK, 1.0);
tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER);
tb.drawU(ug.apply(new UTranslate(x, y)));
final XDimension2D dim = tb.calculateDimension(ug.getStringBounder());

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.sprite;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -57,7 +57,7 @@ public class ListSpriteDiagramFactory extends PSystemCommandFactory {
}
@Override
public ListSpriteDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public ListSpriteDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new ListSpriteDiagram(source, skinParam);
}

View File

@ -36,11 +36,10 @@
package net.sourceforge.plantuml.sprite;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public interface Sprite {
public TextBlock asTextBlock(final HColor color, double scale, ColorMapper colorMapper);
public TextBlock asTextBlock(final HColor color, double scale);
}

View File

@ -123,7 +123,7 @@ public class SpriteColor implements Sprite {
return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR));
}
public TextBlock asTextBlock(final HColor color, final double scale, ColorMapper colorMapper) {
public TextBlock asTextBlock(final HColor color, final double scale) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {

View File

@ -61,10 +61,11 @@ public class SpriteImage implements Sprite {
this.img = new UImage(new PixelImage(Objects.requireNonNull(img), AffineTransformType.TYPE_BILINEAR));
}
public TextBlock asTextBlock(final HColor color, final double scale, final ColorMapper colorMapper) {
public TextBlock asTextBlock(final HColor color, final double scale) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
final ColorMapper colorMapper = ug.getColorMapper();
if (colorMapper == ColorMapper.MONOCHROME)
ug.draw(img.monochrome().scale(scale));
else if (color == null)

View File

@ -211,7 +211,7 @@ public class SpriteMonochrome implements Sprite {
return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR));
}
public TextBlock asTextBlock(final HColor color, final double scale, ColorMapper colorMapper) {
public TextBlock asTextBlock(final HColor color, final double scale) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {

View File

@ -41,7 +41,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UImageSvg;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class SpriteSvg implements Sprite {
@ -52,7 +51,7 @@ public class SpriteSvg implements Sprite {
this.svg = svg;
}
public TextBlock asTextBlock(final HColor color, final double scale, ColorMapper colorMapper) {
public TextBlock asTextBlock(final HColor color, final double scale) {
final UImageSvg img = new UImageSvg(svg, scale);
return new AbstractTextBlock() {

View File

@ -38,9 +38,9 @@ package net.sourceforge.plantuml.sprite;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.WithSprite;
@ -73,7 +73,7 @@ public class StdlibDiagram extends UmlDiagram {
private static final int WIDTH = 1800;
private String name;
public StdlibDiagram(UmlSource source, ISkinSimple skinParam) {
public StdlibDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.HELP, skinParam);
}
@ -142,7 +142,7 @@ public class StdlibDiagram extends UmlDiagram {
final Sprite sprite = getSkinParam().getSprite(n);
TextBlock blockName = Display.create(n).create(FontConfiguration.blackBlueTrue(UFont.sansSerif(14)),
HorizontalAlignment.LEFT, getSkinParam());
TextBlock tb = sprite.asTextBlock(getBlack(), 1.0, getSkinParam().getColorMapper());
TextBlock tb = sprite.asTextBlock(getBlack(), 1.0);
tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER);
tb.drawU(ug.apply(new UTranslate(x, y)));
final XDimension2D dim = tb.calculateDimension(ug.getStringBounder());

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.sprite;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.UmlSource;
@ -54,7 +54,7 @@ public class StdlibDiagramFactory extends PSystemCommandFactory {
}
@Override
public StdlibDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public StdlibDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new StdlibDiagram(source, skinParam);
}

View File

@ -35,9 +35,9 @@
*/
package net.sourceforge.plantuml.statediagram;
import java.util.Map;
import java.util.Objects;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.core.UmlSource;
@ -58,7 +58,7 @@ public class StateDiagram extends AbstractEntityDiagram {
private static final String CONCURRENT_PREFIX = "CONC";
public StateDiagram(UmlSource source, ISkinSimple skinParam) {
public StateDiagram(UmlSource source, Map<String, String> skinParam) {
super(source, UmlDiagramType.STATE, skinParam);
// setNamespaceSeparator(null);
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.statediagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator;
import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore;
@ -66,7 +66,7 @@ import net.sourceforge.plantuml.statediagram.command.CommandLinkStateReverse;
public class StateDiagramFactory extends PSystemCommandFactory {
@Override
public StateDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public StateDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new StateDiagram(source, skinParam);
}

View File

@ -55,7 +55,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.USymbols;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic;

View File

@ -75,7 +75,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
private GeneralImageBuilder createDotDataImageBuilder(DotMode dotMode, StringBounder stringBounder) {
final DotData dotData = new DotData(diagram.getEntityFactory().getRootGroup(), getOrderedLinks(),
diagram.getLeafsvalues(), diagram.getUmlDiagramType(), diagram.getSkinParam(), diagram, diagram,
diagram.getColorMapper(), diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(), dotMode,
diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(), dotMode,
diagram.getNamespaceSeparator(), diagram.getPragma());
final boolean intricated = diagram.mergeIntricated();
return new GeneralImageBuilder(intricated, dotData, diagram.getEntityFactory(), diagram.getSource(),

View File

@ -63,7 +63,6 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersions;
import net.sourceforge.plantuml.cucadiagram.dot.ProcessState;
import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.posimo.Moveable;
import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.vizjs.GraphvizJs;

View File

@ -127,8 +127,8 @@ public final class GroupPngMakerActivity {
final ISkinParam skinParam = diagram.getSkinParam();
final DotData dotData = new DotData(group, links, group.getLeafsDirect(), diagram.getUmlDiagramType(),
skinParam, new InnerGroupHierarchy(), diagram.getColorMapper(), diagram.getEntityFactory(), false,
DotMode.NORMAL, diagram.getNamespaceSeparator(), diagram.getPragma());
skinParam, new InnerGroupHierarchy(), diagram.getEntityFactory(), false, DotMode.NORMAL,
diagram.getNamespaceSeparator(), diagram.getPragma());
final GeneralImageBuilder svek2 = new GeneralImageBuilder(false, dotData, diagram.getEntityFactory(),
diagram.getSource(), diagram.getPragma(), stringBounder, SName.activityDiagram);

View File

@ -123,7 +123,8 @@ public final class GroupPngMakerState {
final ISkinParam skinParam = diagram.getSkinParam();
final Style style = EntityImageStateCommon.getStyleState(group, skinParam);
// final Style styleHeader = EntityImageStateCommon.getStyleStateHeader(group, skinParam);
// final Style styleHeader = EntityImageStateCommon.getStyleStateHeader(group,
// skinParam);
final Style styleTitle = EntityImageStateCommon.getStyleStateTitle(group, skinParam);
final Style styleBody = EntityImageStateCommon.getStyleStateBody(group, skinParam);
@ -139,7 +140,7 @@ public final class GroupPngMakerState {
final List<Link> links = getPureInnerLinks();
final DotData dotData = new DotData(group, links, group.getLeafsDirect(), diagram.getUmlDiagramType(),
skinParam, new InnerGroupHierarchy(), diagram.getColorMapper(), diagram.getEntityFactory(),
skinParam, new InnerGroupHierarchy(), diagram.getEntityFactory(),
diagram.isHideEmptyDescriptionForState(), DotMode.NORMAL, diagram.getNamespaceSeparator(),
diagram.getPragma());

View File

@ -59,7 +59,6 @@ import net.sourceforge.plantuml.graphic.color.Colors;
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.style.StyleSignatureBasic;
import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ClusterDecoration;

View File

@ -53,7 +53,6 @@ import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public abstract class EntityImageStateCommon extends AbstractEntityImage {

View File

@ -41,6 +41,8 @@ import java.util.List;
import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.LineLocationImpl;
import net.sourceforge.plantuml.OptionFlags;
@ -78,7 +80,7 @@ public class SyntaxChecker {
return result;
}
final SourceStringReader sourceStringReader = new SourceStringReader(Defines.createEmpty(), source,
Collections.<String> emptyList());
Collections.<String>emptyList());
final List<BlockUml> blocks = sourceStringReader.getBlocks();
if (blocks.size() == 0) {
@ -97,9 +99,9 @@ public class SyntaxChecker {
final PSystemError sys = (PSystemError) system;
result.setLineLocation(sys.getLineLocation());
result.setSystemError(sys);
for (ErrorUml er : sys.getErrorsUml()) {
for (ErrorUml er : sys.getErrorsUml())
result.addErrorText(er.getError());
}
} else {
result.setDescription(system.getDescription().getDescription());
}
@ -109,7 +111,7 @@ public class SyntaxChecker {
public static SyntaxResult checkSyntaxFair(String source) {
final SyntaxResult result = new SyntaxResult();
final SourceStringReader sourceStringReader = new SourceStringReader(Defines.createEmpty(), source,
Collections.<String> emptyList());
Collections.<String>emptyList());
final List<BlockUml> blocks = sourceStringReader.getBlocks();
if (blocks.size() == 0) {

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.timingdiagram;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.CommonCommands;
@ -69,7 +69,7 @@ import net.sourceforge.plantuml.timingdiagram.command.CommandUseDateFormat;
public class TimingDiagramFactory extends PSystemCommandFactory {
@Override
public TimingDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public TimingDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new TimingDiagram(source);
}

View File

@ -109,7 +109,7 @@ public class ImageBuilder {
private Animation animation;
private boolean annotations;
private HColor backcolor = getDefaultHBackColor();
private ColorMapper colorMapper;
// private ColorMapper colorMapper;
private XDimension2D dimension;
private final FileFormatOption fileFormatOption;
private UDrawable udrawable;
@ -138,9 +138,6 @@ public class ImageBuilder {
private ImageBuilder(FileFormatOption fileFormatOption) {
this.fileFormatOption = fileFormatOption;
this.stringBounder = fileFormatOption.getDefaultStringBounder(SvgCharSizeHack.NO_HACK);
this.colorMapper = fileFormatOption.getColorMapper();
if (this.colorMapper == null)
throw new IllegalArgumentException();
}
public ImageBuilder annotations(boolean annotations) {
@ -220,7 +217,6 @@ public class ImageBuilder {
animation = diagram.getAnimation();
annotations = true;
backcolor = diagram.calculateBackColor();
colorMapper = skinParam.getColorMapper();
margin = calculateMargin(diagram);
metadata = fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null;
seed = diagram.seed();
@ -243,7 +239,7 @@ public class ImageBuilder {
case ANIMATED_GIF:
return writeImageAnimatedGif(os);
default:
return writeImageInternal(fileFormatOption, os, animation);
return writeImageInternal(os, animation);
}
}
@ -254,8 +250,7 @@ public class ImageBuilder {
}
}
private ImageData writeImageInternal(FileFormatOption fileFormatOption, OutputStream os, Animation animationArg)
throws IOException {
private ImageData writeImageInternal(OutputStream os, Animation animationArg) throws IOException {
XDimension2D dim = getFinalDimension();
double dx = 0;
double dy = 0;
@ -272,7 +267,7 @@ public class ImageBuilder {
if (scaleFactor <= 0)
throw new IllegalStateException("Bad scaleFactor");
UGraphic ug = createUGraphic(fileFormatOption, dim, animationArg, dx, dy, scaleFactor,
UGraphic ug = createUGraphic(dim, animationArg, dx, dy, scaleFactor,
titledDiagram == null ? new Pragma() : titledDiagram.getPragma());
maybeDrawBorder(ug, dim);
if (randomPixel)
@ -396,16 +391,17 @@ public class ImageBuilder {
private Image getAviImage(AffineTransformation affineTransform) throws IOException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
writeImageInternal(new FileFormatOption(FileFormat.PNG), baos, Animation.singleton(affineTransform));
writeImageInternal(baos, Animation.singleton(affineTransform));
baos.close();
return SImageIO.read(baos.toByteArray());
}
private UGraphic createUGraphic(FileFormatOption option, final XDimension2D dim, Animation animationArg, double dx,
double dy, double scaleFactor, Pragma pragma) {
switch (option.getFileFormat()) {
private UGraphic createUGraphic(final XDimension2D dim, Animation animationArg, double dx, double dy,
double scaleFactor, Pragma pragma) {
final ColorMapper colorMapper = fileFormatOption.getColorMapper();
switch (fileFormatOption.getFileFormat()) {
case PNG:
return createUGraphicPNG(scaleFactor, dim, animationArg, dx, dy, option.getWatermark());
return createUGraphicPNG(scaleFactor, dim, animationArg, dx, dy, fileFormatOption.getWatermark());
case SVG:
final boolean interactive = "true".equalsIgnoreCase(pragma.getValue("svginteractive"));
return createUGraphicSVG(scaleFactor, dim, interactive);
@ -430,7 +426,7 @@ public class ImageBuilder {
return new UGraphicDebug(scaleFactor, dim, getSvgLinkTarget(), getHoverPathColorRGB(), seed,
getPreserveAspectRatio());
default:
throw new UnsupportedOperationException(option.getFileFormat().toString());
throw new UnsupportedOperationException(fileFormatOption.getFileFormat().toString());
}
}
@ -440,8 +436,9 @@ public class ImageBuilder {
final String preserveAspectRatio = getPreserveAspectRatio();
final boolean svgDimensionStyle = skinParam == null || skinParam.svgDimensionStyle();
final String svgLinkTarget = getSvgLinkTarget();
final UGraphicSvg ug = new UGraphicSvg(backcolor, svgDimensionStyle, dim, colorMapper, false, scaleFactor,
svgLinkTarget, hoverPathColorRGB, seed, preserveAspectRatio, stringBounder, lengthAdjust, interactive);
final UGraphicSvg ug = new UGraphicSvg(backcolor, svgDimensionStyle, dim, fileFormatOption.getColorMapper(),
false, scaleFactor, svgLinkTarget, hoverPathColorRGB, seed, preserveAspectRatio, stringBounder,
lengthAdjust, interactive);
return ug;
}
@ -451,7 +448,7 @@ public class ImageBuilder {
Color pngBackColor = new Color(0, 0, 0, 0);
if (this.backcolor instanceof HColorSimple)
pngBackColor = this.backcolor.toColor(colorMapper);
pngBackColor = this.backcolor.toColor(fileFormatOption.getColorMapper());
if (OptionFlags.getInstance().isReplaceWhiteBackgroundByTransparent() && Color.WHITE.equals(pngBackColor))
pngBackColor = new Color(0, 0, 0, 0);
@ -460,8 +457,8 @@ public class ImageBuilder {
(int) (dim.getHeight() * scaleFactor), pngBackColor, stringBounder);
final Graphics2D graphics2D = builder.getGraphics2D();
final UGraphicG2d ug = new UGraphicG2d(backcolor, colorMapper, stringBounder, graphics2D, scaleFactor,
affineTransforms == null ? null : affineTransforms.getFirst(), dx, dy);
final UGraphicG2d ug = new UGraphicG2d(backcolor, fileFormatOption.getColorMapper(), stringBounder, graphics2D,
scaleFactor, affineTransforms == null ? null : affineTransforms.getFirst(), dx, dy);
ug.setBufferedImage(builder.getBufferedImage());
final BufferedImage im = ug.getBufferedImage();
if (this.backcolor instanceof HColorGradient)
@ -481,7 +478,7 @@ public class ImageBuilder {
} else if (skinParam != null) {
final HColor color = skinParam.hoverPathColor();
if (color != null)
return color.toRGB(colorMapper);
return color.toRGB(fileFormatOption.getColorMapper());
}
return null;

View File

@ -34,8 +34,6 @@
*/
package net.sourceforge.plantuml.ugraphic.color;
import java.awt.Color;
class HColorScheme extends HColor {
private final HColor colorForLight;

View File

@ -81,7 +81,7 @@ public class Version {
}
public static int beta() {
final int beta = 8;
final int beta = 9;
return beta;
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.wbs;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -63,7 +63,7 @@ public class WBSDiagramFactory extends PSystemCommandFactory {
}
@Override
public WBSDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public WBSDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new WBSDiagram(source);
}

View File

@ -37,8 +37,8 @@ package net.sourceforge.plantuml.wire;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
@ -68,7 +68,7 @@ public class WireDiagramFactory extends PSystemCommandFactory {
}
@Override
public WireDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
public WireDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new WireDiagram(source);
}

View File

@ -38,8 +38,8 @@ package net.sourceforge.plantuml.yaml;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram;
@ -61,7 +61,7 @@ public class YamlDiagramFactory extends PSystemAbstractFactory {
}
@Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
public Diagram createSystem(UmlSource source, Map<String, String> skinParam) {
final List<String> highlighted = new ArrayList<>();
JsonValue yaml = null;
StyleExtractor styleExtractor = null;

View File

@ -53,7 +53,7 @@ class SkinParamTest {
assertThat(skinParam.colorArrowSeparationSpace()).isZero();
assertThat(skinParam.getColorMapper()).isEqualTo(ColorMapper.IDENTITY);
// assertThat(skinParam.getColorMapper()).isEqualTo(ColorMapper.IDENTITY);
assertThat(skinParam.componentStyle()).isEqualTo(ComponentStyle.UML2);