1 / 44

Basic Principles of 2D Graphics

Basic Principles of 2D Graphics. Raster 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

Download Presentation

Basic Principles of 2D Graphics

An Image/Link below is provided (as is) to download presentation 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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic Principles of 2D Graphics

  2. Raster 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

  3. Vector Graphics • Efficient storage • Scalable

  4. SimpleJava2DExample • Code necessary: • SimpleJave2DExample • MyFinishWindow

  5. Window Coordinates • 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.

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

  7. 2D Rendering Process • 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

  8. 2D Geometry • 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

  9. Shapes • 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

  10. CurveDemo.java • For an example of how to create curves in Java2D, click here.

  11. GeneralPath • Car Example Code

More Related