paint method
override
Performs the actual drawing operation using the fragment shader.
Implementation
@override
void paint(final Canvas canvas, final Size size) {
// 1. Pass the canvas resolution to the shader
shader.setFloat(0, size.width);
shader.setFloat(1, size.height);
// 2. Pass the interactive Windowing parameters
shader.setFloat(2, windowCenter);
shader.setFloat(3, windowWidth);
// 3. Pass the hardware-specific metadata for Hounsfield Units calculation
shader.setFloat(4, frameResult.metadata.rescaleIntercept);
shader.setFloat(5, frameResult.metadata.rescaleSlope);
// 4. Pass the actual image texture
shader.setImageSampler(0, rawTexture);
// 5. Tell the GPU to paint a rectangle covering the canvas using our shader
final paint = Paint()..shader = shader;
canvas.drawRect(Rect.fromLTWH(0, 0, size.width, size.height), paint);
}