Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a program that displays a series of images overlayed on top of each other

ID: 3699392 • Letter: C

Question

Create a program that displays a series of images overlayed on top of each other.

Create a StackPane.

Create a method named blendModeObjects that returns a Node. This means that it’ll return a node that will then be added to the root in order to display all of the shapes.

Create a group object;

Create a circle with 50,50 as coordinates and radius of 25

Fill the circle with DARKGRAY

Create a rectangle with coordinates(50,50, 50, 50)

Fill color should be set to BLUEVIOLET

Now you need to blend the two.

i.Blend is an effect that combines two objects using one of the predefined blend modes. A blend mode defines the manner in which the objects are mixed together. For example, in figure below, you can see examples of some blend modes applied to an intersecting circle and a square.

Create a rectangle(170, 50, 50, 50) with a BLUEVIOLET fill

Create a circle(170, 50, 25) with a CORAL fill

Now create a circle with a piece cut out of it:

i.Create a circle(50, 150, 25) with a NAVY fill

ii.Create a rectangle(50, 150, 50, 50) with a WHITE fill

iii.Set the Blend Mode to SRC_ATOP

iv.When you add the circle and rectangle to the root, make sure you add the circle first, and then the rectangle.

Java Ex Program 2 Blended Shape Create a program that displays a series of images gverlaved on top of each other. 1. 2. Create a StackPaoe. Create a method named blendModeQbiests that returns a Node. This means that it'll return a node that will then be added to the root in order to display all of the shapes a. b. c. d. e. f. Create a group object; Create a circle with 50,50 as coordinates and radius of 25 Fill the circle with DARKGRAY Create a rectangle with coordinates(50,50, 50, 50) Fill color should be set to BLUEVIOLET Now you need to blend the two. Blend is an effect that combines two objects using one of the predefined blend modes. A blend mode defines the manner in which the objects are mixed together. For example, in figure below, you can see examples of some blend modes applied to an intersecting circle and a square. i. - MULTIPLY SRC_ ATOP SRC OVER g. Create a rectangle(170, 50, 50, 50) with a BLUEVIOLET fill h. Create a circle(170, 50, 25) with a CORAL fil i. Now create a circle with a piece cut out of it: i. Create a circle(50, 150, 25) with a NAVY fill ii. Create a rectangle(50, 150, 50, 50) with a WHITE fill i. Set the Blend Mode to SRC_ATOP iv. When you add the circle and rectangle to the root, make sure you add the circle first, and then the rectangle.

Explanation / Answer

BlendedShapes.java

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.effect.BlendMode;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;


public class BlendedShapes extends Application {
  
    @Override
    public void start(Stage primaryStage) {
   
      
        StackPane root = new StackPane();
        root.getChildren().add(blendModeObjects());
      
        Scene scene = new Scene(root, 300, 250);
      
        primaryStage.setTitle("Blended Shapes");
        primaryStage.setScene(scene);
        primaryStage.show();
    }
  
    static Node blendModeObjects() {
        Group g =new Group();
      
        Circle c = new Circle(50,50,25);
        c.setFill(Color.DARKGRAY);
        c.setBlendMode(BlendMode.MULTIPLY);
      
        Rectangle r = new Rectangle(50,50,50,50);
        r.setFill(Color.BLUEVIOLET);
      
        Rectangle r2 = new Rectangle(170,50,50,50);
        r2.setFill(Color.TEAL);
      
        Circle c2 = new Circle(170,50,25);
        c2.setFill(Color.CORAL);
      
        //use rectangle to remove a piece from the circle
        //add circle first, then rectangle on top

        Rectangle r3 = new Rectangle(50,150,50,50);
        r3.setFill(Color.WHITE);
      
        Circle c3 = new Circle(50,150,25);
        c3.setFill(Color.NAVY);

        g.setBlendMode(BlendMode.SRC_ATOP);
        g.getChildren().addAll(r,c, c2, r2, c3, r3);
        return g;
    }

    public static void main(String[] args) {
        launch(args);
    }
  
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote