1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

Merge pull request #987 from soloturn/small-improvements

Small improvements
This commit is contained in:
PlantUML 2022-04-11 10:12:12 +02:00 committed by GitHub
commit 90fe34915f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 31 deletions

View File

@ -5,12 +5,12 @@
* (C) Copyright 2009-2023, 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
@ -30,7 +30,7 @@
*
*
* Original Author: Arnaud Roques
*
*
*
*/
package net.sourceforge.plantuml.dedication;
@ -50,7 +50,6 @@ import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.security.SImageIO;
import net.sourceforge.plantuml.ugraphic.AffineTransformType;
import net.sourceforge.plantuml.ugraphic.PixelImage;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UImage;
public class PSystemDedication extends PlainDiagram {
@ -64,17 +63,13 @@ public class PSystemDedication extends PlainDiagram {
@Override
protected UDrawable getRootDrawable(FileFormatOption fileFormatOption) {
return new UDrawable() {
public void drawU(UGraphic ug) {
ug.draw(new UImage(new PixelImage(img, AffineTransformType.TYPE_BILINEAR)));
}
};
return ug -> ug.draw(new UImage(new PixelImage(img, AffineTransformType.TYPE_BILINEAR)));
}
public static BufferedImage getBufferedImage(InputStream is) {
try {
final Class<?> clVP8Decoder = Class.forName("net.sourceforge.plantuml.webp.VP8Decoder");
final Object vp8Decoder = clVP8Decoder.newInstance();
final Object vp8Decoder = clVP8Decoder.getDeclaredConstructor().newInstance();
// final VP8Decoder vp8Decoder = new VP8Decoder();
final Method decodeFrame = clVP8Decoder.getMethod("decodeFrame", ImageInputStream.class);
final ImageInputStream iis = SImageIO.createImageInputStream(is);

View File

@ -5,12 +5,12 @@
* (C) Copyright 2009-2023, 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
@ -30,15 +30,13 @@
*
*
* Original Author: Arnaud Roques
*
*
*
*/
package net.sourceforge.plantuml.dedication;
import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.UnsupportedEncodingException;
public final class TinyHashableString {
private final String sentence;
@ -48,11 +46,11 @@ public final class TinyHashableString {
this.sentence = sentence;
}
public final String getSentence() {
public String getSentence() {
return sentence;
}
public final synchronized int tinyHash() throws UnsupportedEncodingException {
public synchronized int tinyHash() {
if (cachedTinyHash == -1) {
cachedTinyHash = Noise.shortHash(sentence.getBytes(UTF_8), Dedication.N.toByteArray());
}

View File

@ -5,12 +5,12 @@
* (C) Copyright 2009-2023, 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
@ -30,7 +30,7 @@
*
*
* Original Author: Arnaud Roques
*
*
*
*/
package net.sourceforge.plantuml.eggs;
@ -85,7 +85,7 @@ public class PSystemWelcome extends PlainDiagram {
return getGraphicStrings();
}
public TextBlockBackcolored getGraphicStrings() throws IOException {
public TextBlockBackcolored getGraphicStrings() {
if (position != null) {
return GraphicStrings.createBlackOnWhite(strings, PSystemVersion.getPlantumlImage(), position);
}

View File

@ -5,12 +5,12 @@
* (C) Copyright 2009-2023, 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
@ -30,20 +30,18 @@
*
*
* Original Author: Arnaud Roques
*
*
*
*/
package net.sourceforge.plantuml.eggs;
import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.UnsupportedEncodingException;
public class SentenceProducer {
private final String secret;
public SentenceProducer(String sentence1, String sentence2) throws UnsupportedEncodingException {
public SentenceProducer(String sentence1, String sentence2) {
final byte[] key = EggUtils.fromSecretSentence(sentence1).toByteArray();
final byte[] sen2 = sentence2.getBytes(UTF_8);
final byte[] crypted = EggUtils.xor(sen2, key);