public TestType1CFont(InputStream is) throws IOException {
   super();
   setPreferredSize(new Dimension(800, 800));
   addKeyListener(this);
   BufferedInputStream bis = new BufferedInputStream(is);
   int count = 0;
   ArrayList<byte[]> al = new ArrayList<byte[]>();
   byte b[] = new byte[32000];
   int len;
   while ((len = bis.read(b, 0, b.length)) >= 0) {
     byte[] c = new byte[len];
     System.arraycopy(b, 0, c, 0, len);
     al.add(c);
     count += len;
     b = new byte[32000];
   }
   data = new byte[count];
   len = 0;
   for (int i = 0; i < al.size(); i++) {
     byte from[] = al.get(i);
     System.arraycopy(from, 0, data, len, from.length);
     len += from.length;
   }
   pos = 0;
   //	printData();
   parse();
   // TODO: free up (set to null) unused structures (data, subrs, stack)
 }
Ejemplo n.º 2
0
 public static void tests() {
   System.err.println("HEY!");
   Mat p0 = Mat.encodePoint(0, 0);
   Mat p1 = Mat.encodePoint(1, .1);
   Mat p2 = Mat.encodePoint(.1, 1);
   Mat p3 = Mat.encodePoint(-1, -.1);
   Mat p4 = Mat.encodePoint(-.1, -1);
   Mat p5 = Mat.encodePoint(0.0001, 0);
   Mat p6 = Mat.encodePoint(-0.0001, 0);
   if (!lineSegIntersect(p1, p3, p2, p4)) {
     try {
       throw new Exception();
     } catch (Exception e) {
       e.printStackTrace();
       System.err.println("hey there");
       System.exit(1);
     }
   }
   if (lineSegIntersect(p1, p4, p2, p3)) {
     try {
       throw new Exception();
     } catch (Exception e) {
       e.printStackTrace();
       System.err.println("hey there");
       System.exit(1);
     }
   }
   if (lineSegIntersect(p1, p5, p2, p4)) {
     try {
       throw new Exception();
     } catch (Exception e) {
       e.printStackTrace();
       System.err.println("hey there");
       System.exit(1);
     }
   }
   if (!lineSegIntersect(p1, p6, p2, p4)) {
     try {
       throw new Exception();
     } catch (Exception e) {
       e.printStackTrace();
       System.err.println("hey there");
       System.exit(1);
     }
   }
   Mat inter = lineSegIntersection(p1, p3, p2, p4);
   if (inter.data[0][0] != 0 || inter.data[1][0] != 0) {
     try {
       throw new Exception();
     } catch (Exception e) {
       e.printStackTrace();
       System.err.println("hey there");
       System.exit(1);
     }
   }
 }
Ejemplo n.º 3
0
  public static void main(String[] args) {
    long start = System.currentTimeMillis();

    while (in.hasNext()) solve();
    out.flush();

    long end = System.currentTimeMillis();
    // trace(end-start + "ms");
    in.close();
    out.close();
  }
Ejemplo n.º 4
0
  public static void main(String[] args) throws Exception {
    long start = System.currentTimeMillis();

    solve();
    out.flush();

    long end = System.currentTimeMillis();
    // trace(end-start + "ms");
    br.close();
    out.close();
  }
