summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Peter Christen <mc@yacy.net>2025-09-21 20:30:22 +0200
committerMichael Peter Christen <mc@yacy.net>2025-09-21 20:30:22 +0200
commit6575e97bc36da3c04558319f9a4ee2e74c69a683 (patch)
tree2e6725179e2c241a337c1ceecf3bf7a945e716e8
parentb16cc99d121c2dd7f351d158c36ed64246e066fe (diff)
introduced 7 pixel font
-rw-r--r--source/net/yacy/visualization/FontGenerator5Pixel.java6
-rw-r--r--source/net/yacy/visualization/FontGenerator7Pixel.java859
-rw-r--r--source/net/yacy/visualization/FontGenerator8Pixel.java892
-rw-r--r--source/net/yacy/visualization/PrintTool.java198
4 files changed, 1020 insertions, 935 deletions
diff --git a/source/net/yacy/visualization/FontGenerator5Pixel.java b/source/net/yacy/visualization/FontGenerator5Pixel.java
index 7d89cccbd..5e43d8035 100644
--- a/source/net/yacy/visualization/FontGenerator5Pixel.java
+++ b/source/net/yacy/visualization/FontGenerator5Pixel.java
@@ -531,9 +531,9 @@ public class FontGenerator5Pixel {
for (int i = 0; i < font.length; i++) {
letter = font[i];
b = 0;
- for (int j = 0; j < 5; j++) {
- b = b << 10;
- v = 1 << 9;
+ for (int j = 0; j < 5; j++) { // 5 rows
+ b = b << 10; // 10 bits per row
+ v = 1 << 9; // value to set
for (int col = 0; col < 5; col++) {
if (letter[j].charAt(col) == '+') b += v;
if (letter[j].charAt(col) == 'X') b += v + (v / 2);
diff --git a/source/net/yacy/visualization/FontGenerator7Pixel.java b/source/net/yacy/visualization/FontGenerator7Pixel.java
new file mode 100644
index 000000000..c9fe4ef12
--- /dev/null
+++ b/source/net/yacy/visualization/FontGenerator7Pixel.java
@@ -0,0 +1,859 @@
+// FontGenerator8Pixel.java
+// ---------------------------
+// by Marc Nause
+// created: 05.04.2007
+//
+// $LastChangedDate$
+// $LastChangedRevision$
+// $LastChangedBy$
+//
+// based on:
+// FontGenerator5Pixle.java
+// ---------------------------
+// (C) by Michael Peter Christen; mc@yacy.net
+// first published on http://www.anomic.de
+// Frankfurt, Germany, 2005
+// created: 31.10.2005
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+package net.yacy.visualization;
+
+public class FontGenerator7Pixel {
+
+//A valid font has 96 characters:
+
+/*
+0x20: !"#$%&'
+0x28:()*+,-./
+0x30:01234567
+0x38:89:;<=>?
+0x40:@ABCDEFG
+0x48:HIJKLMNO
+0x50:PQRSTUVW
+0x58:XYZ[\]^_
+0x60:`abcdefg
+0x68:hijklmno
+0x70:pqrstuvw
+0x78:xyz{|}~
+*/
+
+//Each character has the same height of m lines with n pixels each.
+//While m does not need to equal n both have to stay consistend through
+//the whole font.
+
+ public static final String[][] font =
+ {
+ {".......", //0x20
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ "......."},
+ {"...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ ".......",
+ "...X...",
+ "......."},
+ {"..X.X..",
+ "..X.X..",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ "......."},
+ {"..X.X..",
+ "..X.X..",
+ "XXXXXXX",
+ "..X.X..",
+ "XXXXXXX",
+ "..X.X..",
+ "..X.X..",
+ "......."},
+ {"...XX..",
+ ".XXXXXX",
+ "X..XX..",
+ ".XXXXX.",
+ "...XX.X",
+ "XXXXXX.",
+ "...X...",
+ "......."},
+ {".XX...X",
+ ".XX..X.",
+ "....X..",
+ "...X...",
+ "..X....",
+ ".X...XX",
+ "X....XX",
+ "......."},
+ {".XX....",
+ "X..X...",
+ ".XX....",
+ "..X...X",
+ "X..X.X.",
+ "X...X..",
+ ".XXX..X",
+ "......."},
+ {"...X...",
+ "...X...",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ "......."},
+ {"....X..",
+ "...X...",
+ "..X....",
+ "..X....",
+ "..X....",
+ "...X...",
+ "....X..",
+ "......."},
+ {"...X...",
+ "....X..",
+ ".....X.",
+ ".....X.",
+ ".....X.",
+ "....X..",
+ "...X...",
+ "......."},
+ {"...X...",
+ ".X.X.X.",
+ "..XXX..",
+ "XXXXXXX",
+ "..XXX..",
+ ".X..X.X",
+ "...X...",
+ "......."},
+ {".......",
+ "...X...",
+ "...X...",
+ ".XXXXX.",
+ "...X...",
+ "...X...",
+ ".......",
+ "......."},
+ {".......",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ "...XX..",
+ "...XX..",
+ "....X.."},
+ {".......",
+ ".......",
+ ".......",
+ ".XXXXX.",
+ ".......",
+ ".......",
+ ".......",
+ "......."},
+ {".......",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ "...XX..",
+ "...XX..",
+ "......."},
+ {"......X",
+ ".....X.",
+ "....X..",
+ "...X...",
+ "..X....",
+ ".X.....",
+ "X......",
+ "......."},
+ {".XXXXX.",
+ "X....XX",
+ "X...X.X",
+ "X..X..X",
+ "X.X...X",
+ "XX....X",
+ ".XXXXX.",
+ "......."},
+ {"...X...",
+ "..XX...",
+ ".X.X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ ".XXXXX.",
+ "......."},
+ {"..XXX..",
+ ".X...X.",
+ ".....X.",
+ "....X..",
+ "...X...",
+ "..X....",
+ ".XXXXX.",
+ "......."},
+ {"..XXX..",
+ ".X...X.",
+ ".....X.",
+ "...XX..",
+ ".....X.",
+ ".X...X.",
+ "..XXX..",
+ "......."},
+ {".....X.",
+ "....XX.",
+ "...X.X.",
+ "..X..X.",
+ ".XXXXXX",
+ ".....X.",
+ ".....X.",
+ "......."},
+ {".XXXXXX",
+ ".X.....",
+ ".X.....",
+ ".XXXXX.",
+ "......X",
+ "......X",
+ ".XXXXX.",
+ "......."},
+ {"..XXX..",
+ ".X...X.",
+ ".X.....",
+ ".XXXX..",
+ ".X...X.",
+ ".X...X.",
+ "..XXX..",
+ "......."},
+ {".XXXXX.",
+ ".....X.",
+ ".....X.",
+ "....X..",
+ "...X...",
+ "...X...",
+ "...X...",
+ "......."},
+ {"..XXX..",
+ ".X...X.",
+ ".X...X.",
+ "..XXX..",
+ ".X...X.",
+ ".X...X.",
+ "..XXX..",
+ "......."},
+ {"..XXX..",
+ ".X...X.",
+ ".X...X.",
+ "..XXXX.",
+ ".....X.",
+ ".X...X.",
+ "..XXX..",
+ "......."},
+ {".......",
+ ".......",
+ "...XX..",
+ "...XX..",
+ ".......",
+ "...XX..",
+ "...XX..",
+ "......."},
+ {".......",
+ ".......",
+ "...XX..",
+ "...XX..",
+ ".......",
+ "...XX..",
+ "...XX..",
+ "....X.."},
+ {".....XX",
+ "...XX..",
+ ".XX....",
+ "X......",
+ ".XX....",
+ "...XX..",
+ ".....XX",
+ "......."},
+ {".......",
+ ".......",
+ "..XXXX.",
+ ".......",
+ "..XXXX.",
+ ".......",
+ ".......",
+ "......."},
+ {"XX.....",
+ "..XX...",
+ "....XX.",
+ "......X",
+ "....XX.",
+ "..XX...",
+ "XX.....",
+ "........"},
+ {"..XXX..",
+ ".X...X.",
+ ".....X.",
+ "....X..",
+ "...X...",
+ ".......",
+ "...X...",
+ "......."},
+ {".XXXXX.",
+ "X.....X",
+ "X...XXX",
+ "X..X..X",
+ "X...XXX",
+ "X......",
+ ".XXXXXX",
+ "......."},
+ {".XXXXX.",
+ "X.....X",
+ "X.....X",
+ "XXXXXXX",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "......."},
+ {"XXXXXX.",
+ "X.....X",
+ "X.....X",
+ "XXXXXX.",
+ "X.....X",
+ "X.....X",
+ "XXXXXX.",
+ "......."},
+ {"..XXXX.",
+ ".X....X",
+ "X......",
+ "X......",
+ "X......",
+ ".X....X",
+ "..XXXX.",
+ "......."},
+ {"XXXXX..",
+ "X....X.",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X....X.",
+ "XXXXX..",
+ "......."},
+ {"XXXXXXX",
+ "X......",
+ "X......",
+ "XXXXXX.",
+ "X......",
+ "X......",
+ "XXXXXXX",
+ "......."},
+ {"XXXXXXX",
+ "X......",
+ "X......",
+ "XXXXXX.",
+ "X......",
+ "X......",
+ "X......",
+ "......."},
+ {".XXXXX.",
+ "X......",
+ "X......",
+ "X..XXXX",
+ "X.....X",
+ "X.....X",
+ ".XXXXX.",
+ "......."},
+ {"X.....X",
+ "X.....X",
+ "X.....X",
+ "XXXXXXX",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "......."},
+ {"..XXX..",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "..XXX..",
+ "......."},
+ {"...XXX.",
+ "....X..",
+ "....X..",
+ "....X..",
+ "....X..",
+ "X...X..",
+ ".XXX...",
+ "......."},
+ {"X....XX",
+ "X...XX.",
+ "X..XX..",
+ "XXX....",
+ "X..XX..",
+ "X...XX.",
+ "X....XX",
+ "......."},
+ {"X......",
+ "X......",
+ "X......",
+ "X......",
+ "X......",
+ "X......",
+ "XXXXXXX",
+ "......."},
+ {"X.....X",
+ "XX...XX",
+ "X.X.X.X",
+ "X..X..X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "......."},
+ {"X.....X",
+ "XX....X",
+ "X.X...X",
+ "X..X..X",
+ "X...X.X",
+ "X....XX",
+ "X.....X",
+ "......."},
+ {".XXXXX.",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ ".XXXXX.",
+ "......."},
+ {"XXXXXX.",
+ "X.....X",
+ "X.....X",
+ "XXXXXX.",
+ "X......",
+ "X......",
+ "X......",
+ "......."},
+ {".XXXXX.",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X...X.X",
+ ".XXXXX.",
+ "......X"},
+ {"XXXXXX.",
+ "X.....X",
+ "X.....X",
+ "XXXXXX.",
+ "X...X..",
+ "X....X.",
+ "X.....X",
+ "......."},
+ {".XXXXX.",
+ "X.....X",
+ "X......",
+ ".XXXXX.",
+ "......X",
+ "X.....X",
+ ".XXXXX.",
+ "......."},
+ {"XXXXXXX",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "......."},
+ {"X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ ".XXXXX.",
+ "......."},
+ {"X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ ".X...X.",
+ "..X.X..",
+ "...X...",
+ "......."},
+ {"X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X..X..X",
+ "X.X.X.X",
+ ".X...X.",
+ "......."},
+ {"X.....X",
+ ".X...X.",
+ "..X.X..",
+ "...X...",
+ "..X.X..",
+ ".X...X.",
+ "X.....X",
+ "......."},
+ {"X.....X",
+ ".X...X.",
+ "..X.X..",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "......."},
+ {"XXXXXXX",
+ ".....X.",
+ "....X..",
+ "...X...",
+ "..X....",
+ ".X.....",
+ "XXXXXXX",
+ "......."},
+ {"..XXXX.",
+ "..X....",
+ "..X....",
+ "..X....",
+ "..X....",
+ "..X....",
+ "..XXXX.",
+ "......."},
+ {"X......",
+ ".X.....",
+ "..X....",
+ "...X...",
+ "....X..",
+ ".....X.",
+ "......X",
+ "......."},
+ {"..XXXX.",
+ ".....X.",
+ ".....X.",
+ ".....X.",
+ ".....X.",
+ ".....X.",
+ "..XXXX.",
+ "......."},
+ {"...X...",
+ "..X.X..",
+ ".X...X.",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ "......."},
+ {".......",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ "XXXXXXX",
+ "......."},
+ {"...X...",
+ "....X..",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ ".......",
+ "......."},
+ {".......",
+ ".......",
+ ".XXXX..",
+ ".....X.",
+ ".XXXXX.",
+ "X....X.",
+ ".XXXX.X",
+ "......."},
+ {"X......",
+ "X......",
+ "X......",
+ "XXXXXX.",
+ "X.....X",
+ "X.....X",
+ "XXXXXX.",
+ "......."},
+ {".......",
+ ".......",
+ ".XXXXXX",
+ "X......",
+ "X......",
+ "X......",
+ ".XXXXXX",
+ "......."},
+ {"......X",
+ "......X",
+ "......X",
+ ".XXXXXX",
+ "X.....X",
+ "X.....X",
+ ".XXXXXX",
+ "......."},
+ {".......",
+ ".......",
+ ".XXXXX.",
+ "X.....X",
+ "XXXXXXX",
+ "X......",
+ ".XXXXX.",
+ "......."},
+ {"...XX..",
+ "..X....",
+ "..X....",
+ ".XXX...",
+ "..X....",
+ "..X....",
+ "..X....",
+ "......."},
+ {".......",
+ ".......",
+ ".XXXXX.",
+ "X.....X",
+ "X.....X",
+ ".XXXXXX",
+ "......X",
+ ".XXXXX."},
+ {"X......",
+ "X......",
+ "X......",
+ "XXXXXX.",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "......."},
+ {".......",
+ "...X...",
+ ".......",
+ "..XX...",
+ "...X...",
+ "...X...",
+ "..XXX..",
+ "......."},
+ {".......",
+ "....X..",
+ ".......",
+ "...XX..",
+ "....X..",
+ "....X..",
+ "....X..",
+ "..XX..."},
+ {"X......",
+ "X......",
+ "X....XX",
+ "X..XX..",
+ "XXX....",
+ "X..XX..",
+ "X....XX",
+ "......."},
+ {"..XX...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "..XXX..",
+ "......."},
+ {".......",
+ ".......",
+ ".XX.XX.",
+ "X..X..X",
+ "X..X..X",
+ "X..X..X",
+ "X..X..X",
+ "......."},
+ {".......",
+ ".......",
+ ".XXXXX.",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "......."},
+ {".......",
+ ".......",
+ ".XXXXX.",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ ".XXXXX.",
+ "......."},
+ {".......",
+ ".......",
+ "XXXXXX.",
+ "X.....X",
+ "X.....X",
+ "XXXXXX.",
+ "X......",
+ "X......"},
+ {".......",
+ ".......",
+ ".XXXXXX",
+ "X.....X",
+ "X.....X",
+ ".XXXXXX",
+ "......X",
+ "......X"},
+ {".......",
+ ".......",
+ "X.XXXX.",
+ "XX....X",
+ "X......",
+ "X......",
+ "X......",
+ "......."},
+ {".......",
+ ".......",
+ ".XXXXX.",
+ "X......",
+ ".XXXXX.",
+ "......X",
+ ".XXXXX.",
+ "......."},
+ {"...X...",
+ "...X...",
+ "...X...",
+ ".XXXXX.",
+ "...X...",
+ "...X...",
+ "....XX.",
+ "......."},
+ {".......",
+ ".......",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ ".XXXXX.",
+ "......."},
+ {".......",
+ ".......",
+ "X.....X",
+ "X.....X",
+ ".X...X.",
+ "..X.X..",
+ "...X...",
+ "......."},
+ {".......",
+ ".......",
+ "X.....X",
+ "X.....X",
+ "X..X..X",
+ "X.X.X.X",
+ ".X...X.",
+ "......."},
+ {".......",
+ ".......",
+ "X.....X",
+ ".XX.XX.",
+ "...X...",
+ ".XX.XX.",
+ "X.....X",
+ "......."},
+ {".......",
+ ".......",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ ".XXXXXX",
+ "......X",
+ ".XXXXX."},
+ {".......",
+ ".......",
+ "XXXXXXX",
+ "....XX.",
+ "...X...",
+ ".XX....",
+ "XXXXXXX",
+ "......."},
+ {"...XX..",
+ "..X....",
+ "..X....",
+ "XX.....",
+ "..X....",
+ "..X....",
+ "...XX..",
+ "......."},
+ {"...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X...",
+ "...X..."},
+ {"..XX...",
+ "....X..",
+ "....X..",
+ ".....XX",
+ "....X..",
+ "....X..",
+ "..XX...",
+ "......."},
+ {".......",
+ ".......",
+ "..X....",
+ ".X.XX.X",
+ ".....X.",
+ ".......",
+ ".......",
+ "......."},
+ {"XXXXXXX",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "X.....X",
+ "XXXXXXX",
+ ".......",
+ }
+ };
+
+
+ public static void main(final String[] args) {
+ String[] letter;
+ long b;
+ long v;
+ int c = 0;
+ String s;
+ for (int i = 0; i < font.length; i++) {
+ letter = font[i];
+ b = 0;
+ for (int j = 0; j < 8; j++) { // 8 rows
+ b = b << 7; // 7 bits per row
+ v = 1 << 6; // value to set
+ for (int col = 0; col < 7; col++) {
+ if (letter[j].charAt(col) == 'X') b += v;
+ v = v >> 1;
+ }
+ }
+ s = Long.toHexString(b).toUpperCase();
+ while (s.length() < 16) s = "0" + s;
+ System.out.print("0x" + s + "L,");
+ c++;
+ if (c >= 8) {
+ System.out.println();
+ c = 0;
+ }
+ }
+ }
+
+}
diff --git a/source/net/yacy/visualization/FontGenerator8Pixel.java b/source/net/yacy/visualization/FontGenerator8Pixel.java
deleted file mode 100644
index 30a570e66..000000000
--- a/source/net/yacy/visualization/FontGenerator8Pixel.java
+++ /dev/null
@@ -1,892 +0,0 @@
-// FontGenerator8Pixel.java
-// ---------------------------
-// by Marc Nause
-// created: 05.04.2007
-//
-// $LastChangedDate$
-// $LastChangedRevision$
-// $LastChangedBy$
-//
-// based on:
-// FontGenerator5Pixle.java
-// ---------------------------
-// (C) by Michael Peter Christen; mc@yacy.net
-// first published on http://www.anomic.de
-// Frankfurt, Germany, 2005
-// created: 31.10.2005
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-package net.yacy.visualization;
-
-public class FontGenerator8Pixel {
-
-//A valid font has 96 characters:
-
-/*
-0x20: !"#$%&'
-0x28:()*+,-./
-0x30:01234567
-0x38:89:;<=>?
-0x40:@ABCDEFG
-0x48:HIJKLMNO
-0x50:PQRSTUVW
-0x58:XYZ[\]^_
-0x60:`abcdefg
-0x68:hijklmno
-0x70:pqrstuvw
-0x78:xyz{|}~
-*/
-
-//Each character has the same height of m lines with n pixels each.
-//While m does not need to equal n both have to stay consistend through
-//the whole font.
-
- public static final String[][] font =
- {
- {"........", //0x20
- "........",
- "........",
- "........",
- "........",
- "........",
- "........",
- "........"},
- {"...X....",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "........",
- "...X....",
- "........"},
- {"..X.X...",
- "..X.X...",
- "........",
- "........",
- "........",
- "........",
- "........",
- "........"},
- {"..X.X...",
- "..X.X...",
- "XXXXXXX.",
- "..X.X...",
- "XXXXXXX.",
- "..X.X...",
- "..X.X...",
- "........"},
- {"...XX...",
- ".XXXXXX.",
- "X..XX...",
- ".XXXXX..",
- "...XX.X.",
- "XXXXXX..",
- "...X....",
- "........"},
- {".XX...X.",
- ".XX..X..",
- "....X...",
- "...X....",
- "..X.....",
- ".X...XX.",
- "X....XX.",
- "........"},
- {".XX.....",
- "X..X....",
- ".XX.....",
- "..X...X.",
- "X..X.X..",
- "X...X...",
- ".XXX..X.",
- "........"},
- {"...X....",
- "...X....",
- "........",
- "........",
- "........",
- "........",
- "........",
- "........"},
- {"....X...",
- "...X....",
- "..X.....",
- "..X.....",
- "..X.....",
- "...X....",
- "....X...",
- "........"},
- {"...X....",
- "....X...",
- ".....X..",
- ".....X..",
- ".....X..",
- "....X...",
- "...X....",
- "........"},
- {"...X....",
- ".X.X.X..",
- "..XXX...",
- "XXXXXXX.",
- "..XXX...",
- ".X..X.X.",
- "...X....",
- "........"},
- {"........",
- "...X....",
- "...X....",
- ".XXXXX..",
- "...X....",
- "...X....",
- "........",
- "........"},
- {"........",
- "........",
- "........",
- "........",
- "........",
- "...XX...",
- "...XX...",
- "....X..."},
- {"........",
- "........",
- "........",
- ".XXXXX..",
- "........",
- "........",
- "........",
- "........"},
- {"........",
- "........",
- "........",
- "........",
- "........",
- "...XX...",
- "...XX...",
- "........"},
- {"......X.",
- ".....X..",
- "....X...",
- "...X....",
- "..X.....",
- ".X......",
- "X.......",
- "........"},
- {".XXXXX..",
- "X....XX.",
- "X...X.X.",
- "X..X..X.",
- "X.X...X.",
- "XX....X.",
- ".XXXXX..",
- "........"},
- {"...X....",
- "..XX....",
- ".X.X....",
- "...X....",
- "...X....",
- "...X....",
- ".XXXXX..",
- "........"},
- {"..XXX...",
- ".X...X..",
- ".....X..",
- "....X...",
- "...X....",
- "..X.....",
- ".XXXXX..",
- "........"},
- {"..XXX...",
- ".X...X..",
- ".....X..",
- "...XX...",
- ".....X..",
- ".X...X..",
- "..XXX...",
- "........"},
- {".....X..",
- "....XX..",
- "...X.X..",
- "..X..X..",
- ".XXXXXX.",
- ".....X..",
- ".....X..",
- "........"},
- {".XXXXXX.",
- ".X......",
- ".X......",
- ".XXXXX..",
- "......X.",
- "......X.",
- ".XXXXX..",
- "........"},
- {"..XXX...",
- ".X...X..",
- ".X......",
- ".XXXX...",
- ".X...X..",
- ".X...X..",
- "..XXX...",
- "........"},
- {".XXXXX..",
- ".....X..",
- ".....X..",
- "....X...",
- "...X....",
- "...X....",
- "...X....",
- "........"},
- {"..XXX...",
- ".X...X..",
- ".X...X..",
- "..XXX...",
- ".X...X..",
- ".X...X..",
- "..XXX...",
- "........"},
- {"..XXX...",
- ".X...X..",
- ".X...X..",
- "..XXXX..",
- ".....X..",
- ".X...X..",
- "..XXX...",
- "........"},
- {"........",
- "........",
- "...XX...",
- "...XX...",
- "........",
- "...XX...",
- "...XX...",
- "........"},
- {"........",
- "........",
- "...XX...",
- "...XX...",
- "........",
- "...XX...",
- "...XX...",
- "....X..."},
- {".....XX.",
- "...XX...",
- ".XX.....",
- "X.......",
- ".XX.....",
- "...XX...",
- ".....XX.",
- "........"},
- {"........",
- "........",
- "..XXXX..",
- "........",
- "..XXXX..",
- "........",
- "........",
- "........"},
- {"XX......",
- "..XX....",
- "....XX..",
- "......X.",
- "....XX..",
- "..XX....",
- "XX......",
- "........",},
- {"..XXX...",
- ".X...X..",
- ".....X..",
- "....X...",
- "...X....",
- "........",
- "...X....",
- "........"},
- {".XXXXX..",
- "X.....X.",
- "X...XXX.",
- "X..X..X.",
- "X...XXX.",
- "X.......",
- ".XXXXXX.",
- "........"},
- {".XXXXX..",
- "X.....X.",
- "X.....X.",
- "XXXXXXX.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "........"},
- {"XXXXXX..",
- "X.....X.",
- "X.....X.",
- "XXXXXX..",
- "X.....X.",
- "X.....X.",
- "XXXXXX..",
- "........"},
- {"..XXXX..",
- ".X....X.",
- "X.......",
- "X.......",
- "X.......",
- ".X....X.",
- "..XXXX..",
- "........"},
- {"XXXXX...",
- "X....X..",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X....X..",
- "XXXXX...",
- "........"},
- {"XXXXXXX.",
- "X.......",
- "X.......",
- "XXXXXX..",
- "X.......",
- "X.......",
- "XXXXXXX.",
- "........"},
- {"XXXXXXX.",
- "X.......",
- "X.......",
- "XXXXXX..",
- "X.......",
- "X.......",
- "X.......",
- "........"},
- {".XXXXX..",
- "X.......",
- "X.......",
- "X..XXXX.",
- "X.....X.",
- "X.....X.",
- ".XXXXX..",
- "........"},
- {"X.....X.",
- "X.....X.",
- "X.....X.",
- "XXXXXXX.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "........"},
- {"..XXX...",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "..XXX...",
- "........"},
- {"...XXX..",
- "....X...",
- "....X...",
- "....X...",
- "....X...",
- "X...X...",
- ".XXX....",
- "........"},
- {"X....XX.",
- "X...XX..",
- "X..XX...",
- "XXX.....",
- "X..XX...",
- "X...XX..",
- "X....XX.",
- "........"},
- {"X.......",
- "X.......",
- "X.......",
- "X.......",
- "X.......",
- "X.......",
- "XXXXXXX.",
- "........"},
- {"X.....X.",
- "XX...XX.",
- "X.X.X.X.",
- "X..X..X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "........"},
- {"X.....X.",
- "XX....X.",
- "X.X...X.",
- "X..X..X.",
- "X...X.X.",
- "X....XX.",
- "X.....X.",
- "........"},
- {".XXXXX..",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- ".XXXXX..",
- "........"},
- {"XXXXXX..",
- "X.....X.",
- "X.....X.",
- "XXXXXX..",
- "X.......",
- "X.......",
- "X.......",
- "........"},
- {".XXXXX..",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X...X.X.",
- ".XXXXX..",
- "......X."},
- {"XXXXXX..",
- "X.....X.",
- "X.....X.",
- "XXXXXX..",
- "X...X...",
- "X....X..",
- "X.....X.",
- "........"},
- {".XXXXX..",
- "X.....X.",
- "X.......",
- ".XXXXX..",
- "......X.",
- "X.....X.",
- ".XXXXX..",
- "........"},
- {"XXXXXXX.",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "........"},
- {"X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- ".XXXXX..",
- "........"},
- {"X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- ".X...X..",
- "..X.X...",
- "...X....",
- "........"},
- {"X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X..X..X.",
- "X.X.X.X.",
- ".X...X..",
- "........"},
- {"X.....X.",
- ".X...X..",
- "..X.X...",
- "...X....",
- "..X.X...",
- ".X...X..",
- "X.....X.",
- "........"},
- {"X.....X.",
- ".X...X..",
- "..X.X...",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "........"},
- {"XXXXXXX.",
- ".....X..",
- "....X...",
- "...X....",
- "..X.....",
- ".X......",
- "XXXXXXX.",
- "........"},
- {"..XXXX..",
- "..X.....",
- "..X.....",
- "..X.....",
- "..X.....",
- "..X.....",
- "..XXXX..",
- "........"},
- {"X.......",
- ".X......",
- "..X.....",
- "...X....",
- "....X...",
- ".....X..",
- "......X.",
- "........"},
- {"..XXXX..",
- ".....X..",
- ".....X..",
- ".....X..",
- ".....X..",
- ".....X..",
- "..XXXX..",
- "........"},
- {"...X....",
- "..X.X...",
- ".X...X..",
- "........",
- "........",
- "........",
- "........",
- "........"},
- {"........",
- "........",
- "........",
- "........",
- "........",
- "........",
- "XXXXXXX.",
- "........"},
- {"...X....",
- "....X...",
- "........",
- "........",
- "........",
- "........",
- "........",
- "........"},
- {"........",
- "........",
- ".XXXX...",
- ".....X..",
- ".XXXXX..",
- "X....X..",
- ".XXXX.X.",
- "........"},
- {"X.......",
- "X.......",
- "X.......",
- "XXXXXX..",
- "X.....X.",
- "X.....X.",
- "XXXXXX..",
- "........"},
- {"........",
- "........",
- ".XXXXXX.",
- "X.......",
- "X.......",
- "X.......",
- ".XXXXXX.",
- "........"},
- {"......X.",
- "......X.",
- "......X.",
- ".XXXXXX.",
- "X.....X.",
- "X.....X.",
- ".XXXXXX.",
- "........"},
- {"........",
- "........",
- ".XXXXX..",
- "X.....X.",
- "XXXXXXX.",
- "X.......",
- ".XXXXX..",
- "........"},
- {"...XX...",
- "..X.....",
- "..X.....",
- ".XXX....",
- "..X.....",
- "..X.....",
- "..X.....",
- "........"},
- {"........",
- "........",
- ".XXXXX..",
- "X.....X.",
- "X.....X.",
- ".XXXXXX.",
- "......X.",
- ".XXXXX.."},
- {"X.......",
- "X.......",
- "X.......",
- "XXXXXX..",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "........"},
- {"........",
- "...X....",
- "........",
- "..XX....",
- "...X....",
- "...X....",
- "..XXX...",
- "........"},
- {"........",
- "....X...",
- "........",
- "...XX...",
- "....X...",
- "....X...",
- "....X...",
- "..XX...."},
- {"X.......",
- "X.......",
- "X....XX.",
- "X..XX...",
- "XXX.....",
- "X..XX...",
- "X....XX.",
- "........"},
- {"..XX....",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "..XXX...",
- "........"},
- {"........",
- "........",
- ".XX.XX..",
- "X..X..X.",
- "X..X..X.",
- "X..X..X.",
- "X..X..X.",
- "........"},
- {"........",
- "........",
- ".XXXXX..",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "........"},
- {"........",
- "........",
- ".XXXXX..",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- ".XXXXX..",
- "........"},
- {"........",
- "........",
- "XXXXXX..",
- "X.....X.",
- "X.....X.",
- "XXXXXX..",
- "X.......",
- "X......."},
- {"........",
- "........",
- ".XXXXXX.",
- "X.....X.",
- "X.....X.",
- ".XXXXXX.",
- "......X.",
- "......X."},
- {"........",
- "........",
- "X.XXXX..",
- "XX....X.",
- "X.......",
- "X.......",
- "X.......",
- "........"},
- {"........",
- "........",
- ".XXXXX..",
- "X.......",
- ".XXXXX..",
- "......X.",
- ".XXXXX..",
- "........"},
- {"...X....",
- "...X....",
- "...X....",
- ".XXXXX..",
- "...X....",
- "...X....",
- "....XX..",
- "........"},
- {"........",
- "........",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- ".XXXXX..",
- "........"},
- {"........",
- "........",
- "X.....X.",
- "X.....X.",
- ".X...X..",
- "..X.X...",
- "...X....",
- "........"},
- {"........",
- "........",
- "X.....X.",
- "X.....X.",
- "X..X..X.",
- "X.X.X.X.",
- ".X...X..",
- "........"},
- {"........",
- "........",
- "X.....X.",
- ".XX.XX..",
- "...X....",
- ".XX.XX..",
- "X.....X.",
- "........"},
- {"........",
- "........",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- ".XXXXXX.",
- "......X.",
- ".XXXXX.."},
- {"........",
- "........",
- "XXXXXXX.",
- "....XX..",
- "...X....",
- ".XX.....",
- "XXXXXXX.",
- "........"},
- {"...XX...",
- "..X.....",
- "..X.....",
- "XX......",
- "..X.....",
- "..X.....",
- "...XX...",
- "........"},
- {"...X....",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "...X....",
- "...X...."},
- {"...XX...",
- ".....X..",
- ".....X..",
- "......XX",
- ".....X..",
- ".....X..",
- "...XX...",
- "........"},
- {"........",
- "........",
- "..X.....",
- ".X.XX.X.",
- ".....X..",
- "........",
- "........",
- "........"},
- {"XXXXXXX.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "X.....X.",
- "XXXXXXX.",
- "........"},
-
-
- };
-
-
- public static void main(final String[] args) {
- String[] letter;
- int b;
- int v;
- int c = 0;
- int n = -1;
- int m = -1;
- String s;
-
- //check if font has correct number of letters
- if(font.length != 96){
- System.out.println("\nWARNING: Font has "+font.length+" letters, should have 96 letters.");
- System.out.println(" Font will be invalid!\n");
- }
-
- for (int i = 0; i < font.length; i++) {
- letter = font[i];
- b = 0;
-
- //check if all letters have same numbers of lines
- if((letter.length != n) && (n == -1)) {
- n = letter.length;
- }
- else if(letter.length != n) {
- System.out.println("\n\nWARNING: Letter number "+i+" has different number of lines ("+letter.length+") than predecessors ("+n+").");
- System.out.println(" Font will be invalid!\n");
- }
-
-
- for (int j = 0; j < letter.length; j++) {
-
- b = b << letter[j].length();
- v = 16;
-
- //check if all letters have same number of lines
- if((letter[j].length() != m) && (m == -1)) {
- m=letter[j].length();
- }
- else if(letter[j].length() != m) {
- System.out.println("\n\nWARNING: Letter number "+i+" has a different number of bits ("+letter[j].length()+") than predecessors ("+m+") in line "+j+".");
- System.out.println(" Font will be invalid!\n");
- }
-
- for (int col = 0; col < letter[j].length(); col++) {
-
- if (letter[j].charAt(col) == 'X') b += v;
- v = v >> 1;
- }
- }
- s = Long.toHexString(b).toUpperCase();
- while (s.length() < (letter.length*m/8)) s = "0" + s;
- System.out.print("0x" + s + ",");
- c++;
- if (c >= 8) {
- System.out.println();
- c = 0;
- }
- }
- }
-
-}
diff --git a/source/net/yacy/visualization/PrintTool.java b/source/net/yacy/visualization/PrintTool.java
index f60781c51..ee876db37 100644
--- a/source/net/yacy/visualization/PrintTool.java
+++ b/source/net/yacy/visualization/PrintTool.java
@@ -20,6 +20,9 @@
package net.yacy.visualization;
+import java.io.File;
+import java.io.IOException;
+
public class PrintTool {
@@ -39,57 +42,99 @@ public class PrintTool {
0x0000000EC2E0ECL,0x0000000EC2E030L,0x0000000FF2E3FCL,0x000F0B8B80B80FL,0x00300C0300C030L,0x03C0B80B8B83C0L,0x0000B83BB0B800L,0x03FFC0F03C0FFFL
};
- private static long[] font8 = new long[] {
- 0x00000000,0x02000200,0x00000000,0x1F050500,0x031F0200,0x04081000,0x12110E00,0x00000000,
- 0x04020100,0x00010200,0x07090200,0x02020000,0x00030301,0x00000000,0x00030300,0x04081000,
- 0x14180F00,0x02020F00,0x02040F00,0x00080700,0x0F000000,0x00000F00,0x08080700,0x02020200,
- 0x08080700,0x00080700,0x00030300,0x00030301,0x0C030000,0x07000000,0x01061800,0x02000200,
- 0x11100F00,0x10101000,0x10101F00,0x10080700,0x10101F00,0x10101F00,0x10101000,0x10100F00,
- 0x10101000,0x02020700,0x01110E00,0x13111000,0x10101F00,0x10101000,0x11101000,0x10100F00,
- 0x10101000,0x10110F00,0x11101000,0x00100F00,0x02020200,0x10100F00,0x08050200,0x12150800,
- 0x05081000,0x02020200,0x04081F00,0x04040700,0x01000000,0x00000700,0x00000000,0x00001F00,
- 0x00000000,0x0F100F00,0x10101F00,0x10100F00,0x10100F00,0x1F100F00,0x04040400,0x100F000F,
- 0x10101000,0x02020700,0x01010106,0x1C131000,0x02020700,0x12121200,0x10101000,0x10100F00,
- 0x101F1010,0x100F0000,0x10101000,0x0F000F00,0x02020100,0x10100F00,0x08050200,0x12150800,
- 0x020D1000,0x100F000F,0x020C1F00,0x04040300,0x02020202,0x00000300,0x00000000,0x10101F00,
+ private static long[] font7 = new long[] {
+ 0x0000000000000000L,0x0010204081000400L,0x0028500000000000L,0x002853F94FE50A00L,0x0018FE63E1BF8400L,0x0062C8208208E180L,0x0061218119511C80L,0x0010200000000000L,
+ 0x0008208102020200L,0x0010101020410400L,0x0010A8E7F3894400L,0x00002043E1020000L,0x0000000000030604L,0x00000003E0000000L,0x0000000000030600L,0x0002082082082000L,
+ 0x007D0E2C9A385F00L,0x0010614081021F00L,0x0038881041041F00L,0x00388810C0488E00L,0x0004185127E08100L,0x007E8103E0205F00L,0x00388903C4488E00L,0x007C081041020400L,
+ 0x00388911C4488E00L,0x00388911E0488E00L,0x00000060C0030600L,0x00000060C0030604L,0x0006318406030180L,0x000000F003C00000L,0x00C0603010C63000L,0x0038881041000400L,
+ 0x007D063C98F01F80L,0x007D060FF8306080L,0x00FD060FE8307F00L,0x003C860408084F00L,0x00F90A0C1830BE00L,0x00FF0207E8103F80L,0x00FF0207E8102000L,0x007D0204F8305F00L,
+ 0x0083060FF8306080L,0x0038204081020E00L,0x001C102040911C00L,0x00871A670991A180L,0x0081020408103F80L,0x00838EAC98306080L,0x0083868C98B0E080L,0x007D060C18305F00L,
+ 0x00FD060FE8102000L,0x007D060C18315F01L,0x00FD060FE890A080L,0x007D0603E0305F00L,0x00FE204081020400L,0x0083060C18305F00L,0x0083060C14450400L,0x0083060C19355100L,
+ 0x008288A08288A080L,0x008288A081020400L,0x00FE082082083F80L,0x003C408102040F00L,0x0080808080808080L,0x003C081020408F00L,0x0010511000000000L,0x0000000000003F80L,
+ 0x0010100000000000L,0x000001E027D09E80L,0x00810207E8307F00L,0x000001FC08101F80L,0x0002040BF8305F80L,0x000001F41FF01F00L,0x0018408382040800L,0x000001F4182FC0BEL,
+ 0x00810207E8306080L,0x0000200181020E00L,0x00001000C0810218L,0x0081021CCE132180L,0x0030204081020E00L,0x000001B499326480L,0x000001F418306080L,0x000001F418305F00L,
+ 0x000003F4183FA040L,0x000001FC182FC081L,0x000002F618102000L,0x000001F407C05F00L,0x00102043E1020300L,0x0000020C18305F00L,0x0000020C14450400L,0x0000020C19355100L,
+ 0x0000020B610DA080L,0x0000020C182FC0BEL,0x000003F8610C3F80L,0x0018408602040600L,0x0010204081020408L,0x0030102030810C00L,0x00000082D0400000L,0x00FF060C18307F80L
};
private static void print5(final RasterPlotter matrix, int x, int y, final int angle, final char letter, int intensity) {
final int index = letter - 0x20;
- if (index >= font5.length) return;
+ if (index < 0 || index >= font5.length || intensity <= 0) return;
long character = font5[index];
- long row;
+ long bits;
long c;
int i2 = intensity / 2;
int i3 = intensity / 3;
int i5 = intensity / 5;
- for (int i = 0; i < 5; i++) {
- row = character & 0x3FFL;
- character = character >> 10;
+ for (int row = 0; row < 5; row++) {
+ bits = character & 0x3FFL; // 10 bits per row
+ character = character >> 10; // next row
if (angle == 0) {
- for (int j = 0; j < 5; j++) {
- c = row & 3L;
- if (c == 3) matrix.plot(x + 5 - j, y, intensity);
- else if (c == 2) matrix.plot(x + 5 - j, y, i3);
- row = row >> 2;
+ for (int col = 0; col < 5; col++) {
+ c = bits & 3L;
+ if (c == 3) matrix.plot(x + 5 - col, y, intensity);
+ else if (c == 2) matrix.plot(x + 5 - col, y, i3);
+ bits = bits >> 2;
}
y--;
}
if (angle == 90) {
- for (int j = 0; j < 5; j++) {
- c = row & 3L;
- if (c == 3) matrix.plot(x, y - 5 + j, intensity);
- else if (c == 2) matrix.plot(x, y - 5 + j, i3);
- row = row >> 2;
+ for (int col = 0; col < 5; col++) {
+ c = bits & 3L;
+ if (c == 3) matrix.plot(x, y - 5 + col, intensity);
+ else if (c == 2) matrix.plot(x, y - 5 + col, i3);
+ bits = bits >> 2;
}
x--;
}
if (angle == 315) {
- for (int j = 0; j < 5; j++) {
- c = row & 3L;
- if (c == 3) { matrix.plot(x + 5 - j, y + 5 - j, intensity); matrix.plot(x + 6 - j, y + 5 - j, i2); matrix.plot(x + 5 - j, y + 6 - j, i2); }
- else if (c == 2) { matrix.plot(x + 5 - j, y + 5 - j, i3); matrix.plot(x + 6 - j, y + 5 - j, i5); matrix.plot(x + 5 - j, y + 6 - j, i5); }
- row = row >> 2;
+ for (int col = 0; col < 5; col++) {
+ c = bits & 3L;
+ if (c == 3) { matrix.plot(x + 5 - col, y + 5 - col, intensity); matrix.plot(x + 6 - col, y + 5 - col, i2); matrix.plot(x + 5 - col, y + 6 - col, i2); }
+ else if (c == 2) { matrix.plot(x + 5 - col, y + 5 - col, i3); matrix.plot(x + 6 - col, y + 5 - col, i5); matrix.plot(x + 5 - col, y + 6 - col, i5); }
+ bits = bits >> 2;
+ }
+ x++;
+ y--;
+ }
+ }
+ }
+
+ private static void print7(final RasterPlotter matrix, int x, int y, final int angle, final char letter, final int intensity) {
+ final int index = letter - 0x20;
+ if (index < 0 || index >= font7.length || intensity <= 0) return;
+
+ long character = font7[index];
+ final int i2 = intensity / 2;
+
+ for (int row = 0; row < 8; row++) {
+ long bits = character & 0x7FL; // 7 bits per row
+ character >>= 7; // next row
+
+ if (angle == 0) {
+ for (int col = 0; col < 7; col++) {
+ if ((bits & 1L) != 0L) matrix.plot(x + 7 - col, y, intensity);
+ bits >>= 1;
+ }
+ y--;
+ } else if (angle == 90) {
+ for (int col = 0; col < 7; col++) {
+ if ((bits & 1L) != 0L) matrix.plot(x, y - 7 + col, intensity);
+ bits >>= 1;
+ }
+ x--;
+ } else if (angle == 315) {
+ for (int col = 0; col < 7; col++) {
+ if ((bits & 1L) != 0L) {
+ final int px = x + 7 - col;
+ final int py = y + 7 - col;
+ matrix.plot(px, py, intensity);
+ if (i2 > 0) {
+ matrix.plot(px + 1, py, i2);
+ matrix.plot(px, py + 1, i2);
+ }
+ }
+ bits >>= 1;
}
x++;
y--;
@@ -101,22 +146,51 @@ public class PrintTool {
// align = -1 : left
// align = 1 : right
// align = 0 : center
+ final int size = 6;
+ final int halfStep = size / 2;
int xx = 0, yy = 0;
+
if (angle == 0) {
- xx = (align == -1) ? x : (align == 1) ? x - 6 * message.length() : x - 3 * message.length();
+ xx = (align == -1) ? x : (align == 1) ? x - 6 * message.length() : x - halfStep * message.length();
yy = y;
} else if (angle == 90) {
xx = x;
- yy = (align == -1) ? y : (align == 1) ? y + 6 * message.length() : y + 3 * message.length();
+ yy = (align == -1) ? y : (align == 1) ? y + 6 * message.length() : y + halfStep * message.length();
} else if (angle == 315) {
- xx = (align == -1) ? x : (align == 1) ? x - 6 * message.length() : x - 3 * message.length();
- yy = (align == -1) ? y : (align == 1) ? y - 6 * message.length() : y - 3 * message.length();
+ xx = (align == -1) ? x : (align == 1) ? x - 6 * message.length() : x - halfStep * message.length();
+ yy = (align == -1) ? y : (align == 1) ? y - 6 * message.length() : y - halfStep * message.length();
}
for (int i = 0; i < message.length(); i++) {
print5(matrix, xx, yy, angle, message.charAt(i), intensity);
- if (angle == 0) xx += 6;
- else if (angle == 90) yy -= 6;
- else if (angle == 315) {xx += 6; yy += 6;}
+ if (angle == 0) xx += size;
+ else if (angle == 90) yy -= size;
+ else if (angle == 315) {xx += size; yy += size;}
+ }
+ }
+
+ public static void print7(final RasterPlotter matrix, final int x, final int y, final int angle, final String message, final int align, final int intensity) {
+ if (message == null || message.isEmpty() || intensity <= 0) return;
+
+ final int size = 8;
+ final int halfStep = size / 2;
+ int xx = x, yy = y;
+
+ if (angle == 0) {
+ xx = (align == -1) ? x : (align == 1) ? x - size * message.length() : x - halfStep * message.length();
+ yy = y;
+ } else if (angle == 90) {
+ xx = x;
+ yy = (align == -1) ? y : (align == 1) ? y + size * message.length() : y + halfStep * message.length();
+ } else if (angle == 315) {
+ xx = (align == -1) ? x : (align == 1) ? x - size * message.length() : x - halfStep * message.length();
+ yy = (align == -1) ? y : (align == 1) ? y - size * message.length() : y - halfStep * message.length();
+ }
+
+ for (int i = 0; i < message.length(); i++) {
+ print7(matrix, xx, yy, angle, message.charAt(i), intensity);
+ if (angle == 0) xx += size;
+ else if (angle == 90) yy -= size;
+ else if (angle == 315) {xx += size; yy += size;}
}
}
@@ -146,4 +220,48 @@ public class PrintTool {
}
+ public static void main(final String[] args) {
+ System.setProperty("java.awt.headless", "true");
+
+ final File target = determineTarget(args);
+ final RasterPlotter canvas = new RasterPlotter(360, 260, RasterPlotter.DrawMode.MODE_REPLACE, 0x000010);
+
+ canvas.setColor(0x00FFD0);
+ print5(canvas, 12, 60, 0, "print5 left", -1, 90);
+ canvas.setColor(0xFFAA40);
+ print5(canvas, 348, 100, 0, "print5 right", 1, 90);
+ canvas.setColor(0x66FFAA);
+ print5(canvas, 24, 240, 90, "vertical5", -1, 90);
+ canvas.setColor(0xFF6699);
+ print5(canvas, 40, 150, 315, "diag5", -1, 90);
+ canvas.setColor(0x99DDFF);
+ arcPrint5(canvas, 260, 70, 40, 210, "arcPrint5", 90);
+
+ canvas.setColor(0xFFFFFF);
+ print7(canvas, 12, 120, 0, "print7 demo", -1, 100);
+ canvas.setColor(0x00CCFF);
+ print7(canvas, 340, 180, 0, "print7 right", 1, 90);
+ canvas.setColor(0xFFCC00);
+ print7(canvas, 330, 240, 90, "vertical7", -1, 90);
+ canvas.setColor(0xFF66FF);
+ print7(canvas, 140, 210, 315, "diagonal7", -1, 90);
+
+ try {
+ if (target.getParentFile() != null) target.getParentFile().mkdirs();
+ canvas.save(target, "png");
+ } catch (final IOException e) {
+ throw new RuntimeException("Unable to save PrintTool demo image", e);
+ }
+ }
+
+ private static File determineTarget(final String[] args) {
+ if (args != null && args.length > 0) {
+ final File supplied = new File(args[0]);
+ if (supplied.isDirectory()) return new File(supplied, "printtool-demo.png");
+ return supplied;
+ }
+ return new File("printtool-demo.png");
+ }
+
+
}