UNPKG

epubjs

Version:

Render ePub documents in the browser, across many devices

20 lines (19 loc) 2.78 kB
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Chapter 21. Working with Images and Other Media</title><link rel="stylesheet" href="core.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"/></head><body><div class="chapter" title="Chapter 21. Working with Images and Other Media"><div class="titlepage"><div><div><h1 class="title"><a id="learnjava3-CHP-21"/>Chapter 21. Working with Images and Other Media</h1></div></div></div><p>Until this point, we’ve confined ourselves to working with the high-level drawing commands of the <code class="literal">Graphics2D</code> class, using images in a hands-off mode. In this section, we’ll clear up some of the mystery surrounding images and see how they can be created and transformed. The classes in the <code class="literal">java.awt.image</code> package handle images and their internals; <a class="xref" href="ch21.html#learnjava3-CHP-21-FIG-1" title="Figure 21-1. The java.awt.image package">Figure 21-1</a> shows the important classes in this package.</p><p>First, we’ll return to our discussion of image loading and see how we can get more control over image data using an <code class="literal">ImageObserver</code> to watch as it’s processed asynchronously by GUI components. We’ll also see how to use the <code class="literal">MediaTracker</code> utility to handle the details for us. Then, we’ll move on to the good stuff and have a look at <code class="literal">BufferedImage</code>, which is an image whose pixel data is exposed to you through a memory buffer. If you’re interested in creating sophisticated graphics, rendered images, or video, this will teach you about the foundations of image construction in Java.</p><p>Looking in the other directions, we will also be referring occasionally to the <code class="literal">javax.imageio</code> package, which is part of the <a id="I_indexterm21_id815413" class="indexterm"/><a id="I_indexterm21_id815418" class="indexterm"/>Java Advanced Imaging API (JAI). If you need even more advanced capabilities such as image tiling, loading scaled versions of images over the network, and deferred execution of image data processing for working with really large images, you’ll want to look at JAI.</p><div class="figure"><a id="learnjava3-CHP-21-FIG-1"/><div class="figure-contents"><div class="mediaobject"><a id="I_21_tt1175"/><img src="httpatomoreillycomsourceoreillyimages1707698.png" alt="The java.awt.image package"/></div></div><p class="title">Figure 21-1. The java.awt.image package</p></div></div></body></html>