Ejemplo n.º 5
0
 /**
  * With segmented selections, ignore first mouse up and finalize when user double-clicks,
  * control-clicks or clicks in start box.
  */
 protected void handleMouseUp(int sx, int sy) {
   if (state == MOVING) {
     state = NORMAL;
     return;
   }
   if (state == MOVING_HANDLE) {
     cachedMask = null; // mask is no longer valid
     state = NORMAL;
     updateClipRect();
     oldX = x;
     oldY = y;
     oldWidth = width;
     oldHeight = height;
     return;
   }
   if (state != CONSTRUCTING) return;
   if (IJ.spaceBarDown()) // is user scrolling image?
   return;
   boolean samePoint = false;
   if (xpf != null)
     samePoint = (xpf[nPoints - 2] == xpf[nPoints - 1] && ypf[nPoints - 2] == ypf[nPoints - 1]);
   else samePoint = (xp[nPoints - 2] == xp[nPoints - 1] && yp[nPoints - 2] == yp[nPoints - 1]);
   Rectangle biggerStartBox =
       new Rectangle(ic.screenXD(startXD) - 5, ic.screenYD(startYD) - 5, 10, 10);
   if (nPoints > 2
       && (biggerStartBox.contains(sx, sy)
           || (ic.offScreenXD(sx) == startXD && ic.offScreenYD(sy) == startYD)
           || (samePoint && (System.currentTimeMillis() - mouseUpTime) <= 500))) {
     nPoints--;
     addOffset();
     finishPolygon();
     return;
   } else if (!samePoint) {
     mouseUpTime = System.currentTimeMillis();
     if (type == ANGLE && nPoints == 3) {
       addOffset();
       finishPolygon();
       return;
     }
     // add point to polygon
     if (xpf != null) {
       xpf[nPoints] = xpf[nPoints - 1];
       ypf[nPoints] = ypf[nPoints - 1];
       nPoints++;
       if (nPoints == xpf.length) enlargeArrays();
     } else {
       xp[nPoints] = xp[nPoints - 1];
       yp[nPoints] = yp[nPoints - 1];
       nPoints++;
       if (nPoints == xp.length) enlargeArrays();
     }
     // if (lineWidth>1) fitSpline();
   }
 }
Ejemplo n.º 6
0
  private void drawAWP(Graphics g, int x, int y) {
    if (System.currentTimeMillis() < shotTime + TAWP.SHOOT_TIME) {
      // System.out.println(true);
      double multi = 1.0 * (System.currentTimeMillis() - shotTime) / TAWP.SHOOT_TIME;
      g.setColor(new Color(255, 255, 255, 255 - (int) (multi * 256)));
      g.fillRect(0, 0, Wuigi.screenWidth, Wuigi.screenHeight);
    }
    if (numBullets <= 0) return;

    BufferedImage img = TAWP.IMAGE.getBuffer();
    AffineTransform xform = new AffineTransform();
    // g2d.setPaint(new TexturePaint(figureOutDrawImage(),
    //		new Rectangle2D.Float(0, 0, 32, 32)));
    // g2d.drawImage(figureOutDrawImage(),0,0,null);
    xform.setToIdentity();
    xform.translate(x - 5, y);

    double diffY = y + height / 2 - ScreenManager.mouse.y;
    double diffX = ScreenManager.mouse.x - x - width / 2;

    double angle;

    if (diffY > 0 && diffX > 0) {
      angle = Math.PI / 2 - Math.atan(diffY / diffX);
    } else if (diffY == 0 && diffX > 0) {
      angle = Math.PI / 2;
    } else if (diffY < 0 && diffX > 0) {
      angle = Math.PI / 2 + Math.atan(-diffY / diffX);
    } else if (diffY < 0 && diffX == 0) {
      angle = Math.PI;
    } else if (diffY < 0 && diffX < 0) {
      angle = 3 * Math.PI / 2 - Math.atan(diffY / diffX);
    } else if (diffY == 0 && diffX < 0) {
      angle = 3 * Math.PI / 2;
    } else if (diffY > 0 && diffX < 0) {
      angle = 3 * Math.PI / 2 + Math.atan(-diffY / diffX);
    } else {
      angle = 0;
    }
    angle -= Math.PI / 2;

    if (angle > Math.PI / 2 && angle < 3 * Math.PI / 2) {
      xform.scale(1, -1);
      xform.translate(0, -TAWP.IMAGE.getHeight());
      angle = -angle;
    }
    // xform.scale(/*width/img.getWidth(),height/img.getHeight()*/);
    xform.rotate(angle, 27, 13);

    ((Graphics2D) g).drawImage(img, xform, null);
    ammo.setPos(x + 10, y - 20);
    ammo.draw(g);
  }
