This gist repository is a collection of C# code samples from the SVG Filters and SVG Gradients sections of the Aspose.SVG for .NET documentation. The snippets show how to add Gaussian blur, drop shadows, color filters, lighting effects, linear gradients, and radial gradients to SVG content programmatically.
- Gaussian Blur and Drop Shadows – Apply soft blur and shadow effects with
<feGaussianBlur>,<feDropShadow>,<feOffset>, and<feBlend>. - Color Filters – Use
<feColorMatrix>and<feComponentTransfer>to adjust hue, saturation, luminance, and RGBA channels. - Lighting Effects – Create specular lighting highlights with
<feSpecularLighting>and point lights. - SVG Gradients – Create linear and radial gradients with multiple color stops for scalable vector graphics.
- SVG Builder API – Build filters and gradients with
SVGSVGElementBuilderusing fluent C# code.
Each example is a standalone C# test that demonstrates a practical SVG filter or gradient task for .NET applications.
- Create a .NET C# project and install the Aspose.SVG for .NET library via NuGet.
- Locate the example that matches your specific task.
- Copy the C# code directly from the example. Adjust the file paths, input parameters, and output parameters as needed.
- Run the code to create SVG files with filters and gradients.
Aspose.SVG for .NET is an API for working with SVG files in C# applications. It allows developers to create, load, edit, render, and convert SVG documents without external software. With support for SVG filters, gradients, transformations, conversions, and DOM manipulation, the library helps automate vector graphics workflows in .NET solutions.
- .NET Platforms: .NET Framework 4.6.1+, .NET Core 2.0+, or .NET 5+.
- Supported OS: Windows, Linux, macOS.
- Aspose.SVG for .NET installed via NuGet.