Esempio n. 1
0
 /**
  * Basic nonparametric usage of canny edge detector. No thresholding is used.
  *
  * @param original input image
  */
 public CCannyEdgeDetector(BufferedImage original) {
   size = new Dimension(original.getWidth(), original.getHeight());
   input = original.getData();
   image =
       new BufferedImage(
           (int) size.getWidth(), (int) size.getHeight(), BufferedImage.TYPE_INT_RGB);
   bands = original.getSampleModel().getNumBands();
 }
Esempio n. 2
0
  @Override
  public void paintDone(PlanarImage image, Rectangle visibleRect, boolean synchronous, long time) {
    if (image == null) return;

    Dimension previewDimension = getSize();
    if ((previewDimension.getHeight() > 1) && (previewDimension.getWidth() > 1)) {
      this.visibleRect = visibleRect;
      currentImage = new SoftReference<PlanarImage>(image);
      preview = null;
      repaint();
    }
  }
Esempio n. 3
0
  @Override
  protected BufferedImage doInBackground() {
    int x, y, b;
    int[] A = null;
    int[] sum = new int[bands], sum_x = new int[bands], sum_y = new int[bands];
    WritableRaster raster = image.getRaster();

    for (x = 0; x < size.getWidth(); x++) {
      for (y = 0; y < size.getHeight(); y++) {
        if (y == 0 || y == size.getHeight() - 1 || x == 0 || x == size.getWidth() - 1) {
          for (b = 0; b < bands; b++) {
            sum[b] = 0;
          }
        } else {
          for (b = 0; b < bands; b++) {
            A =
                input.getSamples(
                    x - 1, y - 1, CSobelOperator.matrix_size, CSobelOperator.matrix_size, b, A);
            sum_x[b] = CSobelOperator.getGx(A);
            sum_y[b] = CSobelOperator.getGy(A);
          }

          for (b = 0; b < bands; b++) {
            sum[b] = Math.abs(sum_x[b]) + Math.abs(sum_y[b]);
          }
        }
        raster.setPixel(x, y, sum);
        setProgress(
            100
                * (x * ((int) size.getHeight()) + y)
                / ((int) (size.getWidth() * size.getHeight())));
      }
    }
    image.setData(raster);
    return image;
  }
  public NetworkMapPanel(Hacker hacker, MapPanel mapPanel) {

    Dimension mapsize = mapPanel.networkPanel.getSize();
    double h = mapsize.getHeight();
    System.out.println(h);
    float multi = 400;
    HashMap<String, NetworkButton> networks = new HashMap<String, NetworkButton>();
    networks.put(
        "UGOPNet",
        new NetworkButton(
            "UGOPNet",
            3.0f,
            2.25f,
            1.1f,
            new Color(0, 0, 204),
            "images/browserhome.png",
            hacker,
            multi));
    networks.put(
        "SubNet",
        new NetworkButton(
            "SubNet", 3.0f, 3.5f, 1, new Color(0, 0, 150), "images/down.png", hacker, multi));
    networks.put(
        "ProgNet",
        new NetworkButton(
            "ProgNet", 3.5f, 3.0f, 1, new Color(0, 0, 150), "images/script.png", hacker, multi));
    networks.put(
        "DarkNet",
        new NetworkButton(
            "DarkNet", 3.0f, 4.0f, 0.9f, new Color(50, 50, 50), "images/exit.png", hacker, multi));
    networks.put(
        "LunarMicrosystems",
        new NetworkButton(
            "LunarMicrosystems",
            2,
            4.5f,
            1,
            new Color(0, 153, 255),
            "images/cpu.png",
            hacker,
            multi));
    networks.put(
        "DoSC",
        new NetworkButton(
            "DoSC", 2.25f, 3.25f, 1, new Color(0, 0, 204), "images/firewall.png", hacker, multi));
    networks.put(
        "DTNet",
        new NetworkButton(
            "DTNet",
            2.0f,
            2.0f,
            1,
            new Color(100, 100, 100),
            "images/ducttape.png",
            hacker,
            multi));
    networks.put(
        "GeNet",
        new NetworkButton(
            "GeNet",
            1.0f,
            2.0f,
            1,
            new Color(100, 100, 100),
            "images/germanium.png",
            hacker,
            multi));
    networks.put(
        "SiNet",
        new NetworkButton(
            "SiNet", 1.0f, 3.0f, 1, new Color(100, 100, 100), "images/silicon.png", hacker, multi));
    networks.put(
        "YBCONet",
        new NetworkButton(
            "YBCONet", 0.5f, 2.5f, 1, new Color(100, 100, 100), "images/YBCO.png", hacker, multi));
    networks.put(
        "PuNet",
        new NetworkButton(
            "PuNet",
            0,
            2.0f,
            0.8f,
            new Color(100, 100, 100),
            "images/plutonium.png",
            hacker,
            multi));
    networks.put(
        "UND",
        new NetworkButton(
            "UND", 3.5f, 3.5f, 1, new Color(0, 0, 204), "images/firewall.png", hacker, multi));
    networks.put(
        "UniversityNet",
        new NetworkButton(
            "UniversityNet",
            4.5f,
            2.0f,
            1.0f,
            new Color(0, 0, 204),
            "images/browser.png",
            hacker,
            multi));
    networks.put(
        "DoSCDataBank",
        new NetworkButton(
            "DoSCDatabank",
            1.75f,
            2.5f,
            1.3f,
            new Color(0, 0, 204),
            "images/compile.png",
            hacker,
            multi));
    networks.put(
        "DoSCBank",
        new NetworkButton(
            "DoSCBank", 2.5f, 2.0f, 1, new Color(0, 0, 204), "images/bank.png", hacker, multi));
    networks.put(
        "ArenaNet",
        new NetworkButton(
            "ArenaNet", 4.5f, 3.0f, 1, new Color(204, 0, 0), "images/attack.png", hacker, multi));
    networks.put(
        "TheArena",
        new NetworkButton(
            "TheArena", 4.0f, 4.0f, 1, new Color(204, 0, 0), "images/attack.png", hacker, multi));
    networks.put(
        "LunarCreditUnion",
        new NetworkButton(
            "LunarCreditUnion",
            2.5f,
            4,
            1,
            new Color(0, 153, 255),
            "images/pettycash.png",
            hacker,
            multi));
    networks.put(
        "SpyNet",
        new NetworkButton(
            "SpyNet",
            3.0f,
            4.0f,
            1,
            new Color(200, 200, 200),
            "images/watchIcon.png",
            hacker,
            multi));
    networks.put(
        "LunarDatabank",
        new NetworkButton(
            "LunarDatabank",
            1.0f,
            4.5f,
            1.4f,
            new Color(0, 153, 255),
            "images/bank.png",
            hacker,
            multi));
    networks.put(
        "LunarCorporate",
        new NetworkButton(
            "LunarCorporate", 0, 6.0f, 1, new Color(0, 153, 255), "images/hd.png", hacker, multi));
    networks.put(
        "LunarLabs",
        new NetworkButton(
            "LunarLabs",
            2.5f,
            5.0f,
            1,
            new Color(0, 153, 255),
            "images/repair.png",
            hacker,
            multi));
    networks.put(
        "LunarSpecOps",
        new NetworkButton(
            "LunarSpecOps",
            1f,
            6.0f,
            1,
            new Color(0, 153, 255),
            "images/watchIcon.png",
            hacker,
            multi));
    networks.put(
        "LunarSat",
        new NetworkButton(
            "LunarSat", 0.25f, 5.0f, 1, new Color(0, 153, 255), "images/scan.png", hacker, multi));
    networks.put(
        "LunarColonies",
        new NetworkButton(
            "LunarColonies",
            1.0f,
            5.5f,
            1,
            new Color(0, 153, 255),
            "images/new.png",
            hacker,
            multi));
    networks.put(
        "UGoPIntranet",
        new NetworkButton(
            "UGoPIntranet", 2.5f, 1, 1, new Color(0, 0, 204), "images/http.png", hacker, multi));
    networks.put(
        "UGoPCorporate",
        new NetworkButton(
            "UGoPCorporate", 3.0f, 0, 1, new Color(0, 0, 204), "images/hd.png", hacker, multi));
    networks.put(
        "UGoPDatabank",
        new NetworkButton(
            "UGoPDatabank",
            2.75f,
            1.5f,
            1.2f,
            new Color(0, 0, 204),
            "images/compile.png",
            hacker,
            multi));
    networks.put(
        "UGoPVault",
        new NetworkButton(
            "UGoPVault", 3.0f, 1.0f, 1, new Color(0, 0, 204), "images/bank.png", hacker, multi));
    networks.put(
        "TerrorNet",
        new NetworkButton(
            "TerrorNet",
            5.5f,
            5.0f,
            0.9f,
            new Color(204, 0, 0),
            "images/refresh.png",
            hacker,
            multi));
    networks.put(
        "TerrorStash",
        new NetworkButton(
            "TerrorStash", 4.5f, 4.5f, 1, new Color(204, 0, 0), "images/bank.png", hacker, multi));
    networks.put(
        "TerrorWeaponsNet",
        new NetworkButton(
            "TerrorWeaponsNet",
            5.0f,
            4.0f,
            1,
            new Color(204, 0, 0),
            "images/attack.png",
            hacker,
            multi));
    networks.put(
        "TerrorLeaders",
        new NetworkButton(
            "TerrorLeaders",
            6,
            6.0f,
            0.75f,
            new Color(204, 0, 0),
            "images/firewall.png",
            hacker,
            multi));
    networks.put(
        "InnerCircle",
        new NetworkButton(
            "InnerCircle",
            6,
            0,
            0.5f,
            new Color(150, 0, 100),
            "images/decompile.png",
            hacker,
            multi));
    networks.put(
        "LawNet",
        new NetworkButton(
            "LawNet",
            4.0f,
            1.5f,
            0.75f,
            new Color(150, 0, 100),
            "images/redirect.png",
            hacker,
            multi));
    networks.put(
        "GroundZero",
        new NetworkButton(
            "GroundZero",
            3.0f,
            5.5f,
            1,
            new Color(200, 200, 200),
            "images/ports.png",
            hacker,
            multi));
    networks.put(
        "Wastelands",
        new NetworkButton(
            "Wastelands",
            3.5f,
            4.5f,
            1.2f,
            new Color(204, 0, 0),
            "images/attack.png",
            hacker,
            multi));
    networks.put(
        "JuniperPenetentiary",
        new NetworkButton(
            "JuniperPenetentiary",
            7,
            0,
            0.75f,
            new Color(150, 0, 100),
            "images/firewall.png",
            hacker,
            multi));

    this.nodeList = networks;
    this.hacker = hacker;
    this.mapPanel = mapPanel;
    try {
      back = ImageLoader.getImage("images/NetMapFull.png");
    } catch (Exception e) {
    }
    setLayout(null);
    setBackground(MapPanel.NETWORK_INFO_BACKGROUND);
    setPreferredSize(new Dimension(back.getWidth(), back.getHeight()));

    populate();
  }