Search in sources :

Example 1 with Scale

use of javafx.scene.transform.Scale in project jgnash by ccavanaugh.

the class JavaFXUtils method printImageView.

/**
     * Sends an {@code ImageView} to a printer.
     *
     * @param imageView {@code ImageView} to print
     */
public static void printImageView(final ImageView imageView) {
    final PrinterJob job = PrinterJob.createPrinterJob();
    if (job != null) {
        // Get the default page layout
        final Printer printer = Printer.getDefaultPrinter();
        PageLayout pageLayout = job.getJobSettings().getPageLayout();
        // Request landscape orientation by default
        pageLayout = printer.createPageLayout(pageLayout.getPaper(), PageOrientation.LANDSCAPE, Printer.MarginType.DEFAULT);
        job.getJobSettings().setPageLayout(pageLayout);
        if (job.showPageSetupDialog(MainView.getPrimaryStage())) {
            pageLayout = job.getJobSettings().getPageLayout();
            // determine the scaling factor to fit the page
            final double scale = Math.min(pageLayout.getPrintableWidth() / imageView.getBoundsInParent().getWidth(), pageLayout.getPrintableHeight() / imageView.getBoundsInParent().getHeight());
            imageView.getTransforms().add(new Scale(scale, scale));
            if (job.printPage(imageView)) {
                job.endJob();
            }
        } else {
            job.cancelJob();
        }
    }
}
Also used : PageLayout(javafx.print.PageLayout) Scale(javafx.scene.transform.Scale) Printer(javafx.print.Printer) PrinterJob(javafx.print.PrinterJob)

Example 2 with Scale

use of javafx.scene.transform.Scale in project JFoenix by jfoenixadmin.

the class SVGGlyphBuilder method getIcoMoonGlyph.

/**
	 * will retrieve icons from the glyphs map for a certain glyphName 
	 * 
	 * @param glyphName the glyph name
	 * @return SVGGlyph node 
	 */
public static SVGGlyph getIcoMoonGlyph(String glyphName) {
    SVGGlyph glyph = glyphsMap.get(glyphName).build();
    /*
		 * we need to apply transformation to correct the icon since 
		 * its being after importing from icomoon
		 */
    glyph.getTransforms().add(new Scale(1, -1));
    Translate height = new Translate();
    height.yProperty().bind(Bindings.createDoubleBinding(() -> -glyph.getHeight(), glyph.heightProperty()));
    glyph.getTransforms().add(height);
    return glyph;
}
Also used : Scale(javafx.scene.transform.Scale) Translate(javafx.scene.transform.Translate)

Example 3 with Scale

use of javafx.scene.transform.Scale in project FXyzLib by Birdasaur.

the class TexturedMesh method updateTransforms.

protected void updateTransforms() {
    getTransforms().removeAll(rotateX, rotateY, rotateZ, scale);
    Bounds bounds = getBoundsInLocal();
    javafx.geometry.Point3D p = new javafx.geometry.Point3D((bounds.getMaxX() + bounds.getMinX()) / 2d, (bounds.getMaxY() + bounds.getMinY()) / 2d, (bounds.getMaxZ() + bounds.getMinZ()) / 2d);
    translate = new Translate(0, 0, 0);
    rotateX = new Rotate(0, p.getX(), p.getY(), p.getZ(), Rotate.X_AXIS);
    rotateY = new Rotate(0, p.getX(), p.getY(), p.getZ(), Rotate.Y_AXIS);
    rotateZ = new Rotate(0, p.getX(), p.getY(), p.getZ(), Rotate.Z_AXIS);
    scale = new Scale(1, 1, 1, p.getX(), p.getY(), p.getZ());
    getTransforms().addAll(translate, rotateZ, rotateY, rotateX, scale);
}
Also used : Rotate(javafx.scene.transform.Rotate) Point3D(org.fxyz.geometry.Point3D) Bounds(javafx.geometry.Bounds) Scale(javafx.scene.transform.Scale) Translate(javafx.scene.transform.Translate)

Example 4 with Scale

