local p={}p.__index=p p.ClassName="\082\111\117\110\100\101\100\066\097\099\107\105\110\103\066\117\105\108\100\101\114"p.DEFAULT_SHADOW_TRANSPARENCY=.7 function p.new(N)local q=setmetatable({},p)q._options=N or{sibling=true}return q end function p.Create(N,p)local q=N:CreateBacking(p)N:CreateShadow(q)return q end function p.CreateBacking(N,p)local q=Instance.new("\073\109\097\103\101\076\097\098\101\108")q.Name="\066\097\099\107\105\110\103"q.Size=UDim2.new(1,0,1,0)q.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\055\051\053\054\051\055\049\052\052"q.SliceCenter=Rect.new(4,4,16,16)q.ImageColor3=p.BackgroundColor3 q.ScaleType=Enum.ScaleType.Slice q.BackgroundTransparency=1 if N._options.sibling then q.ZIndex=-1 else q.ZIndex=p.ZIndex-1 end q.Parent=p p.BackgroundTransparency=1 return q end function p.CreateTopBacking(N,p)local q=N:CreateBacking(p)q.ImageRectSize=Vector2.new(20,16)q.SliceCenter=Rect.new(4,4,16,16)return q end function p.CreateLeftBacking(N,p)local q=N:CreateBacking(p)q.ImageRectSize=Vector2.new(16,20)q.SliceCenter=Rect.new(4,4,16,16)return q end function p.CreateRightBacking(N,p)local q=N:CreateBacking(p)q.ImageRectSize=Vector2.new(16,20)q.SliceCenter=Rect.new(4,4,16,16)q.ImageRectOffset=Vector2.new(4,0)return q end function p.CreateBottomBacking(N,p)local q=N:CreateBacking(p)q.ImageRectSize=Vector2.new(20,16)q.ImageRectOffset=Vector2.new(0,4)q.SliceCenter=Rect.new(4,4,12,12)return q end function p.CreateTopShadow(N,p)local q=N:CreateShadow(p)q.ImageRectSize=Vector2.new(80,64)q.SliceCenter=Rect.new(16,16,64,64)return q end function p.CreateShadow(q,N)local k=Instance.new("\073\109\097\103\101\076\097\098\101\108")k.Name="\083\104\097\100\111\119"k.Size=UDim2.new(1,6,1,6)k.AnchorPoint=Vector2.new(.5,.5)k.Position=UDim2.new(.5,0,.5,1)k.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\055\051\053\054\052\052\049\053\053"k.SliceCenter=Rect.new(16,16,64,64)k.ImageColor3=Color3.new(0,0,0)k.ScaleType=Enum.ScaleType.Slice k.BackgroundTransparency=1 k.ImageTransparency=p.DEFAULT_SHADOW_TRANSPARENCY k.ZIndex=N.ZIndex-1 k.Parent=N.Parent return k end return p
--- Construct a rounded backing with a shadow
-- @classmod RoundedBackingBuilder

local RoundedBackingBuilder = {}
RoundedBackingBuilder.__index = RoundedBackingBuilder
RoundedBackingBuilder.ClassName = "RoundedBackingBuilder"
RoundedBackingBuilder.DEFAULT_SHADOW_TRANSPARENCY = 0.7

--- Initializes a new RoundedBackingBuilder
-- @param options Options to set
-- {
--     sibling = true; -- If true, assumes sibling mode in the ScreenGui, defaults to true
-- }
function RoundedBackingBuilder.new(options)
	local self = setmetatable({}, RoundedBackingBuilder)

	self._options = options or {
		sibling = true;
	}

	return self
end

function RoundedBackingBuilder:Create(gui)
	local backing = self:CreateBacking(gui)
	self:CreateShadow(backing)

	return backing
end

function RoundedBackingBuilder:CreateBacking(gui)
	local backing = Instance.new("ImageLabel")
	backing.Name = "Backing"
	backing.Size = UDim2.new(1, 0, 1, 0)
	backing.Image = "rbxassetid://735637144"
	backing.SliceCenter = Rect.new(4, 4, 16, 16)
	backing.ImageColor3 = gui.BackgroundColor3
	backing.ScaleType = Enum.ScaleType.Slice
	backing.BackgroundTransparency = 1
	if self._options.sibling then
		backing.ZIndex = -1
	else
		backing.ZIndex = gui.ZIndex - 1
	end
	backing.Parent = gui

	gui.BackgroundTransparency = 1

	return backing
end

--- Only top two corners are rounded
function RoundedBackingBuilder:CreateTopBacking(gui)
	local backing = self:CreateBacking(gui)
	backing.ImageRectSize = Vector2.new(20, 16)
	backing.SliceCenter = Rect.new(4, 4, 16, 16)

	return backing
end

function RoundedBackingBuilder:CreateLeftBacking(gui)
	local backing = self:CreateBacking(gui)
	backing.ImageRectSize = Vector2.new(16, 20)
	backing.SliceCenter = Rect.new(4, 4, 16, 16)

	return backing
end

function RoundedBackingBuilder:CreateRightBacking(gui)
	local backing = self:CreateBacking(gui)
	backing.ImageRectSize = Vector2.new(16, 20)
	backing.SliceCenter = Rect.new(4, 4, 16, 16)
	backing.ImageRectOffset = Vector2.new(4, 0)

	return backing
end

--- Only bottom two corners are rounded
function RoundedBackingBuilder:CreateBottomBacking(gui)
	local backing = self:CreateBacking(gui)
	backing.ImageRectSize = Vector2.new(20, 16)
	backing.ImageRectOffset = Vector2.new(0, 4)
	backing.SliceCenter = Rect.new(4, 4, 12, 12)

	return backing
end

function RoundedBackingBuilder:CreateTopShadow(backing)
	local shadow = self:CreateShadow(backing)
	shadow.ImageRectSize = Vector2.new(80, 64)
	shadow.SliceCenter = Rect.new(16, 16, 64, 64)

	return shadow
end

function RoundedBackingBuilder:CreateShadow(backing)
	local shadow = Instance.new("ImageLabel")
	shadow.Name = "Shadow"
	shadow.Size = UDim2.new(1, 6, 1, 6)
	shadow.AnchorPoint = Vector2.new(0.5, 0.5)
	shadow.Position = UDim2.new(0.5, 0, 0.5, 1)
	shadow.Image = "rbxassetid://735644155"
	shadow.SliceCenter = Rect.new(16, 16, 64, 64)
	shadow.ImageColor3 = Color3.new(0, 0, 0)
	shadow.ScaleType = Enum.ScaleType.Slice
	shadow.BackgroundTransparency = 1
	shadow.ImageTransparency = RoundedBackingBuilder.DEFAULT_SHADOW_TRANSPARENCY
	shadow.ZIndex = backing.ZIndex - 1
	shadow.Parent = backing.Parent

	return shadow
end

return RoundedBackingBuilder