Ejemplo n.º 7
0
Archivo: B.java Proyecto: t8m8/AtCoder
  public static void main(String[] args) {
    debug = args.length > 0;
    long start = System.currentTimeMillis();

    solve();
    out.flush();

    long end = System.currentTimeMillis();
    dump((end - start) + "ms");
    in.close();
    out.close();
  }
Ejemplo n.º 8
0
 void showFrameRate(Graphics g) {
   frames++;
   if (System.currentTimeMillis() > firstFrame + 1000) {
     firstFrame = System.currentTimeMillis();
     fps = frames;
     frames = 0;
   }
   g.setColor(Color.white);
   g.fillRect(10, 12, 50, 15);
   g.setColor(Color.black);
   g.drawString((int) (fps + 0.5) + " fps", 10, 25);
 }
Ejemplo n.º 9
0
  public static void main(String[] args) {
    debug = args.length > 0;
    long start = System.nanoTime();

    solve();
    out.flush();

    long end = System.nanoTime();
    dump((end - start) / 1000000 + " ms");
    in.close();
    out.close();
  }
Ejemplo n.º 10
0
 private void chkFPS() {
   if (fpsCount == 0) {
     fpsTime = System.currentTimeMillis() / 1000;
     fpsCount++;
     return;
   }
   fpsCount++;
   long time = System.currentTimeMillis() / 1000;
   if (time != fpsTime) {
     lastFPS = fpsCount;
     fpsCount = 1;
     fpsTime = time;
   }
 }
Ejemplo n.º 11
0
  public void handleImage() {
    while (true) {
      Image src = null;
      try {
        src = new Image(visionImage.take(), width, height);
      } catch (InterruptedException e) {
        e.printStackTrace();
        continue;
      }

      // Apply Blob Track to Image
      Image dest = new Image(src);
      blobTrack.apply(src, dest);

      OdometryMsg msg = new OdometryMsg();

      if (LOCALIZE && System.currentTimeMillis() - last_localization > LOCALIZATION_INTERVAL) {
        ResetMsg stop_msg = new ResetMsg();
        stop_msg.reset = false;
        stopPub.publish(stop_msg);

        Point2D.Double curr_point;
        synchronized (localization) {
          curr_point = localization.localize(odo_x, odo_y, blobTrack.fiducials);
        }
        msg.x = curr_point.x;
        msg.y = curr_point.y;

        last_localization = System.currentTimeMillis();
      } else {
        msg.x = odo_x;
        msg.y = odo_y;
      }
      msg.theta = odo_theta;
      localPub.publish(msg);

      // Update newly formed vision message
      gui.setVisionImage(dest.toArray(), width, height);

      try {
        Thread.sleep(1000);
      } catch (Exception exc) {
        exc.printStackTrace();
      }

      ResetMsg stop_msg = new ResetMsg();
      stop_msg.reset = true;
      stopPub.publish(stop_msg);
    }
  }
Ejemplo n.º 12
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == m_bGameStart) {
      isGameStart = true;
      isGameHalt = false;
      isGameOver = false;
      m_bGameStart.setEnabled(false);
      m_bGameHalt.setEnabled(true);
      setNextReady(true);
    } else if (e.getSource() == m_bGameHalt) {
      m_bGameHalt.setEnabled(false);
      m_bGameStart.setEnabled(true);
      isGameHalt = true;
      m_bGameStart.setText("continue");
    } else if (e.getSource() == m_bGameOver) {
      isGameStart = false;
      isGameOver = true;
      //// System.out.println("ok \n");
      System.exit(0);
    }

    // if is voice control
    else if (e.getSource() == m_bVoiceControl) {
      if (m_bVoiceControl.getText().equalsIgnoreCase("Voice control")) {
        m_bVoiceControl.setText("Cancel VC");
        // start voice control
        TetrisControl tc = new TetrisControl(this);
        tc.start();
      } else {
        m_bVoiceControl.setText("Voice control");
      }
    }
  }
Ejemplo n.º 13
0
 public void actionPerformed(ActionEvent ev) {
   if (ev.getSource() == newg) {
     dialog.hide();
     resetBoard();
   }
   if (ev.getSource() == quitg) System.exit(0);
 }
