Esempio n. 1
0
  public void run() {
    MOVE_PREV = MOVE_DOWN;

    System.out.println("INIT!");
    map = new int[mapX][mapY];

    for (int i = 0; i < map.length; i++) {
      for (int j = 0; j < map[i].length; j++) {
        map[i][j] = 0;
      }
    }
    map[blockP.x][blockP.y] = 1;
    //    	map[0][20] = 1;

    StdDraw.setXscale(-1.0, 1.0);
    StdDraw.setYscale(-1.0, 1.0);

    // initial values

    // double vx = 0.015, vy = 0.023;     // velocity

    // main animation loop
    while (true) {

      drawGame();
      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      movePrev();
    }
  }
Esempio n. 2
0
  /**
   * Construct a GIFEncoder. The constructor will convert the image to an indexed color array.
   * <B>This may take some time.</B>
   *
   * <p>
   *
   * @param image The image to encode. The image <B>must</B> be completely loaded.
   * @exception AWTException Will be thrown if the pixel grab fails. This can happen if Java runs
   *     out of memory. It may also indicate that the image contains more than 256 colors.
   */
  public GIFEncoder(Image image) throws AWTException {
    width_ = (short) image.getWidth(null);
    height_ = (short) image.getHeight(null);

    int values[] = new int[width_ * height_];
    PixelGrabber grabber = new PixelGrabber(image, 0, 0, width_, height_, values, 0, width_);

    try {
      if (grabber.grabPixels() != true)
        throw new AWTException("Grabber returned false: " + grabber.status()); // $NON-NLS-1$
    } catch (InterruptedException ex) {
      ex.printStackTrace();
    }

    byte r[][] = new byte[width_][height_];
    byte g[][] = new byte[width_][height_];
    byte b[][] = new byte[width_][height_];
    int index = 0;
    for (int y = 0; y < height_; ++y)
      for (int x = 0; x < width_; ++x) {
        r[x][y] = (byte) ((values[index] >> 16) & 0xFF);
        g[x][y] = (byte) ((values[index] >> 8) & 0xFF);
        b[x][y] = (byte) ((values[index]) & 0xFF);
        ++index;
      }
    ToIndexedColor(r, g, b);
  }
