Skip to content

Commit 40fa44e

Browse files
committed
Committing P0267R4.
1 parent a81e5e2 commit 40fa44e

17 files changed

+158
-147
lines changed

papers/P0267R4.pdf

1.57 MB
Binary file not shown.

source/brush.tex

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,25 @@
6161
\item If the result of \tcode{b.type()} is \tcode{brush_type::radial} then \tcode{b} is a \term{radial gradient brush}.
6262
\end{enumerate}
6363

64-
\rSec2 [brush.sampling.color] {Sampling from a color brush}
64+
\rSec2 [brush.sampling.color] {Sampling from a solid color brush}
6565

6666
\pnum
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()}.
67+
When \tcode{b} is a solid color brush, then when sampling from \tcode{b}, the visual data returned shall always be the visual data equivalent \tcode{bgra_color} used to construct \tcode{b}, regardless of the point which is to be sampled and regardless of the return values of Wrap Mode, Filter, and Matrix.
6868

6969
\rSec2 [brush.sampling.linear] {Sampling from a linear gradient brush}
7070

7171
\pnum
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()}.
72+
When \tcode{b} is a linear gradient brush, when sampling point \tcode{pt}, where \tcode{pt} is the return value of calling the \tcode{transform_point} member function of Matrix using the requested point, from \tcode{b}, the visual data returned shall be as specified by \ref{gradients.linear} and \ref{gradients.sampling}.
7373

7474
\rSec2 [brush.sampling.radial] {Sampling from a radial gradient brush}
7575

7676
\pnum
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()}.
77+
When \tcode{b} is a radial gradient brush, when sampling point \tcode{pt}, where \tcode{pt} is the return value of calling the \tcode{transform_point} member function of Matrix using the requested point, from \tcode{b}, the visual data returned shall be as specified by \ref{gradients.radial} and \ref{gradients.sampling}.
7878

7979
\rSec2 [brush.sampling.surface] {Sampling from a surface brush}
8080

8181
\pnum
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()}.
82+
When \tcode{b} is a surface brush, when sampling point \tcode{pt}, where \tcode{pt} is the return value of calling the \tcode{transform_point} member function of Matrix using the requested point, from \tcode{b}, the visual data returned shall be from the point \tcode{pt} in the graphics data of the brush, taking into account the values of Wrap Mode and Filter.
8383

8484
\rSec1 [brush.cons] {\tcode{brush} constructors and assignment operators}
8585

@@ -96,7 +96,7 @@
9696
The brush's brush type shall be set to the value \tcode{brush_type::solid_color}.
9797

9898
\pnum
99-
The graphics data of the brush shall be created from the return value of \tcode{f.color()}. The visual data format of the graphics data shall be as-if it is that specified by \tcode{format::argb}.
99+
The graphics data of the brush shall be created from the value of \tcode{c}. The visual data format of the graphics data shall be as-if it is that specified by \tcode{format::argb}.
100100

101101
\pnum
102102
\remarks

source/brushes.tex

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
\pnum
88
Brushes contain visual data and serve as sources of visual data for rendering and composing operations.
99

10+
\pnum
1011
There are four types of brushes:
1112
\begin{itemize}
12-
\item color;
13+
\item solid color;
1314
\item linear gradient;
1415
\item radial gradient; and,
1516
\item surface.
@@ -27,7 +28,11 @@
2728
A brush is used either as a Source Brush or a Mask Brush (\ref{surface.rendering.brushes}).
2829

2930
\pnum
30-
When a brush is used in a rendering and composing operation, a \tcode{brush_props} object or \tcode{mask_props} object can modify the result of sampling the brush.
31+
When a brush is used in a rendering and composing operation, if it is used as a Source Brush, it has a \tcode{brush_props} object that describes how the brush is interpreted for purposes of sampling. If it is used as a Mask Brush, it has a \tcode{mask_props} object that describes how the brush is interpreted for purposes of sampling.
32+
33+
\pnum
34+
The \tcode{brush_props} and \tcode{mask_props} classes both have a Wrap Mode, Filter and Matrix (\ref{brushprops.summary} and \ref{maskprops.summary}). Where necessary, these shall be referenced using those terms without regard to whether the brush is being used as a Source Brush or a Mask Brush.
35+
3136

