Examples of WFImage


Examples of org.jwildfire.image.WFImage

      int minSize = 16;
      int maxSize = 16000;
      File file = getRandomFile();
      if (file != null) {
        byte[] imgData = Tools.readFile(file.getAbsolutePath());
        WFImage img = new ImageReader(new JLabel()).loadImage(file.getAbsolutePath());
        if (img.getImageWidth() >= minSize && img.getImageWidth() <= maxSize && img.getImageHeight() >= minSize && img.getImageHeight() <= maxSize) {
          int hashcode = RessourceManager.calcHashCode(imgData);
          SimpleImage wfImg = (SimpleImage) RessourceManager.getImage(hashcode, imgData);
          RGBPalette gradient = new MedianCutQuantizer().createPalette(wfImg);
          return new ImageData(null, file.getName(), imgData, gradient);
        }
View Full Code Here

Examples of org.jwildfire.image.WFImage

    int height = pImageHeight;
    double x[] = pMesh3D.getX();
    double y[] = pMesh3D.getY();
    double z[] = pMesh3D.getZ();

    WFImage heightMap = this.heightMap.getHDRImage();
    if (heightMap != null) {
      int hwidth = heightMap.getImageWidth();
      int hheight = heightMap.getImageHeight();
      if ((hwidth != this.hWidth) || (hheight != this.hHeight)) {
        throw new IllegalArgumentException("Heightmap has the wrong size (scaling of HDR images currently not supported)");
      }
      float lum[] = new float[2];
      ((SimpleHDRImage) heightMap).getMinMaxLum(lum);
      lumMin = lum[0];
      lumMax = lum[1];
      lumRange = lumMax - lumMin;
    }
    else {
      heightMap = this.heightMap.getImage();
      int hwidth = heightMap.getImageWidth();
      int hheight = heightMap.getImageHeight();
      if ((hwidth != this.hWidth) || (hheight != this.hHeight)) {
        SimpleImage scaledHeightMap = ((SimpleImage) heightMap).clone();
        ScaleTransformer scaleT = new ScaleTransformer();
        scaleT.setAspect(this.aspect);
        scaleT.setUnit(ScaleTransformer.Unit.PIXELS);
View Full Code Here

Examples of org.jwildfire.image.WFImage

  public static WFImage getImage(String pFilename) throws Exception {
    if (pFilename == null || pFilename.length() == 0) {
      throw new IllegalStateException();
    }
    WFImage res = imageMapByName.get(pFilename);
    if (res == null) {
      if (!new File(pFilename).exists()) {
        throw new FileNotFoundException(pFilename);
      }
      String fileExt = null;
View Full Code Here

Examples of org.jwildfire.image.WFImage

    return res;
  }

  public static WFImage getImage(int pHashCode, byte[] pImageData) throws Exception {
    Integer key = Integer.valueOf(pHashCode);
    WFImage res = imageMapByHash.get(key);
    if (res == null) {
      String fileExt = guessImageExtension(pImageData);
      File f = File.createTempFile("tmp", "." + fileExt);
      f.deleteOnExit();
      Tools.writeFile(f.getAbsolutePath(), pImageData);
View Full Code Here

Examples of org.jwildfire.image.WFImage

        byte[] imgData = downloadRessource(imgUrl);
        String fileExt = RessourceManager.guessImageExtension(imgData);
        File f = File.createTempFile("tmp", "." + fileExt);
        f.deleteOnExit();
        Tools.writeFile(f.getAbsolutePath(), imgData);
        WFImage img = new ImageReader(new JLabel()).loadImage(f.getAbsolutePath());
        if (img.getImageWidth() >= minSize && img.getImageWidth() <= maxSize && img.getImageHeight() >= minSize && img.getImageHeight() <= maxSize) {
          int hashcode = RessourceManager.calcHashCode(imgData);
          SimpleImage wfImg = (SimpleImage) RessourceManager.getImage(hashcode, imgData);
          RGBPalette gradient = new MedianCutQuantizer().createPalette(wfImg);
          return new ImageData(pageUrl, imgUrl, imgData, gradient);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.