Package org.jwildfire.image

Examples of org.jwildfire.image.SimpleImage


    renderProgressUpdater.initProgress(maxCount);
    RandomMovieGenerator randGen = RandomMovieGeneratorList.getRandomMovieGeneratorInstance(pGeneratorname, true);
    for (int i = 0; i < maxCount; i++) {
      MovieThumbnail thumbnail;
      thumbnail = new MovieThumbnail(randGen.createMovie(prefs), null);
      SimpleImage img = thumbnail.getPreview(3 * prefs.getTinaRenderPreviewQuality() / 4);
      if (prefs.getTinaRandomBatchRefreshType() == RandomBatchRefreshType.INSERT) {
        randomBatch.add(0, thumbnail);
        imgList.add(0, img);
      }
      else {
View Full Code Here


    }
  }

  private SimpleImage renderFlame(Flame pFlame, Dimension pImgSize, boolean pWithTimeout) {
    int pImageWidth = pImgSize.width, pImageHeight = pImgSize.height;
    SimpleImage img;
    if (pFlame != null && pImageWidth > 16 && pImageHeight > 16) {
      return img = executeRenderThread(pFlame, pImageWidth, pImageHeight, pWithTimeout);
    }
    else {
      img = new SimpleImage(pImageWidth, pImageHeight);
    }
    return img;
  }
