added intensity option to graphics

pull/8/head
Michael Peter Christen 10 years ago
parent a5007f345e
commit eec78e1b0c

@ -104,7 +104,7 @@ public class AccessPicture_p {
}
//picture.gridDot(centerx, centery, 31, false);
picture.setColor(color_text_l);
picture.gridPrint(centerx, centery, 5, "THIS YACY PEER", "\"" + sb.peers.myName().toUpperCase() + "\"", 0);
picture.gridPrint(centerx, centery, 5, "THIS YACY PEER", "\"" + sb.peers.myName().toUpperCase() + "\"", 0, 100);
// left column: collect data for access from outside
final int verticalSlots = (picture.gridHeight() >> 1) - 1;
@ -141,7 +141,7 @@ public class AccessPicture_p {
picture.gridDot(gridLeft, i * 2 + 1, 7, false, 100);
picture.gridDot(gridLeft, i * 2 + 1, 8, false, 100);
picture.setColor(color_text_l);
picture.gridPrint(gridLeft, i * 2 + 1, 8, hosts[i].toUpperCase(), "COUNT = " + count[i] + ", TIME > " + ((time[i] >= 60000) ? ((time[i] / 60000) + " MINUTES") : ((time[i] / 1000) + " SECONDS")), -1);
picture.gridPrint(gridLeft, i * 2 + 1, 8, hosts[i].toUpperCase(), "COUNT = " + count[i] + ", TIME > " + ((time[i] >= 60000) ? ((time[i] / 60000) + " MINUTES") : ((time[i] / 1000) + " SECONDS")), -1, 100);
if (corona) {
picture.gridLine((centerx - gridLeft) / 2 - 2, i * 2 + 1, gridLeft, i * 2 + 1,
color_line, 100, "AAAAAA", 100, 12, 11 - coronaangle / 30, 0, true);
@ -176,7 +176,7 @@ public class AccessPicture_p {
picture.gridDot(gridRight, i * 2 + 1, 7, false, 100);
picture.gridDot(gridRight, i * 2 + 1, 8, false, 100);
picture.setColor(color_text_l);
picture.gridPrint(gridRight, i * 2 + 1, 8, hosts[i].toUpperCase(), count[i] + " BYTES, " + time[i] + " MS DUE", 1);
picture.gridPrint(gridRight, i * 2 + 1, 8, hosts[i].toUpperCase(), count[i] + " BYTES, " + time[i] + " MS DUE", 1, 100);
if (corona) {
picture.gridLine(gridRight, i * 2 + 1, centerx + (gridRight - centerx) / 2 + 2, i * 2 + 1,
color_line, 100, "AAAAAA", 100, 12, 11 - coronaangle / 30, 0, true);
@ -192,8 +192,8 @@ public class AccessPicture_p {
// print headline
picture.setColor(color_text_l);
PrintTool.print(picture, 2, 6, 0, "YACY NODE ACCESS GRID", -1);
PrintTool.print(picture, width - 2, 6, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1);
PrintTool.print(picture, 2, 6, 0, "YACY NODE ACCESS GRID", -1, 100);
PrintTool.print(picture, width - 2, 6, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1, 80);
// print legend
picture.setColor(color_grid_l);
@ -202,7 +202,7 @@ public class AccessPicture_p {
picture.gridLine(centerx - 3, 0, centerx - 3, picture.gridHeight() - 1);
picture.setColor(color_dot_l);
picture.gridLine(gridLeft, picture.gridHeight() - 1, centerx - 3, picture.gridHeight() - 1);
picture.gridPrint(gridLeft, picture.gridHeight() - 1, 8, "", "INCOMING CONNECTIONS", -1);
picture.gridPrint(gridLeft, picture.gridHeight() - 1, 8, "", "INCOMING CONNECTIONS", -1, 80);
picture.setColor(color_grid_l);
picture.gridLine(centerx + 3, 0, gridRight, 0);
@ -210,7 +210,7 @@ public class AccessPicture_p {
picture.gridLine(gridRight, 0, gridRight, picture.gridHeight() - 1);
picture.setColor(color_dot_l);
picture.gridLine(centerx + 3, picture.gridHeight() - 1, gridRight, picture.gridHeight() - 1);
picture.gridPrint(gridRight, picture.gridHeight() - 1, 8, "", "OUTGOING CONNECTIONS", 1);
picture.gridPrint(gridRight, picture.gridHeight() - 1, 8, "", "OUTGOING CONNECTIONS", 1, 80);
return picture;

@ -108,8 +108,8 @@ public class WebStructurePicture_p {
// probably no information available
final RasterPlotter.DrawMode drawMode = (RasterPlotter.darkColor(color_back)) ? RasterPlotter.DrawMode.MODE_ADD : RasterPlotter.DrawMode.MODE_SUB;
graphPicture = new RasterPlotter(width, height, drawMode, color_back);
PrintTool.print(graphPicture, width / 2, height / 2, 0, "NO WEB STRUCTURE DATA AVAILABLE.", 0);
PrintTool.print(graphPicture, width / 2, height / 2 + 16, 0, "START A WEB CRAWL TO OBTAIN STRUCTURE DATA.", 0);
PrintTool.print(graphPicture, width / 2, height / 2, 0, "NO WEB STRUCTURE DATA AVAILABLE.", 0, 100);
PrintTool.print(graphPicture, width / 2, height / 2 + 16, 0, "START A WEB CRAWL TO OBTAIN STRUCTURE DATA.", 0, 100);
} else {
// recursively find domains, up to a specific depth
GraphPlotter graph = new GraphPlotter();
@ -141,9 +141,9 @@ public class WebStructurePicture_p {
}
// print headline
graphPicture.setColor(Long.parseLong(color_text, 16));
PrintTool.print(graphPicture, 2, 8, 0, "YACY WEB-STRUCTURE ANALYSIS", -1);
if (hosts != null) PrintTool.print(graphPicture, 2, 16, 0, "LINK ENVIRONMENT OF DOMAIN " + hosts.toUpperCase(), -1);
PrintTool.print(graphPicture, width - 2, 8, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1);
PrintTool.print(graphPicture, 2, 8, 0, "YACY WEB-STRUCTURE ANALYSIS", -1, 100);
if (hosts != null) PrintTool.print(graphPicture, 2, 16, 0, "LINK ENVIRONMENT OF DOMAIN " + hosts.toUpperCase(), -1, 80);
PrintTool.print(graphPicture, width - 2, 8, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1, 80);
return graphPicture;
}

@ -36,8 +36,8 @@ public class imagetest {
final RasterPlotter img = new RasterPlotter(800, 600, RasterPlotter.DrawMode.MODE_SUB, "FFFFFF");
img.setColor(RasterPlotter.GREY);
for (int y = 0; y < 600; y = y + 50) PrintTool.print(img, 0, 6 + y, 0, Integer.toString(y), -1);
for (int x = 0; x < 800; x = x + 50) PrintTool.print(img, x, 6 , 0, Integer.toString(x), -1);
for (int y = 0; y < 600; y = y + 50) PrintTool.print(img, 0, 6 + y, 0, Integer.toString(y), -1, 100);
for (int x = 0; x < 800; x = x + 50) PrintTool.print(img, x, 6 , 0, Integer.toString(x), -1, 100);
img.setColor(RasterPlotter.RED);
img.dot(550, 110, 90, true, 100);
img.setColor(RasterPlotter.GREEN);
@ -50,9 +50,9 @@ public class imagetest {
img.arc(220, 110, 50, 90, 30, 110);
img.arc(210, 120, 50, 90, 30, 110);
img.setColor(RasterPlotter.GREY);
PrintTool.print(img, 50, 110, 0, "BROADCAST MESSAGE #772: NODE %882 GREY abcefghijklmnopqrstuvwxyz", -1);
PrintTool.print(img, 50, 110, 0, "BROADCAST MESSAGE #772: NODE %882 GREY abcefghijklmnopqrstuvwxyz", -1, 100);
img.setColor(RasterPlotter.GREEN);
PrintTool.print(img, 50, 120, 0, "BROADCAST MESSAGE #772: NODE %882 GREEN abcefghijklmnopqrstuvwxyz", -1);
PrintTool.print(img, 50, 120, 0, "BROADCAST MESSAGE #772: NODE %882 GREEN abcefghijklmnopqrstuvwxyz", -1, 100);
for (long i = 0; i < 256; i++) {
img.setColor(i);
img.dot(10 + 14 * (int) (i / 16), 200 + 14 * (int) (i % 16), 6, true, 100);
@ -79,7 +79,7 @@ public class imagetest {
for (byte c = (byte) 'A'; c <= 'Z'; c++) {
angle = (c - (byte) 'A') * 360 / ((byte) 'Z' - (byte) 'A');
img.arcLine(550, 400, 81, 100, angle, true, null, null, -1, -1, -1, false);
PrintTool.arcPrint(img, 550, 400, 100, angle, "ANGLE" + angle + ":" + (char) c);
PrintTool.arcPrint(img, 550, 400, 100, angle, "ANGLE" + angle + ":" + (char) c, 100);
}
return img;

@ -57,7 +57,7 @@ public class osm {
* set the lowercase letters do not look good, so we use uppercase only.
* The (C) symbol is not available in our font, so we use the letters (C) instead.
*/
PrintTool.print(map, map.getWidth() - 6, map.getHeight() - 6, 0, "(C) OPENSTREETMAP CONTRIBUTORS", 1);
PrintTool.print(map, map.getWidth() - 6, map.getHeight() - 6, 0, "(C) OPENSTREETMAP CONTRIBUTORS", 1, 80);
return new EncodedImage(map, header.get("EXT", null), true);
}

@ -93,17 +93,17 @@ public final class Banner {
// draw description
bannerPicture.setColor(data.getTextcolor());
PrintTool.print(bannerPicture, 100, 12, 0, PEER_NAME + addBlanks(data.getName(), PEER_NAME.length()), -1);
PrintTool.print(bannerPicture, 100, 22, 0, DOCUMENTS + addBlanksAndDots(data.getLinks(), DOCUMENTS.length()), -1);
PrintTool.print(bannerPicture, 100, 32, 0, DHT_WORDS + addBlanksAndDots(data.getWords(), DHT_WORDS.length()), -1);
PrintTool.print(bannerPicture, 100, 42, 0, TYPE + addBlanks(data.getType(), TYPE.length()), -1);
PrintTool.print(bannerPicture, 100, 52, 0, SPEED + addBlanks(data.getPpm() + PAGES_MINUTE, SPEED.length()), -1);
PrintTool.print(bannerPicture, 290, 12, 0, NETWORK + addBlanks(data.getNetwork() + " [" + data.getPeers() + "]", NETWORK.length()), -1);
PrintTool.print(bannerPicture, 290, 22, 0, LINKS + addBlanksAndDots(data.getNlinks(), LINKS.length()), -1);
PrintTool.print(bannerPicture, 290, 32, 0, WORDS + addBlanksAndDots(data.getNwords(), WORDS.length()), -1);
PrintTool.print(bannerPicture, 290, 42, 0, QUERIES + addBlanks(formatQpm(data.getNqph()) + QUERIES_HOUR, QUERIES.length()), -1);
PrintTool.print(bannerPicture, 290, 52, 0, SPEED + addBlanks(data.getNppm() + PAGES_MINUTE, SPEED.length()), -1);
PrintTool.print(bannerPicture, 100, 12, 0, PEER_NAME + addBlanks(data.getName(), PEER_NAME.length()), -1, 100);
PrintTool.print(bannerPicture, 100, 22, 0, DOCUMENTS + addBlanksAndDots(data.getLinks(), DOCUMENTS.length()), -1, 80);
PrintTool.print(bannerPicture, 100, 32, 0, DHT_WORDS + addBlanksAndDots(data.getWords(), DHT_WORDS.length()), -1, 80);
PrintTool.print(bannerPicture, 100, 42, 0, TYPE + addBlanks(data.getType(), TYPE.length()), -1, 80);
PrintTool.print(bannerPicture, 100, 52, 0, SPEED + addBlanks(data.getPpm() + PAGES_MINUTE, SPEED.length()), -1, 80);
PrintTool.print(bannerPicture, 290, 12, 0, NETWORK + addBlanks(data.getNetwork() + " [" + data.getPeers() + "]", NETWORK.length()), -1, 80);
PrintTool.print(bannerPicture, 290, 22, 0, LINKS + addBlanksAndDots(data.getNlinks(), LINKS.length()), -1, 80);
PrintTool.print(bannerPicture, 290, 32, 0, WORDS + addBlanksAndDots(data.getNwords(), WORDS.length()), -1, 80);
PrintTool.print(bannerPicture, 290, 42, 0, QUERIES + addBlanks(formatQpm(data.getNqph()) + QUERIES_HOUR, QUERIES.length()), -1, 80);
PrintTool.print(bannerPicture, 290, 52, 0, SPEED + addBlanks(data.getNppm() + PAGES_MINUTE, SPEED.length()), -1, 80);
final int height = data.getHeight();
final int width = data.getWidth();

@ -289,10 +289,10 @@ public class NetworkGraph {
// draw description
networkPicture.setColor(COL_HEADLINE);
PrintTool.print(networkPicture, 2, 6, 0, "YACY NETWORK '" + networkName.toUpperCase() + "'", -1);
PrintTool.print(networkPicture, 2, 14, 0, networkTitle.toUpperCase(), -1);
PrintTool.print(networkPicture, width - 2, 6, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1);
PrintTool.print(networkPicture, width - 2, 14, 0, "DRAWING OF " + totalCount + " SELECTED PEERS", 1);
PrintTool.print(networkPicture, 2, 6, 0, "YACY NETWORK '" + networkName.toUpperCase() + "'", -1, 100);
PrintTool.print(networkPicture, 2, 14, 0, networkTitle.toUpperCase(), -1, 80);
PrintTool.print(networkPicture, width - 2, 6, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1, 80);
PrintTool.print(networkPicture, width - 2, 14, 0, "DRAWING OF " + totalCount + " SELECTED PEERS", 1, 80);
// wait for draw termination
//for (final Thread t: drawThreads) try { t.join(); } catch (final InterruptedException ee) {}
@ -309,7 +309,7 @@ public class NetworkGraph {
// paint the line from the other peer to the inner border of the network circle
img.arcLine(centerX, centerY, innerradius, innerradius - 20, angleOther, out, colorLine, null, 12, (coronaangle < 0) ? -1 : coronaangle / 30, 2, true);
// paint a line between the two inner border points of my peer and the other peer
img.arcConnect(centerX, centerY, innerradius - 20, angleMy, angleOther, out, colorLine, 100, null, 100, 12, (coronaangle < 0) ? -1 : coronaangle / 30, 2, true, otherSeed.getName(), colorLine);
img.arcConnect(centerX, centerY, innerradius - 20, angleMy, angleOther, out, colorLine, 100, null, 100, 12, (coronaangle < 0) ? -1 : coronaangle / 30, 2, true, otherSeed.getName(), colorLine, 100);
}
private static class drawNetworkPicturePeerJob {
@ -357,7 +357,7 @@ public class NetworkGraph {
this.img.arcLine(this.centerX, this.centerY, this.innerradius + 18, this.innerradius + linelength, angle, true, this.colorLine, 0x444444l, 12, this.coronaangle / 30, 0, true);
// draw text
this.img.setColor(this.colorText);
PrintTool.arcPrint(this.img, this.centerX, this.centerY, this.innerradius + linelength, angle, name);
PrintTool.arcPrint(this.img, this.centerX, this.centerY, this.innerradius + linelength, angle, name, 100);
// draw corona around dot for crawling activity
final int ppmx = Math.min(this.seed.getPPM() / 20, 10);

@ -53,7 +53,7 @@ public class Captcha extends RasterPlotter {
for(int i=0;i<chars;i++){
y = random.nextInt(height/2) + (height/4);
setColor(((random.nextInt(128)+64)<<16) + ((random.nextInt(128)+64)<<8) + random.nextInt(128)+64);
PrintTool.print(this, widthPerChar*i+random.nextInt(widthPerChar/2) , y , 0, code.substring(i,i+1), -1);
PrintTool.print(this, widthPerChar*i+random.nextInt(widthPerChar/2) , y , 0, code.substring(i,i+1), -1, 100);
}
//adding some noise

@ -62,11 +62,11 @@ public class ChartPlotter extends RasterPlotter {
//this.foregroundColor = foregroundColor;
if (name != null) {
if (foregroundColor != null) this.setColor(foregroundColor);
PrintTool.print(this, width / 2 - name.length() * 3, 6, 0, name, -1);
PrintTool.print(this, width / 2 - name.length() * 3, 6, 0, name, -1, 100);
}
if (subline != null) {
if (lightColor != null) this.setColor(lightColor);
PrintTool.print(this, width / 2 - subline.length() * 3, 14, 0, subline, -1);
PrintTool.print(this, width / 2 - subline.length() * 3, 14, 0, subline, -1, 100);
}
}
@ -101,7 +101,7 @@ public class ChartPlotter extends RasterPlotter {
final int y = (coord_y - this.offsets[dimension_y]) * this.pixels[dimension_y] / this.scales[dimension_y];
if (dotsize == 1) plot(this.leftborder + x, this.height - this.bottomborder - y, 100);
else dot(this.leftborder + x, this.height - this.bottomborder - y, dotsize, true, 100);
if (anot != null) PrintTool.print(this, this.leftborder + x + dotsize + 2 + ((anotAngle == 315) ? -9 : 0), this.height - this.bottomborder - y + ((anotAngle == 315) ? -3 : 0), anotAngle, anot, (anotAngle == 0) ? (anot.length() * 6 + x > this.width ? 1 : -1) : ((anotAngle == 315) ? 1 : 0));
if (anot != null) PrintTool.print(this, this.leftborder + x + dotsize + 2 + ((anotAngle == 315) ? -9 : 0), this.height - this.bottomborder - y + ((anotAngle == 315) ? -3 : 0), anotAngle, anot, (anotAngle == 0) ? (anot.length() * 6 + x > this.width ? 1 : -1) : ((anotAngle == 315) ? 1 : 0), 100);
}
public void chartLine(final int dimension_x, final int dimension_y, final float coord_x1, final int coord_y1, final float coord_x2, final int coord_y2) {
@ -133,12 +133,12 @@ public class ChartPlotter extends RasterPlotter {
}
setColor(colorNaming);
line(x, y - 3, x, y + 3, 100);
PrintTool.print(this, x, (top) ? y - 3 : y + 9, 0, Integer.toString(s), -1);
PrintTool.print(this, x, (top) ? y - 3 : y + 9, 0, Integer.toString(s), -1, 80);
x += pixelperscale;
s += scale;
}
setColor(colorNaming);
PrintTool.print(this, this.width - this.rightborder, (top) ? y - 9 : y + 15, 0, name, 1);
PrintTool.print(this, this.width - this.rightborder, (top) ? y - 9 : y + 15, 0, name, 1, 80);
line(this.leftborder - 4, y, this.width - this.rightborder + 4, y, 100);
}
@ -170,12 +170,12 @@ public class ChartPlotter extends RasterPlotter {
line(x - 3, y, x + 3, y, 100);
s1 = (s >= 1000000 && s % 10000 == 0) ? Integer.toString(s / 1000000) + "M" : (s >= 1000 && s % 1000 == 0) ? Integer.toString(s / 1000) + "K" : Integer.toString(s);
if (s1.length() > s1max) s1max = s1.length();
PrintTool.print(this, (left) ? this.leftborder - 4 : this.width - this.rightborder + 4, y, 0, s1, (left) ? 1 : -1);
PrintTool.print(this, (left) ? this.leftborder - 4 : this.width - this.rightborder + 4, y, 0, s1, (left) ? 1 : -1, 80);
y -= pixelperscale;
s += scale;
}
setColor(colorNaming);
PrintTool.print(this, (left) ? Math.max(6, x - s1max * 6 - 6) : x + s1max * 6 + 9, this.height - this.bottomborder, 90, name, -1);
PrintTool.print(this, (left) ? Math.max(6, x - s1max * 6 - 6) : x + s1max * 6 + 9, this.height - this.bottomborder, 90, name, -1, 80);
line(x, this.topborder - 4, x, this.height - this.bottomborder + 4, 100);
}

@ -68,7 +68,7 @@ public class DemoApplet extends Applet implements Runnable {
RasterPlotter.demoPaint(m);
final int y = (int) (System.currentTimeMillis() / 10 % 300);
m.setColor(RasterPlotter.GREY);
PrintTool.print(m, 0, y, 0, "Hello World", -1);
PrintTool.print(m, 0, y, 0, "Hello World", -1, 100);
}
}

@ -324,7 +324,7 @@ public class GraphPlotter implements Cloneable {
image.setColor(c.layer == 0 ? color_dot0_l : color_dota_l);
image.dot(x, y, 6, true, 100);
image.setColor(color_text_l);
PrintTool.print(image, x, y + 10, 0, name.toUpperCase(), 0 /*x < 2 * width / 5 ? 1 : x > 3 * width / 5 ? -1 : 0*/);
PrintTool.print(image, x, y + 10, 0, name.toUpperCase(), 0 /*x < 2 * width / 5 ? 1 : x > 3 * width / 5 ? -1 : 0*/, 100);
}
// draw lines

@ -100,13 +100,13 @@ public class HexGridPlotter extends RasterPlotter {
CircleTool.circle(this, projectionX(x, y), projectionY(y), radius, fromArc, toArc);
}
public void gridPrint(final int x, final int y, final int radius, final String messageHigh, final String messageLow, final int align) {
if (messageHigh != null && messageHigh.length() > 0) PrintTool.print(this, projectionX(x, y) - align * radius, projectionY(y) - (cellwidth2 >> 2) - ((align == 0) ? radius : 0), 0, messageHigh, align);
if (messageLow != null && messageLow.length() > 0) PrintTool.print(this, projectionX(x, y) - align * radius, projectionY(y) + (cellwidth2 >> 2) + 4 + ((align == 0) ? radius : 0), 0, messageLow, align);
public void gridPrint(final int x, final int y, final int radius, final String messageHigh, final String messageLow, final int align, int intensity) {
if (messageHigh != null && messageHigh.length() > 0) PrintTool.print(this, projectionX(x, y) - align * radius, projectionY(y) - (cellwidth2 >> 2) - ((align == 0) ? radius : 0), 0, messageHigh, align, intensity);
if (messageLow != null && messageLow.length() > 0) PrintTool.print(this, projectionX(x, y) - align * radius, projectionY(y) + (cellwidth2 >> 2) + 4 + ((align == 0) ? radius : 0), 0, messageLow, align, intensity);
}
public void gridPrint315(final int x, final int y, final int radius, final String message315) {
if (message315 != null && message315.length() > 0) PrintTool.print(this, projectionX(x, y) + (radius >> 1), projectionY(y) + (cellwidth2 >> 2) + 4, 315, message315, -1);
public void gridPrint315(final int x, final int y, final int radius, final String message315, int intensity) {
if (message315 != null && message315.length() > 0) PrintTool.print(this, projectionX(x, y) + (radius >> 1), projectionY(y) + (cellwidth2 >> 2) + 4, 315, message315, -1, intensity);
}
public void gridLine(
@ -150,37 +150,37 @@ public class HexGridPlotter extends RasterPlotter {
picture.drawGrid(gridcolor);
long dotcolori = Long.parseLong(dotcolor, 16);
picture.setColor(dotcolori);
picture.gridDot(0, 0, 5, true, 100); picture.gridPrint(0, 0, 5, "", "0,0", -1);
picture.gridDot(0, 0, 5, true, 100); picture.gridPrint(0, 0, 5, "", "0,0", -1, 100);
for (int i = 1; i < picture.gridHeight() -1; i++) {
picture.setColor(dotcolori);picture.gridDot(0, i, 3, true, 100);
picture.setColor(dotcolori);picture.gridPrint(0, i, 3, "", "0," + i, -1);
picture.setColor(dotcolori);picture.gridPrint(0, i, 3, "", "0," + i, -1, 100);
}
for (int i = 1; i < picture.gridWidth() -1; i++) {
picture.setColor(dotcolori);picture.gridDot(i, 0, 3, true, 100);
picture.setColor(dotcolori);picture.gridPrint315(i, 0, 3, i + ",0");
picture.setColor(dotcolori);picture.gridPrint315(i, 0, 3, i + ",0", 100);
}
picture.setColor(dotcolori);
picture.gridDot(0, picture.gheight - 1, 5, true, 100); picture.gridPrint(0, picture.gheight - 1, 5, "0, grid.gheight - 1", "", -1);
picture.gridDot(picture.gwidth - 1, 0, 5, true, 100); picture.gridPrint(picture.gwidth - 1, 0, 5, "", "grid.gwidth - 1, 0", -1);
picture.gridDot(picture.gwidth - 1, picture.gheight - 1, 5, true, 100); picture.gridPrint(picture.gwidth - 1, picture.gheight - 1, 5, "grid.gwidth - 1, grid.gheight - 1", "", 1);
picture.gridDot(0, picture.gheight - 1, 5, true, 100); picture.gridPrint(0, picture.gheight - 1, 5, "0, grid.gheight - 1", "", -1, 100);
picture.gridDot(picture.gwidth - 1, 0, 5, true, 100); picture.gridPrint(picture.gwidth - 1, 0, 5, "", "grid.gwidth - 1, 0", -1, 100);
picture.gridDot(picture.gwidth - 1, picture.gheight - 1, 5, true, 100); picture.gridPrint(picture.gwidth - 1, picture.gheight - 1, 5, "grid.gwidth - 1, grid.gheight - 1", "", 1, 100);
picture.gridDot(3, 3, 20, 0, 360);
picture.gridDot(7, 5, 5, 0, 360);
picture.gridPrint(7, 5, 8, "COMMUNICATION TEST", "TRANSFER 64KBIT", -1);
picture.gridPrint(7, 5, 8, "COMMUNICATION TEST", "TRANSFER 64KBIT", -1, 100);
picture.gridDot(14, 8, 5, true, 100);
picture.gridLine(7, 5, 14, 8);
picture.gridPrint315(14, 8, 8, "NULL");
picture.gridPrint315(14, 8, 8, "NULL", 100);
picture.gridDot(4, 28, 5, 0, 360);
picture.gridPrint(4, 28, 8, "REVERSE", "ESREVER", -1);
picture.gridPrint(4, 28, 8, "REVERSE", "ESREVER", -1, 100);
picture.gridLine(4, 28, 14, 8);
picture.gridDot(picture.gwidth - 1, picture.gheight - 4, 5, 0, 360);
picture.gridPrint(picture.gwidth - 1, picture.gheight - 4, 5, "INTERNET", "END", 1);
picture.gridPrint(picture.gwidth - 1, picture.gheight - 4, 5, "INTERNET", "END", 1, 100);
picture.gridDot(picture.gwidth / 2, picture.gheight / 2, 5, 0, 360);
picture.gridPrint(picture.gwidth / 2, picture.gheight / 2, 5, "HOME PEER", "ANON_23", 0);
picture.gridPrint(picture.gwidth / 2, picture.gheight / 2, 5, "HOME PEER", "ANON_23", 0, 100);
//grid.gridLine(grid.gwidth - 2, grid.gheight - 2, grid.gwidth / 2, grid.gheight / 2);
picture.gridLine(picture.gwidth / 2, picture.gheight / 2, picture.gwidth - 1, picture.gheight - 4);
return picture;

@ -39,20 +39,23 @@ public class PrintTool {
0x0000000EC2E0ECL,0x0000000EC2E030L,0x0000000FF2E3FCL,0x000F0B8B80B80FL,0x00300C0300C030L,0x03C0B80B8B83C0L,0x0000B83BB0B800L,0x03FFC0F03C0FFFL
};
private static void print(final RasterPlotter matrix, int x, int y, final int angle, final char letter) {
private static void print(final RasterPlotter matrix, int x, int y, final int angle, final char letter, int intensity) {
final int index = letter - 0x20;
if (index >= font.length) return;
long character = font[index];
long row;
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;
if (angle == 0) {
for (int j = 0; j < 5; j++) {
c = row & 3L;
if (c == 3) matrix.plot(x + 5 - j, y, 100);
else if (c == 2) matrix.plot(x + 5 - j, y, 36);
if (c == 3) matrix.plot(x + 5 - j, y, intensity);
else if (c == 2) matrix.plot(x + 5 - j, y, i3);
row = row >> 2;
}
y--;
@ -60,8 +63,8 @@ public class PrintTool {
if (angle == 90) {
for (int j = 0; j < 5; j++) {
c = row & 3L;
if (c == 3) matrix.plot(x, y - 5 + j, 100);
else if (c == 2) matrix.plot(x, y - 5 + j, 36);
if (c == 3) matrix.plot(x, y - 5 + j, intensity);
else if (c == 2) matrix.plot(x, y - 5 + j, i3);
row = row >> 2;
}
x--;
@ -69,8 +72,8 @@ public class PrintTool {
if (angle == 315) {
for (int j = 0; j < 5; j++) {
c = row & 3L;
if (c == 3) { matrix.plot(x + 5 - j, y + 5 - j, 100); matrix.plot(x + 6 - j, y + 5 - j, 50); matrix.plot(x + 5 - j, y + 6 - j, 50); }
else if (c == 2) { matrix.plot(x + 5 - j, y + 5 - j, 36); matrix.plot(x + 6 - j, y + 5 - j, 18); matrix.plot(x + 5 - j, y + 6 - j, 18); }
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;
}
x++;
@ -79,7 +82,7 @@ public class PrintTool {
}
}
public static void print(final RasterPlotter matrix, final int x, final int y, final int angle, final String message, final int align) {
public static void print(final RasterPlotter matrix, final int x, final int y, final int angle, final String message, final int align, int intensity) {
// align = -1 : left
// align = 1 : right
// align = 0 : center
@ -95,7 +98,7 @@ public class PrintTool {
yy = (align == -1) ? y : (align == 1) ? y - 6 * message.length() : y - 3 * message.length();
}
for (int i = 0; i < message.length(); i++) {
print(matrix, xx, yy, angle, message.charAt(i));
print(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;}
@ -113,7 +116,7 @@ public class PrintTool {
* @param angle angle == position of text on a circle in distance of radius
* @param message the message to be printed
*/
public static void arcPrint(final RasterPlotter matrix, final int cx, final int cy, final int radius, final double angle, final String message) {
public static void arcPrint(final RasterPlotter matrix, final int cx, final int cy, final int radius, final double angle, final String message, final int intensity) {
final int x = cx + (int) ((radius + 1) * Math.cos(RasterPlotter.PI180 * angle));
final int y = cy - (int) ((radius + 1) * Math.sin(RasterPlotter.PI180 * angle));
int yp = y + 3;
@ -124,7 +127,7 @@ public class PrintTool {
int xp = x - 3 * message.length();
if ((angle > (90 + arcDist)) && (angle < (270 - arcDist))) xp = x - 6 * message.length();
if ((angle < (90 - arcDist)) || (angle > (270 + arcDist))) xp = x;
print(matrix, xp, yp, 0, message, -1);
print(matrix, xp, yp, 0, message, -1, intensity);
}

@ -507,7 +507,7 @@ public class RasterPlotter {
}
/**
* draw a connecting line between two points o a circle
* draw a connecting line between two points on a circle
* @param cx center of circle, x
* @param cy center of circle, y
* @param arcRadius radius of circle
@ -526,7 +526,7 @@ public class RasterPlotter {
public void arcConnect(final int cx, final int cy, final int arcRadius, final double angle1, final double angle2, final boolean in,
final Long colorLine, final int intensityLine,
final Long colorDot, final int intensityDot, final int dotDist, final int dotPos, final int dotRadius, final boolean dotFilled,
final String message, final Long colorMessage) {
final String message, final Long colorMessage, final int intensityMessage) {
final double a1 = PI180 * angle1;
final double a2 = PI180 * angle2;
// find positions of points
@ -552,7 +552,7 @@ public class RasterPlotter {
if (ym < cy) ym += 6; else ym -=6;
if (xm < cx) xm += 6; else xm -=6;
if (xm > cx) xm -= 6 * message.length();
PrintTool.print(this, xm, ym, 0, message.toUpperCase(), -1);
PrintTool.print(this, xm, ym, 0, message.toUpperCase(), -1, intensityMessage);
}
}
@ -852,16 +852,16 @@ public class RasterPlotter {
public static void demoPaint(final RasterPlotter m) {
m.setColor(GREY);
m.line(0, 70, 100, 70, 100); PrintTool.print(m, 0, 65, 0, "Grey", -1);
m.line(0, 70, 100, 70, 100); PrintTool.print(m, 0, 65, 0, "Grey", -1, 100);
m.line(65, 0, 65, 300, 100);
m.setColor(RED);
m.line(0, 90, 100, 90, 100); PrintTool.print(m, 0, 85, 0, "Red", -1);
m.line(0, 90, 100, 90, 100); PrintTool.print(m, 0, 85, 0, "Red", -1, 100);
m.line(70, 0, 70, 300, 100);
m.setColor(GREEN);
m.line(0, 110, 100, 110, 100); PrintTool.print(m, 0, 105, 0, "Green", -1);
m.line(0, 110, 100, 110, 100); PrintTool.print(m, 0, 105, 0, "Green", -1, 100);
m.line(75, 0, 75, 300, 100);
m.setColor(BLUE);
m.line(0, 130, 100, 130, 100); PrintTool.print(m, 0, 125, 0, "Blue", -1);
m.line(0, 130, 100, 130, 100); PrintTool.print(m, 0, 125, 0, "Blue", -1, 100);
m.line(80, 0, 80, 300, 100);
}

Loading…
Cancel
Save