Download Jason Hoang

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

BSAVE (bitmap format) wikipedia , lookup

Apple II graphics wikipedia , lookup

Waveform graphics wikipedia , lookup

Tektronix 4010 wikipedia , lookup

Transcript
Hoang, 1
Jason Hoang
CS 491B
Jun 2nd, 2005
DrawingPaint
Abstract: Simulating graphics with a computer has always been a challenging problem.
This report will discuss the implementation of a drawing panel with paint tools in Java 2D
graphics. The main objective of this project is to simulate a drawing tools panel with convenient,
interactive and automated design process assisted by computers.
1. Introduction:
The purpose of DrawingPaint is to create a Paint application to allow computer
users to use the application to assist in their design processes. This software allows computer
users to view, edit, and design their graphic designer files through a user friendly GUI.
DrawingPaint application has been widely used by mechanical designers, civil engineers,
architects, and so on. Paint application software usually helps computer users’ design processes
with drawing tools such as pens, erasers, and scales. Most of their application programs are
expensive or complex, and there are still some inconveniences and fewer capabilities in fields of
team designing and data management. To overcome those problems, in my project I developed
DrawingPaint system which is simple, efficient and manageable by applying the whole
simulation on a local computer. It is much more economical, convenient, and interactive than
available commercial Paint application software.
Since I wanted to create an application which is economic and efficient, Java was chosen
as the main language for development of this implemented DrawingPaint application. Indeed,
Java language is providing efficient ways to add drawing elements to an object oriented
language.
2. Technological Background:
Hoang, 2
Sun Microsystems has developed Java language with Object Oriented language. It has a
very large class library and hierarchy which helps programmers to simplify their codes and
Java’s simplicity and portability makes it easy to use by using readily made classes. Using of
Java 2D in this project not only increases the level of complexity of the simulator engine
incrementally but also simplifies the design and implementation of the simulator.
Java 2D API introduced in JDK 1.2 provides enhanced two–dimensional graphics, text,
and image capabilities for Java programs through extensions to the Abstract Windowing Toolkit
(AWT). It is a set of classes that extent the capabilities of Sun’s Abstract Windowing Toolkit.
It handles arbitrary shapes, text, and images and provides a uniform mechanism for performing
transformations, such as rotation and scaling. It also supports a wide array of presentation
devices such as displays and printers, as well as image formats and encoding, color spaces, and
rendering techniques and effects. More than that, Java 2D offers comprehensive text and font
handling, as well as color support.
In this project, Java 2D performs a lot of calculations for me and minimize amounts of
necessary work for each operation unlike other programming languages. Therefore, the use of
Java in this project retains both great flexibility and high performance.
3. System Architecture:
3.1 Software Perspective:
With this software, users can install and create drawing designers in all kinds of window
X. Users can use this application for entertainment, fun time, or to practice their skills such as
controlling mouse, key board, or design graphical objects.
3.2 Document Conventions and Definitions
System, Software, Program: These are all terms referring to this system.
Database: A directory which contains saving drawing files.
GUI: Graphical user interface.
Windows X: Windows 95, 98, ME, 2000, and XP
3.3 Tools:
 Java language.
 Text Editor.
Hoang, 3
 Java Development Kit 1.3 or later.
4. Design and Implementation Details:
The DrawingPaint application system is implemented using Java j2sdk 1.3 or later
versions. The DrawingPaint system utilizes a file to save in a data directory objects that is
created by the computer users. The user interface system includes installing this application on
any operating system of computers. Once the application configuration has been accomplished,
the users can open this application and go to the menu bar and click drawing tools to start their
graphic designers. If successful, the users can save, view or design any linear objects. The
objects that the designers create are saved in a data file. The data file as data storage for the
graphical files which are saved on the local computer’s hard drive. The users can open the data
storage file for viewing or modification of objects. Thus, the output paradigms are satisfied with
the following diagram.
4.1 Graphical User Interface Design
Menu Bar
The menu bar provides user interface for file manipulation, selecting design attributes for
drawing, configuring color setting for graphical designer objects, editing user’s point viewing of
drawing objects, and getting help information for operating DrawingPaint application system.
Hoang, 4
File menu:
New: Clear current drawing data and create a new drawing data file.
Load: Opens a data file.
Save: saves the current data to a file.
Print: send the current data to the printer.
Exit: close the DrawingPaint application.
Color setting menu
Color: configures color setting to draw via color chooser.
Hoang, 5
Drawing Shapes menu
Shapes: provides drawing tools for drawing line, square, rectangle, circle, oval,
arc, rounded rectangle, polygon, input text string, and free hand drawing.
Edit viewing menu
Erase: provide functions to delete selected elements or all elements.
Clearpad: clear current drawing panel.
Resize: change size of drawing screen to suitable to user’s viewing.
Copy: copy and save all drawing objects on the clipboard.
Paste: draw all drawing objects on the clipboard to the drawing screen.
Cut: just like a copy, except it erase the drawing screen afterwards.
Undo: delete the last element which is drawn on the drawing screen.
Hoang, 6
Help information menu
Information: Instructions how to use DrawingPaint application.
4.2 Drawing Screen
The drawing screen displays drawing data in memory. This component also provides user
interface for selection of elements by clicking mouse at a desired point on a drawing data.
Implementation DrawingPaint System Design
Establishing a user interface for a drawing package which allows users may be drawn
from a range of two dimensional shapes with using different colors. The shapes can draw in
outline or filled. There are also facilities to erase, help how to use the drawing package, and load
the previous drawing files or save the present drawing objects. This package is implemented
through the action, item, mouse and window listeners. The action listener will react in response
to any button being pressed; the item listener will react to radio buttons being pressed; the mouse
listener will react to mouse buttons being operated; the mouse motion listener will react to the
movement of the mouse and finally the window listener will react in response to the frame being
closed. The algorithms of classes’ constructor for this project are simulated as following:

