Chapter 2
Two-Dimensional Graphics
With this chapter, we begin our study of computer graphics by looking at the two-dimensional case. Things are simpler, and a lot easier to visualize, in 2D than in 3D, but most of the ideas that are covered in this chapter will also be very relevant to 3D.
The chapter begins with four sections that examine 2D graphics in a general way, without tying it to a particular programming language or graphics API. The coding examples in these sections are written in pseudocode that should make sense to anyone with enough programming background to be reading this book. In the next three sections, we will take quick looks at 2D graphics in three particular languages: Java with Graphics2D, JavaScript with HTML <canvas> graphics, and SVG. We will see how these languages use many of the general ideas from earlier in the chapter.
Contents of Chapter 2:
- Section 1: Pixels, Coordinates, and Colors
- Section 2: Shapes
- Section 3: Transforms
- Section 4: Hierarchical Modeling
- Section 5: Java Graphics2D
- Section 6: HTML Canvas Graphics
- Section 7: SVG: A Scene Description Language