use of javafx.scene.transform.Scale in project Gargoyle by callakrsos.

the class CaptureItemHandler method createLaledItems.

/**
	 * @작성자 : KYJ
	 * @작성일 : 2016. 9. 28.
	 */
protected void createLaledItems() {
    Button btn = new Button("텍스트");
    btn.setOnAction(e -> {
        Label label = new Label("텍스트");
        label.getTransforms().add(new Scale(5, 5));
        label.setOnMouseClicked(ev -> {
            if (ev.getClickCount() == 2) {
                DialogUtil.showInputDialog(btn, "Text", "Input Text").ifPresent(v -> {
                    if (ValueUtil.isNotEmpty(v.getValue())) {
                        label.setText(v.getValue());
                    }
                });
                ev.consume();
            }
        });
        controller.addItemEvent(label);
        controller.addChildren(label);
    });
    items.add(btn);
}
Also used : Button(javafx.scene.control.Button) Label(javafx.scene.control.Label) Scale(javafx.scene.transform.Scale)

Example 5 with Scale

use of javafx.scene.transform.Scale in project Gargoyle by callakrsos.

the class CaptureScreenController method createPicutre.

public void createPicutre(String image) throws FileNotFoundException {
    ImageView ivPicture = new ImageView();
    File file = new File(snapShotDir, "tmpImage.png");
    try {
        ivPicture.getTransforms().add(new Scale(1.3, 1.3));
        ivPicture.setImage(new Image(new FileInputStream(file)));
    } catch (FileNotFoundException e) {
        throw e;
    }
    addItemEvent(ivPicture);
    //		ivPicture.getTransforms().add(scale);
    //
    //		ivPicture.setOnMouseDragged(ev -> {
    //			double dragX = ev.getSceneX() - dragAnchor.getX();
    //			double dragY = ev.getSceneY() - dragAnchor.getY();
    //			//calculate new position of the circle
    //
    //			double newXPosition = initX + dragX;
    //			double newYPosition = initY + dragY;
    //
    //			//if new position do not exceeds borders of the rectangle, translate to this position
    //			ivPicture.setTranslateX(newXPosition);
    //			ivPicture.setTranslateY(newYPosition);
    //
    //		});
    //
    //		ivPicture.setOnMousePressed(ev -> {
    //			initX = ivPicture.getTranslateX();
    //			initY = ivPicture.getTranslateY();
    //			dragAnchor = new Point2D(ev.getSceneX(), ev.getSceneY());
    //		});
    anchorBoard.getChildren().add(ivPicture);
//		spPic.getcon
}
Also used : FileNotFoundException(java.io.FileNotFoundException) Scale(javafx.scene.transform.Scale) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) File(java.io.File) FileInputStream(java.io.FileInputStream)

Aggregations

Scale (javafx.scene.transform.Scale)7 File (java.io.File)3 ImageView (javafx.scene.image.ImageView)3 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 Map (java.util.Map)2 SwingFXUtils (javafx.embed.swing.SwingFXUtils)2 SnapshotParameters (javafx.scene.SnapshotParameters)2 Button (javafx.scene.control.Button)2 Image (javafx.scene.image.Image)2 WritableImage (javafx.scene.image.WritableImage)2 Translate (javafx.scene.transform.Translate)2 FileChooser (javafx.stage.FileChooser)2 ImageIO (javax.imageio.ImageIO)2 GargoyleLoadBar (com.kyj.fx.voeditor.visual.component.bar.GargoyleLoadBar)1 GargoyleSynchLoadBar (com.kyj.fx.voeditor.visual.component.bar.GargoyleSynchLoadBar)1 WebViewConsole (com.kyj.fx.voeditor.visual.component.console.WebViewConsole)1 DockNode (com.kyj.fx.voeditor.visual.component.dock.pane.DockNode)1 JavaTextView (com.kyj.fx.voeditor.visual.component.popup.JavaTextView)1 FxSVNHistoryDataSupplier (com.kyj.fx.voeditor.visual.component.scm.FxSVNHistoryDataSupplier)1