Title: Graphics2D Fun Things: Extra Content Summary
Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER

Graphics2D Fun Things: Extra Content Summary

Zip of Project containing all of the Graphics2D programs

- This whole section presents additional capabilites that are provided with the Graphics2D class which extends the basic Graphics class. This link downloads an executable project with all of the examples in it.

BasicStroke class

- In this set of notes we explore the ramafications of creating a wider line(or Stroke) than the default 1 pixel stroke. We also look at the effect of "Rendering Hints". The BasicStroke manages the issues:
  - Join: How to draw the bend where 2 lines come together.
  - Cap - How to draw the end of a line

Animation techniques

- In this set of notes we first review Animation techniques where we explicitly create a Thread to call repaint in order to create an animation.
- Secondly we demonstrate a new class: javax.swing.Timer which simplifies the Animation process.

Dashes

- How to create a Dashing pattern
- How to use the dashPhase to create a moving dash appearance.

Shape Concepts

- The concept of the Shape interface and some examples: Ellipse2D.Double, RoundRectangle2D.Double.
- GeneralPath Shape to draw arbitrary shapes.
- Area class to combine shapes together.

Shape Fill Options

- Gradient Fills
- TextureFills - Wall papering an image

Transformations using AffineTransforms

- AffineTransform concept and doing a Translation
- Other operations: rotations, scaling shearing
- Donut transformation example

Composition

- AlphaComposite class - composite rules and transparency options
- Sun fade out example against the clouds using AlphaComposite rules

More Composition Examples

- Using a BufferedImage with AlphaComposite concepts
- Spotlight example using AlphaComposite concepts
- Animated Waiting example: uses Transformations and AlphaComposite concepts

Clipping

- Simple clipping example on an image
- Rotating Shape Clip area example.

Demo approaches: Moving Star

- Using Translation, Rotation, and Scaling to create a fast moving star that has lots of flicker
- Using a JPanel to get rid of the flicker in the previous example

More Demos -- mostly a review

- Moving Scaling object using a new interface: WheelListener
- More examples for review purposes: Bubbles Demo, "Puffer" Demo, Resizing Rectangle

Last Modified: June 24, 2015 2:43 PM