Skip to content

feat(Core.Components):Add SpectreCanvas component.#78

Merged
LittleLittleCloud merged 12 commits intoRazorConsole:mainfrom
TeseySTD:main
Oct 31, 2025
Merged

feat(Core.Components):Add SpectreCanvas component.#78
LittleLittleCloud merged 12 commits intoRazorConsole:mainfrom
TeseySTD:main

Conversation

@TeseySTD
Copy link
Member

@TeseySTD TeseySTD commented Oct 30, 2025

As discussed in issue #77, this PR introduces a new Canvas component that can render an array of pixels. It wraps the Canvas renderable from the Spectre.Console library.
Additionally, I've added:

Gallery examples to demonstrate usage:
Gallery screenshot
Design documentation for component.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a SpectreCanvas component to RazorConsole that enables rendering pixel-based graphics with customizable colors. The implementation uses a registry pattern to pass pixel data between the Razor component and the Vdom translator.

  • Introduces SpectreCanvas component with support for configurable canvas dimensions, pixel width, scaling, and max width
  • Implements CanvasDataRegistry for managing pixel data across the rendering pipeline
  • Adds a gallery showcase with heart, checkerboard, and gradient examples

Reviewed Changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/RazorConsole.Core/Components/SpectreCanvas.razor New component for rendering pixel arrays to Spectre.Console Canvas
src/RazorConsole.Core/Rendering/CanvasDataRegistry.cs Registry for storing and retrieving pixel data by GUID
src/RazorConsole.Core/Vdom/Translators/CanvasElementTranslator.cs Translator that converts Vdom nodes to Spectre.Console Canvas renderables
src/RazorConsole.Core/Vdom/VdomSpectreTranslator.cs Registers the new CanvasElementTranslator
src/RazorConsole.Gallery/Components/SpectreCanvasGallery.razor Gallery page demonstrating SpectreCanvas with three pixel art examples
src/RazorConsole.Gallery/Components/App.razor Adds "Spectre Canvas" to the gallery menu
design-doc/builtin-components.md Documents the SpectreCanvas component API

@LittleLittleCloud
Copy link
Member

LittleLittleCloud commented Oct 31, 2025

@TeseySTD some comments from copilot makes sense, Could you resolve them

could you also make a screenshot of canvas gallery and included it in PR description

TeseySTD and others added 7 commits October 31, 2025 10:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
@TeseySTD
Copy link
Member Author

@TeseySTD some comments from copilot makes sense, Could you resolve them

could you also make a screenshot of canvas gallery and included it in PR description

Done.

@LittleLittleCloud LittleLittleCloud merged commit 1c63e9c into RazorConsole:main Oct 31, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants