|
8 | 8 | The class \tcode{brush} describes an opaque wrapper for a graphics data graphics resource. |
9 | 9 |
|
10 | 10 | \pnum |
11 | | -A \tcode{brush} object shall be usable with any \tcode{surface} or \tcode{surface}-derived object. |
| 11 | +A \tcode{brush} object is usable with any \tcode{surface} or \tcode{surface}-derived object. |
12 | 12 |
|
13 | 13 | \pnum |
14 | | -A \tcode{brush} object's graphics data is immutable. It is observable only by the effect that it produces when the brush is used as a Source Brush (\ref{surface.sourcebrush}) or as a Mask Brush (\ref{surface.rendering} and \ref{surface.masking}). |
| 14 | +A \tcode{brush} object's graphics data is immutable. It is observable only by the effect that it produces when the brush is used as a Source Brush or as a Mask Brush (\ref{surface.rendering.brushes}). |
15 | 15 |
|
16 | 16 | \pnum |
17 | | -A \tcode{brush} object also has a tiling value of type \tcode{tiling}, a filter value of type \tcode{filter}, and a transformation matrix of type \tcode{matrix_2d}. |
| 17 | +A \tcode{brush} object has an immutable \tcode{brush_type} value which indicates which type of brush it is (Table~\ref{tab:brushtype.meanings}). |
18 | 18 |
|
19 | 19 | \pnum |
20 | | -A \tcode{brush} object has an immutable \tcode{brush_type} observable state data value which indicates which type of brush it is (Table~\ref{tab:brushtype.meanings}). |
21 | | - |
22 | | -\pnum |
23 | | -The \tcode{brush} object's graphics data may have less precision than the graphics data of the brush factory object from which it was created. |
| 20 | +As a result of technological limitations and considerations, \tcode{brush} object's graphics data can have less precision than the data from which it was created. |
24 | 21 |
|
25 | 22 | \pnum |
26 | 23 | \enterexample |
27 | | -Several graphics and rendering technologies that are currently widely used store individual color and alpha channel data as 8-bit unsigned normalized integer values while the \tcode{double} type that is used by the \tcode{rgba_color} class for individual color and alpha is often a 64-bit value. It is precisely these situations which the preceding paragraph is intended to address. |
| 24 | +Several graphics and rendering technologies that are currently widely used typically store individual color and alpha channel data as 8-bit unsigned normalized integer values while the \tcode{double} type that is used by the \tcode{rgba_color} class for individual color and alpha is often a 64-bit value. As such, it is possible for a loss of precision when transforming the 64-bit channel data of an \tcode{rgba_color} object to the 8-bit channel data that is commonly used internally in such graphics and rendering technologies. |
28 | 25 | \exitexample |
29 | 26 |
|
30 | 27 | \rSec1 [brush.synopsis] {\tcode{brush} synopsis} |
|
34 | 31 | class brush { |
35 | 32 | public: |
36 | 33 | // \ref{brush.cons}, construct/copy/move/destroy: |
37 | | - brush() = delete; |
38 | | - brush(const brush&); |
39 | | - brush& operator=(const brush&); |
40 | | - brush(brush&& other) noexcept; |
41 | | - brush& operator=(brush&& other) noexcept; |
42 | | - |
43 | | - brush(const rgba_color& c); |
44 | | - brush(const rgba_color& c, error_code& ec) noexcept; |
45 | | - template <class Allocator> |
| 34 | + explicit brush(const rgba_color& c); |
| 35 | + template <class InputIterator> |
46 | 36 | brush(const vector_2d& begin, const vector_2d& end, |
47 | | - const color_stop_group<Allocator>& csg); |
48 | | - template <class Allocator> |
| 37 | + InputIterator first, InputIterator last); |
49 | 38 | brush(const vector_2d& begin, const vector_2d& end, |
50 | | - const color_stop_group<Allocator>& csg, error_code& ec) noexcept; |
51 | | - template <class Allocator> |
| 39 | + initializer_list<color_stop> il); |
| 40 | + template <class InputIterator> |
52 | 41 | brush(const circle& start, const circle& end, |
53 | | - const color_stop_group<Allocator>& csg); |
54 | | - template <class Allocator> |
| 42 | + InputIterator first, InputIterator last); |
55 | 43 | brush(const circle& start, const circle& end, |
56 | | - const color_stop_group<Allocator>& csg, error_code& ec) noexcept; |
57 | | - brush(image_surface&& img); |
58 | | - brush(image_surface&& img, error_code& ec) noexcept; |
59 | | - |
60 | | - // \ref{brush.modifiers}, modifiers: |
61 | | - void tiling(experimental::io2d::tiling e) noexcept; |
62 | | - void filter(experimental::io2d::filter f) noexcept; |
63 | | - void matrix(const matrix_2d& m) noexcept; |
| 44 | + initializer_list<color_stop> il); |
| 45 | + explicit brush(image_surface&& img); |
64 | 46 |
|
65 | 47 | // \ref{brush.observers}, observers: |
66 | | - experimental::io2d::tiling tiling() const noexcept; |
67 | | - experimental::io2d::filter filter() const noexcept; |
68 | | - matrix_2d matrix() const noexcept; |
69 | 48 | brush_type type() const noexcept; |
70 | 49 | }; |
71 | 50 | } } } } |
|
85 | 64 | \rSec2 [brush.sampling.color] {Sampling from a color brush} |
86 | 65 |
|
87 | 66 | \pnum |
88 | | -When \tcode{b} is a color brush, then when sampling from \tcode{b}, the visual data returned shall always be the visual data equivalent \tcode{rgba_code} which was passed in when \tcode{b} was created, regardless of the point which is to be sampled and regardless of the return values of \tcode{b.tiling()}, \tcode{b.filter()}, and \tcode{b.matrix()}. |
| 67 | +When \tcode{b} is a color brush, then when sampling from \tcode{b}, the visual data returned shall always be the visual data equivalent \tcode{rgba_code} which was passed in when \tcode{b} was created, regardless of the point which is to be sampled and regardless of the return values of \tcode{b.wrap_mode()}, \tcode{b.filter()}, and \tcode{b.matrix()}. |
89 | 68 |
|
90 | 69 | \rSec2 [brush.sampling.linear] {Sampling from a linear gradient brush} |
91 | 70 |
|
92 | 71 | \pnum |
93 | | -When \tcode{b} is a linear gradient brush, then when sampling from \tcode{b}, the visual data returned shall be from the point \tcode{pt} in the rendered linear gradient, where \tcode{pt} is the return value when passing the point to be sampled to \tcode{b.matrix().transform_coords} and the rendered linear gradient is created as specified by \ref{gradients.linear} and \ref{gradients.sampling}, taking into account the value of \tcode{b.tiling()}. |
| 72 | +When \tcode{b} is a linear gradient brush, then when sampling from \tcode{b}, the visual data returned shall be from the point \tcode{pt} in the rendered linear gradient, where \tcode{pt} is the return value when passing the point to be sampled to \tcode{b.matrix().transform_coords} and the rendered linear gradient is created as specified by \ref{gradients.linear} and \ref{gradients.sampling}, taking into account the value of \tcode{b.wrap_mode()}. |
94 | 73 |
|
95 | 74 | \rSec2 [brush.sampling.radial] {Sampling from a radial gradient brush} |
96 | 75 |
|
97 | 76 | \pnum |
98 | | -When \tcode{b} is a radial gradient brush, then when sampling from \tcode{b}, the visual data returned shall be from the point \tcode{pt} in the rendered radial gradient, where \tcode{pt} is the return value when passing the point to be sampled to \tcode{b.matrix().transform_coords} and the rendered radial gradient is created as specified by \ref{gradients.radial} and \ref{gradients.sampling}, taking into account the value of \tcode{b.tiling()}. |
| 77 | +When \tcode{b} is a radial gradient brush, then when sampling from \tcode{b}, the visual data returned shall be from the point \tcode{pt} in the rendered radial gradient, where \tcode{pt} is the return value when passing the point to be sampled to \tcode{b.matrix().transform_coords} and the rendered radial gradient is created as specified by \ref{gradients.radial} and \ref{gradients.sampling}, taking into account the value of \tcode{b.wrap_mode()}. |
99 | 78 |
|
100 | 79 | \rSec2 [brush.sampling.surface] {Sampling from a surface brush} |
101 | 80 |
|
102 | 81 | \pnum |
103 | | -When \tcode{b} is a surface brush, then when sampling from \tcode{b}, the visual data returned shall be from the point \tcode{pt} in the graphics data of the brush, where \tcode{pt} is the return value when passing the point to be sampled to \tcode{b.matrix().transform_coords}, taking into account the value of \tcode{b.tiling()} and \tcode{b.filter()}. |
| 82 | +When \tcode{b} is a surface brush, then when sampling from \tcode{b}, the visual data returned shall be from the point \tcode{pt} in the graphics data of the brush, where \tcode{pt} is the return value when passing the point to be sampled to \tcode{b.matrix().transform_coords}, taking into account the value of \tcode{b.wrap_mode()} and \tcode{b.filter()}. |
104 | 83 |
|
105 | 84 | \rSec1 [brush.cons] {\tcode{brush} constructors and assignment operators} |
106 | 85 |
|
|
121 | 100 | The brush's brush type shall be set to the value \tcode{brush_type::solid_color}. |
122 | 101 |
|
123 | 102 | \pnum |
124 | | -The brush's tiling shall be set to the value \tcode{experimental::io2d::tiling::none}. |
| 103 | +The brush's wrap mode shall be set to the value \tcode{experimental::io2d::wrap_mode::none}. |
125 | 104 |
|
126 | 105 | \pnum |
127 | 106 | The brush's filter shall be set to the value \tcode{experimental::io2d::filter::fast}. |
|
168 | 147 | The brush's brush type shall be set to the value \tcode{brush_type::linear}. |
169 | 148 |
|
170 | 149 | \pnum |
171 | | -The brush's tiling shall be set to the value \tcode{experimental::io2d::tiling::none}. |
| 150 | +The brush's wrap mode shall be set to the value \tcode{experimental::io2d::wrap_mode::none}. |
172 | 151 |
|
173 | 152 | \pnum |
174 | 153 | The brush's filter shall be set to the value \tcode{experimental::io2d::filter::fast}. |
|
196 | 175 |
|
197 | 176 | \indexlibrary{\idxcode{brush}!constructor} |
198 | 177 | \begin{itemdecl} |
199 | | -template <class Allocator> |
| 178 | +template <class InputIterator> |
200 | 179 | brush(const circle& start, const circle& end, |
201 | | - const color_stop_group<Allocator>& csg); |
202 | | -template <class Allocator> |
203 | | -brush(const circle& start, const circle& end, |
204 | | - const color_stop_group<Allocator>& csg, error_code& ec) noexcept; |
| 180 | + InputIterator first, InputIterator last); |
205 | 181 | \end{itemdecl} |
206 | 182 | \begin{itemdescr} |
207 | 183 | \pnum |
208 | 184 | \effects |
209 | 185 | Constructs an object of type \tcode{brush}. |
210 | 186 |
|
211 | 187 | \pnum |
212 | | -The brush shall be a radial gradient brush. |
| 188 | +The brush is a radial gradient brush. |
213 | 189 |
|
214 | 190 | \pnum |
215 | | -The brush's brush type shall be set to the value \tcode{brush_type::radial}. |
216 | 191 |
|
217 | 192 | \pnum |
218 | | -The brush's tiling shall be set to the value \tcode{experimental::io2d::tiling::none}. |
219 | | - |
220 | | -\pnum |
221 | | -The brush's filter shall be set to the value \tcode{experimental::io2d::filter::fast}. |
222 | | - |
223 | | -\pnum |
224 | | -The brush's transformation matrix shall be set to the value \tcode{matrix_2d::init_identity()}. |
| 193 | +The brush's brush type is \tcode{brush_type::radial}. |
225 | 194 |
|
226 | 195 | \pnum |
227 | 196 | The graphics data of the brush is nominally as specified the introductory paragraphs of \ref{gradients} and in \ref{gradients.radial}. Its color stops shall be the values contained in \tcode{csg}. However because the graphics data is not directly observable, it is \unspecnorm what data is stored and how it is stored, provided that the results of sampling from the brush are the same as if the brush's graphics data was stored as specified in the introductory paragraphs of \ref{gradients} and in \ref{gradients.radial}. |
228 | 197 |
|
229 | 198 | \pnum |
230 | 199 | \remarks |
231 | 200 | Sampling from this brush shall produce the results specified in \ref{brush.sampling.radial}. |
232 | | - |
233 | | -\pnum |
234 | | -\throws |
235 | | -As specified in Error reporting (\ref{\iotwod.err.report}). |
236 | | - |
237 | | -\pnum |
238 | | -\errors |
239 | | -\tcode{errc::not_enough_memory} if there was a failure to allocate memory. |
240 | | - |
241 | | -\tcode{io2d_error::invalid_status} if there was a failure to allocate a resource other than memory. |
242 | 201 | \end{itemdescr} |
243 | 202 |
|
244 | 203 | \indexlibrary{\idxcode{brush}!constructor} |
245 | 204 | \begin{itemdecl} |
246 | | -brush(image_surface&& img); |
247 | | -brush(image_surface&& img, error_code& ec) noexcept; |
| 205 | +explicit brush(image_surface&& img); |
248 | 206 | \end{itemdecl} |
249 | 207 | \begin{itemdescr} |
250 | 208 | \pnum |
|
253 | 211 | Constructs an object of type \tcode{brush}. |
254 | 212 |
|
255 | 213 | \pnum |
256 | | -The brush shall be a surface brush. |
257 | | - |
258 | | -\pnum |
259 | | -The brush's brush type shall be set to the value \tcode{brush_type::surface}. |
| 214 | +The brush is a surface brush. |
260 | 215 |
|
261 | 216 | \pnum |
262 | | -The brush's tiling shall be set to the value \tcode{experimental::io2d::tiling::none}. |
| 217 | +The brush's brush type is \tcode{brush_type::surface}. |
263 | 218 |
|
264 | 219 | \pnum |
265 | | -The brush's filter shall be set to the value \tcode{experimental::io2d::filter::good}. |
266 | | - |
267 | | -\pnum |
268 | | -The brush's transformation matrix shall be set to the value \tcode{matrix_2d::init_identity()}. |
| 220 | +The graphics data of the brush is nominally the same as the graphics data of the \underlyingimagesurface of \tcode{img}. However because the graphics data is not directly observable, it is \unspecnorm what data is stored and how it is stored. |
269 | 221 |
|
270 | 222 | \pnum |
271 | 223 | The graphics data of the brush shall be the \underlyingimagesurface of \tcode{img}. |
272 | 224 |
|
273 | 225 | \pnum |
274 | 226 | \remarks |
275 | 227 | Sampling from this brush shall produce the results specified in \ref{brush.sampling.surface}. |
276 | | - |
277 | | -\pnum |
278 | | -\throws |
279 | | -As specified in Error reporting (\ref{\iotwod.err.report}). |
280 | | - |
281 | | -\pnum |
282 | | -\errors |
283 | | -\tcode{errc::not_enough_memory} if there was a failure to allocate memory. |
284 | | - |
285 | | -\tcode{io2d_error::invalid_status} if there was a failure to allocate a resource other than memory. |
286 | | -\end{itemdescr} |
287 | | - |
288 | | -\rSec1 [brush.modifiers]{\tcode{brush} modifiers} |
289 | | - |
290 | | -\indexlibrary{\idxcode{brush}!\idxcode{tiling}} |
291 | | -\indexlibrary{\idxcode{tiling}!\idxcode{brush}} |
292 | | -\begin{itemdecl} |
293 | | -void tiling(experimental::io2d::tiling e) noexcept; |
294 | | -\end{itemdecl} |
295 | | -\begin{itemdescr} |
296 | | -\pnum |
297 | | -\effects |
298 | | -The brush's tiling shall be set to the value of \tcode{e}. |
299 | | -\end{itemdescr} |
300 | | - |
301 | | -\indexlibrary{\idxcode{brush}!\idxcode{filter}} |
302 | | -\indexlibrary{\idxcode{filter}!\idxcode{brush}} |
303 | | -\begin{itemdecl} |
304 | | -void filter(experimental::io2d::filter f) noexcept; |
305 | | -\end{itemdecl} |
306 | | -\begin{itemdescr} |
307 | | -\pnum |
308 | | -\effects |
309 | | -The brush's filter shall be set to the value \tcode{f}. |
310 | | -\end{itemdescr} |
311 | | - |
312 | | -\indexlibrary{\idxcode{brush}!\idxcode{matrix}} |
313 | | -\indexlibrary{\idxcode{matrix}!\idxcode{brush}} |
314 | | -\begin{itemdecl} |
315 | | -void matrix(const matrix_2d& m) noexcept; |
316 | | -\end{itemdecl} |
317 | | -\begin{itemdescr} |
318 | | -\pnum |
319 | | -\effects |
320 | | -The brush's transformation matrix shall be set to the value \tcode{m}. |
321 | 228 | \end{itemdescr} |
322 | 229 |
|
323 | 230 | \rSec1 [brush.observers]{\tcode{brush} observers} |
324 | 231 |
|
325 | | -\indexlibrary{\idxcode{brush}!\idxcode{tiling}} |
326 | | -\indexlibrary{\idxcode{tiling}!\idxcode{brush}} |
327 | | -\begin{itemdecl} |
328 | | -experimental::io2d::tiling tiling() const noexcept; |
329 | | -\end{itemdecl} |
330 | | -\begin{itemdescr} |
331 | | -\pnum |
332 | | -\returns |
333 | | -The value of brush's tiling. |
334 | | -\end{itemdescr} |
335 | | - |
336 | | -\indexlibrary{\idxcode{brush}!\idxcode{filter}} |
337 | | -\indexlibrary{\idxcode{filter}!\idxcode{brush}} |
338 | | -\begin{itemdecl} |
339 | | -experimental::io2d::filter filter() const noexcept; |
340 | | -\end{itemdecl} |
341 | | -\begin{itemdescr} |
342 | | -\pnum |
343 | | -\returns |
344 | | -The value of the brush's filter. |
345 | | -\end{itemdescr} |
346 | | - |
347 | | -\indexlibrary{\idxcode{brush}!\idxcode{matrix}} |
348 | | -\indexlibrary{\idxcode{matrix}!\idxcode{brush}} |
349 | | -\begin{itemdecl} |
350 | | -matrix_2d matrix() const noexcept; |
351 | | -\end{itemdecl} |
352 | | -\begin{itemdescr} |
353 | | -\pnum |
354 | | -\returns |
355 | | -The value of the brush's transformation matrix. |
356 | | -\end{itemdescr} |
357 | | - |
358 | 232 | \indexlibrary{\idxcode{brush}!\idxcode{type}} |
359 | | -\indexlibrary{\idxcode{type}!\idxcode{brush}} |
360 | 233 | \begin{itemdecl} |
361 | 234 | brush_type type() const noexcept; |
362 | 235 | \end{itemdecl} |
|
0 commit comments