CS 2110 Fall Instructions. 1 Installing the code. Homework 4 Paint Program. 0.1 Grading, Partners, Academic Integrity, Help

Similar documents
CS2110 Fall 2015 Assignment A5: Treemaps 1

Paint Tutorial (Project #14a)

Our second exam is Thursday, November 10. Note that it will not be possible to get all the homework submissions graded before the exam.

Photoshop tutorial: Final Product in Photoshop:

CS 315 Software Design Homework 1 First Sip of Java Due: Sept. 10, 11:30 PM

Tips from the experts: How to waste a lot of time on this assignment

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

CS 201 Advanced Object-Oriented Programming Lab 10 - Recursion Due: April 21/22, 11:30 PM

Our second exam is Monday, April 3. Note that it will not be possible to get all the homework submissions graded before the exam.

CMPSCI 187 / Spring 2015 Hangman

CS 134 Programming Exercise 3:

Assignment Submission HOWTO

Adobe Photoshop Sh S.K. Sublania and Sh. Naresh Chand

Tips from the experts: How to waste a lot of time on this assignment

10 Connector Designer

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.

ITEC185. Introduction to Digital Media

CIS 121 Data Structures and Algorithms with Java Spring 2018

CMPSCI 187 / Spring 2015 Hanoi

Topic Notes: Java and Objectdraw Basics

CS3114 (Fall 2013) PROGRAMMING ASSIGNMENT #2 Due Tuesday, October 11:00 PM for 100 points Due Monday, October 11:00 PM for 10 point bonus

How to...create a Video VBOX Gauge in Inkscape. So you want to create your own gauge? How about a transparent background for those text elements?

CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon

Adobe illustrator Introduction

a f b e c d Figure 1 Figure 2 Figure 3

1 Getting started with Processing

Standard Toolbar. Main Toolbar. Page Sorter. Action Toolbar

CISC 1600, Lab 2.1: Processing

Programming Standards: You must conform to good programming/documentation standards. Some specifics:

CS Problem Solving and Object-Oriented Programming

CS 2110 Assignment 8: Planet X

1.00/1.001 Introduction to Computers and Engineering Problem Solving Fall 2002 Problem Set 3 Due: Day 11. Problem 1. Finding the Median (15%)

3. When you process a largest recent earthquake query, you should print out:

HYPERSTUDIO TOOLS. THE GRAPHIC TOOL Use this tool to select graphics to edit. SPRAY PAINT CAN Scatter lots of tiny dots with this tool.

Creating Vector Shapes Week 2 Assignment 1. Illustrator Defaults

Ai Adobe. Illustrator. Creative Cloud Beginner

Learning to use the drawing tools

Programming Assignment 2 (PA2) - DraggingEmoji & ShortLongWords

Education and Training CUFMEM14A. Exercise 2. Create, Manipulate and Incorporate 2D Graphics

Programming Project 1

PHOTOSHOP WORKSPACE. Interface Overview. Menus. The Tools. Palettes. Presets and Preferences PHOTOSHOP WORKSPACE UNIVERSAL TASKS PHOTO AND VIDEO TASKS

CS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM

CS 051 Homework Laboratory #2

Com S 227 Assignment Submission HOWTO

Scripting Tutorial - Lesson 11: Advanced: Introducing Classes

CISC 1600, Lab 3.1: Processing

Phase 2: Due 11/28/18: Additional code to add, move and remove vertices in response to user mouse clicks on the screen.

Project #3. Computer Science 2334 Fall Create a Graphical User Interface and import/export software for a Hurricane Database.

CS 106 Winter Lab 05: User Interfaces

Assignment 1. Application Development

Adobe Flash CS3 Reference Flash CS3 Application Window

CS 201 Advanced Object-Oriented Programming Lab 3, Asteroids Part 1 Due: February 17/18, 11:30 PM

be able to read, understand, and modify a program written by someone else utilize the Java Swing classes to implement a GUI

CSCI 585- Database Systems Spring 2008 Homework Assignment 2 Due: Tuesday, April

HO-1: INTRODUCTION TO FIREWORKS

CMPSCI 187 / Spring 2015 Sorting Kata

1. Multimedia authoring is the process of creating a multimedia production:

To get a copy of this image you right click on the image with your mouse and you will get a menu. Scroll down the menu and select "Save Image As".

CSCI 135 Programming Exam #1 Fundamentals of Computer Science I Fall 2014

ShaDe for SketchUp. User's Guide All rights reserved For research use only (non-commercial use) Manuela Ruiz Montiel and Universidad de Málaga

2. If a window pops up that asks if you want to customize your color settings, click No.

SNOWFLAKES PHOTO BORDER - PHOTOSHOP CS6 / CC

BUSINESS PROCESS DOCUMENTATION. Presented By Information Technology

1 Getting started with Processing

CISC 1600 Lecture 3.1 Introduction to Processing

Fall 2013 Program/Homework Assignment #2 (100 points) -(Corrected Version)

Corel Draw 11. What is Vector Graphics?

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Introduction. What is Max?

Programming Assignment 4 ( 100 Points )

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1

Introduction Make a plan with tool Rectangle Measurements Toolbar Enter Return Measurements Toolbar Measure Protractor

CS 315 Data Structures Fall Figure 1

COPYRIGHTED MATERIAL PHOTOSHOP WORKSPACE. Interface Overview 3. Menus 15. The Toolbox 29. Palettes 61. Presets and Preferences 83 WEB TASKS

ANSWER KEY. Chapter 1. Introduction to Computers

CMPSCI 120 Extra Credit #1 Professor William T. Verts

CMSC 201 Fall 2016 Homework 6 Functions

Lesson 6 Adding Graphics

CS61BL: Data Structures & Programming Methodology Summer Project 1: Dots!

TYPE EDIT V12. Tutorial 03. Multicopy to create a set of medals COPYRIGHT 2014 GRAVOTECH MARKING SAS ALL RIGHTS RESERVED

We will start our journey into Processing with creating static images using commands available in Processing:

ADOBE DREAMWEAVER CS4 BASICS

Programme. Introduction to Animation Shop

[ 8 marks ] Demonstration of Programming Concepts

Introduction to Google SketchUp

CS 201 Advanced Object-Oriented Programming Lab 4 - Asteroids, Part 2 Due: February 24/25, 11:30 PM

Art, Nature, and Patterns Introduction

Chapter 3 Syntax, Errors, and Debugging. Fundamentals of Java

How to create an animated face

You Can Make a Difference! Due April 11/12 (Implementation plans due in class on 4/9)

TWO-DIMENSIONAL FIGURES

Basic Computer Programming (Processing)

Unit 21 - Creating a Navigation Bar in Macromedia Fireworks

Programming Assignment 3 ( 100 Points ) START EARLY!

Adobe Flash CS4 Part 1: Introduction to Flash

CS 134 Programming Exercise 2:

Spring CS Homework 3 p. 1. CS Homework 3

Honors Computer Science Python Mr. Clausen Program 7A, 7B

for ArcSketch Version 1.1 ArcSketch is a sample extension to ArcGIS. It works with ArcGIS 9.1

HOW TO. In this section, you will find. miscellaneous handouts that explain. HOW TO do various things.

Transcription:

CS 2110 Fall 2012 Homework 4 Paint Program Due: Wednesday, 12 November, 11:59PM In this assignment, you will write parts of a simple paint program. Some of the functionality you will implement is: 1. Freehand drawing, erasing, airbrushing. 2. Drawing lines and circles. 0 Instructions 0.1 Grading, Partners, Academic Integrity, Help Solutions will be graded on correctness, the quality of the algorithms, and style. A correct program compiles without errors or warnings and behaves according the the requirements given here and in the comments of the code. A program with good style is clear, concise, and easy to read. You can work in groups of two. Form the group well before the assignment due date. Both must do something to form the group: one proposes, the other accepts. People in a group must work together. It is against the rules for one person to do programming on this assignment without the other person sitting nearby and helping. Take turns driving using the keyboard and mouse. With the exception of your CMS-registered group partner, you may not look at anyone else s code, in any form, or show your code to anyone else (except the course staff), in any form. You may not show or give your code to another student in the class. We will pin a note on the Piazza, as we did for A4, to discuss important points. Check it often. 1 Installing the code The release contains source code (files with extension.java) and image files (with extension.png). Follow the following steps to install the code: 1. Create an empty Java project in eclipse and copy the code into the source (src) folder of the project. The easiest way to do this is by dragging the code to the appropriate place inside Eclipse. 2. Copy the image files to the default current directory. This is typically the project directory (inside the workspace folder, there is a folder with the same name as the Eclipse project, and this is the project directory). Method main for the program is in file PaintGUI.java. CS 2110 Fall 2012 1/7 Homework 4

2 Example of drawing in Java We give you a simple example of drawing in Java. Suppose you want to create an image object, e.g. a rectangular image of width 800 pixels and height 600 pixels. You want to color the entire image with a single color. The main steps involved are the following: Construct the image object: BufferedImage img= new BufferedImage(width,height,BufferedImage.TYPE INT ARGB); The argument BufferedImage.TYPE INT ARGB tells Java to create an image with 8-bit RGBA (red, green, blue, alpha) color components packed into integer pixels. The alpha component corresponds to transparency. Obtain the graphics object of the image, which exposes drawing functionality. Graphics2D g2d= (Graphics2D) img.getgraphics(); Set the drawing color. g2d.setcolor(drawingcolor); Fill the rectangular area with top-left corner (0,0) with the current drawing color. g2d.fillrect(0, 0, width, height); You can also explicitly construct shapes, like rectangles Shape rect= new Rectangle2D.Double(topLeftX, toplefty, w, h); and draw them on the image (the outline of the shape) g2d.draw(rect); or draw them filled with the current drawing color g2d.fill(rect); For more information, you can read Java s tutorial: http://docs.oracle.com/javase/tutorial/2d/index.html The code we have provided contains several examples that are intuitive enough to understand without going into too much detail in Java s vast API for 2D graphics. CS 2110 Fall 2012 2/7 Homework 4

3 Paint program You can see a screenshot of a fully implemented paint program in Figure 1, where we also show it annotated with what the important GUI components represent. The program allows you to open image files and save in images files. See Figure 2. You can draw with a pencil (freehand drawing), erase, airbrush. You can draw lines and circles. You can change both the foreground color (used for drawing) and the background color (used for erasing). See Figure 3. SAVE: The program lets you know when there are unsaved changes to the image. Label SAVE appears at the bottom whenever changes are made and disappears when the image is saved to a file. You will see some more functionality by running the release code. 4 Project Structure A significant part of your work for this assignment will be to read the release code and figure out how it works. You may need to find the relevant Java documentation on the Web and read it. Successful completion of the assignment requires you to understand well how the existing code works. Here is a brief description of classes: DrawingCanvas: This class represents the image you are painting. It handles the mouse events that are relevant for drawing and performs the drawing operations. PaintGUI: This class sets up the main window of the program. It handles the creation of most GUI components and responds to relevant actions. NewImageDialog: A custom dialog for creating new blank images. Tool: An enumeration of the available drawing tools. DrawingCanvas and PaintGUI are the only classes you need to modify. Do not change anything else in the code. Every point inside the code where you have to change/add something has been marked for you. 5 Class DrawingCanvas The parts that have to be implemented have been clearly marked in the release code. You will find detailed instructions in the code. Some remarks: Freehand pencil drawing should leave no gaps. That is, when you press and drag the mouse around, it should draw on the trace of the mouse movement. The eraser should behave similarly. CS 2110 Fall 2012 3/7 Homework 4

Figure 1: Fully implemented paint program. CS 2110 Fall 2012 4/7 Homework 4

Figure 2: Open and save image files. CS 2110 Fall 2012 5/7 Homework 4

Figure 3: Drawing. CS 2110 Fall 2012 6/7 Homework 4

The airbrush does not have to leave a continuous trace. We suggest you implement line drawing as follows: When you first press the mouse, one endpoint of the line is fixed (nothing is drawn on the image yet). When you press the mouse for a second time, the second endpoint is fixed and the line is drawn on the image. You should visualize the tentative line after the first endpoint is given and before the second endpoint is given. That is, while the user is deciding on the second endpoint and moving the mouse around, they can see the line that will be drawn. Do something similar for the circle. For example, when you first press the mouse, you fix the center of the circle and the second time you fix a point that is on the circle and draw. 6 Class PaintGUI The parts that have to be implemented have been clearly marked in the release code. There is very little to be done here and it is very straightforward, but you need to read and understand the code well before you attempt to make any changes. 7 Submission Compress exactly the following files into a zip file that you will then submit on CMS: README.txt: This file should contain your name, your NetID, all known issues you have with your submitted code, and the names of anyone you have discussed the homework with (except the course staff). Also, if you want to explain something about your code that you think needs clarification, you can add a few paragraphs here. All the.java files needed for your program. Do not include any files ending in.class. All.java files should compile and conform to the prototypes we gave you. We write our own classes that use your classes public methods to test your code. Even if you do not use a method we require, you should still implement it for our use. CS 2110 Fall 2012 7/7 Homework 4