pixman-dotnet
0.46.9
dotnet add package pixman-dotnet --version 0.46.9
NuGet\Install-Package pixman-dotnet -Version 0.46.9
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="pixman-dotnet" Version="0.46.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="pixman-dotnet" Version="0.46.9" />
<PackageReference Include="pixman-dotnet" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add pixman-dotnet --version 0.46.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: pixman-dotnet, 0.46.9"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package pixman-dotnet@0.46.9
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=pixman-dotnet&version=0.46.9
#tool nuget:?package=pixman-dotnet&version=0.46.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
pixman-dotnet
pixman-dotnet are .NET bindings for pixman, the pixel-manipulation and compositing library used by cairo and the X server.
Usage
using Pixman;
using var canvas = PixmanImage.CreateBits(PixmanFormat.A8R8G8B8, 256, 256);
// Fill with a linear gradient…
using var gradient = PixmanImage.CreateLinearGradient(
new PixmanPointFixed(0, 0), new PixmanPointFixed(256, 256),
[
new PixmanGradientStop(0.0, PixmanColor.FromRgba(0x33, 0x66, 0xff, 0xff)),
new PixmanGradientStop(1.0, PixmanColor.FromRgba(0xff, 0x33, 0x99, 0xff)),
]);
canvas.Composite(PixmanOp.Src, gradient, mask: null, 0, 0, 0, 0, 0, 0, 256, 256);
// …composite a translucent solid square over it…
using var solid = PixmanImage.CreateSolidFill(PixmanColor.FromRgba(0xff, 0xff, 0xff, 0x80));
canvas.Composite(PixmanOp.Over, solid, mask: null, 0, 0, 0, 0, 64, 64, 128, 128);
// …and read the pixels back.
Span<byte> pixels = canvas.DataSpan;
using Pixman;
using var region = new PixmanRegion32(0, 0, 100, 100);
using var other = new PixmanRegion32(50, 50, 100, 100);
region.IntersectWith(other);
PixmanBox32 extents = region.Extents; // 50,50 → 100,100
The raw layer is always available and interoperates with the wrapper via Handle:
using Pixman.Native;
unsafe
{
Console.WriteLine(Libpixman.pixman_version());
pixman_image* img = Libpixman.pixman_image_create_bits(
pixman_format_code_t.PIXMAN_a8r8g8b8, 64, 64, null, 0);
Libpixman.pixman_image_unref(img);
}
Testing
dotnet test
Samples
# Renders gradients/trapezoids and writes sample.ppm to the working directory.
dotnet run --project samples/Pixman.NET.Sample
# Renders with pixman into a DRM dumb buffer and displays it (Linux, needs DRM master).
dotnet run --project samples/Pixman.NET.DrmSample -- /dev/dri/card0 5
Regenerating the bindings
git submodule update --init
dotnet tool restore
sh eng/generate.sh
Requires a system clang for its builtin-header resource directory.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-ios26.0 is compatible. net10.0-maccatalyst was computed. net10.0-maccatalyst26.0 is compatible. net10.0-macos was computed. net10.0-tvos was computed. net10.0-tvos26.0 is compatible. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
-
net10.0-ios26.0
- No dependencies.
-
net10.0-maccatalyst26.0
- No dependencies.
-
net10.0-tvos26.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on pixman-dotnet:
| Package | Downloads |
|---|---|
|
NVello.Pixman
Zero-copy interop between NVello (vello_cpu) pixmaps and pixman-dotnet images |
GitHub repositories
This package is not used by any popular GitHub repositories.