Skip to content

feat: add non-destructive monochrome color rendering - #2

Open
brownie-cake wants to merge 2 commits into
mainfrom
feature/monochrome-color-mode
Open

feat: add non-destructive monochrome color rendering#2
brownie-cake wants to merge 2 commits into
mainfrom
feature/monochrome-color-mode

Conversation

@brownie-cake

@brownie-cake brownie-cake commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an engine-level fixed-color rendering mode for native DWF/DWFx/XPS previews.

  • adds DwfViewerOptions.monochromeColor and LoadOptions.monochromeColor
  • adds runtime setMonochromeColor() / getMonochromeColor() APIs
  • maps W2D vector strokes, fills and text fallbacks without mutating parsed data
  • maps XPS Fill, Stroke, SolidColorBrush and GradientStop colors while preserving brush alpha and resource references
  • maps W3D mesh/material colors while retaining geometry buffers and material opacity
  • leaves raster image pages, page background, UI chrome, geometry and line weights unchanged
  • clears renderer caches when switching color policy so Canvas/WebGL/WASM paths stay consistent

Validation

  • added scripts/validate-monochrome.mjs
  • covers source immutability, implicit W2D colors, transparent brushes, XPS resources/gradients, W3D geometry sharing and opacity preservation
  • latest head 1feff212f828f3761d69c781466fda3afdb64c3c passes both CI and Cloudflare Pages demo checks

Integration stack

This is the native-renderer prerequisite for:

  1. feat: add monochrome CAD plot color mode cad-viewer#1 — shared Canvas2D/WebGL/text/entity color policy
  2. feat: add CAD monochrome plot mode file-viewer#244 — File Viewer configuration and toolbar integration for [feature]: 希望增加黑白线条界面 file-viewer#213

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.

1 participant