You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The attributes \lstinline!HorizontalCylinder!, \lstinline!VerticalCylinder! and \lstinline!Sphere! specify gradients that represent a horizontal cylinder, a vertical cylinder and a sphere, respectively.
1011
1011
The gradient goes from line color to fill color.
1012
+
Examples of gradient fills are given in \cref{fig:cylinder-gradient,fig:sphere-gradient,fig:sphere-gradient}.
1012
1013
1013
1014
The border pattern attributes \lstinline!Raised!, \lstinline!Sunken! and \lstinline!Engraved! represent frames which are rendered in a tool-dependent way --- inside the extent of the filled shape.
The extent/points of the filled shape describe the theoretical zero-thickness filled shape, and the actual rendered border is then half inside and half outside the extent.
1060
1061
1062
+
\begin{example}
1063
+
Gradient fill patterns.
1064
+
1065
+
\Cref{fig:cylinder-gradient} shows the use of \lstinline!FillPattern.HorizontalCylinder!.
1066
+
Since the gradient fill is determined before applying rotation, the line where \lstinline!fillColor! is attained gets rotated together with the rectangle.
1067
+
It is also seen that the \lstinline!lineColor! is attained where the ellipse touches the the enclosing rectangle.
1068
+
1069
+
\Cref{fig:sphere-gradient} shows the use of \lstinline!FillPattern.Sphere! on a \lstinline!Rectangle!.
1070
+
It is seen that the \lstinline!fillColor! is attained at the center of the enclosing ellipse (coinciding with the center of the rectangle), and that the \lstinline!lineColor! is attained at the corners of the rectangle, which all lie on the enclosing ellipse.
1071
+
If the rectangle would have had rounded corners (by specifying a positive \lstinline!radius!), the geometry of the gradient fill would not change, meaning that the \lstinline!lineColor! would not be attained.
1072
+
While the \lstinline!FillPattern.Sphere! name suggests that it is used to make circles look like spheres, this example also illustrates how it can be used to give a less flat look to other shapes.
1073
+
1074
+
\Cref{fig:sphere-gradient-triangle} shows the use of \lstinline!FillPattern.Sphere! on a \lstinline!Polygon!.
1075
+
Determining the minimal area enclosing ellipse is a non-trivial but computationally tractable problem.
1076
+
In practice, it will be difficult for the naked eye to tell the difference between a gradient based on the minimal area enclosing ellipse, and a gradient based on a nearby ellipse, especially if the \lstinline!fillColor! is used in the areas which fail to be enclosed by the ellipse.
1077
+
Hence, accurate application of the gradient fill is a quality of implementation.
1078
+
\end{example}
1079
+
1080
+
\begin{figure}[H]
1081
+
\begin{center}
1082
+
% Workaround for unreliable support for linear gradients in at least some popular PDF viewers (Apple).
1083
+
\ifpdf
1084
+
\includegraphics{cylinder-gradient.png}
1085
+
\else
1086
+
\includegraphics{cylinder-gradient}
1087
+
\fi
1088
+
\end{center}
1089
+
\caption{
1090
+
Applying \lstinline!FillPattern.HorizontalCylinder! to an \lstinline!Ellipse! with \lstinline!startAngle!, \lstinline!endAngle!, \lstinline!rotation!, and \lstinline!closure = EllipseClosure.Chord!.
1091
+
The \lstinline!fillColor! (darker) and the \lstinline!lineColor! (brighter) are shown in two circles behind the ellipse.
1092
+
The dashed line shows the minimal enclosing axis-aligned rectangle, after rotating it together with the ellipse.
1093
+
Since lighting and reflective properties of the imaginary cylinder are not defined by the specification, many details of the rendering are tool specific.
1094
+
Here, a more shiny cylinder is shown to the left, and a more matte cylinder to the right.
1095
+
}
1096
+
\label{fig:cylinder-gradient}
1097
+
\end{figure}
1098
+
1099
+
\begin{figure}[H]
1100
+
\begin{center}
1101
+
% Warning: Is there really no need for a workaround here, similar to the one in \cref{fig:cylinder-gradient}?
1102
+
\includegraphics{sphere-gradient}
1103
+
\end{center}
1104
+
\caption{
1105
+
Applying \lstinline!FillPattern.Sphere! to a \lstinline!Rectangle! with \lstinline!rotation!.
1106
+
The \lstinline!fillColor! is shown in the triangle on top of the rectangle, and the \lstinline!lineColor! is shown in the circle behind one of the rectangle's corners.
1107
+
The dashed line shows the minimal area enclosing ellipse, after rotating it together with the rectangle.
1108
+
Similar to the cylinder gradients, many details of the rendering are tool specific.
1109
+
}
1110
+
\label{fig:sphere-gradient}
1111
+
\end{figure}
1112
+
1113
+
\begin{figure}[H]
1114
+
\begin{center}
1115
+
% Warning: Is there really no need for a workaround here, similar to the one in \cref{fig:cylinder-gradient}?
1116
+
\includegraphics{sphere-gradient-triangle}
1117
+
\end{center}
1118
+
\caption{
1119
+
Applying \lstinline!FillPattern.Sphere! to a \lstinline!Polygon! with three points.
1120
+
The dashed line shows the minimal area enclosing ellipse.
1121
+
In addition to tool-specific design choices when gradient fills are applied to simpler shapes, application to a \lstinline!Polygon! also involves a quality of implementation aspect.
0 commit comments