Create a quick and dirty style system.

This commit is contained in:
H. Utku Maden 2022-08-03 22:54:16 +03:00
parent c26dcfe3f3
commit ecd31a5cde
2 changed files with 165 additions and 0 deletions

@ -155,6 +155,11 @@ namespace Quik
/// The line to draw.
/// </summary>
public QuikLine Line { get; }
/// <summary>
/// Stroke style of the line.
/// </summary>
public QuikStrokeStyle Style { get; set; }
/// <summary>
/// Create a draw line command.
@ -178,6 +183,11 @@ namespace Quik
/// The array of lines to draw.
/// </summary>
public QuikLine[] Lines { get; }
/// <summary>
/// Stroke style of the lines.
/// </summary>
public QuikStrokeStyle Style { get; set; }
/// <summary>
/// Create a draw lines command.
@ -201,6 +211,11 @@ namespace Quik
/// The Bezier curve segments to draw.
/// </summary>
public QuikBezier[] Segments;
/// <summary>
/// Stroke style of the curve.
/// </summary>
public QuikStrokeStyle Style { get; set; }
/// <summary>
/// Create a draw Bezier curve command.
@ -224,6 +239,21 @@ namespace Quik
/// The rectangle to draw.
/// </summary>
public QuikRectangle Rectangle { get; }
/// <summary>
/// Stroke style of the border.
/// </summary>
public QuikStrokeStyle StrokeStyle { get; set; }
/// <summary>
/// Fill style of the contents.
/// </summary>
public QuikFillStyle FillStyle { get; set; }
/// <summary>
/// Radius for round corners.
/// </summary>
public float CornerRadius { get; set; }
/// <summary>
/// Create a draw rectangle command.
@ -247,6 +277,21 @@ namespace Quik
/// The rectangles to draw.
/// </summary>
public QuikRectangle[] Rectangles { get; }
/// <summary>
/// Stroke style of the border.
/// </summary>
public QuikStrokeStyle StrokeStyle { get; set; }
/// <summary>
/// Fill style of the contents.
/// </summary>
public QuikFillStyle FillStyle { get; set; }
/// <summary>
/// Radius for round corners.
/// </summary>
public float CornerRadius { get; set; }
/// <summary>
/// Create a draw rectangles commands.
@ -270,6 +315,16 @@ namespace Quik
/// The ellipse to draw.
/// </summary>
public QuikEllipse Ellipse { get; }
/// <summary>
/// Stroke style of the border.
/// </summary>
public QuikStrokeStyle StrokeStyle { get; set; }
/// <summary>
/// Fill style of the contents.
/// </summary>
public QuikFillStyle FillStyle { get; set; }
/// <summary>
/// Create a draw ellipse command.
@ -293,6 +348,16 @@ namespace Quik
/// The ellipses to draw.
/// </summary>
public QuikEllipse[] Ellipses { get; }
/// <summary>
/// Stroke style of the border.
/// </summary>
public QuikStrokeStyle StrokeStyle { get; set; }
/// <summary>
/// Fill style of the contents.
/// </summary>
public QuikFillStyle FillStyle { get; set; }
/// <summary>
/// Create a draw ellipses command.
@ -316,6 +381,16 @@ namespace Quik
/// The triangle to draw.
/// </summary>
public QuikTriangle Triangle { get; }
/// <summary>
/// Stroke style of the border.
/// </summary>
public QuikStrokeStyle StrokeStyle { get; set; }
/// <summary>
/// Fill style of the contents.
/// </summary>
public QuikFillStyle FillStyle { get; set; }
/// <summary>
/// Create a draw triangle command.
@ -339,6 +414,16 @@ namespace Quik
/// The triangles to draw.
/// </summary>
public QuikTriangle[] Triangles { get; }
/// <summary>
/// Stroke style of the border.
/// </summary>
public QuikStrokeStyle StrokeStyle { get; set; }
/// <summary>
/// Fill style of the contents.
/// </summary>
public QuikFillStyle FillStyle { get; set; }
/// <summary>
/// Create a draw triangles command.
@ -363,6 +448,16 @@ namespace Quik
/// The vertices that make up the polygon.
/// </summary>
public QuikVec2[] Polygon { get; }
/// <summary>
/// Stroke style of the border.
/// </summary>
public QuikStrokeStyle StrokeStyle { get; set; }
/// <summary>
/// Fill style of the contents.
/// </summary>
public QuikFillStyle FillStyle { get; set; }
/// <summary>
/// Create a draw polygon command.

70
Quik/QuikStyle.cs Normal file

@ -0,0 +1,70 @@
namespace Quik
{
/// <summary>
/// A line stipple pattern.
/// </summary>
public struct QuikStipplePattern
{
/// <summary>
/// The stipple pitch value.
/// </summary>
public float Pitch;
/// <summary>
/// The stipple duty cycle.
/// </summary>
public float DutyCycle;
public QuikStipplePattern(float pitch, float dutyCycle)
{
Pitch = pitch;
DutyCycle = dutyCycle;
}
public static QuikStipplePattern None => new QuikStipplePattern(0.0f, 1.0f);
}
/// <summary>
/// Stroke style for lines and borders.
/// </summary>
public class QuikStrokeStyle
{
/// <summary>
/// Stroke color.
/// </summary>
public QuikColor Color { get; set; }
/// <summary>
/// Stroke width.
/// </summary>
public float Width { get; set; }
/// <summary>
/// Stroke stipple pattern.
/// </summary>
public QuikStipplePattern StipplePattern { get; set; }
public QuikStrokeStyle()
{
}
public QuikStrokeStyle(QuikColor color, float width, QuikStipplePattern pattern)
{
Color = color;
Width = width;
StipplePattern = pattern;
}
public QuikStrokeStyle(QuikColor color, float width) : this(color, width, QuikStipplePattern.None)
{
}
}
/// <summary>
/// Fill style for rectangles and the like.
/// </summary>
public class QuikFillStyle
{
public QuikColor Color { get; set; }
}
}