3237
%\pnum
3338
%A brush has its own coordinate space.

source/color-stop.tex

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
constexpr color_stop(double o, const bgra_color& c);
2121

2222
// \ref{colorstops.colorstop.modifiers}, modifiers:
23-
void offset(double val) noexcept;
24-
void color(const bgra_color& val) noexcept;
23+
constexpr void offset(double val) noexcept;
24+
constexpr void color(const bgra_color& val) noexcept;
2525

2626
// \ref{colorstops.colorstop.observers}, observers:
27-
double offset() const noexcept;
28-
bgra_color color() const noexcept;
27+
constexpr double offset() const noexcept;
28+
constexpr bgra_color color() const noexcept;
2929
};
3030
} } } }
3131
\end{codeblock}
@@ -53,7 +53,7 @@
5353
\indexlibrary{\idxcode{color_stop}!\idxcode{offset}}
5454
\indexlibrary{\idxcode{offset}!\idxcode{color_stop}}
5555
\begin{itemdecl}
56-
void offset(double val) noexcept;
56+
constexpr void offset(double val) noexcept;
5757
\end{itemdecl}
5858
\begin{itemdescr}
5959
\pnum
@@ -64,7 +64,7 @@
6464
\indexlibrary{\idxcode{color_stop}!\idxcode{color}}
6565
\indexlibrary{\idxcode{color}!\idxcode{color_stop}}
6666
\begin{itemdecl}
67-
void color(double val) noexcept;
67+
constexpr void color(double val) noexcept;
6868
\end{itemdecl}
6969
\begin{itemdescr}
7070
\pnum
@@ -77,7 +77,7 @@
7777
\indexlibrary{\idxcode{color_stop}!\idxcode{offset}}
7878
\indexlibrary{\idxcode{offset}!\idxcode{color_stop}}
7979
\begin{itemdecl}
80-
double offset() const noexcept;
80+
constexpr double offset() const noexcept;
8181
\end{itemdecl}
8282
\begin{itemdescr}
8383
\pnum
@@ -88,7 +88,7 @@
8888
\indexlibrary{\idxcode{color_stop}!\idxcode{color}}
8989
\indexlibrary{\idxcode{color}!\idxcode{color_stop}}
9090
\begin{itemdecl}
91-
bgra_color color() const noexcept;
91+
constexpr bgra_color color() const noexcept;
9292
\end{itemdecl}
9393
\begin{itemdescr}
9494
\pnum

source/config.tex

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
%!TEX root = io2d.tex
22
%%--------------------------------------------------
33
%% Version numbers
4-
\newcommand{\docno}{D0267R4}
4+
\newcommand{\docno}{P0267R4}
55
\newcommand{\prevdocno}{P0267R3}
6-
\newcommand{\cppver}{201402L}
6+
\newcommand{\cppver}{201703L}
77

88
%% Release date
9-
%\newcommand{\reldate}{2017-02-06} % Fixed date
10-
\newcommand{\reldate}{\today} % Relative date
9+
\newcommand{\reldate}{2017-03-20} % Fixed date
10+
%\newcommand{\reldate}{\today} % Relative date
1111

1212
%% Library chapters
1313
% %\newcommand{\firstlibchapter}{language.support}

source/display-surface.tex

+55-77
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@
128128
\pnum
129129
Table~\ref{tab:displaysurface.state.listing} specifies the name, type, function, and default value for each item of a display surface's observable state.
130130

131-
\pnum
132-
Because the \tcode{display_surface} class publicly derives from the \tcode{surface} class, the observable state of a display surface also includes the observable state of a surface, as specified at \ref{surface.state.default}.
133-
134131
\begin{libreqtab4b}
135132
{Display surface observable state}
136133
{tab:displaysurface.state.listing}
@@ -147,6 +144,11 @@
147144
This is the brush that shall be used as specified by \tcode{scaling::letterbox} (Table~\ref{tab:scaling.meanings}) &
148145
\tcode{brush\{ \{ bgra_color::black() \} \}} \\ \rowsep
149146

