From 8efd935beec138afa49be42b875295d23cede393 Mon Sep 17 00:00:00 2001
From: tobitege <10787084+tobitege@users.noreply.github.com>
Date: Sun, 7 Jun 2026 08:31:36 +0200
Subject: [PATCH] Fix release CI warnings
Add XML documentation for the image converter APIs reported by CI.
Suppress CS1591 during generated XML documentation builds so existing undocumented public APIs do not flood release builds.
Pin Windows GitHub Actions jobs to windows-2022 to avoid the upcoming windows-latest image migration notice.
---
.github/workflows/ci.yml | 2 +-
.github/workflows/release.yml | 2 +-
Directory.Build.targets | 6 +
.../ImageConverter.cs | 17 +-
.../ImageProcessingOptionsBuilder.cs | 229 +++++++++++++++++-
5 files changed, 252 insertions(+), 4 deletions(-)
create mode 100644 Directory.Build.targets
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4325175..e84b712 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,7 +17,7 @@ on:
jobs:
build:
- runs-on: windows-latest
+ runs-on: windows-2022
steps:
- uses: actions/checkout@v6
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index fda6da8..060f665 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -39,7 +39,7 @@ jobs:
build-desktop:
needs: validate
- runs-on: windows-latest
+ runs-on: windows-2022
permissions:
contents: read
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 0000000..cf89a6d
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,6 @@
+
+
+
+ $(NoWarn);CS1591
+
+
diff --git a/OpenSourceToolkit.Converters/ImageConverter.cs b/OpenSourceToolkit.Converters/ImageConverter.cs
index aaaea13..e7f1d7c 100644
--- a/OpenSourceToolkit.Converters/ImageConverter.cs
+++ b/OpenSourceToolkit.Converters/ImageConverter.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
@@ -6,9 +6,18 @@
namespace OpenSourceToolkit.Converters
{
+ ///
+ /// Provides basic image conversion helpers for file and byte-array inputs.
+ ///
[SupportedOSPlatform("windows")]
public static class ImageConverter
{
+ ///
+ /// Converts an image file to the specified output format.
+ ///
+ /// Path to the source image file.
+ /// Path where the converted image should be saved.
+ /// Image format to use for the output file.
public static void Convert(string inputPath, string outputPath, ImageFormat format)
{
using (var image = Image.FromFile(inputPath))
@@ -17,6 +26,12 @@ public static void Convert(string inputPath, string outputPath, ImageFormat form
}
}
+ ///
+ /// Converts image bytes to the specified output format.
+ ///
+ /// Source image bytes.
+ /// Image format to use for the converted bytes.
+ /// The converted image bytes.
public static byte[] Convert(byte[] inputBytes, ImageFormat format)
{
using (var inputStream = new MemoryStream(inputBytes))
diff --git a/OpenSourceToolkit.Converters/ImageProcessingOptionsBuilder.cs b/OpenSourceToolkit.Converters/ImageProcessingOptionsBuilder.cs
index 0475264..0100dd0 100644
--- a/OpenSourceToolkit.Converters/ImageProcessingOptionsBuilder.cs
+++ b/OpenSourceToolkit.Converters/ImageProcessingOptionsBuilder.cs
@@ -1,4 +1,4 @@
-namespace OpenSourceToolkit.Converters
+namespace OpenSourceToolkit.Converters
{
///
/// Fluent builder for ImageProcessingOptions.
@@ -12,18 +12,35 @@ public class ImageProcessingOptionsBuilder
// Output Settings
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Sets the output image format.
+ ///
+ /// Output format name, such as "png" or "jpg".
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithFormat(string format)
{
_options.Format = format;
return this;
}
+ ///
+ /// Sets the output image quality.
+ ///
+ /// Output quality value.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithQuality(int quality)
{
_options.Quality = quality;
return this;
}
+ ///
+ /// Sets resize options for the output image.
+ ///
+ /// Optional target width.
+ /// Optional target height.
+ /// Whether to preserve the original aspect ratio.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithResize(int? width, int? height, bool maintainAspectRatio = true)
{
_options.Width = width;
@@ -36,24 +53,46 @@ public ImageProcessingOptionsBuilder WithResize(int? width, int? height, bool ma
// Adjustments
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Sets the brightness adjustment.
+ ///
+ /// Brightness adjustment value.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithBrightness(int brightness)
{
_options.Brightness = brightness;
return this;
}
+ ///
+ /// Sets the contrast adjustment.
+ ///
+ /// Contrast adjustment value.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithContrast(int contrast)
{
_options.Contrast = contrast;
return this;
}
+ ///
+ /// Sets the saturation adjustment.
+ ///
+ /// Saturation adjustment value.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithSaturation(int saturation)
{
_options.Saturation = saturation;
return this;
}
+ ///
+ /// Sets brightness, contrast, and saturation adjustments.
+ ///
+ /// Brightness adjustment value.
+ /// Contrast adjustment value.
+ /// Saturation adjustment value.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithAdjustments(int brightness, int contrast, int saturation)
{
_options.Brightness = brightness;
@@ -66,18 +105,33 @@ public ImageProcessingOptionsBuilder WithAdjustments(int brightness, int contras
// Filters
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Enables or disables grayscale conversion.
+ ///
+ /// Whether grayscale conversion is enabled.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithGrayscale(bool enabled = true)
{
_options.Grayscale = enabled;
return this;
}
+ ///
+ /// Enables or disables sepia conversion.
+ ///
+ /// Whether sepia conversion is enabled.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithSepia(bool enabled = true)
{
_options.Sepia = enabled;
return this;
}
+ ///
+ /// Enables or disables color inversion.
+ ///
+ /// Whether color inversion is enabled.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithInvert(bool enabled = true)
{
_options.Invert = enabled;
@@ -88,12 +142,22 @@ public ImageProcessingOptionsBuilder WithInvert(bool enabled = true)
// Blur / Sharpen
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Sets the blur radius.
+ ///
+ /// Blur radius value.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithBlur(int radius)
{
_options.BlurRadius = radius;
return this;
}
+ ///
+ /// Sets the sharpen amount.
+ ///
+ /// Sharpen amount value.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithSharpen(int amount)
{
_options.SharpenAmount = amount;
@@ -104,24 +168,46 @@ public ImageProcessingOptionsBuilder WithSharpen(int amount)
// Transform
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Sets the rotation angle.
+ ///
+ /// Rotation angle in degrees.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithRotation(int angle)
{
_options.RotationAngle = angle;
return this;
}
+ ///
+ /// Enables or disables horizontal flipping.
+ ///
+ /// Whether horizontal flipping is enabled.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithFlipHorizontal(bool enabled = true)
{
_options.FlipHorizontal = enabled;
return this;
}
+ ///
+ /// Enables or disables vertical flipping.
+ ///
+ /// Whether vertical flipping is enabled.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithFlipVertical(bool enabled = true)
{
_options.FlipVertical = enabled;
return this;
}
+ ///
+ /// Sets rotation and flip options.
+ ///
+ /// Rotation angle in degrees.
+ /// Whether horizontal flipping is enabled.
+ /// Whether vertical flipping is enabled.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithTransform(int rotationAngle, bool flipHorizontal, bool flipVertical)
{
_options.RotationAngle = rotationAngle;
@@ -134,6 +220,14 @@ public ImageProcessingOptionsBuilder WithTransform(int rotationAngle, bool flipH
// Crop
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Enables cropping and sets the crop rectangle.
+ ///
+ /// Crop origin on the x-axis.
+ /// Crop origin on the y-axis.
+ /// Crop width.
+ /// Crop height.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithCrop(int x, int y, int width, int height)
{
_options.CropEnabled = true;
@@ -144,6 +238,10 @@ public ImageProcessingOptionsBuilder WithCrop(int x, int y, int width, int heigh
return this;
}
+ ///
+ /// Disables cropping.
+ ///
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithCropDisabled()
{
_options.CropEnabled = false;
@@ -154,6 +252,16 @@ public ImageProcessingOptionsBuilder WithCropDisabled()
// Watermark
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Enables a text watermark and sets its options.
+ ///
+ /// Watermark text.
+ /// Watermark position.
+ /// Watermark opacity.
+ /// Watermark font size.
+ /// Watermark color.
+ /// Watermark padding.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithTextWatermark(
string text,
WatermarkPosition position = WatermarkPosition.BottomRight,
@@ -173,6 +281,14 @@ public ImageProcessingOptionsBuilder WithTextWatermark(
return this;
}
+ ///
+ /// Enables an image watermark and sets its options.
+ ///
+ /// Watermark image bytes.
+ /// Watermark position.
+ /// Watermark opacity.
+ /// Watermark padding.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithImageWatermark(
byte[] imageBytes,
WatermarkPosition position = WatermarkPosition.BottomRight,
@@ -188,6 +304,10 @@ public ImageProcessingOptionsBuilder WithImageWatermark(
return this;
}
+ ///
+ /// Disables watermarking.
+ ///
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithWatermarkDisabled()
{
_options.WatermarkEnabled = false;
@@ -198,12 +318,23 @@ public ImageProcessingOptionsBuilder WithWatermarkDisabled()
// Phase 3 Effects
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Enables or disables automatic image enhancement.
+ ///
+ /// Whether automatic enhancement is enabled.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithAutoEnhance(bool enabled = true)
{
_options.AutoEnhance = enabled;
return this;
}
+ ///
+ /// Enables vignette and sets its options.
+ ///
+ /// Vignette radius.
+ /// Vignette softness.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithVignette(int radius = 50, int softness = 50)
{
_options.Vignette = true;
@@ -212,12 +343,21 @@ public ImageProcessingOptionsBuilder WithVignette(int radius = 50, int softness
return this;
}
+ ///
+ /// Disables vignette.
+ ///
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithVignetteDisabled()
{
_options.Vignette = false;
return this;
}
+ ///
+ /// Enables posterization and sets the number of color levels.
+ ///
+ /// Number of posterization levels.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithPosterize(int levels = 4)
{
_options.Posterize = true;
@@ -225,12 +365,21 @@ public ImageProcessingOptionsBuilder WithPosterize(int levels = 4)
return this;
}
+ ///
+ /// Disables posterization.
+ ///
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithPosterizeDisabled()
{
_options.Posterize = false;
return this;
}
+ ///
+ /// Enables edge detection and sets its radius.
+ ///
+ /// Edge detection radius.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithEdgeDetect(int radius = 1)
{
_options.EdgeDetect = true;
@@ -238,6 +387,10 @@ public ImageProcessingOptionsBuilder WithEdgeDetect(int radius = 1)
return this;
}
+ ///
+ /// Disables edge detection.
+ ///
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithEdgeDetectDisabled()
{
_options.EdgeDetect = false;
@@ -248,6 +401,12 @@ public ImageProcessingOptionsBuilder WithEdgeDetectDisabled()
// Background Removal
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Enables background removal and sets its options.
+ ///
+ /// Background color to remove.
+ /// Color matching tolerance.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithBackgroundRemoval(string backgroundColor = "transparent", int tolerance = 10)
{
_options.RemoveBackground = true;
@@ -256,6 +415,10 @@ public ImageProcessingOptionsBuilder WithBackgroundRemoval(string backgroundColo
return this;
}
+ ///
+ /// Disables background removal.
+ ///
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithBackgroundRemovalDisabled()
{
_options.RemoveBackground = false;
@@ -266,6 +429,11 @@ public ImageProcessingOptionsBuilder WithBackgroundRemovalDisabled()
// Metadata
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Enables or disables metadata stripping.
+ ///
+ /// Whether metadata stripping is enabled.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithStripMetadata(bool enabled = true)
{
_options.StripMetadata = enabled;
@@ -276,6 +444,11 @@ public ImageProcessingOptionsBuilder WithStripMetadata(bool enabled = true)
// ICO Multi-size
// ═══════════════════════════════════════════════════════════════════════════
+ ///
+ /// Enables multi-size ICO generation.
+ ///
+ /// Optional ICO sizes to generate.
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithMultiSizeIco(int[] sizes = null)
{
_options.GenerateMultiSizeIco = true;
@@ -286,6 +459,10 @@ public ImageProcessingOptionsBuilder WithMultiSizeIco(int[] sizes = null)
return this;
}
+ ///
+ /// Disables multi-size ICO generation.
+ ///
+ /// The current builder instance.
public ImageProcessingOptionsBuilder WithMultiSizeIcoDisabled()
{
_options.GenerateMultiSizeIco = false;
@@ -299,6 +476,7 @@ public ImageProcessingOptionsBuilder WithMultiSizeIcoDisabled()
///
/// Builds and returns the configured ImageProcessingOptions.
///
+ /// The configured image processing options.
public ImageProcessingOptions Build()
{
return _options;
@@ -307,6 +485,7 @@ public ImageProcessingOptions Build()
///
/// Creates a new builder instance.
///
+ /// A new image processing options builder.
public static ImageProcessingOptionsBuilder Create()
{
return new ImageProcessingOptionsBuilder();
@@ -315,6 +494,7 @@ public static ImageProcessingOptionsBuilder Create()
///
/// Creates a builder pre-configured for preview (PNG format, no resize/output settings).
///
+ /// A builder configured for preview output.
public static ImageProcessingOptionsBuilder ForPreview()
{
return new ImageProcessingOptionsBuilder().WithFormat("png");
@@ -323,6 +503,9 @@ public static ImageProcessingOptionsBuilder ForPreview()
///
/// Creates a builder pre-configured for batch conversion (format and resize only).
///
+ /// Output format name.
+ /// Output quality value.
+ /// A builder configured for batch conversion.
public static ImageProcessingOptionsBuilder ForBatch(string format, int quality = 90)
{
return new ImageProcessingOptionsBuilder()
@@ -334,7 +517,51 @@ public static ImageProcessingOptionsBuilder ForBatch(string format, int quality
/// Creates options for single image editing with all effect parameters.
///
/// Output format (e.g., "png", "jpg")
+ /// Output quality value.
/// Include resize/format/quality settings (false for preview)
+ /// Whether resize settings are enabled.
+ /// Optional resize width.
+ /// Optional resize height.
+ /// Whether to preserve the original aspect ratio.
+ /// Brightness adjustment value.
+ /// Contrast adjustment value.
+ /// Saturation adjustment value.
+ /// Whether grayscale conversion is enabled.
+ /// Whether sepia conversion is enabled.
+ /// Whether color inversion is enabled.
+ /// Blur radius value.
+ /// Sharpen amount value.
+ /// Rotation angle in degrees.
+ /// Whether horizontal flipping is enabled.
+ /// Whether vertical flipping is enabled.
+ /// Whether cropping is enabled.
+ /// Crop origin on the x-axis.
+ /// Crop origin on the y-axis.
+ /// Crop width.
+ /// Crop height.
+ /// Whether watermarking is enabled.
+ /// Optional watermark text.
+ /// Optional watermark image bytes.
+ /// Watermark position.
+ /// Watermark opacity.
+ /// Watermark font size.
+ /// Watermark color.
+ /// Watermark padding.
+ /// Whether automatic enhancement is enabled.
+ /// Whether vignette is enabled.
+ /// Vignette radius.
+ /// Vignette softness.
+ /// Whether posterization is enabled.
+ /// Number of posterization levels.
+ /// Whether edge detection is enabled.
+ /// Edge detection radius.
+ /// Whether background removal is enabled.
+ /// Background color to remove.
+ /// Color matching tolerance.
+ /// Whether metadata stripping is enabled.
+ /// Whether multi-size ICO generation is enabled.
+ /// Optional ICO sizes to generate.
+ /// The configured image processing options.
public static ImageProcessingOptions BuildSingleImageOptions(
// Output settings
string format,