cornerstone
cornerstone copied to clipboard
How can I set fillStyle to 'white' when the modality is PT?
I have read renderGrayscaleImage.js code, I think the fillStyle of canvas is hard coding to 'black' here. If I want to set a different fillStyle color to my canvas, or invert fillStyle together while viewport.invert
toggling, any ideas for the scene will be appreciated 🙏
Maybe this issue is related to #414
I changed renderGrayscaleImage.js code, it's ok for my need.
But in this way, I should create a forked version of cornerstone-core, any ideas for custom fillStyle with original cornerstone-core API.
// Clear the canvas
const { invert } = enabledElement.viewport;
context.fillStyle = invert ? 'white' : 'black';
context.fillRect(0, 0, enabledElement.canvas.width, enabledElement.canvas.height);
We would likely need to PR a change that preserves the default behavior, but gives you the ability to override it.