Package org.jwildfire.image

Examples of org.jwildfire.image.SimpleImage


  private void refreshImagePanel() {
    if (imagePanel != null) {
      imageRootPanel.remove(imagePanel);
    }
    ImgSize size = getImgSize();
    image = new SimpleImage(size.getWidth(), size.getHeight());
    image.fillBackground(prefs.getTinaRandomBatchBGColorRed(), prefs.getTinaRandomBatchBGColorGreen(), prefs.getTinaRandomBatchBGColorBlue());
    imagePanel = new ImagePanel(image, 0, 0, image.getImageWidth());
    imagePanel.setSize(image.getImageWidth(), image.getImageHeight());
    imagePanel.setPreferredSize(new Dimension(image.getImageWidth(), image.getImageHeight()));
View Full Code Here


  }

  public SimpleImage renderHorizPalette(RGBColor[] pColors, int pWidth, int pHeight) {
    if (pColors == null || pWidth < 1 || pHeight < 1)
      throw new IllegalArgumentException();
    SimpleImage img = new SimpleImage(RGBPalette.PALETTE_SIZE, pHeight);
    for (int i = 0; i < pColors.length; i++) {
      RGBColor color = pColors[i];
      if (color == null) {
        color = RGBPalette.BLACK;
      }
      int r = color.getRed();
      int g = color.getGreen();
      int b = color.getBlue();
      for (int j = 0; j < pHeight; j++) {
        img.setRGB(i, j, r, g, b);
      }
    }
    if (img.getImageWidth() != pWidth || img.getImageHeight() != pHeight) {
      ScaleTransformer scaleT = new ScaleTransformer();
      scaleT.setScaleWidth(pWidth);
      scaleT.setScaleHeight(pHeight);
      scaleT.setAspect(ScaleAspect.IGNORE);
      scaleT.setUnit(Unit.PIXELS);
View Full Code Here

          }
        }
        System.arraycopy(newTransformedColors, 0, transformedColors, 0, PALETTE_SIZE);
        newTransformedColors = null;
      }
      SimpleImage img = new RGBPaletteRenderer().renderHorizPalette(transformedColors, PALETTE_SIZE, 1);
      if (modRed != 0 || modGreen != 0 || modBlue != 0 || modContrast != 0 || modGamma != 0 || modBrightness != 0 || modSaturation != 0) {
        BalancingTransformer bT = new BalancingTransformer();
        bT.setRed(modRed);
        bT.setGreen(modGreen);
        bT.setBlue(modBlue);
        bT.setContrast(modContrast);
        bT.setGamma(modGamma);
        bT.setBrightness(modBrightness);
        bT.setSaturation(modSaturation);
        bT.transformImage(img);
      }
      if (modHue != 0) {
        HSLTransformer hT = new HSLTransformer();
        hT.setHue(modHue);
        hT.transformImage(img);
      }
      if (modSwapRGB != 0) {
        SwapRGBTransformer sT = new SwapRGBTransformer();
        int maxValues = Mode.values().length;
        int idx = (int) ((double) Math.abs(modSwapRGB) / (double) 255.0 * (double) (maxValues - 1));
        sT.setMode(Mode.values()[idx]);
        sT.transformImage(img);
      }
      Pixel pixel = new Pixel();
      for (int i = startIdx; i <= endIdx; i++) {
        RGBColor color = transformedColors[i];
        pixel.setARGBValue(img.getARGBValue(i, 0));
        color.setRed(pixel.r);
        color.setGreen(pixel.g);
        color.setBlue(pixel.b);
      }
      modified = false;
