The fill_keep function blends an RGBA color with the current result color of the Sdf2d drawing context, converting the color to pre-multiplied alpha format before blending. It preserves the existing shapes and clipping settings, allowing you to apply additional fills without resetting the drawing state.
Sdf2d instance where the blending operation is performed. The function modifies the result field of self in place.vec4): An RGBA color to be blended with the existing content.In this example:
Sdf2d drawing context using the current position (self.pos) and size (self.rect_size) of the viewport.(10.0, 10.0) with a width and height of 80.0 units and rounded corners with a radius of 5.0.fill_keep to apply a semi-transparent red color (vec4(1.0, 0.0, 0.0, 0.5)) to the rectangle. The fill_keep function converts the color to pre-multiplied alpha and blends it with the existing content, preserving the current shape and clipping settings.