Skip to content

Commit 852dddb

Browse files
committed
add logo
Signed-off-by: Stefan Niederhauser <ghuder5@gmx.ch>
1 parent 9637513 commit 852dddb

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright © 2015 Stefan Niederhauser (nidin@gmx.ch)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package guru.nidi.graphviz;
17+
18+
import guru.nidi.graphviz.attribute.*;
19+
import guru.nidi.graphviz.engine.Format;
20+
import guru.nidi.graphviz.engine.Graphviz;
21+
import guru.nidi.graphviz.model.Graph;
22+
import guru.nidi.graphviz.model.Node;
23+
24+
import java.io.File;
25+
import java.io.IOException;
26+
27+
import static guru.nidi.graphviz.attribute.Color.GREY80;
28+
import static guru.nidi.graphviz.attribute.Color.WHITE;
29+
import static guru.nidi.graphviz.attribute.GraphAttr.pad;
30+
import static guru.nidi.graphviz.attribute.Rank.RankDir.LEFT_TO_RIGHT;
31+
import static guru.nidi.graphviz.model.Factory.graph;
32+
import static guru.nidi.graphviz.model.Factory.node;
33+
34+
class LogoCreator {
35+
public static void main(String[] args) throws IOException {
36+
final Image duke = Image.of("graphviz-java/src/test/resources/duke.png");
37+
final Size size = Size.mode(Size.Mode.FIXED).size(30, 20);
38+
final Node d = node("b").with(Label.of(""), duke, size);
39+
final Node c = node("\n\n\nJava").with(duke, size).link(d);
40+
final Node b = node("\n\n\nGraphviz").with(duke, size).link(d);
41+
final Node a = node("a").with(Label.of(""), duke, size).link(b, c);
42+
final Style<ForAll> lineWidth = Style.lineWidth(10);
43+
final Graph g = graph()
44+
.graphAttr().with(GREY80.gradient(WHITE).background().angle(90), Rank.dir(LEFT_TO_RIGHT), pad(5, 5))
45+
.linkAttr().with(lineWidth)
46+
.nodeAttr().with(lineWidth, Style.FILLED, Color.WHITE.fill(), Font.size(140))
47+
.with(a);
48+
Graphviz.fromGraph(g).width(1280).height(640).render(Format.PNG).toFile(new File("logo"));
49+
}
50+
}
73.3 KB
Loading

logo.png

49.5 KB
Loading

0 commit comments

Comments
 (0)