Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

AngleSharp.Renderer

CI GitHub Tag NuGet Count Issues Open CLA Assistant

AngleSharp.Renderer extends the core AngleSharp library with some more powerful rendering capabilities. This repository is the home of the source for the AngleSharp.Renderer NuGet package.

Current Status

The project now contains a first draft implementation with:

  • A backend-agnostic rendering core and display-list model
  • A SkiaSharp backend that renders PNG output
  • A basic DOM-driven text layout pass (block flow, heading scaling, word wrapping)
  • Basic support for HTML canvas via a bitmap-backed 2D rendering context

This is an initial vertical slice and not a full browser-grade layout engine yet.

Quick Start

using AngleSharp;
using AngleSharp.Renderer;

var context = BrowsingContext.New(Configuration.Default.WithCss().WithRendering());
var document = await context.OpenAsync(req => req.Content(@"
<html>
	<body>
		<h1>Hello Renderer</h1>
		<p>This is a first draft image render from AngleSharp.Renderer.</p>
	</body>
</html>"));

var renderer = new HtmlRenderer();
var image = renderer.RenderToPng(document, new HtmlRenderOptions
{
		Width = 800,
		Height = 450,
});

await File.WriteAllBytesAsync("render.png", image.Data);

Registering the rendering service with WithRendering() is also what enables support for <canvas> elements and their 2D drawing context. The renderer currently provides a lightweight bitmap-backed implementation for common drawing operations such as rectangles, paths, text, clear operations, and simple state management.

Design Direction

The current architecture is intentionally split into two layers:

  • Core: DOM/CSS integration, layout model, display-list generation
  • Backend: rasterization (currently SkiaSharp)

This keeps future work open for additional backends and interactive rendering scenarios.

.NET Foundation

This project is supported by the .NET Foundation.

License

AngleSharp.Renderer is released using the MIT license. For more information see the license file.

About

👼 Extends AngleSharp with rendering capability.

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

Sponsor this project

Packages

Contributors

Languages