public ShearSample() { super(125,160); //create rectangle Rectangle rect = new Rectangle(75, 75, Color.web("#ed4b00", 0.5)); rect.setTranslateY(50); Shear shear = new Shear(0.7, 0); rect.getTransforms().add(shear); //show the rectangles getChildren().addAll(rect); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Shear X", shear.xProperty(), 0d, 1d), new SimplePropertySheet.PropDesc("Shear Y", shear.yProperty(), 0d, 1d), new SimplePropertySheet.PropDesc("Shear Pivot X", shear.pivotXProperty(), 0d, 50d), new SimplePropertySheet.PropDesc("Shear Pivot Y", shear.pivotYProperty(), 0d, 50d) ); // END REMOVE ME }
public static Node createIconContent() { final Rectangle r1 = new Rectangle (22, 0, 64, 64); r1.setArcHeight(4); r1.setArcWidth(4); r1.setFill(Color.web("#ed4b00",0.5)); r1.getTransforms().add(new Shear(-0.35, 0)); Polygon polygon = createArrow(); polygon.setLayoutX(-5); polygon.setLayoutY(-2); polygon.setRotate(90); Rectangle r2 = new Rectangle (0, 0, 64, 64); r2.setArcHeight(4); r2.setArcWidth(4); r2.setFill(Color.web("#ed4b00", 0.25)); javafx.scene.Group g = new javafx.scene.Group(r2,r1, polygon); return new javafx.scene.Group(g); }
public void shearSelectedObject(double x, double y) { GUIState guiState = mainController.getGUIController().getGuiState(); FocusOutline focusOutline = guiState.getFocusOutline(); Shear shearing = new Shear(); shearing.setX(x); shearing.setY(y); shearing.setPivotX(focusOutline.getRotateAnchor().getCenterX()); shearing.setPivotY(focusOutline.getRotateAnchor().getCenterY()); focusOutline.getFocusRectangle().getTransforms().add(shearing); focusOutline.getRotateAnchor().getTransforms().add(shearing); guiState.getSelectedObject().getTransforms().add(shearing); for (ResizeAnchor resizeAnchor : focusOutline.getResizeAnchors()) { resizeAnchor.getTransforms().add(shearing); } }
private Transform GetTransformation(int width, int height) { double centerX = width * GetDoubleAttribute("X") / MaximumX; double centerY = height * GetDoubleAttribute("Y") / MaximumY; double skewX = 90 * (GetDoubleAttribute("SkewX") - MaximumX / 2.0) / MaximumX; double skewY = 90 * (GetDoubleAttribute("SkewY") - MaximumY / 2.0) / MaximumY; double scaleX = GetDoubleAttribute("Width"); double scaleY = GetDoubleAttribute("Height"); double rotation = (GetDoubleAttribute("Rotation") / MaximumX) * 360; Shear skewTransform = new Shear(skewX, skewY, centerX, centerY); Rotate rotateTransform = new Rotate(rotation, centerX, centerY); Scale scaleTransform = new Scale(scaleX, scaleY, centerX, centerY); return rotateTransform.createConcatenation(scaleTransform).createConcatenation(skewTransform); }
public Digit(Color onColor, Color offColor, Effect onEffect, Effect offEffect) { this.onColor = onColor; this.offColor = offColor; this.onEffect = onEffect; this.offEffect = offEffect; getChildren().addAll(polygons); getTransforms().add(new Shear(-0.1,0)); showNumber(0); }
public static String getTransforms(Node object) { String transforms = ""; for (Transform transform : object.getTransforms()) { StringBuilder currentTransform = new StringBuilder(); if (!transforms.isEmpty()) { currentTransform.append(" "); } if (transform instanceof Rotate) { Rotate rotate = (Rotate) transform; currentTransform.append("rotate("); currentTransform.append(rotate.getAngle()); currentTransform.append(" "); currentTransform.append(rotate.getPivotX()); currentTransform.append(" "); currentTransform.append(rotate.getPivotY()); currentTransform.append(")"); } if (transform instanceof Shear) { Shear shear = (Shear) transform; currentTransform.append("matrix("); currentTransform.append("1"); currentTransform.append(", "); currentTransform.append(shear.getY()); currentTransform.append(", "); currentTransform.append(shear.getX()); currentTransform.append(", "); currentTransform.append("1"); currentTransform.append(", "); currentTransform.append("0"); currentTransform.append(", "); currentTransform.append("0"); currentTransform.append(")"); } transforms += currentTransform.toString(); } return transforms; }
/** * @param shear the shear to set */ public void setShear(Shear shear) { this.shear = shear; }
/** * @return the shear */ public Shear getShear() { return shear; }