Chapter 15 - Graphics. This chapter introduces basic general computer graphics concepts as well as a few specifics for Java. This chapter’s objectives are to: Understand computer graphics basics; learn about paint, paintcomponent, and repaint methods; learn about coordinates and colors; review shape drawing methods; learn to use fonts and draw graphics text. | Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved. Graphics 15- This chapter introduces basic general computer graphics concepts as well as a few specifics for Java. Objectives: Understand computer graphics basics Learn about paint, paintComponent, and repaint methods Learn about coordinates and colors Review shape drawing methods Learn to use fonts and draw graphics text 15- For more detailed graphics information refer to Java API, Sun’s tutorials and more technical books. Computer Graphics Basics There are two types of graphics devices: vector and raster. A vector device has some kind of pen that can move and draw lines directly on the surface. A raster device creates a picture by setting colors to individual pixels (picture elements) on a rectangular “raster.” 15- An example of a vector device is a plotter. Some models actually . | Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved. Graphics 15- This chapter introduces basic general computer graphics concepts as well as a few specifics for Java. Objectives: Understand computer graphics basics Learn about paint, paintComponent, and repaint methods Learn about coordinates and colors Review shape drawing methods Learn to use fonts and draw graphics text 15- For more detailed graphics information refer to Java API, Sun’s tutorials and more technical books. Computer Graphics Basics There are two types of graphics devices: vector and raster. A vector device has some kind of pen that can move and draw lines directly on the surface. A raster device creates a picture by setting colors to individual pixels (picture elements) on a rectangular “raster.” 15- An example of a vector device is a plotter. Some models actually include a moving “hand” that grabs pens of different colors from a pen holder. Basics (cont’d) A graphics adapter in your computer is a raster device. VRAM (video RAM) contains the information about the colors of all pixels. The screen displays the contents of VRAM. To draw a shape, you need to set the exactly right set of pixels to the required colors. The number of pixels in the raster vertically and horizontally is called the device resolution. 15- For example, a computer screen may have a resolution of 1024 by 768 (pixels). Basics (cont’d) A graphics software package provides functions for: setting drawing attributes: color, line width and style, fill texture and pattern, font drawing lines, circles, rectangles, polygons, and other basic shapes. In other words, a graphics package turns a raster device into a “logical” vector device. 15- Special graphics co-processors may assist in generating graphics. Graphics in Java Java library offer a graphics class Graphics and a graphics .