Ejemplo n.º 14
0
 void resetMaxBounds() {
   ImageWindow win = imp.getWindow();
   if (win != null && (System.currentTimeMillis() - win.setMaxBoundsTime) > 500L) {
     win.setMaximizedBounds(win.maxWindowBounds);
     maxBoundsReset = true;
   }
 }
Ejemplo n.º 15
0
 public static void main(String[] args) {
   try {
     // The image is loaded either from this
     //   default filename or the first command-
     //   line argument.
     // The second command-line argument specifies
     //   what string will be displayed. The third
     //   specifies at what point in the string the
     //   background color will change.
     String filename = "Raphael.jpg";
     String message = "Java2D";
     int split = 4;
     if (args.length > 0) filename = args[0];
     if (args.length > 1) message = args[1];
     if (args.length > 2) split = Integer.parseInt(args[2]);
     ApplicationFrame f = new ApplicationFrame("ShowOff v1.0");
     f.setLayout(new BorderLayout());
     ShowOff showOff = new ShowOff(filename, message, split);
     f.add(showOff, BorderLayout.CENTER);
     f.setSize(f.getPreferredSize());
     f.center();
     f.setResizable(false);
     f.setVisible(true);
   } catch (Exception e) {
     System.out.println(e);
     System.exit(0);
   }
 }
 ////////////////////////////////////////////////////////////////////////////
 // Paint
 //
 public synchronized void paint(Graphics g) {
   Graphics2D g2 = (Graphics2D) g;
   // Graphics2D buffGraphics2 = (Graphics2D) buffGraphics;
   //    g2.drawImage(bImage, 3, 3, getWidth() - 3, getHeight() - 3,
   //        0, 0, iWidth, iHeight, null);
   g2.drawImage(bImage, 0, 0, iWidth, iHeight, null);
   g2.drawString(String.valueOf(System.currentTimeMillis()), 10, 10);
 }
Ejemplo n.º 17
0
  private BufferedImage figureOutDrawImage(Sprite[] imgs) {

    Sprite img;
    if (dead) {
      return imgs[5].getBuffer();
    }

    if (Math.abs((int) (vel.y * 100)) > 0 && !piped) {
      img = imgs[1];
    } else if (!(movingRight || movingLeft) && vel.x == 0) img = imgs[0];
    else {
      if (movingRight && vel.x < 0 || movingLeft && vel.x > 0) img = imgs[4];
      else {
        if (rightFoot) img = imgs[3];
        else img = imgs[2];
      }
    }

    if (star && (starTime < 8000 / 15 || System.currentTimeMillis() % 60 > 30)) {
      int width = img.getBuffer().getWidth(), height = img.getBuffer().getHeight();
      Sprite limg = new Sprite(img.getBuffer());
      for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
          Color pixel = limg.getPixel(x, y);
          if (pixel.getAlpha() != 0) {
            limg.setPixel(
                x,
                y,
                new Color(
                    255 - pixel.getRed(),
                    255 - pixel.getGreen(),
                    255 - pixel.getBlue(),
                    pixel.getAlpha()));
          }
        }
      }
      img = limg;
    } else if (metal) {
      int width = img.getBuffer().getWidth(), height = img.getBuffer().getHeight();
      Sprite limg = new Sprite(img.getBuffer());
      for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
          Color pixel = limg.getPixel(x, y);
          if (pixel.getAlpha() != 0) {
            int gray = (pixel.getRed() + pixel.getBlue() + pixel.getGreen()) / 3;
            limg.setPixel(x, y, new Color(gray, gray, gray, pixel.getAlpha()));
          }
        }
      }
      img = limg;
    }

    if (facingRight) {
      return img.flipX();
    } else {
      return img.getBuffer();
    }
  }
Ejemplo n.º 18
0
 /** Resets to simple elliptic curve */
 public void resetToDefault() {
   try {
     setSurface("y^2+x^4-1", "x", "y", new Point2D.Double(0, 0), new Point2D.Double(1.0, 1.0));
   } catch (SetSurfaceException e) {
     System.err.println(e);
     System.err.println("Fatal error: setting surface to known, simple default failed");
     System.exit(1);
   }
 }
