DmodelPanel Masking Help

Hey guys, I recently started working on a new hud to develop my coding skills in glua. Before i continue working on it, I need you guys to tell me how can i use masking on a panel according to a surface.
Just in case you didn’t understand what I’m talking about. Here is what i have:

Here is my problem:

And here is the result I am intending to achieve:

The circle is a surface in a painted panel and the DmodelPanel is a child to that panel

So, I would like a clear explanation from A to Z about what do i need to do.
Here is a part of my code just in case you need a clearer idea about the structure:

function HPHud()

	local hud = vgui.Create('DPanel')

	--skipped some code

	function hud:Paint(w, h)
		-- skipped more code

		--function that will draw the circle using drawpoly

                drawCircledBox(false, padw ,padh, 0, radius - 7, 360, nil, nil, Color(0,0,0,255), nil)

	local plymod = vgui.Create('DModelPanel', hud)
	-- skip skip skip
	function plymod:LayoutEntity(ent)
		--skip some more

	function plymod.Entity:GetPlayerColor()
		return pl:GetPlayerColor()
        -- skipped more code relate to the eyepos

This looks to me like a stencils case.

There was a bit of code around the forums several times already that does this.

Ok, I fixed it using stencils in the paint function of the panel. Thank you for the quick help :smiley:

Edit: For future help, if you are having trouble with the paint function of the dmodelpanel use this github page as a reference to it