View Full Code Here

        int idx = 0;
        for (int i = 0; i < rows; i++) {
          for (int j = 0; j < cols; j++) {
            JPanel panel = flamePanels[idx++];
            Dimension size = panel.getSize();
            SimpleImage img = new SimpleImage(Tools.FTOI(size.getWidth()), Tools.FTOI(size.getHeight()));
            final ImagePanel imgPanel = new ImagePanel(img, 0, 0, img.getImageWidth());
            imagePanels[i][j] = imgPanel;
            imgPanel.setImage(img);
            imgPanel.setLocation(BORDER_SIZE, BORDER_SIZE);

            final int row = i;
View Full Code Here

        List<Flame> mutations = new ArrayList<Flame>();
        initProgress(rows, cols);
        int centreX = rows / 2;
        int centreY = cols / 2;

        SimpleImage baseFlameImg = renderFlame(baseFlame.makeCopy(), probeSize, false);
        SimpleImage simplifiedBaseFlameImg = RandomFlameGeneratorSampler.createSimplifiedRefImage(baseFlameImg);

        int step = 0;
        for (int i = 0; i < rows; i++) {
          for (int j = 0; j < cols; j++) {
            // Let centre flame untouched
            SimpleImage renderedImg = null;
            if ((i != centreX || j != centreY)) {
              int x = (i - centreX);
              int y = (j - centreY);
              final int MAX_ITER = 10;
              final double MIN_RENDER_COVERAGE = 0.42;
View Full Code Here

    int step = 0;
    for (int i = 0; i < rows; i++) {
      for (int j = 0; j < cols; j++) {
        Flame mutation = selectedSet.getFlame(i, j).makeCopy();
        Flame morphed = createWeightedFlame(selectedSet.getBaseFlame(), mutation);
        SimpleImage renderedImg = renderFlame(morphed, imgSize, false);
        ImagePanel pnl = imagePanels[i][j];
        pnl.setImage(renderedImg);
        showProgress(++step);
        pnl.invalidate();
        try {
View Full Code Here

  @Override
  protected void performPixelTransformation(WFImage pImg) {
    if ((Math.abs(this.amount) < MathLib.EPSILON) || ((displaceXMap == null) && (displaceYMap == null)))
      return;
    SimpleImage img = (SimpleImage) pImg;
    double nAmount = this.amount / 127.5;
    double rZoom = 1.0 / this.zoom;
    int width = pImg.getImageWidth();
    int height = pImg.getImageHeight();
    SimpleImage xMap = (displaceXMap != null) ? displaceXMap.getImage() : null;
    SimpleImage yMap = (displaceYMap != null) ? displaceYMap.getImage() : null;
    Pixel pPixel = new Pixel();
    double w1 = (double) width - 1.0;
    double h1 = (double) height - 1.0;
    double cx = (double) width / 2.0;
    double cy = (double) height / 2.0;
    for (int pY = 0; pY < height; pY++) {
      for (int pX = 0; pX < width; pX++) {
        double x0 = pX - cx;
        double y0 = pY - cy;

        double dX, dY;
        if (xMap == null)
          dX = 0.0;
        else
          dX = (double) (xMap.getRValueIgnoreBounds(pX, pY) - 127.5) * nAmount;
        if (yMap == null)
          dY = 0.0;
        else
          dY = (double) (yMap.getGValueIgnoreBounds(pX, pY) - 127.5) * nAmount;

        double x = cx + (x0 + dX) * rZoom;
        double y = cy + (y0 + dY) * rZoom;

        /* render it */
 
View Full Code Here

  @PropertyMax(255)
  private int luminosity = 0;

  @Override
  protected void performPixelTransformation(WFImage pImg) {
    SimpleImage img = (SimpleImage) pImg;
    int width = pImg.getImageWidth();
    int height = pImg.getImageHeight();
    Pixel rgbPixel = new Pixel();
    HSLPixel hslPixel = new HSLPixel();

    double phue = (double) (this.hue) / 255.0;
    if (phue < (-1.0))
      phue = -1;
    else if (phue > 1.0)
      phue = 1.0;
    double psaturation = (double) (this.saturation) / 255.0;
    if (psaturation < (-1.0))
      psaturation = -1.0;
    else if (psaturation > 1.0)
      psaturation = 1.0;
    double pluminosity = (double) (this.luminosity) / 255.0;
    if (pluminosity < (-1.0))
      pluminosity = -1;
    else if (pluminosity > 1.0)
      pluminosity = 1.0;
    for (int i = 0; i < height; i++) {
      for (int j = 0; j < width; j++) {
        rgbPixel.setARGBValue(img.getARGBValue(j, i));
        rgb2hsl(rgbPixel, hslPixel);
        hslPixel.luminosity += pluminosity;
        if (hslPixel.luminosity < 0.0)
          hslPixel.luminosity = 0.0;
        else if (hslPixel.luminosity > 1.0)
          hslPixel.luminosity = 1.0;
        hslPixel.saturation += psaturation;
        if (hslPixel.saturation < 0.0)
          hslPixel.saturation = 0.0;
        else if (hslPixel.saturation > 1.0)
          hslPixel.saturation = 1.0;
        if (hslPixel.hue != (-1.0)) {
          hslPixel.hue += phue;
          if (hslPixel.hue < 0.0)
            hslPixel.hue += 1.0;
          else if (hslPixel.hue > 1.0)
            hslPixel.hue -= 1.0;
        }
        hsl2rgb(hslPixel, rgbPixel);
        img.setRGB(j, i, rgbPixel);
      }
    }
  }
View Full Code Here

  @Property(description = "Repeat the image at the borders")
  private boolean wrap = true;

  @Override
  protected void performPixelTransformation(WFImage pImg) {
    SimpleImage img = (SimpleImage) pImg;
    if (!damp) {
      if (axis == Axis.X)
        waveX(img);
      else
        waveY(img);
View Full Code Here

  @Property(description = "Merge mode", editorClass = ModeEditor.class)
  private Mode mode = Mode.HORIZONTAL;

  @Override
  protected void performImageTransformation(WFImage pImg) {
    SimpleImage img = (SimpleImage) pImg;
    int width1 = pImg.getImageWidth();
    int height1 = pImg.getImageHeight();
    int width2 = image2.getImage().getImageWidth();
    int height2 = image2.getImage().getImageHeight();

    int bgWidth, bgHeight;
    if (this.mode == Mode.HORIZONTAL) {
      bgWidth = width1 + width2;
      bgHeight = (height1 > height2) ? height1 : height2;
    }
    else {
      bgWidth = (width1 > width2) ? width1 : width2;
      bgHeight = height1 + height2;
    }
    SimpleImage bgImg = new SimpleImage(bgWidth, bgHeight);
    if (this.mode == Mode.HORIZONTAL) {
      {
        ComposeTransformer cT = new ComposeTransformer();
        cT.setForegroundImage(img);
        cT.setHAlign(ComposeTransformer.HAlignment.OFF);
        cT.setLeft(0);
        cT.setVAlign(ComposeTransformer.VAlignment.CENTRE);
        cT.transformImage(bgImg);
      }
      {
        ComposeTransformer cT = new ComposeTransformer();
        cT.setForegroundImage(image2.getImage());
        cT.setHAlign(ComposeTransformer.HAlignment.OFF);
        cT.setLeft(width1);
        cT.setVAlign(ComposeTransformer.VAlignment.CENTRE);
        cT.transformImage(bgImg);
      }
    }
    else {
      {
        ComposeTransformer cT = new ComposeTransformer();
        cT.setForegroundImage(img);
        cT.setHAlign(ComposeTransformer.HAlignment.CENTRE);
        cT.setVAlign(ComposeTransformer.VAlignment.OFF);
        cT.setTop(0);
        cT.transformImage(bgImg);
      }
      {
        ComposeTransformer cT = new ComposeTransformer();
        cT.setForegroundImage(image2.getImage());
        cT.setHAlign(ComposeTransformer.HAlignment.CENTRE);
        cT.setVAlign(ComposeTransformer.VAlignment.OFF);
        cT.setTop(height1);
        cT.transformImage(bgImg);
      }
    }
    img.setBufferedImage(bgImg.getBufferedImg(), bgWidth, bgHeight);
  }
View Full Code Here

      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

TOP

Related Classes of org.jwildfire.image.SimpleImage

Copyright © 2018 www.massapicom. 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.