Package org.jwildfire.transform

Examples of org.jwildfire.transform.TextTransformer$ModeEditor


            long t1 = System.currentTimeMillis();
            SimpleImage img = res.getImage();
            img.getBufferedImg().setAccelerationPriority(1.0f);

            if (data.layerAppendBtn.isSelected() && !pMouseDown) {
              TextTransformer txt = new TextTransformer();
              txt.setText1("layer-append-mode active");
              txt.setAntialiasing(true);
              txt.setColor(Color.RED);
              txt.setMode(Mode.NORMAL);
              txt.setFontStyle(FontStyle.BOLD);
              txt.setFontName("Arial");
              txt.setFontSize(16);
              txt.setHAlign(HAlignment.RIGHT);
              txt.setVAlign(VAlignment.BOTTOM);
              txt.transformImage(img);
            }

            if (data.layerPreviewBtn.isSelected()) {
              Layer onlyVisibleLayer = null;
              for (Layer layer : getCurrFlame().getLayers()) {
                if (layer.isVisible()) {
                  if (onlyVisibleLayer == null) {
                    onlyVisibleLayer = layer;
                  }
                  else {
                    onlyVisibleLayer = null;
                    break;
                  }
                }
              }
              boolean drawSubLayer = flame.getLayers().size() > 1 && getCurrLayer() != null && getCurrLayer() != onlyVisibleLayer && !cfg.isNoControls();

              if (drawSubLayer) {
                Flame singleLayerFlame = new Flame();
                singleLayerFlame.assign(flame);
                singleLayerFlame.getLayers().clear();
                singleLayerFlame.getLayers().add(getCurrLayer().makeCopy());
                singleLayerFlame.getFirstLayer().setVisible(true);
                singleLayerFlame.getFirstLayer().setWeight(1.0);
                RenderInfo lInfo = new RenderInfo(width / 4 * renderScale, height / 4 * renderScale, RenderMode.PREVIEW);
                double lWScl = (double) lInfo.getImageWidth() / (double) singleLayerFlame.getWidth();
                double lHScl = (double) lInfo.getImageHeight() / (double) singleLayerFlame.getHeight();
                singleLayerFlame.setPixelsPerUnit((lWScl + lHScl) * 0.5 * singleLayerFlame.getPixelsPerUnit() * 0.5);
                singleLayerFlame.setWidth(lInfo.getImageWidth());
                singleLayerFlame.setHeight(lInfo.getImageHeight());
                FlameRenderer lRenderer = new FlameRenderer(singleLayerFlame, prefs, false, false);
                RenderedFlame lRes = lRenderer.renderFlame(lInfo);
                SimpleImage layerImg = lRes.getImage();

                boolean drawLayerNumber = true;
                if (drawLayerNumber) {
                  RectangleTransformer rT = new RectangleTransformer();
                  int textWidth = 28;
                  int textHeight = 22;
                  int margin = 2;

                  rT.setColor(new java.awt.Color(0, 0, 0));
                  rT.setLeft(layerImg.getImageWidth() - textWidth - 2 * margin);
                  rT.setTop(layerImg.getImageHeight() - textHeight - 2 * margin);
                  rT.setThickness(textHeight / 2 + 1);
                  rT.setWidth(textWidth);
                  rT.setHeight(textHeight);
                  rT.transformImage(layerImg);

                  TextTransformer txt = new TextTransformer();
                  txt.setText1("  " + (flame.getLayers().indexOf(getCurrLayer()) + 1) + "  ");
                  txt.setAntialiasing(true);
                  txt.setColor(new java.awt.Color(200, 200, 200));
                  txt.setMode(Mode.NORMAL);
                  txt.setFontStyle(FontStyle.BOLD);
                  txt.setFontName("Arial");
                  txt.setFontSize(16);
                  txt.setHAlign(HAlignment.NONE);
                  txt.setPosX(layerImg.getImageWidth() - textWidth - margin);
                  txt.setPosY(layerImg.getImageHeight() - textHeight - margin);
                  txt.setVAlign(VAlignment.NONE);
                  txt.transformImage(layerImg);
                }

                RectangleTransformer rT = new RectangleTransformer();
                rT.setColor(new java.awt.Color(200, 200, 200));
                rT.setLeft(0);
View Full Code Here


  private List<Point> getPoints() {
    if (_points == null) {
      String key = makeRessourceKey();
      _points = (List<Point>) RessourceManager.getRessource(key);
      if (_points == null) {
        TextTransformer txt = new TextTransformer();
        txt.setText1(text);
        txt.setAntialiasing(false);
        txt.setColor(Color.WHITE);
        txt.setMode(Mode.NORMAL);
        txt.setFontStyle(FontStyle.PLAIN);
        txt.setFontName(font_name);
        txt.setFontSize(font_size);
        txt.setHAlign(HAlignment.CENTRE);
        txt.setVAlign(VAlignment.CENTRE);
        txt.setBaseLineOffset(baseline);

        Dimension dim = txt.calculateTextSize();
        int imgWidth = (int) (dim.getWidth() + 2 * font_size);
        int imgHeight = (int) (dim.getHeight() + 2 * font_size);
        SimpleImage imgMap = new SimpleImage(imgWidth, imgHeight);

        txt.transformImage(imgMap);
        _points = new ArrayList<Point>();
        double w2 = (double) imgMap.getImageWidth() / 2.0;
        double h2 = (double) imgMap.getImageHeight() / 2.0;
        for (int i = 0; i < imgMap.getImageHeight(); i++) {
          for (int j = 0; j < imgMap.getImageWidth(); j++) {
View Full Code Here

          FlameRenderer renderer = new FlameRenderer(renderFlame, prefs, false, false);
          renderer.setProgressUpdater(null);
          RenderedFlame res = renderer.renderFlame(info);
          SimpleImage img = res.getImage();
          if (pDrawFPS) {
            TextTransformer txt = new TextTransformer();
            txt.setText1("fps: " + Tools.doubleToString(pFPS) + ", time: " + Tools.doubleToString(pFrame / 1000.0) + "s");
            txt.setAntialiasing(false);
            txt.setColor(Color.LIGHT_GRAY);
            txt.setMode(Mode.NORMAL);
            txt.setFontStyle(FontStyle.PLAIN);
            txt.setFontName("Arial");
            txt.setFontSize(10);
            txt.setHAlign(HAlignment.LEFT);
            txt.setVAlign(VAlignment.BOTTOM);
            txt.transformImage(img);
          }
          imgPanel.setImage(img);
        }
        finally {
          flame.setSpatialFilterRadius(oldSpatialFilterRadius);
View Full Code Here

            Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
          }

          ImagePanel pnl = pnlList.get(selectedPnl);
          SimpleImage img = pnl.getImage();
          TextTransformer txt = new TextTransformer();
          txt.setText1(bMove ? "(moved)" : "(copied)");
          txt.setAntialiasing(true);
          txt.setColor(bMove ? Color.RED : Color.GRAY);
          txt.setMode(Mode.NORMAL);
          txt.setFontStyle(FontStyle.BOLD);
          txt.setFontName("Arial");
          txt.setFontSize(24);
          txt.setHAlign(HAlignment.CENTRE);
          txt.setVAlign(VAlignment.CENTRE);
          txt.transformImage(img);

          pnl.invalidate();
          pnl.repaint();

          enableControls();
View Full Code Here

          }
          node.setRemoved(false);
          ImagePanel pnl = pnlList.get(selectedPnl);
          SimpleImage img = pnl.getImage();

          TextTransformer txt = new TextTransformer();
          txt.setText1("(deleted)");
          txt.setAntialiasing(true);
          txt.setColor(Color.RED);
          txt.setMode(Mode.NORMAL);
          txt.setFontStyle(FontStyle.BOLD);
          txt.setFontName("Arial");
          txt.setFontSize(24);
          txt.setHAlign(HAlignment.CENTRE);
          txt.setVAlign(VAlignment.CENTRE);
          txt.transformImage(img);

          pnl.invalidate();
          pnl.repaint();
        }
      }
View Full Code Here

TOP

Related Classes of org.jwildfire.transform.TextTransformer$ModeEditor

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.