Advanced AWT The Rendering Pipeline

Slides:



Advertisements
Similar presentations
Introduction to Computation and Problem Solving Class 17: Lab: The Graphics 2D API 1 Prof. Steven R. Lerman and Dr. V. Judson Harward.
Advertisements

2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 2 2D Graphics: Basics.
Georgia Institute of Technology Drawing in Java – part 2 Barb Ericson Georgia Institute of Technology September 2005.
CSC1401 Drawing in Java - 2. Reminder from last class How do you save your modified picture? String filename = …; Picture stevePicture = new Picture(filename);
COM 1020 Martin Cooke 2D Graphics. Objectives To show how to draw in a Swing- based GUI using Java 2D See Java2Demo in demo/jfc/Java2D.
More Java Drawing in 2D Animations with Timer. Drawing Review A simple two-dimensional coordinate system exists for each graphics context or drawing surface.
Chapter 3 Drawing and Composing an Illustration. Objectives Draw straight lines Draw curved lines Draw elements of an illustration Apply attributes to.
Java2 Printing API Jean-Cédric Desrochers March 9, 2000.
Lecture07 Graphics Programming in Java. Introduction Most of the graphics programming of java is done with: Most of the graphics programming of java is.
Graphics Programming. In this class, we will cover: The difference between AWT and Swing Creating a frame Frame positioning Displaying information in.
1 L38 Graphics and Java 2D™ (3). 2 OBJECTIVES In this chapter you will learn:  To understand graphics contexts and graphics objects.  To understand.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 2 2D Graphics: Basics F The architecture.
Swing Graphics ● Empty Swing containers have no visual appearance except for a background color ● Every JComponent must have a paintComponent method that.
Introduction to Computer Graphics
How do bitmapped graphics differ? Bitmaps are the most common type of picture format. Vector images are inherently different from bitmap images.
V Obtained from a summer workshop in Guildford County July, 2014
CS324e - Elements of Graphics and Visualization Java2D Graphics.
Vector Graphics Making custom images. Raster vs. Vector Graphics In computer graphics, a raster graphics image, or bitmap, is a dot matrix data structure.
Java ME & Blackberry APIs for Game Dev Week III. Overview Java 2D API Java 3D API SVG Blackberry APIs
Lecture 4 - Introduction to Computer Graphics
2D Graphics: Rendering Details
Chapter 28 - Java Graphics and Java2D Outline 28.1Introduction 28.2Graphics Contexts and Graphics Objects 28.3Color Control 28.4Font Control 28.5Drawing.
 Pearson Education, Inc. All rights reserved. 1 Ch 12 Graphics and Java 2D In this chapter you will learn:  To understand graphics contexts.
(C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci.
Advanced User Interfaces with Java SD’98 - Session 3206 Ted Faison Faison Computing Inc.
2D Graphics Basics Chapter 2. Bird’s Eye View  Overview of Computer Graphics  2D Graphics: Basics –Basic 2D graphics, rendering pipeline, geometry,
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 3 2D Graphics: Rendering Details.
Chapter 6 Working with Patterns and Brushes. Objectives Use the Move command Create a pattern Design a repeating pattern Use the Pattern Options panel.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 3 This presentation © 2004, MacAvon Media Productions Introduction to Computer Graphics.
Java Graphics. Review 3 kinds of elements in components API? Layout managers Events Extend vs. Implement.
Java Graphics Stuart Hansen 11/6/03. What’s Wrong with OpenGL Graphics – not GUI –No real support of text boxes, buttons, etc. Procedural - not OOP –No.
1 Chapter 3 2D Graphics: Rendering Details  Color spaces, paints stroke types  Affine transforms including translation, rotation, scaling, shearing,
Creating Your Own Widgets CompSci 230 S Software Construction.
Watercolor! Arbitrary Color & Line Design Mrs. Fox.
© 2011 Delmar, Cengage Learning Chapter 6 Working with Patterns and Brushes.
Painting (Chapter 12) Java Certification Study Group January 25, 1999 Mark Roth.
Java Dynamic Graphics.
© 2010 Delmar, Cengage Learning Chapter 1 Getting Started with Illustrator.
Georgia Institute of Technology Drawing in Java – part 3 Barb Ericson Georgia Institute of Technology September 2006.
Java Graphics Opening Discussion zWhat did we talk about last class? zDo you have any questions about the assignment? zOffset between class.
Adobe Illustrator Basics Chris Maxwell FIT 1012 September
Line: the path of a point made by a drawing utensil: also the quality of a line (thick, thin, mechanical, or whimsical) Students will complete 3 exercises,
Advanced Java Screen Update Techniques SD’98 - Session 4406 Ted Faison Faison Computing Inc.
Graphics in Java Opening Discussion zDo you have any questions about the quiz? zWhat did we talk about last class? zDo you have any questions.
Projects: not limited to spec Error checking File filters Create multiple file formats Polygons Filled shapes Etc.
IS502:M ULTIMEDIA D ESIGN FOR I NFORMATION S YSTEM D IGITAL S TILL I MAGES Presenter Name: Mahmood A.Moneim Supervised By: Prof. Hesham A.Hefny Winter.
Chapter 7 Vector Editing © 2013 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website,
Georgia Institute of Technology Drawing in Java – part 2 Dr Usman Saeed Assistant Professor Faculty of Computing and Information Technology North Jeddah.
CPCS 391 Computer Graphics Lab One. Computer Graphics Using Java What is Computer Graphics: Computer graphics are graphics created using computers and,
Advanced AWT Paint. ● Paint is used to fill a shape, its inside is covered with paint. ● Use the setPaint method to set the paint style to an object with.
Barb Ericson Georgia Institute of Technology September 2005
12 Graphics and Java 2D™.
Creating Your Own Widgets
Adobe Illustrator The purpose of this review is to help prepare you for the Adobe Illustrator Industry exam.
Fill and Stroke Stroke is the outline of a shape, text or image.
Advanced AWT Strokes.
JAVA 2 Design and programming of GUI
Introduction to Computer Graphics
Java Graphics The basic rendering mechanism is the drawing system that controls when and how programs can draw on a graphics component. When a component.
Chapter 7 Vector Editing
2.02 Understand Digital Vector Graphics
Graphic Editing Terms Cropping
Watercolor! Adorable Animals &Arbitrary Color
(c) 2002 University of Wisconsin, CS 559
Drawing in Illustrator
Chapter 49 Java 2D.
Lecture 4 - Introduction to Computer Graphics
Barb Ericson Georgia Institute of Technology September 2005
Presentation transcript:

Advanced AWT The Rendering Pipeline

The Rendering Pipeline The original JDK 1.0 had a very simple mechanism for drawing shapes Select color and paint mode, and call methods of the Graphics class such as drawRect or fillOval. The Java 2D API supports many more options: Easily produce a wide variety of shapes. Control over the stroke, the pen that traces shape boundaries. Fill shapes with solid colors, varying hues, and repeating patterns.

Use transformations to move, scale, rotate, or stretch shapes. Clip shapes to restrict them to arbitrary areas. Select composition rules to describe how to combine the pixels of a new shape with existing pixels. Give rendering hints to make trade-offs between speed and drawing quality

To Draw a Shape

To Draw a Shape 1. Obtain an object of the Graphics2D class. This class is a subclass of the Graphics class. Ever since Java SE 1.2, methods such as paint and paintComponent automatically receive an object of the Graphics2D class. public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; ... }

2. Use the setRenderingHints method to set rendering hints: trade-offs between speed and drawing quality. RenderingHints hints = . . .; g2.setRenderingHints(hints); 3. Use the setStroke method to set the stroke. The stroke draws the outline of the shape. You can select the thickness and choose among solid and dotted lines. Stroke stroke = . . .; g2.setStroke(stroke);

4. Use the setPaint method to set the paint 4. Use the setPaint method to set the paint. The paint fills areas such as the stroke path or the interior of a shape. Paint paint = . . .; g2.setPaint(paint); 5. Use the clip method to set the clipping region. Shape clip = . . .; g2.clip(clip);

6. Use the transform method to set a transformation from user space to device space. AffineTransform transform = . . .; g2.transform(transform); 7. Use the setComposite method to set a composition rule that describes how to combine the new pixels with the existing pixels. Composite composite = . . .; g2.setComposite(composite);

Create a shape. The Java 2D API supplies many shape objects and methods to combine shapes. Shape shape = . . .; 9. Draw or fill the shape. If you draw the shape, its outline is stroked. If you fill the shape, the interior is painted. g2.draw(shape); g2.fill(shape);