Skip to content

Commit c408923

Browse files
committed
Provide images to complement the textual specification of gradient fills
1 parent 9911756 commit c408923

10 files changed

Lines changed: 197 additions & 0 deletions

chapters/annotations.tex

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,7 @@ \subsubsection{Graphical Properties}\label{graphical-properties}
10091009

10101010
The attributes \lstinline!HorizontalCylinder!, \lstinline!VerticalCylinder! and \lstinline!Sphere! specify gradients that represent a horizontal cylinder, a vertical cylinder and a sphere, respectively.
10111011
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}.
10121013

10131014
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.
10141015

@@ -1058,6 +1059,70 @@ \subsubsection{Graphical Properties}\label{graphical-properties}
10581059
\annotationindex{FilledShape}
10591060
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.
10601061

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.
1122+
}
1123+
\label{fig:sphere-gradient-triangle}
1124+
\end{figure}
1125+
10611126
\subsection{Component Instance}\label{component-instance}
10621127

10631128
A component instance can be represented within the diagram and/or icon layer of the enclosing class.

media/cylinder-gradient.pdf

8.48 KB
Binary file not shown.

media/cylinder-gradient.png

23.2 KB
Loading

media/cylinder-gradient.svg

Lines changed: 61 additions & 0 deletions
Loading

media/sphere-gradient-triangle.pdf

4.86 KB
Binary file not shown.

media/sphere-gradient-triangle.png

13.8 KB
Loading

media/sphere-gradient-triangle.svg

Lines changed: 36 additions & 0 deletions
Loading

media/sphere-gradient.pdf

4.73 KB
Binary file not shown.

media/sphere-gradient.png

18.7 KB
Loading

media/sphere-gradient.svg

Lines changed: 35 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)