147+
\term{Letterbox Brush Props} &
148+
\tcode{brush_props} &
149+
This is the brush properties for the Letterbox Brush &
150+
\tcode{brush_props\{ \}} \\ \rowsep
151+
150152
\term{Scaling Type} &
151153
\tcode{scaling} &
152154
When the User Scaling Callback is equal to its default value, this is the type of scaling that shall be used when transferring the Back Buffer to the Display Buffer &
@@ -211,7 +213,7 @@
211213

212214
\term{User Scaling Callback} &
213215
\tcode{function<\br
214-
\tcode{experimental::}%%\br
216+
\tcode{experimental::}\br
215217
\tcode{io2d::}\br
216218
\tcode{rectangle(}\br
217219
\tcode{const display_surface\&,}\br
@@ -252,6 +254,17 @@
252254
noexcept;
253255
\end{itemdecl}
254256
\begin{itemdescr}
257+
\pnum
258+
\preconditions
259+
\tcode{preferredWidth > 0}.
260+
261+
\pnum
262+
\tcode{preferredHeight > 0}.
263+
264+
\pnum
265+
\tcode{preferredFormat != experimental::io2d::format::invalid}.
266+
267+
255268
\pnum
256269
\effects
257270
Constructs an object of type \tcode{display_surface}.
@@ -280,8 +293,6 @@
280293

281294
\pnum
282295
\errors
283-
\tcode{errc::invalid_argument} if \tcode{preferredWidth <= 0}, \tcode{preferredHeight <= 0}, or \tcode{preferredFormat == experimental::io2d::format::invalid}.
284-
285296
\tcode{io2d::device_error} if successful creation of the \tcode{display_surface} object would exceed the maximum number of simultaneous valid \tcode{display_surface} objects that the implementation supports.
286297

287298
\pnum
@@ -305,6 +316,22 @@
305316
noexcept;
306317
\end{itemdecl}
307318
\begin{itemdescr}
319+
\pnum
320+
\preconditions
321+
\tcode{preferredWidth > 0}.
322+
323+
\pnum
324+
\tcode{preferredHeight > 0}.
325+
326+
\pnum
327+
\tcode{preferredDisplayWidth > 0}.
328+
329+
\pnum
330+
\tcode{preferredDisplayHeight > 0}.
331+
332+
\pnum
333+
\tcode{preferredFormat != experimental::io2d::format::invalid}.
334+
308335
\pnum
309336
\effects
310337
Constructs an object of type \tcode{display_surface}.
@@ -333,8 +360,6 @@
333360

334361
\pnum
335362
\errors
336-
\tcode{errc::invalid_argument} if \tcode{preferredWidth <= 0}, \tcode{preferredHeight <= 0}, \tcode{preferredDisplayWidth <= 0}, \tcode{preferredDisplayHeight <= 0}, or \tcode{preferredFormat == experimental::io2d::format::invalid}.
337-
338363
\tcode{io2d::device_error} if successful creation of the \tcode{display_surface} object would exceed the maximum number of simultaneous valid \tcode{display_surface} objects that the implementation supports.
339364

340365
\pnum
@@ -641,45 +666,18 @@
641666
\indexlibrary{\idxcode{display_surface}!\idxcode{letterbox_brush}}
642667
\indexlibrary{\idxcode{letterbox_brush}!\idxcode{display_surface}}
643668
\begin{itemdecl}
644-
void letterbox_brush(experimental::nullvalue_t) noexcept;
669+
void letterbox_brush(const optional<brush&>b,
670+
const optional<brush_props>& bp = nullopt);
671+
void letterbox_brush(const optional<brush&>b, error_code& ec,
672+
const optional<brush_props>& bp = nullopt) noexcept;
645673
\end{itemdecl}
646674
\begin{itemdescr}
647675
\pnum
648676
\effects
649-
Sets the Letterbox Brush to its default value.
650-
\end{itemdescr}
677+
Sets the Letterbox Brush to the value contained in \tcode{b} if it contains a value, otherwise set Letterbox Brush to its default value.
651678

652-
\indexlibrary{\idxcode{display_surface}!\idxcode{letterbox_brush}}
653-
\indexlibrary{\idxcode{letterbox_brush}!\idxcode{display_surface}}
654-
\begin{itemdecl}
655-
void letterbox_brush(const bgra_color& c);
656-
void letterbox_brush(const bgra_color& c, error_code& ec) noexcept;
657-
\end{itemdecl}
658-
\begin{itemdescr}
659-
\pnum
660-
\effects
661-
Sets the Letterbox Brush to a value as-if \tcode{experimental::io2d::brush\{ solid_color_brush_factory\{ \} \}}.
662-
663-
\pnum
664-
\throws
665-
As specified in Error reporting (\ref{\iotwod.err.report}).
666-
667-
\pnum
668-
\errors
669-
The errors, if any, produced by this function are \impldef{display_surface!letterbox_brush}.
670-
\end{itemdescr}
671-
672-
\indexlibrary{\idxcode{display_surface}!\idxcode{letterbox_brush}}
673-
\indexlibrary{\idxcode{letterbox_brush}!\idxcode{display_surface}}
674-
\begin{itemdecl}
675-
void letterbox_brush(const experimental::io2d::brush& b);
676-
void letterbox_brush(const experimental::io2d::brush& b, error_code& ec)
677-
noexcept;
678-
\end{itemdecl}
679-
\begin{itemdescr}
680679
\pnum
681-
\effects
682-
Sets the Letterbox Brush to \tcode{b}.
680+
Sets the Letterbox Brush Props to the value contained in \tcode{bp} if it contains a value, otherwise sets it Letterbox Brush Props to its default value.
683681

684682
\pnum
685683
\throws
@@ -738,14 +736,12 @@
738736
\begin{itemdescr}
739737
\pnum
740738
\effects
741-
When \tcode{display_surface::show} is executing, informs the implementation that it shall call the Draw Callback as soon as possible.
739+
When \tcode{display_surface::begin_show} is executing, informs the implementation that the Draw Callback must be called as soon as possible.
742740
\end{itemdescr}
743741

744-
\indexlibrary{\idxcode{display_surface}!\idxcode{show}}
745-
\indexlibrary{\idxcode{show}!\idxcode{display_surface}}
742+
\indexlibrary{\idxcode{display_surface}!\idxcode{begin_show}}
746743
\begin{itemdecl}
747-
int show();
748-
int show(error_code& ec) noexcept;
744+
int begin_show();
749745
\end{itemdecl}
750746
\begin{itemdescr}
751747
\pnum
@@ -764,7 +760,7 @@
764760
\end{enumeraten}
765761

766762
\pnum
767-
If \tcode{display_surface::exit_show} is called from the Draw Callback, the implementation shall finish executing the Draw Callback and shall immediately cease to perform any actions in the continuous loop other than handling any implementation and host environment matters.
763+
If \tcode{display_surface::end_show} is called from the Draw Callback, the implementation shall finish executing the Draw Callback and shall immediately cease to perform any actions in the continuous loop other than handling any implementation and host environment matters needed to exit the loop properly.
768764

769765
\pnum
770766
No later than when this function returns, the output device shall cease to display the contents of the Display Buffer.
@@ -793,41 +789,23 @@
793789
Other errors, if any, produced by this function are \impldef{display_surface!show}.
794790
\end{itemdescr}
795791

796-
\indexlibrary{\idxcode{display_surface}!\idxcode{exit_show}}
797-
\indexlibrary{\idxcode{exit_show}!\idxcode{display_surface}}
792+
\indexlibrary{\idxcode{display_surface}!\idxcode{end_show}}
798793
\begin{itemdecl}
799-
void exit_show();
800-
void exit_show(error_code& ec) noexcept;
801-
void exit_show(std::chrono::duration d);
802-
void exit_show(std::chrono::duration d, error_code& ec) noexcept;
794+
void end_show();
803795
\end{itemdecl}
804796
\begin{itemdescr}
805-
\pnum
806-
\requires
807-
This function shall only be called from the Draw Callback; no diagnostic is required.
808-
809797
\pnum
810798
\effects
811-
The implementation shall initiate the process of exiting the \tcode{display_surface::show} function's continuous loop.
812-
813-
\pnum
814-
Implementations shall not wait until the \tcode{display_surface::show} function's continuous loop ends before returning from this function.
815-
816-
\pnum
817-
Implementations should follow any procedures that the host environment requires in order to cause the \tcode{display_surface::show} function's continuous loop to stop executing without error.
799+
If this function is called outside of the Draw Callback while it is being executed in the \tcode{display_surface::begin_show} function's continuous loop, it does nothing.
818800

819801
\pnum
820-
A \term{termination time duration} shall then be determined as follows:
821-
\begin{itemize}
822-
\item If no \tcode{std::chrono::duration} is provided, the termination time duration is \unspecnorm. Implementations should exit the \tcode{display_surface::show} function's continuous loop as soon as the host environment allows.
823-
\item Otherwise, implementations shall exit the \tcode{display_surface::show} function's continuous loop as soon as the host environment allows once the \tcode{std::chrono::duration} value has elapsed.
824-
\end{itemize}
802+
Otherwise, the implementation initiates the process of exiting the \tcode{display_surface::begin_show} function's continuous loop.
825803

826804
\pnum
827-
The implementation shall continue to execute the \tcode{display_surface::show} function until it returns or until termination time duration milliseconds have passed since the termination time duration was determined, whichever comes first.
805+
If possible, any procedures that the host environment requires in order to cause the \tcode{display_surface::show} function's continuous loop to stop executing without error should be followed.
828806

829807
\pnum
830-
If the \tcode{display_surface::show} function has not returned before termination time duration milliseconds have passed since the termination time duration was determined the implementation shall force the \tcode{display_surface::show} function's continuous loop to stop executing and shall then cause \tcode{display_surface::show} to return.
808+
The \tcode{display_surface::begin_show} function's loop continues execution until it returns.
831809
\end{itemdescr}
832810

833811
\rSec1 [displaysurface.observers]{\tcode{display_surface} observers}
@@ -890,23 +868,23 @@
890868
\indexlibrary{\idxcode{display_surface}!\idxcode{dimensions}}
891869
\indexlibrary{\idxcode{dimensions}!\idxcode{display_surface}}
892870
\begin{itemdecl}
893-
tuple<int, int> dimensions() const noexcept;
871+
vector_2d dimensions() const noexcept;
894872
\end{itemdecl}
895873
\begin{itemdescr}
896874
\pnum
897875
\returns
898-
A \tcode{tuple<int, int>} where the first element is the Draw Width and the second element is the Draw Height.
876+
A \tcode{vector_2d} constructed using the Draw Width as the first argument and the Draw Height as the second argument.
899877
\end{itemdescr}
900878

901879
\indexlibrary{\idxcode{display_surface}!\idxcode{display_dimensions}}
902880
\indexlibrary{\idxcode{display_dimensions}!\idxcode{display_surface}}
903881
\begin{itemdecl}
904-
tuple<int, int> display_dimensions() const noexcept;
882+
vector_2d display_dimensions() const noexcept;
905883
\end{itemdecl}
906884
\begin{itemdescr}
907885
\pnum
908886
\returns
909-
A \tcode{tuple<int, int>} where the first element is the Display Width and the second element is the Display Height.
887+
A \tcode{vector_2d} constructed using the Display Width as the first argument and the Display Height as the second argument.
910888
\end{itemdescr}
911889

912890
\indexlibrary{\idxcode{display_surface}!\idxcode{scaling}}
@@ -945,12 +923,12 @@
945923
\indexlibrary{\idxcode{display_surface}!\idxcode{letterbox_brush}}
946924
\indexlibrary{\idxcode{letterbox_brush}!\idxcode{display_surface}}
947925
\begin{itemdecl}
948-
experimental::io2d::brush letterbox_brush() const noexcept;
926+
optional<brush> letterbox_brush() const noexcept;
949927
\end{itemdecl}
950928
\begin{itemdescr}
951929
\pnum
952930
\returns
953-
The Letterbox Brush.
931+
A \tcode{optional<brush>} object constructed using the user-provided Letterbox Brush or, if no user-provided Letterbox Brush is set, an empty \tcode{optional<brush>} object.
954932
\end{itemdescr}
955933

956934
\indexlibrary{\idxcode{display_surface}!\idxcode{auto_clear}}

0 commit comments

Comments
 (0)