View Full Code Here

  public List<RGBPalette> readPaletteFromMapData(String pMapData, String pFilename) throws Exception {
    List<RGBPalette> res = new ArrayList<RGBPalette>();
    RGBPalette gradient = new RGBPalette();
    res.add(gradient);
    gradient.setFlam3Name(new File(pFilename).getName());
    SimpleImage img = new ImageReader().loadImage(pFilename);
    if (img.getImageWidth() > 0 && img.getImageHeight() > 0) {
      Map<Integer, RGBColor> colors = new HashMap<Integer, RGBColor>();
      Pixel rgbPixel = new Pixel();
      for (int i = 0; i < img.getImageWidth(); i++) {
        rgbPixel.setARGBValue(img.getARGBValue(i, 0));
        RGBColor color = new RGBColor(rgbPixel.r, rgbPixel.g, rgbPixel.b);
        colors.put(i, color);
      }
      gradient.setColors(colors, false, false);
    }
View Full Code Here

      movie = pMovie;
      preview = pPreview;
    }

    private void generatePreview(int pQuality) {
      preview = new SimpleImage(IMG_WIDTH * IMG_COUNT, IMG_HEIGHT - 1);
      for (int i = 0; i < IMG_COUNT; i++) {

        RenderInfo info = new RenderInfo(IMG_WIDTH, IMG_HEIGHT, RenderMode.PREVIEW);
        Flame renderFlame;
        if (movie.getParts().size() > 0) {
          int frame = (int) ((double) movie.getFrameCount() / ((double) IMG_COUNT + 1) * i + 0.5);
          Flame morphedFlame = movie.getFlame(frame);
          renderFlame = movie.createAnimatedFlame(morphedFlame, frame);
        }
        else {
          renderFlame = new Flame();
        }

        double wScl = (double) info.getImageWidth() / (double) renderFlame.getWidth();
        double hScl = (double) info.getImageHeight() / (double) renderFlame.getHeight();
        renderFlame.setPixelsPerUnit((wScl + hScl) * 0.5 * renderFlame.getPixelsPerUnit());
        renderFlame.setWidth(IMG_WIDTH);
        renderFlame.setHeight(IMG_HEIGHT);
        renderFlame.setSpatialFilterRadius(0.0);
        FlameRenderer renderer = new FlameRenderer(renderFlame, prefs, false, false);
        renderFlame.setSampleDensity(pQuality / IMG_COUNT);
        RenderedFlame res = renderer.renderFlame(info);
        SimpleImage foreground = res.getImage();
        ComposeTransformer composeT = new ComposeTransformer();
        composeT.setHAlign(ComposeTransformer.HAlignment.OFF);
        composeT.setVAlign(ComposeTransformer.VAlignment.OFF);
        composeT.setTop(0);
        composeT.setLeft(i * IMG_WIDTH);
 
View Full Code Here

    panel.setSize(new Dimension(panelWidth, PANEL_HEIGHT));
    panel.setLayout(null);
    panel.setLocation(0, 0);

    if (imageWidth > 16 && imageHeight > 16 && pPart.getFlame() != null) {
      SimpleImage img = createPartPreview(pPart, imageWidth, imageHeight);
      ImagePanel imgPanel = new ImagePanel(img, 0, 0, img.getImageWidth());
      imgPanel.setImage(img);
      imgPanel.setLocation(BORDER_SIZE, BORDER_SIZE);
      panel.add(imgPanel);
    }
View Full Code Here

        for (Component cmp : pnl.getComponents()) {
          if (cmp instanceof ImagePanel) {
            ImagePanel imgPnl = (ImagePanel) cmp;
            int width = imgPnl.getBounds().width;
            int height = imgPnl.getBounds().height;
            SimpleImage img = createPartPreview(pPart, width, height);
            imgPnl.setImage(img, imgPnl.getBounds().x, imgPnl.getBounds().y, width);
            imgPnl.invalidate();
            imgPnl.validate();
            pnl.getParent().repaint();
            break;
View Full Code Here

  private FlamePanel getFlamePanel() {
    if (flamePanel == null) {
      int width = swfAnimatorPreviewRootPanel.getWidth();
      int height = swfAnimatorPreviewRootPanel.getHeight();
      SimpleImage img = new SimpleImage(width, height);
      img.fillBackground(0, 0, 0);
      flamePanel = new FlamePanel(prefs, img, 0, 0, swfAnimatorPreviewRootPanel.getWidth(), this, null);
      ResolutionProfile resProfile = getResolutionProfile();
      flamePanel.setRenderWidth(resProfile.getWidth());
      flamePanel.setRenderHeight(resProfile.getHeight());
      flamePanel.setFocusable(true);
View Full Code Here

            flame.setSampleDensity(oldSampleDensity);
          }
        }
      }
      else {
        imgPanel.setImage(new SimpleImage(width, height));
      }
      swfAnimatorPreviewRootPanel.repaint();
    }
  }
View Full Code Here

    JPanel batchPanel = new JPanel();
    batchPanel.setLayout(null);
    batchPanel.setSize(panelWidth, panelHeight);
    batchPanel.setPreferredSize(new Dimension(panelWidth, panelHeight));
    for (int i = 0; i < randomBatch.size(); i++) {
      SimpleImage img = randomBatch.get(i).getPreview(3 * prefs.getTinaRenderPreviewQuality() / 4);
      // add it to the main panel
      ImagePanel imgPanel = new ImagePanel(img, 0, 0, img.getImageWidth());
      imgPanel.setImage(img);
      imgPanel.setLocation(BORDER_SIZE, i * IMG_HEIGHT + (i + 1) * BORDER_SIZE);
      randomBatch.get(i).setImgPanel(imgPanel);
      final int idx = i;
      addRemoveButton(imgPanel, idx);
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.