Skip to content

Commit e1d0a72

Browse files
committed
Add XML docs for public APIs
1 parent 6a3b15f commit e1d0a72

3 files changed

Lines changed: 61 additions & 0 deletions

File tree

OpenSourceToolkit.Calculators/ScientificCalculator.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44

55
namespace OpenSourceToolkit.Calculators
66
{
7+
/// <summary>
8+
/// Evaluates mathematical expressions with common scientific functions and operators.
9+
/// </summary>
710
public static class ScientificCalculator
811
{
12+
/// <summary>
13+
/// Evaluates a mathematical expression and returns the calculated result.
14+
/// </summary>
15+
/// <param name="expression">The expression to evaluate.</param>
16+
/// <returns>The calculated result, zero for empty input, or <see cref="double.NaN"/> when evaluation fails.</returns>
917
public static double Evaluate(string expression)
1018
{
1119
if (string.IsNullOrWhiteSpace(expression)) return 0;

OpenSourceToolkit.Colors/ColorConverter.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,28 @@
33

44
namespace OpenSourceToolkit.Colors
55
{
6+
/// <summary>
7+
/// Provides color conversion helpers for common color formats and color spaces.
8+
/// </summary>
69
public static class ColorConverter
710
{
11+
/// <summary>
12+
/// Converts RGB color components to a hexadecimal color string.
13+
/// </summary>
14+
/// <param name="r">The red component from 0 to 255.</param>
15+
/// <param name="g">The green component from 0 to 255.</param>
16+
/// <param name="b">The blue component from 0 to 255.</param>
17+
/// <returns>A hexadecimal color string in the format #RRGGBB.</returns>
818
public static string RgbToHex(int r, int g, int b)
919
{
1020
return $"#{r:X2}{g:X2}{b:X2}";
1121
}
1222

23+
/// <summary>
24+
/// Converts a hexadecimal color string to RGB color components.
25+
/// </summary>
26+
/// <param name="hex">The hexadecimal color string to convert.</param>
27+
/// <returns>The red, green, and blue components, or zeros when conversion fails.</returns>
1328
public static (int R, int G, int B) HexToRgb(string hex)
1429
{
1530
try
@@ -23,6 +38,13 @@ public static (int R, int G, int B) HexToRgb(string hex)
2338
}
2439
}
2540

41+
/// <summary>
42+
/// Converts RGB color components to HSL color components.
43+
/// </summary>
44+
/// <param name="r">The red component from 0 to 255.</param>
45+
/// <param name="g">The green component from 0 to 255.</param>
46+
/// <param name="b">The blue component from 0 to 255.</param>
47+
/// <returns>The hue in degrees, saturation from 0 to 1, and lightness from 0 to 1.</returns>
2648
public static (double H, double S, double L) RgbToHsl(int r, int g, int b)
2749
{
2850
double rd = r / 255.0;
@@ -58,6 +80,13 @@ public static (double H, double S, double L) RgbToHsl(int r, int g, int b)
5880
return (h * 360.0, s, l);
5981
}
6082

83+
/// <summary>
84+
/// Converts HSL color components to RGB color components.
85+
/// </summary>
86+
/// <param name="h">The hue in degrees.</param>
87+
/// <param name="s">The saturation from 0 to 1.</param>
88+
/// <param name="l">The lightness from 0 to 1.</param>
89+
/// <returns>The red, green, and blue components.</returns>
6190
public static (int R, int G, int B) HslToRgb(double h, double s, double l)
6291
{
6392
// h: 0-360, s: 0-1, l: 0-1
@@ -90,6 +119,13 @@ private static double Hue2Rgb(double p, double q, double t)
90119
return p;
91120
}
92121

122+
/// <summary>
123+
/// Converts RGB color components to HSV color components.
124+
/// </summary>
125+
/// <param name="r">The red component from 0 to 255.</param>
126+
/// <param name="g">The green component from 0 to 255.</param>
127+
/// <param name="b">The blue component from 0 to 255.</param>
128+
/// <returns>The hue in degrees, saturation from 0 to 1, and value from 0 to 1.</returns>
93129
public static (double H, double S, double V) RgbToHsv(int r, int g, int b)
94130
{
95131
double rd = r / 255.0;
@@ -116,6 +152,13 @@ public static (double H, double S, double V) RgbToHsv(int r, int g, int b)
116152
return (h * 360.0, s, v);
117153
}
118154

155+
/// <summary>
156+
/// Converts RGB color components to CMYK color components.
157+
/// </summary>
158+
/// <param name="r">The red component from 0 to 255.</param>
159+
/// <param name="g">The green component from 0 to 255.</param>
160+
/// <param name="b">The blue component from 0 to 255.</param>
161+
/// <returns>The cyan, magenta, yellow, and key components as percentages.</returns>
119162
public static (int C, int M, int Y, int K) RgbToCmyk(int r, int g, int b)
120163
{
121164
double rd = r / 255.0;
@@ -132,6 +175,13 @@ public static (int C, int M, int Y, int K) RgbToCmyk(int r, int g, int b)
132175
return ((int)(c * 100), (int)(m * 100), (int)(y * 100), (int)(k * 100));
133176
}
134177

178+
/// <summary>
179+
/// Converts RGB color components to CIE L*a*b* color components.
180+
/// </summary>
181+
/// <param name="r">The red component from 0 to 255.</param>
182+
/// <param name="g">The green component from 0 to 255.</param>
183+
/// <param name="b">The blue component from 0 to 255.</param>
184+
/// <returns>The lightness, a-axis, and b-axis components.</returns>
135185
public static (double L, double A, double B) RgbToLab(int r, int g, int b)
136186
{
137187
double R = r / 255.0;

OpenSourceToolkit.Core/CoreDummy.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ namespace OpenSourceToolkit.Core
44
{
55
// Placeholder for shared core types if needed later.
66
// For now empty.
7+
/// <summary>
8+
/// Placeholder type for the core assembly.
9+
/// </summary>
710
public class CoreDummy
811
{
912
}

0 commit comments

Comments
 (0)