Hello,
first of all I hope you understood my English good enough…
I want to use an existing PNG image file with partial transparency. On this image I want to draw Rectangles, Lines (through MonoGame.Extended) and text which must be clipped outside of the image and within the transparency area. I’m not secure if I understood this right that it would function through renderTarget/renderTarget2D which I read in the Internet some time ago.
I did not found a solution with such a code for an image yet.
Hello and thanks! I tried it out and unfortunately it does not work.
I think you did not understand my question. As yet I created a RenderTarget2D with a specified background color. Onto the RenderTarget2D i placed the mentioned image and DrawLine(…). The Line is within the target as well as the image. But the line is not clipped on the transparent image area. Should I post the appropriate code? Regards
public RenderTarget2D (
GraphicsDevice graphicsDevice,
int width,
int height,
bool mipMap,
SurfaceFormat preferredFormat,
DepthFormat preferredDepthFormat,
int preferredMultiSampleCount,
RenderTargetUsage usage
)
Not 100 but i think you have to have non premultiplied alpha on and the rt has to be color format prior to rendering and then pass it thru a shader that passes the alpha im not entirely sure that will work though.