Skip to content

Commit 182f51e

Browse files
committed
Prepare chapter 17 for editing
1 parent ea1f414 commit 182f51e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

17_canvas.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ A new canvas is empty, meaning it is entirely ((transparent)) and thus shows up
7272

7373
{{index "2d (canvas context)", "webgl (canvas context)", OpenGL, [canvas, context], dimensions, [interface, canvas]}}
7474

75-
The `<canvas>` tag is intended to allow different styles of ((drawing)). To get access to an actual drawing interface, we first need to create a _((context))_, an object whose methods provide the drawing interface. There are currently three widely supported drawing styles: `"2d"` for two-dimensional graphics and `"webgl"` for three-dimensional graphics through the OpenGL interface, and `"webgpu"`, which fills much the same role as WebGL, but provides a more modern interface.
75+
The `<canvas>` tag is intended to allow different styles of ((drawing)). To get access to an actual drawing interface, we first need to create a _((context))_, an object whose methods provide the drawing interface. There are currently three widely supported drawing styles: `"2d"` for two-dimensional graphics, `"webgl"` for three-dimensional graphics through the OpenGL interface, and `"webgpu"`, a more modern and flexible alternative to WebGL.
7676

7777
{{index rendering, graphics, efficiency}}
7878

@@ -116,11 +116,11 @@ In the ((canvas)) interface, a shape can be _filled_, meaning its area is given
116116

117117
{{index "fillRect method", "strokeRect method"}}
118118

119-
The `fillRect` method fills a ((rectangle)). It takes first the x- and y-((coordinates)) of the rectangle's top-left corner, then its width, and then its height. A similar method, `strokeRect`, draws the ((outline)) of a rectangle.
119+
The `fillRect` method fills a ((rectangle)). It takes first the x- and y-((coordinates)) of the rectangle's top-left corner, then its width, and then its height. A similar method called `strokeRect` draws the ((outline)) of a rectangle.
120120

121121
{{index [state, "of canvas"]}}
122122

123-
Neither method takes any further parameters. The color of the fill, thickness of the stroke, and so on, are not determined by an argument to the method (as you might reasonably expect) but rather by properties of the context object.
123+
Neither method takes any further parameters. The color of the fill, thickness of the stroke, and so on, are not determined by an argument to the method, as you might reasonably expect, but rather by properties of the context object.
124124

125125
{{index filling, "fillStyle property"}}
126126

@@ -848,7 +848,7 @@ if}}
848848

849849
## Choosing a graphics interface
850850

851-
So when you need to generate graphics in the browser, you can choose between plain HTML, ((SVG)), and ((canvas)). There is no single _best_ approach that works in all situations. Each option has strengths and weaknesses.
851+
Thus, when you need to generate graphics in the browser, you can choose between plain HTML, ((SVG)), and ((canvas)). There is no single _best_ approach that works in all situations. Each option has strengths and weaknesses.
852852

853853
{{index "text wrapping"}}
854854

@@ -868,7 +868,7 @@ But ((canvas))'s ((pixel))-oriented approach can be an advantage when drawing a
868868

869869
{{index "ray tracer"}}
870870

871-
There are also effects, such as rendering a scene one pixel at a time (for example, using a ray tracer) or postprocessing an image with JavaScript (blurring or distorting it), that can be realistically handled only by a ((pixel))-based approach.
871+
There are also effects, such as rendering a scene one ((pixel)) at a time (for example, using a ray tracer) or postprocessing an image with JavaScript (blurring or distorting it), that are only practical with a canvas element.
872872

873873
In some cases, you may want to combine several of these techniques. For example, you might draw a ((graph)) with ((SVG)) or ((canvas)) but show ((text))ual information by positioning an HTML element on top of the picture.
874874

@@ -967,7 +967,7 @@ hint}}
967967

968968
{{index label, text, "pie chart example"}}
969969

970-
[Earlier](canvas#pie_chart) in the chapter, we saw an example program that drew a pie chart. Modify this program so that the name of each category is shown next to the slice that represents it. Try to find a pleasing-looking way to automatically position this text that would work for other data sets as well. You may assume that categories are big enough to leave ample room for their labels.
970+
[Earlier](canvas#pie_chart) in the chapter, we saw an example program that drew a pie chart. Modify this program so that the name of each category is shown next to the slice that represents it. Try to find a pleasing-looking way to automatically position this text that would work for other data sets as well. You may assume that categories are big enough to leave enough room for their labels.
971971

972972
You might need `Math.sin` and `Math.cos` again, which are described in [Chapter ?](dom#sin_cos).
973973

0 commit comments

Comments
 (0)