zoomGroup.getChildren().add(content); setContent(contentGroup); scaleTransform = new Scale(scaleValue, scaleValue, 0, 0); zoomGroup.getTransforms().add(scaleTransform);
Scale scale = new Scale(scaleFactor, scaleFactor); scale.setPivotX(0); scale.setPivotY(0);
/** * Configures the default scale to use for assets. This allows one to use higher resolution * imagery than the device might normally. For example, one can supply scale 2 here, and * configure the graphics scale to 1.25 in order to use iOS Retina graphics (640x960) on a WXGA * (480x800) device. */ public void setAssetScale(float scaleFactor) { assert scaleFactor > 0; this.assetScale = new Scale(scaleFactor); }
/** * Configures the default scale to use for assets. This allows one to specify an intermediate * graphics scale (like 1.5) and scale the 2x imagery down to 1.5x instead of scaling the 1.5x * imagery up (or displaying nothing at all). */ public void setAssetScale(float scaleFactor) { this.assetScale = new Scale(scaleFactor); }
/** * Configures the default scale to use for assets. This allows one to specify an intermediate * graphics scale (like 1.5) and scale the 2x imagery down to 1.5x instead of scaling the 1.5x * imagery up (or displaying nothing at all). */ public void setAssetScale(float scaleFactor) { this.assetScale = new Scale(scaleFactor); }
/** * Configures the default scale to use for assets. This allows one to specify an intermediate * graphics scale (like 1.5) and scale the 2x imagery down to 1.5x instead of scaling the 1.5x * imagery up (or displaying nothing at all). */ public void setAssetScale(float scaleFactor) { this.assetScale = new Scale(scaleFactor); }
/** * Configures the default scale to use for assets. This allows one to specify an intermediate * graphics scale (like 1.5) and scale the 2x imagery down to 1.5x instead of scaling the 1.5x * imagery up (or displaying nothing at all). */ public void setAssetScale(float scaleFactor) { this.assetScale = new Scale(scaleFactor); }
final Scale scale = new Scale(1,1); anchorPane.getTransforms().add(scale);
double scaleX = node.getBoundsInParent().getWidth(); double scaleY = node.getBoundsInParent().getHeight(); node.getTransforms().add(new Scale(scaleX, scaleY));
@Override public Scale hackScale () { return new Scale(screenScale); }
public AndroidGraphics(Platform plat, Bitmap.Config bitmapConfig, float scaleFactor) { super(plat, new AndroidGL20(), new Scale(scaleFactor)); this.preferredBitmapConfig = bitmapConfig; }
final Scale scale = new Scale(); group.getTransforms().add(scale); // change scale scale.setX(2);
double[] points = new double[] { 0, 0, 0, 1, 1, 1, 1, 0 }; Rotate rot = new Rotate(45, 0.5, 0.5); Translate t = new Translate(5, 7); Scale sc = new Scale(3, 3); for (Transform transform : Arrays.asList(rot, t, sc)) { transform.transform2DPoints(points, 0, points, 0, 4); } System.out.println(Arrays.toString(points));
private void viewportAndScaleChanged (int fbWidth, int fbHeight) { float scale = fbWidth / viewSizeM.width; // plat.log().info("viewportAndScaleChanged: " + fbWidth + "x" + fbHeight + "@" + scale); if (scale != scale().factor) scaleChanged(new Scale(scale)); viewportChanged(fbWidth, fbHeight); } }
private static Scale viewScale (RoboPlatform.Config config) { float deviceScale = (float)UIScreen.getMainScreen().getScale(); boolean useHalfSize = useHalfSize(config); return new Scale((useHalfSize ? 2 : 1) * deviceScale); }
private void initGraphics(){ pointer = new Path(); pointer.setFill(pointerColour.get()); pointer.setStrokeWidth(0); pointer.getElements().add(new MoveTo(50, 50)); pointer.getElements().add(new LineTo(50, 200)); pointer.getElements().add(new LineTo(200, 200)); pointer.getElements().add(new ClosePath()); pointer.relocate(70, 70); pointer.getTransforms().add(new Scale(2, 2, 50, 50)); }
public void print(final Node node) { Printer printer = Printer.getDefaultPrinter(); PageLayout pageLayout = printer.createPageLayout(Paper.NA_LETTER, PageOrientation.PORTRAIT, Printer.MarginType.DEFAULT); double scaleX = pageLayout.getPrintableWidth() / node.getBoundsInParent().getWidth(); double scaleY = pageLayout.getPrintableHeight() / node.getBoundsInParent().getHeight(); node.getTransforms().add(new Scale(scaleX, scaleY)); PrinterJob job = PrinterJob.createPrinterJob(); if (job != null) { boolean success = job.printPage(node); if (success) { job.endJob(); } } }
@Override public void initialize(URL location, ResourceBundle resources) { anchorpane.setOnScroll(event -> { double zoom_fac = 1.05; if(delta_y < 0) { zoom_fac = 2.0 - zoom_fac; } Scale newScale = new Scale(); newScale.setPivotX(event.getX); newScale.setPivotY(event.getY); newScale.setX( content_group.getScaleX() * zoom_fac ); newScale.setY( content_group.getScaleY() * zoom_fac ); content_group.getTransforms().add(newScale); event.consume(); }); }
void checkScaleFactor () { float scaleFactor = Display.getPixelScaleFactor(); if (scaleFactor != scale().factor) updateViewport( new Scale(scaleFactor), Display.getWidth(), Display.getHeight()); }
Affine transform = new Affine() ; // creates identity transform node.getTransforms().add(transform); Timeline timeline = new Timeline(Duration.seconds(0.04), event -> { double shiftX = ... ; double shiftY = ... ; double scaleX = ... ; double scaleY = ... ; double angle = 0.75 ; Affine change = new Affine(); change.append(new Translate(shiftX, shiftY)); change.append(new Scale(scaleX, scaleY)); change.append(new Rotate(angle, new Point3D(1, 0, 0))); transform.append(change); }); timeline.setCycleCount(Animation.INDEFINITE); timeline.play();