Skip to main content
Engineering LibreTexts

2: Two-Dimensional Graphics

  • Page ID
    13716
  • 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.

    (By the way, readers might be interested in the labs that I used when I taught a course from this textbook in 2017. They can be found on that course’s web page, at http://math.hws.edu/eck/cs424/index f17.html.)