Ejemplo n.º 19
0
 void setMaxBounds() {
   if (maxBoundsReset) {
     maxBoundsReset = false;
     ImageWindow win = imp.getWindow();
     if (win != null && !IJ.isLinux() && win.maxBounds != null) {
       win.setMaximizedBounds(win.maxBounds);
       win.setMaxBoundsTime = System.currentTimeMillis();
     }
   }
 }
Ejemplo n.º 20
0
  boolean setHighscore() {
    int high = 0;
    boolean newh = false;

    String path = "";
    if (System.getProperty("os.name").toLowerCase().indexOf("mac") >= 0)
      path =
          new JFileChooser().getFileSystemView().getDefaultDirectory().toString()
              + "/Library/Application Support/ByRikard/IJAG";
    else path = System.getenv("APPDATA") + "/ByRikard/IJAG";
    String highscorePath = path + "/highscore";

    try {
      FileInputStream fstream = new FileInputStream(highscorePath);
      DataInputStream in = new DataInputStream(fstream);
      BufferedReader br = new BufferedReader(new InputStreamReader(in));
      high = Integer.parseInt(br.readLine());
      in.close();
    } catch (Exception e) {
    }
    oldHighScore = high;
    if (high < player.score) {
      high = player.score;
      newh = true;
    }

    try {
      String content = "" + high;
      File file = new File(highscorePath);

      if (!file.exists()) {
        file.createNewFile();
      }
      FileWriter fw = new FileWriter(file.getAbsoluteFile());
      BufferedWriter bw = new BufferedWriter(fw);
      bw.write(content);
      bw.close();

    } catch (IOException e) {
    }
    return newh;
  }
  public void run() {
    while (Thread.currentThread() == animator) {
      line.setX1(line.getX1() + line.getX1Run() * line.getX1Dir());
      line.setY1(line.getY1() + line.getY1Rise() * line.getY1Dir());
      line.setX2(line.getX2() + line.getX2Run() * line.getX2Dir());
      line.setY2(line.getY2() + line.getY2Rise() * line.getY2Dir());

      if (line.getX1() < 0) {
        line.setX1(0);
        line.switchX1Dir();
      } // end if
      else if (line.getX1() > this.getWidth()) {
        line.setX1(this.getWidth());
        line.switchX1Dir();
      } // end else if

      if (line.getY1() < 0) {
        line.setY1(0);
        line.switchY1Dir();
      } // end if
      else if (line.getY1() > this.getHeight()) {
        line.setY1(this.getHeight());
        line.switchY1Dir();
      } // end else if

      if (line.getX2() < 0) {
        line.setX2(0);
        line.switchX2Dir();
      } // end if
      else if (line.getX2() > this.getWidth()) {
        line.setX2(this.getWidth());
        line.switchX2Dir();
      } // end else if

      if (line.getY2() < 0) {
        line.setY2(0);
        line.switchY2Dir();
      } // end if
      else if (line.getY2() > this.getHeight()) {
        line.setY2(this.getHeight());
        line.switchY2Dir();
      } // end else if
    }

    repaint();

    try {
      Thread.sleep(delay); // have the thread sleep for "delay" milliseconds
    } // end try
    catch (InterruptedException e) {
      System.exit(-1);
    } // end catch
  } // end run method
Ejemplo n.º 22
0
    CExplode(double x, double y) {
      for (int i = 0; i < particles.length; i++) {
        // particles[i][0] = new Ellipse2D.Double(x, y, 10, 10);
        particles[i][0] =
            new Arc2D.Double(
                x - 25, y - 25, 50, 50, 360 / particles.length * i, 360 / particles.length * 2, 0);
        particles[i][1] = rand.nextDouble() + rand.nextInt(3) - 1;
        particles[i][2] = rand.nextDouble() + rand.nextInt(3) - 1;

        created = System.nanoTime();
      }
    }
Ejemplo n.º 23
0
 void enlargeArrays() {
   if (xp != null) {
     int[] xptemp = new int[maxPoints * 2];
     int[] yptemp = new int[maxPoints * 2];
     System.arraycopy(xp, 0, xptemp, 0, maxPoints);
     System.arraycopy(yp, 0, yptemp, 0, maxPoints);
     xp = xptemp;
     yp = yptemp;
   }
   if (xpf != null) {
     float[] xpftemp = new float[maxPoints * 2];
     float[] ypftemp = new float[maxPoints * 2];
     System.arraycopy(xpf, 0, xpftemp, 0, maxPoints);
     System.arraycopy(ypf, 0, ypftemp, 0, maxPoints);
     xpf = xpftemp;
     ypf = ypftemp;
   }
   int[] xp2temp = new int[maxPoints * 2];
   int[] yp2temp = new int[maxPoints * 2];
   System.arraycopy(xp2, 0, xp2temp, 0, maxPoints);
   System.arraycopy(yp2, 0, yp2temp, 0, maxPoints);
   xp2 = xp2temp;
   yp2 = yp2temp;
   if (IJ.debugMode) IJ.log("PolygonRoi: " + maxPoints + " points");
   maxPoints *= 2;
 }
Ejemplo n.º 24
0
  private void graphGrid(ArrayList<ArrayList<Position>> grid) throws InterruptedException {
    System.out.println(
        "Size of file by rows = " + grid.size() + ", columns = " + grid.get(0).size());
    final long current = System.currentTimeMillis();
    // System.out.println("Time for parsing file: " + ((current - startParseTime) / 1000) + " sec");
    // long afterEdge = 0;
    // long timeFindEdge = 0;

    ArrayList<Integer> ranges = findRanges();
    final Cell<Integer> threadsActive = new Cell<Integer>(threads);
    class EdgeThread extends Thread {

      int startRow = 0;
      int endRow = 0;

      public EdgeThread(int startRow, int endRow) {
        this.startRow = startRow;
        this.endRow = endRow;
      }

      public void run() {
        System.out.println("Thread: " + this.getId());
        findEdges(startRow, endRow);
        boolean lastThread;
        synchronized (threadsActive) {
          lastThread = --threadsActive.object == 0;
        }
        if (lastThread) {
          System.out.println("Last Thread: " + this.getId());
          long afterEdge = System.currentTimeMillis();
          long timeFindEdge = (afterEdge - current) / 1000;
          System.out.println("Time for findEdges: " + timeFindEdge + " sec");

          colorSCC();
          long afterColor = System.currentTimeMillis();
          long timeForColor = (afterColor - afterEdge) / 1000;
          System.out.println("Time for coloring and find CC: " + timeForColor + " sec");
          // findConnectedComponents();
          create();
          long timeForCreate = (System.currentTimeMillis() - afterColor) / 1000;
          System.out.println("Time for creating map: " + timeForCreate + " sec");
        }
      }
    }
    for (int i = 0; i < threads; i++) {
      EdgeThread thread = new EdgeThread(ranges.get(2 * i), ranges.get(2 * i + 1));
      thread.start();
    }

    Thread.currentThread().join();
  }
Ejemplo n.º 25
0
  public void saveGlyphFile(OutputStream a_output) {
    try {
      Transformer transformer = getTransformer();
      Document document = m_glyph.makeDocument();
      DOMSource source = new DOMSource(document);
      StreamResult result = new StreamResult(a_output);
      transformer.transform(source, result);
    } catch (ParserConfigurationException | TransformerException e) {
      e.printStackTrace();
    }

    m_savedTime = System.currentTimeMillis();
    m_modifiedTime = m_savedTime;
  }
