cornerstone icon indicating copy to clipboard operation
cornerstone copied to clipboard

How can I set fillStyle to 'white' when the modality is PT?

Open laozhu opened this issue 5 years ago • 2 comments

image

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

laozhu avatar Jan 10 '20 08:01 laozhu

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);

laozhu avatar Jan 15 '20 06:01 laozhu

We would likely need to PR a change that preserves the default behavior, but gives you the ability to override it.

dannyrb avatar Jan 15 '20 13:01 dannyrb