Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) New methods to insert bitmaps that feature transparencies. *) Logo background is transparent now. (Using pixel at (0,0) to determine which color is transparent. Too dirty?) *) Logo is loaded through filesystem instead of HTTP now.
low01276cd6ed6f6b4
diff --git a/htroot/Banner.java b/htroot/Banner.javaindex 3f29e9b2b..65d74a083 100644--- a/htroot/Banner.java+++ b/htroot/Banner.java@@ -46,9 +46,6 @@import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaGrafics;-import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.server.serverCore;-import de.anomic.server.serverDomains;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.ymage.ymageMatrix;@@ -56,8 +53,8 @@ import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacySeed;import java.awt.image.BufferedImage;+import java.io.File;import java.io.IOException;-import java.net.URL;import javax.imageio.ImageIO;/** draw a banner with information about the peer */@@ -65,7 +62,7 @@ public class Banner {public static ymageMatrix respond(httpHeader header, serverObjects post, serverSwitch env) throws IOException {- final String IMAGE = "env/grafics/yacy.gif";+ final String IMAGE = "htroot/env/grafics/yacy.gif";int width = 468;int height = 60;String bgcolor = plasmaGrafics.COL_BACKGROUND;@@ -126,11 +123,7 @@ public class Banner {}if (!plasmaGrafics.logoIsLoaded()) {- plasmaSwitchboard switchboard = (plasmaSwitchboard)env;- int port = serverCore.getPortNr(switchboard.getConfig("port", "8080"));- String host = serverDomains.myPublicLocalIP().getHostAddress();- BufferedImage logo = ImageIO.read(new URL("http://"+host+":"+port+"/"+IMAGE));- //BufferedImage logo = ImageIO.read(new File(IMAGE));+ BufferedImage logo = ImageIO.read(new File(IMAGE));return plasmaGrafics.getBannerPicture(1000, width, height, bgcolor, textcolor, bordercolor, name, links, words, type, myppm, network, nlinks, nwords, nqph, nppm, logo);}diff --git a/source/de/anomic/plasma/plasmaGrafics.java b/source/de/anomic/plasma/plasmaGrafics.javaindex f6b3be98a..5e2da543d 100644--- a/source/de/anomic/plasma/plasmaGrafics.java+++ b/source/de/anomic/plasma/plasmaGrafics.java@@ -396,7 +396,7 @@ public class plasmaGrafics {if (logo != null) {int x = (int)(100/2 - logo.getWidth()/2);int y = (int)(height/2 - logo.getHeight()/2);- bannerPicture.insertBitmap(logo, x, y);+ bannerPicture.insertBitmap(logo, x, y, 0, 0);}if (!bordercolor.equals("")) {diff --git a/source/de/anomic/ymage/ymageMatrix.java b/source/de/anomic/ymage/ymageMatrix.javaindex 1c48a9df2..b9787b1dd 100644--- a/source/de/anomic/ymage/ymageMatrix.java+++ b/source/de/anomic/ymage/ymageMatrix.java@@ -264,20 +264,51 @@ public class ymageMatrix /*implements Cloneable*/ {* @author Marc Nause*/public void insertBitmap(BufferedImage bitmap, int x, int y) {+ insertBitmap(bitmap, x, y, -1);+ }++ /**+ * inserts an image into the ymageMatrix where all pixels that have the same RGB value as the+ * pixel at (xx, yy) are transparent+ * @param bitmap the bitmap to be inserted+ * @param x the x value of the upper left coordinate in the ymageMatrix where the bitmap will be placed+ * @param y the y value of the upper left coordinate in the ymageMatrix where the bitmap will be placed+ * @param xx the x value of the pixel that determines which color is transparent+ * @param yy the y value of the pixel that determines which color is transparent+ * @author Marc Nause+ */+ public void insertBitmap(BufferedImage bitmap, int x, int y, int xx, int yy) {+ insertBitmap(bitmap, x, y, bitmap.getRGB(xx, yy));+ }++ /**+ * inserts an image into the ymageMatrix where all pixels that have a special RGB value+ * pixel at (xx, yy) are transparent+ * @param bitmap the bitmap to be inserted+ * @param x the x value of the upper left coordinate in the ymageMatrix where the bitmap will be placed+ * @param y the y value of the upper left coordinate in the ymageMatrix where the bitmap will be placed+ * @param rgb the RGB value that will be transparent+ * @author Marc Nause+ */+ public void insertBitmap(BufferedImage bitmap, int x, int y, int transRGB) {int heightSrc = bitmap.getHeight();int widthSrc = bitmap.getWidth();int heightTgt = image.getHeight();int widthTgt = image.getWidth();+ int rgb;for (int i = 0; i < heightSrc; i++) {for (int j = 0; j < widthSrc; j++) {// pixel in legal area?if (j+x >= 0 && i+y >= 0 && i+y < heightTgt && j+x < widthTgt) {- image.setRGB(j+x, i+y, bitmap.getRGB(j, i));+ rgb = bitmap.getRGB(j, i);+ if (rgb != transRGB) {+ image.setRGB(j+x, i+y, rgb);+ }}}}- }+ }public static void demoPaint(ymageMatrix m) {m.setColor(SUBTRACTIVE_CYAN);