Set background color of JPanel.

Set layout to null.

Initialize radio buttons, text fields, and menu components.

Detect actionListener perform.

Set window displaying.

Detect and get coordinates of mouse position.

Detect mouse movements such as moved, pressed, dragged, or released.

Set color chooser menu in the colors array.

Detect window operating.
5. Project Class Structure:
As mention above, Java 2D provides very a large class library and hierarchy which helps
programmers to simplify their codes by using readily made classes. In this project, I imported an
awt class to support for my color selection and drawing tools. I created a main sketchpad class
which was calling draw () and color () methods in ClosedShapes class. I also created arc, ellipse,
Hoang, 7
circle, square, rectangle, roundRectangle, polygon, fdraw, and line classes. They were subclasses
of ClosedShapes class which were override methods in their parent class whenever they were
called. The class structure of this project is shown in the following diagram.
Hoang, 8
6. Performance Evaluation:
DrawingPaint project is built accordance to schedule time. It is worked alright when calling
each drawing tool function. However, color chooser just works simple with a drop down
menu for color choosing, it is not worked as color panel for editing of complex color
choosing. There is also a limitation of text input. For now, the action of text input just works
like to input text string in text area. It could not save in data storage. Unfortunately, all text
inputs and drawing graphics on the drawing panel are alright for printing action.
7. Conclusion and Future Work:
Hoang, 9
The development of implemented DrawingPaint is going to be gradual. In general, this
project is successful to build the drawing panel and tools for users to design their graphical
images. It have options such as saving, loading, inserting of text strings to the drawing panel,
printing, and lot of drawing tools for computer users who choose to save their works or to create
complicated designer graphics. In fact, this project retains both great flexibility and performance.
This project would be adding more functionality to its application and make it more reliable
and efficient. This application also would be expandable to become a server application with a
lot of functionalities of user account management, remote data management, system monitoring,
system log generation and communications with multiple clients over a TCP/IP stream socket.
2. Look up
DrawingPaintServer
Data Storage
Drawing data
5. Load data
1. Query file list
4. Open a file
3. Reply file list
6. Send saved data
DrawingPaintClient
Drawing data
8. References:
Appendix A: User manual
For proper running this project, audiences (computer users) need to interact with the
computer. Audiences who are best suited for this documentation include Engineers (Mechanical,
Electrical, Civil, etc.), Architectures, Computer Scientists, Structural Designers, and computer
Hoang, 10
network specialists. These audiences can implement their designer graphics creatively to
enhance their productivities, creativities, profitability, and accessibilities. In order to understand
the content of this documentation, the following terms will often be used throughout this
documentation. Therefore, the list below will assist the users in understanding these terms and
its definitions.
Terms and Definitions:
1. User: This refers to a computer user who has the permission to design any linear objects.
For example, a designer can draw any objects, save the objects which have been being
created, and view them later.
2. Drawing Shapes: This refers to drawing tools which assist users to draw straight lines,
squares, rectangles, circles, ovals, arcs, rounded rectangles, and polygons by providing 2
points or one click and dragging mouse.
3. Text: This refers to input text strings to the drawing panel or to label graphical designers.
4. Color: This refers to options of choosing color for each drawing tool which users have
been using.
5. Tool: This refers to action of editing of users’ point of view. This action includes
zooming, editing, and erasing elements.
6. Outline: This action that results in drawing outline of drawing objects.
7. Fill: This action that result fills up the background of drawing objects with the same color
which users have been chosen.
8. Save: The action that results in saving designed works.
9. Load: The action that results open and view previous saving files (graphical images)
10. New: The action that results of erasing the whole drawing panel and start over from a
blank drawing panel.
11. Print: The action that results of sending all drawing objects to the printer.
12. Exit: The action that results in closing application system.
Appendix B: Sources and related websites:
 http://www.skywayradio.com/tech/java/2d
 http://www.sun.com/
 Java 2D
Hoang, 11
 Java Programming with JBuilder.
 Java for Practitioners.