跳转至

第二章 二维图形绘制

Two-Dimensional Graphics

通过本章,我们开始学习计算机图形学,首先从二维图形开始。在二维情况下,事情更简单,比在三维情况下更容易形象化,但本章涵盖的大部分概念也将与三维情况非常相关。

本章开始的四个部分以一种通用的方式检视二维图形,而不将其与特定的编程语言或图形API联系起来。这些部分中的编码示例采用了伪代码编写,应该能让任何具有足够编程背景的人理解。在接下来的三个部分中,我们将快速查看三种特定语言中的二维图形:使用Graphics2D的Java,使用HTML <canvas>图形的JavaScript以及SVG。我们将看到这些语言如何使用本章前面介绍的许多通用概念。

第二章内容:

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: