Loading in 5 sec....

Basic Principles of 2D GraphicsPowerPoint Presentation

Basic Principles of 2D Graphics

- 76 Views
- Uploaded on
- Presentation posted in: General

Basic Principles of 2D Graphics

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Basic Principles of 2D Graphics

- aka pixel or pixel-oriented graphics.
- Colors are assigned to each pixel.
- Used for computer monitors, printers, and file formats like bitmap or jpg
- All geometrical shapes must be converted to pixels
- Leads to high computational efforts
- Possible aliasing effects (aka jaggies)
- Bound to specific resolution

- Efficient storage
- Scalable

- Code necessary:
- SimpleJave2DExample
- MyFinishWindow

- To find the exact width of the margins (usually this is not necessary, but the ability is available)
Insets ins = this.getInsets();

This statement places the width of the left, right, upper, and lower margin in pixels and can be retrieved by:

ins.left, ins.right, ins.top, and ins.bottom.

- In Java2D, you first define your objects. However, none of them will appear on the screen until they are either drawn or filled.

- Simple 2D Graphics programs can be outlined as follows:
- Construct 2D Objects
- Apply transformations on those objects
- Apply color and other rendering properties
- Render the scene on a graphics device

- 2D Geometric objects are made up of an infinite number of points in a plane.
- They can be represented efficiently through geometric equations or parametric equations that describe the objects

- Object implement the “Shape” interface with a draw and fill method.
- Useful facts and examples: http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html#Java2D-Tutorial-Shapes

- For an example of how to create curves in Java2D, click here.

- Car Example Code