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

@ -156,6 +156,11 @@ namespace Quik
/// </summary> /// </summary>
public QuikLine Line { get; } public QuikLine Line { get; }
/// <summary>
/// Stroke style of the line.
/// </summary>
public QuikStrokeStyle Style { get; set; }
/// <summary> /// <summary>
/// Create a draw line command. /// Create a draw line command.
/// </summary> /// </summary>
@ -179,6 +184,11 @@ namespace Quik
/// </summary> /// </summary>
public QuikLine[] Lines { get; } public QuikLine[] Lines { get; }
/// <summary>
/// Stroke style of the lines.
/// </summary>
public QuikStrokeStyle Style { get; set; }
/// <summary> /// <summary>
/// Create a draw lines command. /// Create a draw lines command.
/// </summary> /// </summary>
@ -202,6 +212,11 @@ namespace Quik
/// </summary> /// </summary>
public QuikBezier[] Segments; public QuikBezier[] Segments;
/// <summary>
/// Stroke style of the curve.
/// </summary>
public QuikStrokeStyle Style { get; set; }
/// <summary> /// <summary>
/// Create a draw Bezier curve command. /// Create a draw Bezier curve command.
/// </summary> /// </summary>
@ -225,6 +240,21 @@ namespace Quik
/// </summary> /// </summary>
public QuikRectangle Rectangle { get; } 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> /// <summary>
/// Create a draw rectangle command. /// Create a draw rectangle command.
/// </summary> /// </summary>
@ -248,6 +278,21 @@ namespace Quik
/// </summary> /// </summary>
public QuikRectangle[] Rectangles { get; } 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> /// <summary>
/// Create a draw rectangles commands. /// Create a draw rectangles commands.
/// </summary> /// </summary>
@ -271,6 +316,16 @@ namespace Quik
/// </summary> /// </summary>
public QuikEllipse Ellipse { get; } 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> /// <summary>
/// Create a draw ellipse command. /// Create a draw ellipse command.
/// </summary> /// </summary>
@ -294,6 +349,16 @@ namespace Quik
/// </summary> /// </summary>
public QuikEllipse[] Ellipses { get; } 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> /// <summary>
/// Create a draw ellipses command. /// Create a draw ellipses command.
/// </summary> /// </summary>
@ -317,6 +382,16 @@ namespace Quik
/// </summary> /// </summary>
public QuikTriangle Triangle { get; } 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> /// <summary>
/// Create a draw triangle command. /// Create a draw triangle command.
/// </summary> /// </summary>
@ -340,6 +415,16 @@ namespace Quik
/// </summary> /// </summary>
public QuikTriangle[] Triangles { get; } 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> /// <summary>
/// Create a draw triangles command. /// Create a draw triangles command.
/// </summary> /// </summary>
@ -364,6 +449,16 @@ namespace Quik
/// </summary> /// </summary>
public QuikVec2[] Polygon { get; } 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> /// <summary>
/// Create a draw polygon command. /// Create a draw polygon command.
/// </summary> /// </summary>

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; }
}
}