Esempio n. 3
0
 public synchronized ImageIcon originalPage(int i) {
   try {
     page1.await();
   } catch (InterruptedException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return new ImageIcon(pdffile.getPage(i - 1).getImage(w, h, rect, null, true, true));
 }
Esempio n. 4
0
 private void grabPixels(PixelGrabber grabber) {
   try {
     grabber.grabPixels();
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
   // if (grabber.getColorModel() != ColorModel.getRGBdefault()) {
   //	System.err.println("Warning: found other colormodel than default.");
   // }
 }
  public void run() {
    Thread t = Thread.currentThread();

    while (t == gameLoop) {
      try {
        updateObjects();
        Thread.sleep(20);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      repaint();
    }
  }
Esempio n. 6
0
 public static void ensureLoaded(Image img) throws Exception {
   // System.err.println("In ensureloaded");
   mediatracker.addImage(img, 0);
   try {
     mediatracker.waitForAll();
     if (mediatracker.getErrorsAny() != null) {
       mediatracker.removeImage(img);
       throw new Exception("Error loading image");
     }
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
   mediatracker.removeImage(img);
   // System.err.println("Out ensureloaded");
 }
Esempio n. 7
0
  public void run() {
    try {
      while (running) {

        try {
          Thread.sleep(framerate);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
        repaint();
        updateObjects();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Esempio n. 8
0
  public void setActivo(boolean val) {
    glass.setVisible(val);
    setVisible(val);
    JLayeredPane.getLayeredPaneAbove(glass).moveToFront(glass);

    if (val) {
      synchronized (syncMonitor) {
        try {
          if (SwingUtilities.isEventDispatchThread()) {
            EventQueue theQueue = getToolkit().getSystemEventQueue();
            while (isVisible()) {
              AWTEvent event = theQueue.getNextEvent();
              Object source = event.getSource();

              if (event instanceof ActiveEvent) {
                ((ActiveEvent) event).dispatch();
              } else if (source instanceof Component) {
                ((Component) source).dispatchEvent(event);
              } else if (source instanceof MenuComponent) {
                ((MenuComponent) source).dispatchEvent(event);
              } else {
                System.out.println("No se puede despachar: " + event);
              }
            }
          } else {
            while (isVisible()) {
              syncMonitor.wait();
            }
          }
        } catch (InterruptedException ignored) {
          System.out.println("Excepción de interrupción: " + ignored.getMessage());
        }
      }
    } else {
      synchronized (syncMonitor) {
        setVisible(false);
        glass.setVisible(false);
        syncMonitor.notifyAll();

        eliminarDelContenedor();
      }
    }
  }
Esempio n. 9
0
  public void init() {
    MediaTracker mt = new MediaTracker(this);

    URL url = getClass().getResource("tiger.gif");

    try {
      image = createImage((ImageProducer) url.getContent());
      mt.addImage(image, 0);
      mt.waitForID(0);
    } catch (Exception e) {
      e.printStackTrace();
    }
    imw = image.getWidth(this);
    imh = image.getWidth(this);
    pixels = new int[imw * imh];

    try {
      PixelGrabber pg = new PixelGrabber(image, 0, 0, imw, imh, pixels, 0, imw);
      pg.grabPixels();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }

    addMouseMotionListener(
        new MouseMotionAdapter() {
          public void mouseMoved(MouseEvent e) {
            int mx = e.getX(), my = e.getY();

            if (mx > 0 && mx < imw && my > 0 && my < imh) {
              int pixel = ((int[]) pixels)[my * imw + mx];

              int red = defaultRGB.getRed(pixel),
                  green = defaultRGB.getGreen(pixel),
                  blue = defaultRGB.getBlue(pixel),
                  alpha = defaultRGB.getAlpha(pixel);

              showStatus("red=" + red + " green=" + green + " blue=" + blue + " alpha=" + alpha);
            }
          }
        });
  }
Esempio n. 10
0
  private static int[] makeGradientPallet() {
    BufferedImage image = new BufferedImage(100, 1, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    Point2D start = new Point2D.Float(0f, 0f);
    Point2D end = new Point2D.Float(99f, 0f);
    float[] dist = {0f, .5f, 1f};
    Color[] colors = {Color.RED, Color.YELLOW, Color.GREEN};
    g2.setPaint(new LinearGradientPaint(start, end, dist, colors));
    g2.fillRect(0, 0, 100, 1);
    g2.dispose();

    int width = image.getWidth(null);
    int[] pallet = new int[width];
    PixelGrabber pg = new PixelGrabber(image, 0, 0, width, 1, pallet, 0, width);
    try {
      pg.grabPixels();
    } catch (InterruptedException ex) {
      ex.printStackTrace();
    }
    return pallet;
  }
Esempio n. 11
0
  private static BufferedImage convertToBufferedImage(Image image) throws IOException {
    if (image instanceof BufferedImage) {
      return (BufferedImage) image;

    } else {
      MediaTracker tracker = new MediaTracker(null /*not sure how this is used*/);
      tracker.addImage(image, 0);
      try {
        tracker.waitForAll();
      } catch (InterruptedException e) {
        throw new IOException(e.getMessage());
      }
      BufferedImage bufImage =
          new BufferedImage(
              image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);

      Graphics g = bufImage.createGraphics();
      g.drawImage(image, 0, 0, null);
      return bufImage;
    }
  }
Esempio n. 12
0
  public void run() {
    long lastTime = System.nanoTime();
    double unprocessed = 0;
    int frames = 0;
    long lastTimer1 = System.currentTimeMillis();

    try {
      init();
    } catch (Exception e) {
      e.printStackTrace();
      return;
    }

    // if (!isMultiplayer) {
    // createLevel();
    // }

    int toTick = 0;

    long lastRenderTime = System.nanoTime();
    int min = 999999999;
    int max = 0;

    while (running) {
      if (!this.hasFocus()) {
        keys.release();
      }

      double nsPerTick = 1000000000.0 / framerate;
      boolean shouldRender = false;
      while (unprocessed >= 1) {
        toTick++;
        unprocessed -= 1;
      }

      int tickCount = toTick;
      if (toTick > 0 && toTick < 3) {
        tickCount = 1;
      }
      if (toTick > 20) {
        toTick = 20;
      }

      for (int i = 0; i < tickCount; i++) {
        toTick--;
        // long before = System.nanoTime();
        tick();
        // long after = System.nanoTime();
        // System.out.println("Tick time took " + (after - before) *
        // 100.0 / nsPerTick + "% of the max time");
        shouldRender = true;
      }
      // shouldRender = true;

      BufferStrategy bs = getBufferStrategy();
      if (bs == null) {
        createBufferStrategy(3);
        continue;
      }
      if (shouldRender) {
        frames++;
        Graphics g = bs.getDrawGraphics();

        Random lastRandom = TurnSynchronizer.synchedRandom;
        TurnSynchronizer.synchedRandom = null;

        render(g);

        TurnSynchronizer.synchedRandom = lastRandom;

        long renderTime = System.nanoTime();
        int timePassed = (int) (renderTime - lastRenderTime);
        if (timePassed < min) {
          min = timePassed;
        }
        if (timePassed > max) {
          max = timePassed;
        }
        lastRenderTime = renderTime;
      }

      long now = System.nanoTime();
      unprocessed += (now - lastTime) / nsPerTick;
      lastTime = now;

      try {
        Thread.sleep(1);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      if (shouldRender) {
        if (bs != null) {
          bs.show();
        }
      }

      if (System.currentTimeMillis() - lastTimer1 > 1000) {
        lastTimer1 += 1000;
        fps = frames;
        frames = 0;
      }
    }
  }
Esempio n. 13
0
  public synchronized RenderedImage runDCRaw(dcrawMode mode, boolean secondaryPixels)
      throws IOException, UnknownImageTypeException, BadImageFileException {
    if (!m_decodable || (mode == dcrawMode.full && m_rawColors != 3))
      throw new UnknownImageTypeException("Unsuported Camera");

    RenderedImage result = null;

    File of = null;

    try {
      if (mode == dcrawMode.preview) {
        if (m_thumbWidth >= 1024 && m_thumbHeight >= 768) {
          mode = dcrawMode.thumb;
        }
      }

      long t1 = System.currentTimeMillis();

      of = File.createTempFile("LZRAWTMP", ".ppm");

      boolean four_colors = false;
      final String makeModel = m_make + ' ' + m_model;
      for (String s : four_color_cameras)
        if (s.equalsIgnoreCase(makeModel)) {
          four_colors = true;
          break;
        }

      if (secondaryPixels) runDCRawInfo(true);

      String cmd[];
      switch (mode) {
        case full:
          if (four_colors)
            cmd =
                new String[] {
                  DCRAW_PATH,
                  "-F",
                  of.getAbsolutePath(),
                  "-v",
                  "-f",
                  "-H",
                  "1",
                  "-t",
                  "0",
                  "-o",
                  "0",
                  "-4",
                  m_fileName
                };
          else if (m_filters == -1 || (m_make != null && m_make.equalsIgnoreCase("SIGMA")))
            cmd =
                new String[] {
                  DCRAW_PATH,
                  "-F",
                  of.getAbsolutePath(),
                  "-v",
                  "-H",
                  "1",
                  "-t",
                  "0",
                  "-o",
                  "0",
                  "-4",
                  m_fileName
                };
          else if (secondaryPixels)
            cmd =
                new String[] {
                  DCRAW_PATH,
                  "-F",
                  of.getAbsolutePath(),
                  "-v",
                  "-j",
                  "-H",
                  "1",
                  "-t",
                  "0",
                  "-s",
                  "1",
                  "-d",
                  "-4",
                  m_fileName
                };
          else
            cmd =
                new String[] {
                  DCRAW_PATH,
                  "-F",
                  of.getAbsolutePath(),
                  "-v",
                  "-j",
                  "-H",
                  "1",
                  "-t",
                  "0",
                  "-d",
                  "-4",
                  m_fileName
                };
          break;
        case preview:
          cmd =
              new String[] {
                DCRAW_PATH,
                "-F",
                of.getAbsolutePath(),
                "-v",
                "-t",
                "0",
                "-o",
                "1",
                "-w",
                "-h",
                m_fileName
              };
          break;
        case thumb:
          cmd = new String[] {DCRAW_PATH, "-F", of.getAbsolutePath(), "-v", "-e", m_fileName};
          break;
        default:
          throw new IllegalArgumentException("Unknown mode " + mode);
      }

      String ofName = null;

      synchronized (DCRaw.class) {
        Process p = null;
        InputStream dcrawStdErr;
        InputStream dcrawStdOut;
        if (ForkDaemon.INSTANCE != null) {
          ForkDaemon.INSTANCE.invoke(cmd);
          dcrawStdErr = ForkDaemon.INSTANCE.getStdErr();
          dcrawStdOut = ForkDaemon.INSTANCE.getStdOut();
        } else {
          p = Runtime.getRuntime().exec(cmd);
          dcrawStdErr = new BufferedInputStream(p.getErrorStream());
          dcrawStdOut = p.getInputStream();
        }

        String line, args;
        // output expected on stderr
        while ((line = readln(dcrawStdErr)) != null) {
          // System.out.println(line);

          if ((args = match(line, DCRAW_OUTPUT)) != null)
            ofName = args.substring(0, args.indexOf(" ..."));
        }

        // Flush stdout just in case...
        while ((line = readln(dcrawStdOut)) != null) ; // System.out.println(line);

        if (p != null) {
          dcrawStdErr.close();

          try {
            p.waitFor();
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
          m_error = p.exitValue();
          p.destroy();
        } else m_error = 0;
      }

      System.out.println("dcraw value: " + m_error);

      if (m_error > 0) {
        of.delete();
        throw new BadImageFileException(of);
      }

      if (!ofName.equals(of.getPath())) {
        of.delete();
        of = new File(ofName);
      }

      if (of.getName().endsWith(".jpg") || of.getName().endsWith(".tiff")) {
        if (of.getName().endsWith(".jpg")) {
          try {
            LCJPEGReader jpegReader = new LCJPEGReader(of.getPath());
            result = jpegReader.getImage();
          } catch (Exception e) {
            e.printStackTrace();
          }
        } else {
          try {
            LCTIFFReader tiffReader = new LCTIFFReader(of.getPath());
            result = tiffReader.getImage(null);
          } catch (Exception e) {
            e.printStackTrace();
          }
        }
        long t2 = System.currentTimeMillis();

        int totalData =
            result.getWidth()
                * result.getHeight()
                * result.getColorModel().getNumColorComponents()
                * (result.getColorModel().getTransferType() == DataBuffer.TYPE_BYTE ? 1 : 2);

        System.out.println("Read " + totalData + " bytes in " + (t2 - t1) + "ms");
      } else {
        ImageData imageData;
        try {
          imageData = readPPM(of);
        } catch (Exception e) {
          e.printStackTrace();
          throw new BadImageFileException(of, e);
        }

        // do not change the initial image geometry
        // m_width = Math.min(m_width, imageData.width);
        // m_height = Math.min(m_height, imageData.height);

        long t2 = System.currentTimeMillis();

        int totalData =
            imageData.width
                * imageData.height
                * imageData.bands
                * (imageData.dataType == DataBuffer.TYPE_BYTE ? 1 : 2);

        System.out.println("Read " + totalData + " bytes in " + (t2 - t1) + "ms");

        final ColorModel cm;
        if (mode == dcrawMode.full) {
          if (imageData.bands == 1) {
            cm =
                new ComponentColorModel(
                    ColorSpace.getInstance(ColorSpace.CS_GRAY),
                    false,
                    false,
                    Transparency.OPAQUE,
                    DataBuffer.TYPE_USHORT);
          } else {
            cm = JAIContext.colorModel_linear16;
          }
        } else {
          if (imageData.bands == 3)
            cm =
                new ComponentColorModel(
                    JAIContext.sRGBColorSpace,
                    false,
                    false,
                    Transparency.OPAQUE,
                    DataBuffer.TYPE_BYTE);
          else if (imageData.bands == 4)
            cm =
                new ComponentColorModel(
                    JAIContext.CMYKColorSpace,
                    false,
                    false,
                    Transparency.OPAQUE,
                    imageData.dataType);
          else throw new UnknownImageTypeException("Weird number of bands: " + imageData.bands);
        }

        final DataBuffer buf =
            imageData.dataType == DataBuffer.TYPE_BYTE
                ? new DataBufferByte(
                    (byte[]) imageData.data, imageData.bands * imageData.width * imageData.height)
                : new DataBufferUShort(
                    (short[]) imageData.data, imageData.bands * imageData.width * imageData.height);

        final WritableRaster raster =
            Raster.createInterleavedRaster(
                buf,
                imageData.width,
                imageData.height,
                imageData.bands * imageData.width,
                imageData.bands,
                imageData.bands == 3 ? new int[] {0, 1, 2} : new int[] {0},
                null);

        result = new BufferedImage(cm, raster, false, null);
      }
    } catch (IOException e) {
      if (of != null) of.delete();
      throw e;
    } finally {
      if (of != null) of.delete();
    }
    return result;
  }
Esempio n. 14
0
  private void runDCRawInfo(boolean secondary) throws IOException {
    String info[] = {DCRAW_PATH, "-v", "-i", "-t", "0", m_fileName};
    String secondaryInfo[] = {DCRAW_PATH, "-v", "-i", "-s", "1", "-t", "0", m_fileName};

    synchronized (DCRaw.class) {
      Process p = null;
      InputStream dcrawStdOut;
      InputStream dcrawStdErr;
      if (ForkDaemon.INSTANCE != null) {
        ForkDaemon.INSTANCE.invoke(secondary ? secondaryInfo : info);
        dcrawStdOut = ForkDaemon.INSTANCE.getStdOut();
        dcrawStdErr = ForkDaemon.INSTANCE.getStdErr();
      } else {
        p = Runtime.getRuntime().exec(secondary ? secondaryInfo : info);
        dcrawStdOut = p.getInputStream();
        dcrawStdErr = new BufferedInputStream(p.getErrorStream());
      }

      // output expected on stdout
      String line, args;
      while ((line = readln(dcrawStdOut)) != null) {
        // System.out.println(line);

        String search;

        if (secondary) {
          if (line.startsWith(search = CAMERA_MULTIPLIERS)) {
            String multipliers[] = line.substring(search.length()).split("\\s");
            m_secondary_cam_mul[0] = Float.parseFloat(multipliers[0]);
            m_secondary_cam_mul[1] = Float.parseFloat(multipliers[1]);
            m_secondary_cam_mul[2] = Float.parseFloat(multipliers[2]);
            m_secondary_cam_mul[3] = Float.parseFloat(multipliers[3]);
          }
        } else {
          // if (line.startsWith(search = FILENAME)) {
          //     String filename = line.substring(search.length());
          // } else
          if (line.startsWith(search = TIMESTAMP)) {
            String timestamp = line.substring(search.length());
            try {
              m_captureDateTime = new SimpleDateFormat().parse(timestamp).getTime();
            } catch (ParseException e) {
              m_captureDateTime = 0;
            }
          } else if (line.startsWith(search = CAMERA)) {
            String camera = line.substring(search.length());
            m_make = camera.substring(0, camera.indexOf(' '));
            m_model = camera.substring(m_make.length() + 1);
          } else if (line.startsWith(search = ISO)) {
            String iso = line.substring(search.length());
            m_iso = Integer.decode(iso);
          } else if (line.startsWith(search = SHUTTER)) {
            String shutterSpeed = line.substring(search.length() + 2);
            float exposureTime = 0;
            try {
              exposureTime = Float.valueOf(shutterSpeed.substring(0, shutterSpeed.indexOf(" sec")));
              if (exposureTime != 0) m_shutterSpeed = 1 / exposureTime;
            } catch (NumberFormatException e) {
            }
          } else if (line.startsWith(search = APERTURE)) {
            String aperture = line.substring(search.length() + 2);
            try {
              m_aperture = Float.valueOf(aperture);
            } catch (NumberFormatException e) {
            }
          } else if (line.startsWith(search = FOCAL_LENGTH)) {
            String focalLenght = line.substring(search.length());
            try {
              m_focalLength = Float.valueOf(focalLenght.substring(0, focalLenght.indexOf(" mm")));
            } catch (NumberFormatException e) {
            }
            // } else if (line.startsWith(search = NUM_RAW_IMAGES)) {
            //     String numRawImages = line.substring(search.length());
            // } else if (line.startsWith(search = EMBEDDED_ICC_PROFILE)) {
            //     String embeddedICCProfile = line.substring(search.length());
          } else if (line.startsWith(CANNOT_DECODE)) {
            m_decodable = false;
          } else if ((args = match(line, THUMB_SIZE)) != null) {
            String sizes[] = args.split(" x ");
            m_thumbWidth = Integer.decode(sizes[0]);
            m_thumbHeight = Integer.decode(sizes[1]);
          } else if ((args = match(line, FULL_SIZE)) != null) {
            String sizes[] = args.split(" x ");
            m_fullWidth = Integer.decode(sizes[0]);
            m_fullHeight = Integer.decode(sizes[1]);
          } else if ((args = match(line, IMAGE_SIZE)) != null) {
            String sizes[] = args.split(" x ");
            m_rawWidth = Integer.decode(sizes[0]);
            m_rawHeight = Integer.decode(sizes[1]);
          } else if ((args = match(line, OUTPUT_SIZE)) != null) {
            String sizes[] = args.split(" x ");
            m_width = Integer.decode(sizes[0]);
            m_height = Integer.decode(sizes[1]);
          } else if (line.startsWith(search = RAW_COLORS)) {
            String rawColors = line.substring(search.length());
            m_rawColors = Integer.decode(rawColors);
          } else if (line.startsWith(search = FILTER_PATTERN)) {
            String pattern = line.substring(search.length());
            if (pattern.length() >= 8 && !pattern.substring(0, 4).equals(pattern.substring(4, 8)))
              m_filters = -1;
            else if (pattern.startsWith("BGGR")) m_filters = 0x16161616;
            else if (pattern.startsWith("GRBG")) m_filters = 0x61616161;
            else if (pattern.startsWith("GBRG")) m_filters = 0x49494949;
            else if (pattern.startsWith("RGGB")) m_filters = 0x94949494;
            else m_filters = -1;
          } else if (line.startsWith(search = DAYLIGHT_MULTIPLIERS)) {
            String multipliers[] = line.substring(search.length()).split("\\s");
            m_pre_mul[0] = Float.parseFloat(multipliers[0]);
            m_pre_mul[1] = Float.parseFloat(multipliers[1]);
            m_pre_mul[2] = Float.parseFloat(multipliers[2]);
            m_pre_mul[3] = m_pre_mul[1];
          } else if (line.startsWith(search = CAMERA_MULTIPLIERS)) {
            String multipliers[] = line.substring(search.length()).split("\\s");
            m_cam_mul[0] = Float.parseFloat(multipliers[0]);
            m_cam_mul[1] = Float.parseFloat(multipliers[1]);
            m_cam_mul[2] = Float.parseFloat(multipliers[2]);
            m_cam_mul[3] = Float.parseFloat(multipliers[3]);
          } else if (line.startsWith(CAMERA_RGB_PROFILE)) {
            String rgb_cam[] = line.substring(CAMERA_RGB_PROFILE.length()).split("\\s");
            m_rgb_cam = new float[9];
            for (int i = 0; i < 9; i++) {
              m_rgb_cam[i] = Float.parseFloat(rgb_cam[i]);
            }
          } else if (line.startsWith(CAMERA_XYZ_PROFILE)) {
            String xyz_cam[] = line.substring(CAMERA_XYZ_PROFILE.length()).split("\\s");
            m_xyz_cam = new float[9];
            for (int i = 0; i < 9; i++) {
              m_xyz_cam[i] = Float.parseFloat(xyz_cam[i]);
            }
          }
        }
      }

      // Flush stderr just in case...
      while ((line = readln(dcrawStdErr)) != null) ; // System.out.println(line);

      if (p != null) {
        dcrawStdOut.close();
        try {
          p.waitFor();
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
        m_error = p.exitValue();
        p.destroy();
      } else m_error = 0;
    }
  }