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