Ejemplo n.º 26
0
  void renderer(Graphics2D g2d) {
    height = window.getHeight() - 20;
    width = window.getWidth();

    lastTime = curTime;
    curTime = System.currentTimeMillis();
    totalTime += curTime - lastTime;
    if (totalTime > 1000) {
      totalTime -= 1000;
      fps = frames;
      frames = 0;
    }
    ++frames;

    delta = 16.0 / (curTime - lastTime);
    if (delta < 0) delta = 0;

    g2d.setColor(Color.white);
    if (removeMode) g2d.fill(new Rectangle(0, 0, width, height));

    if (eventHandeler(g2d)) {
      renderBackground(g2d);
      return;
    }

    Graphics2D map = (Graphics2D) g2d.create();
    playerHandeler();
    xOffset = -player.body.getCenterX() + width / 2;
    yOffset = -player.body.getCenterY() + height / 2;

    if (-xOffset < bounds.getBounds2D().getX()) xOffset = -bounds.getBounds2D().getX();
    else if (-xOffset > bounds.getBounds2D().getMaxX() - width)
      xOffset = -bounds.getBounds2D().getMaxX() + width;

    if (-yOffset < bounds.getBounds2D().getY()) yOffset = -bounds.getBounds2D().getY();
    else if (-yOffset > bounds.getBounds2D().getMaxY() - height + 3)
      yOffset = -bounds.getBounds2D().getMaxY() + height - 3;

    map.translate(xOffset, yOffset);

    renderBackground(map);
    itemHandeler(map);
    enemieHandeler();
    characterHandeler(map);

    map.setColor(Color.black);
    map.draw(bounds);

    renderUI(g2d);
  }
Ejemplo n.º 27
0
      public void run() {
        System.out.println("Thread: " + this.getId());
        findEdges(startRow, endRow);
        boolean lastThread;
        synchronized (threadsActive) {
          lastThread = --threadsActive.object == 0;
        }
        if (lastThread) {
          System.out.println("Last Thread: " + this.getId());
          long afterEdge = System.currentTimeMillis();
          long timeFindEdge = (afterEdge - current) / 1000;
          System.out.println("Time for findEdges: " + timeFindEdge + " sec");

          colorSCC();
          long afterColor = System.currentTimeMillis();
          long timeForColor = (afterColor - afterEdge) / 1000;
          System.out.println("Time for coloring and find CC: " + timeForColor + " sec");
          // findConnectedComponents();
          create();
          long timeForCreate = (System.currentTimeMillis() - afterColor) / 1000;
          System.out.println("Time for creating map: " + timeForCreate + " sec");
        }
      }
Ejemplo n.º 28
0
  private XRCompositeManager(XRSurfaceData surface) {
    con = new XRBackendNative();
    // con = XRBackendJava.getInstance();

    String gradProp = System.getProperty("sun.java2d.xrgradcache");
    enableGradCache =
        gradProp == null || !(gradProp.equalsIgnoreCase("false") || gradProp.equalsIgnoreCase("f"));

    XRPaints.register(this);

    initResources(surface);

    maskBuffer = new MaskTileManager(this, surface.getXid());
    textRenderer = new XRTextRenderer(this);
    maskImage = new XRMaskImage(this, surface.getXid());
  }
Ejemplo n.º 29
0
  /** shoots the AWP */
  public void shootAWP(int x, int y) {
    if (numBullets > 0) {
      numBullets--;
      AWP.start();
      shotTime = System.currentTimeMillis();
      ammo.setText("" + numBullets);

      double awpx = pos.x + width / 2;
      double awpy = pos.y + height / 2;

      double mousex = x + this.pos.x - (Wuigi.screenWidth / 2.0 + xOffset());
      double mousey = Wuigi.screenHeight + pos.y + 32 - (ScreenManager.mouse.y + yOffset());

      addSpawn(new AWPBullet(awpx, awpy, mousex, mousey));
    }
  }
 public static void main(String args[]) {
   if (args.length != 1) {
     System.out.println("Need the name of a cff font.");
     System.exit(0);
   }
   JFrame jf = new JFrame("Font test: " + args[0]);
   try {
     FileInputStream fis = new FileInputStream(args[0]);
     TestType1CFont panel = new TestType1CFont(fis);
     jf.getContentPane().add(panel);
     jf.pack();
     jf.setVisible(true);
     panel.requestFocus();
   } catch (IOException ioe) {
   }
 }