Package org.jwildfire.swing

Examples of org.jwildfire.swing.ImagePanel


      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()));

    imageRootPanel.add(imagePanel, BorderLayout.CENTER);
View Full Code Here


  private void clearCurrentPreview() {
    for (int i = 0; i < randomBatch.size(); i++) {
      FlameMovie bMovie = randomBatch.get(i).getMovie();
      if (bMovie == currMovie) {
        randomBatch.get(i).preview = null;
        ImagePanel pnl = randomBatch.get(i).getImgPanel();
        if (pnl != null) {
          pnl.replaceImage(randomBatch.get(i).getPreview(prefs.getTinaRenderPreviewQuality() / 2));
          pnl.repaint();
        }
        break;
      }
    }
  }
View Full Code Here

    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);
    }

    int yOff = 2 * BORDER_SIZE + imageHeight;
    {
View Full Code Here

      int idx = currMovie.getParts().indexOf(pPart);
      if (idx >= 0) {
        JPanel pnl = flamePartPanelList.get(idx);
        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

    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);
      imgPanel.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent e) {
          if (e.getClickCount() > 1 || e.getButton() != MouseEvent.BUTTON1) {
            importFromRandomBatch(idx);
          }
        }
View Full Code Here

        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;
            final int col = j;

            imgPanel.addMouseListener(new java.awt.event.MouseAdapter() {

              @Override
              public void mouseClicked(java.awt.event.MouseEvent e) {
                if (e.getClickCount() == 2 || e.getButton() == MouseEvent.BUTTON3) {
                  mutate(row, col);
View Full Code Here

    final Color selColor = new Color(65, 63, 147);
    final Color deSelColor = new Color(0, 0, 0);

    for (int i = 0; i < 5; i++) {
      for (int j = 0; j < 5; j++) {
        ImagePanel pnl = imagePanels[i][j];
        boolean sel = i == pRow && j == pCol;
        ((JPanel) pnl.getParent()).setBorder(new LineBorder(sel ? selColor : deSelColor, sel ? 5 : 1));
      }
    }
    selRow = pRow;
    selCol = pCol;
    enableControls();
View Full Code Here

    }
  }

  private Dimension calcImageSize() {
    createImagePanels();
    ImagePanel pnl = imagePanels[0][0];
    Dimension size = pnl.getSize();
    int imageWidth = Tools.FTOI(size.getWidth());
    int imageHeight = Tools.FTOI(size.getHeight());
    return new Dimension(imageWidth, imageHeight);
  }
View Full Code Here

            else {
              mutations.add(baseFlame.makeCopy());
              renderedImg = renderFlame(baseFlame.makeCopy(), renderSize, false);
            }

            ImagePanel pnl = imagePanels[i][j];
            pnl.setImage(renderedImg);
            showProgress(++step);

            try {
              pnl.invalidate();
              Graphics g = pnl.getGraphics();
              if (g != null) {
                pnl.paint(g);
              }
            }
            catch (Throwable ex) {
              ex.printStackTrace();
            }
View Full Code Here

    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 {
          Graphics g = pnl.getGraphics();
          if (g != null) {
            pnl.paint(g);
          }
        }
        catch (Throwable ex) {
          ex.printStackTrace();
        }
View Full Code Here

TOP

Related Classes of org.jwildfire.swing.ImagePanel

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.