Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java pls Concept Summary: 1. Graphics Java/C# 2. Colors 3. Drawing Lines Objective: In this assignment you'll be drawing all the possible red, green, blue,

Java pls

image text in transcribedimage text in transcribed

Concept Summary: 1. Graphics Java/C# 2. Colors 3. Drawing Lines Objective: In this assignment you'll be drawing all the possible red, green, blue, purple and white shades next to each other in a window. When you are done, your output should look like this: Color Choices Java Initial Steps: 1) Create a Group object. 2) Create a Canvas of size 300x300 3) Create a Graphics Context, set it to your canvas.getGraphicsContext2D0; 4) Add your canvas to your group C# Initial Steps: 1) In Form1. Designer.cs add an protected override void OnPaint(PaintEventArgs e) a) It should auto complete a basic method with a base.onPaint(e) 2) Create a Graphics object assign it e.Graphics 3) Make a variable of type Pen; Both Languages: 1) Remember an RGB (red, green,blue) value for a color is made up of 3 numbers each between 0 and 255. So solid red is 255,0,0 as you want ALL the red, none of the green and none of the Blue. Solid blue is 0,0,255, and solid purple is made up of red and blue, so it'd be 255,0,255. 2) You'll want to be able to alter your pen using RGB (red, green,blue) values in between drawing each line. a) Java: gc.setStroke(Color.rgb(255,0,0)); //Assumes you called your graphics context gc, will set the pen to red. b) C#: Color myColor=Color.FromArgb(255,0,0); myPen = new Pen(myColor); //Assumes you called your pen myPen, makes pen red. 3) For the red stripe you are going to use a loop from 0 -> 255. a) Set up your pen with the color 0,0,0. b) Draw a line from x=10, y=0 to x=50, y=0 c) Repeat steps a and b, but this time the color should be 1,0,0, and the y values should be 1. Leave the x values the same each time. d) Repeat steps a and b, but this time the color should be 2,0,0 and the y values should be 2. e) f) Repeat steps a and b all the way until y=255 and color is 255,0,0. 4) Repeat for the green stripe. a) Set up your pen with 0,0,0 b) Draw a line from x=60, y=0 to x=100, y=0. c) Repeat steps a and b, but this time the color should be 0,1,0 and the y should be 1. d) e) Repeat steps a and b, but this time the color should be 0,255,0 and the y should be 255. 5) Repeat for the blue stripe. a) These steps are the same, except i) Colors go from 0,0,0 to 0,0,255 ii) Lines are from x=110, y=0 to x=150, y=0 through x=110, y=255 to x=150, y=255. 6) Repeat for the purple stripe. a) These steps are the same, except: i) Colors go from 0,0,0 to 255,0,255 (ie, both red and blue increment together) ii) Lines are from x=160, y=0 to x=200, y=0 through x=160,y=255 to x=200, y=255. 7) Repeat for the white strip. a) These steps are the same, except: i) Colors go from 0,0,0 to 255,255,255 (i.e. all 3 colors increment together) ii) Lines are from x=210, y=0 to x=250, y=0 through x=210, y=255 to x=250, y=255. Final steps: C#: You are done. Java: Make a new Scene: Scene myScene=new Scene(root); Set the primaryStage.setScene(myScene); //This assumes you called your group root

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

Students also viewed these Databases questions

Question

What are the various alternatives?

Answered: 1 week ago

Question

What is meant by Career Planning and development ?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago