Documentation

The Java™ Tutorials
Hide TOC
Advanced Topics in Java2DJava2D中的高级主题
Trail: 2D Graphics

Lesson: Advanced Topics in Java2D课程:Java2D中的高级主题

This lesson shows you how to use Graphics2D to display graphics with fancy outline and fill styles, transform graphics when they are rendered, constrain rendering to a particular area, and generally control the way graphics look when they are rendered.本课程介绍如何使用Graphics2D显示具有奇特轮廓和填充样式的图形,在渲染时变换图形,将渲染约束到特定区域,以及通常控制渲染时图形的外观。You'll also learn how to create complex Shape objects by combining simple ones and how to detect when the user clicks on a displayed graphics primitive.您还将学习如何通过组合简单图形对象来创建复杂Shape对象,以及如何检测用户何时单击显示的图形图元。These topics are discussed in the following sections:以下章节将讨论这些主题:

Transforming Shapes, Text, and Images转换形状、文本和图像

This section shows you how to modify the default transformation so that objects are translated, rotated, scaled, or sheared when they are rendered.本节介绍如何修改默认变换,以便在渲染对象时平移、旋转、缩放或剪切对象。

Clipping the Drawing Region剪切绘图区域

You can use any shape as a clipping path—the area within which rendering takes place.您可以使用任何形状作为剪裁路径—进行渲染的区域。

Compositing Graphics合成图形

This section illustrates the various compositing styles supported by AlphaComposite and shows you how to set the compositing style in the Graphics2D rendering context.本节说明AlphaComposite支持的各种合成样式,并说明如何在Graphics2D渲染上下文中设置合成样式。

Controlling Rendering Quality控制渲染质量

This section describes the rendering hints that Graphics2D supports and shows you how to specify your preference in the trade-off between rendering quality and speed.本节介绍Graphics2D支持的渲染提示,并向您展示如何在渲染质量和速度之间进行权衡时指定首选项。

Constructing Complex Shapes from Geometry Primitives从几何图元构造复杂形状

This section shows you how to perform boolean operations on Shape objects using the Area class.本节介绍如何使用Area类对Shape对象执行布尔操作。

Supporting User Interaction支持用户交互

This section shows you how to perform hit detection on graphics primitives.本节介绍如何对图形原语执行命中检测。


Previous page: Previous Lesson
Next page: Transforming Shapes, Text, and Images