[Question]
  [
Inspired by [this SO question](https://stackoverflow.com/q/46019607/1682559).
## Challenge:
**Input:**
* A string \$s\$
* A character \$c\$
**Output:**
Create a diamond-square ASCII art of the string in all four directions, with the first character of the string in the center and going outwards. Which is inside a square ASCII-art carpet, with the character as filler. This may sound pretty vague, so here's an example:
Input: \$s\$ = `string`, \$c\$ = `.`  
Output:
```
..........g..........
........g.n.g........
......g.n.i.n.g......
....g.n.i.r.i.n.g....
..g.n.i.r.t.r.i.n.g..
g.n.i.r.t.s.t.r.i.n.g
..g.n.i.r.t.r.i.n.g..
....g.n.i.r.i.n.g....
......g.n.i.n.g......
........g.n.g........
..........g..........
```
## Challenge rules:
* Input-string may also be a list of characters
* Output may also be a list of string-lines or matrix of characters
* Input-string and character are guaranteed to be non-empty
* The string is guaranteed to not contain the character
* Both string and character will only be printable ASCII (unicode range [32,126], space ' ' to and including tilde '~')
## General rules:
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer in bytes wins.  
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
* [Standard rules apply](https://codegolf.meta.stackexchange.com/questions/2419/default-for-code-golf-program-function-or-snippet/2422#2422) for your answer with [default I/O rules](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods/), so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
* [Default Loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are forbidden.
* If possible, please add a link with a test for your code (i.e. [TIO](https://tio.run/#)).
* Also, adding an explanation for your answer is highly recommended.
## Test cases:
Input: \$s\$ = `11111`, \$c=\$ = `0`  
Output:
```
00000000100000000
00000010101000000
00001010101010000
00101010101010100
10101010101010101
00101010101010100
00001010101010000
00000010101000000
00000000100000000
```
Input: \$s\$ = `12345ABCDEF`, \$c\$ = `#`  
Output:
```
####################F####################
##################F#E#F##################
################F#E#D#E#F################
##############F#E#D#C#D#E#F##############
############F#E#D#C#B#C#D#E#F############
##########F#E#D#C#B#A#B#C#D#E#F##########
########F#E#D#C#B#A#5#A#B#C#D#E#F########
######F#E#D#C#B#A#5#4#5#A#B#C#D#E#F######
####F#E#D#C#B#A#5#4#3#4#5#A#B#C#D#E#F####
##F#E#D#C#B#A#5#4#3#2#3#4#5#A#B#C#D#E#F##
F#E#D#C#B#A#5#4#3#2#1#2#3#4#5#A#B#C#D#E#F
##F#E#D#C#B#A#5#4#3#2#3#4#5#A#B#C#D#E#F##
####F#E#D#C#B#A#5#4#3#4#5#A#B#C#D#E#F####
######F#E#D#C#B#A#5#4#5#A#B#C#D#E#F######
########F#E#D#C#B#A#5#A#B#C#D#E#F########
##########F#E#D#C#B#A#B#C#D#E#F##########
############F#E#D#C#B#C#D#E#F############
##############F#E#D#C#D#E#F##############
################F#E#D#E#F################
##################F#E#F##################
####################F####################
```
Input: \$s\$ = `@+-|-o-|-O`, \$c\$ = `:`  
Output:
```
::::::::::::::::::O::::::::::::::::::
::::::::::::::::O:-:O::::::::::::::::
::::::::::::::O:-:|:-:O::::::::::::::
::::::::::::O:-:|:-:|:-:O::::::::::::
::::::::::O:-:|:-:o:-:|:-:O::::::::::
::::::::O:-:|:-:o:-:o:-:|:-:O::::::::
::::::O:-:|:-:o:-:|:-:o:-:|:-:O::::::
::::O:-:|:-:o:-:|:-:|:-:o:-:|:-:O::::
::O:-:|:-:o:-:|:-:+:-:|:-:o:-:|:-:O::
O:-:|:-:o:-:|:-:+:@:+:-:|:-:o:-:|:-:O
::O:-:|:-:o:-:|:-:+:-:|:-:o:-:|:-:O::
::::O:-:|:-:o:-:|:-:|:-:o:-:|:-:O::::
::::::O:-:|:-:o:-:|:-:o:-:|:-:O::::::
::::::::O:-:|:-:o:-:o:-:|:-:O::::::::
::::::::::O:-:|:-:o:-:|:-:O::::::::::
::::::::::::O:-:|:-:|:-:O::::::::::::
::::::::::::::O:-:|:-:O::::::::::::::
::::::::::::::::O:-:O::::::::::::::::
::::::::::::::::::O::::::::::::::::::
```
Input: \$s\$ = `AB`, \$c\$ = `c`  
Output:
```
ccBcc
BcAcB
ccBcc
```
Input: \$s\$ = `~`, \$c\$ = `X`  
Output:
```
~
```
Input: \$s\$ = `/\^/\`, \$c\$ = `X`  
Output:
```
XXXXXXXX\XXXXXXXX
XXXXXX\X/X\XXXXXX
XXXX\X/X^X/X\XXXX
XX\X/X^X\X^X/X\XX
\X/X^X\X/X\X^X/X\
XX\X/X^X\X^X/X\XX
XXXX\X/X^X/X\XXXX
XXXXXX\X/X\XXXXXX
XXXXXXXX\XXXXXXXX
```
  
[Answer]
# [R](https://www.r-project.org/), ~~118~~ ~~95~~ 92 bytes
```
function(a,d,n=length(a),I=c(n:1,1:n)[-n])for(i in I-1)write(c(a,d)[pmin(I+i,n+1)],1,n*2,,d)
```
[Try it online!](https://tio.run/##bcvNCoJQEAXgfU8ht81MjsW12ggu@gXfIFADMa8N2Ch6pV2vbia4a3HgwPlOO5hwML3klmuBjB4kYVVIaZ@QIUVhDhJo0oFg7EmKpm6BHRYn8jS@W7YF5L8Xxs2LBSKXSVyNKWmSlU/jMBjopeLOQmfbrqnYghobS6lIKURSa4WLP0j7293@cDydL9dZLv/LTZLcx8zqNin1UVMdvg "R – Try It Online")
Thanks to:
* Giuseppe for fixing an error and a golf
* Aaron Hayman for 22 bytes worth of golf
[Answer]
# [J](http://jsoftware.com/), ~~59~~ 56 bytes
```
,{~[:((0-2*#)}.\[:,0,:"0({:>:t)*t=:]+/<:)[:(|.@}.,])#\@]
```
[Try it online!](https://tio.run/##XcxNC4JAEAbgu79iyMO6urtuVpchw4/yFARdXbtI9nFIKA@B2l/fVOqyAy8D7zPMXc8EqSBEIMBAAg7hAtLjPtOs/eToOJIHrk17oXJkkuFMOi1usKFuE2Lh@Wukw1Unol6wgtoqKjS1wDqX1xqIIFABeTXP2@NCft1/y8nm45hkk1GCxXIVJ@l2l5mOo0ce73g95GByOX2OE7N/T72vTr4i@gs "J – Try It Online")
Too long solution for [J](http://jsoftware.com/) ... (entirely my fault)
[Answer]
# [R](https://www.r-project.org/), an ugly 118 bytes version
By letting the input be a vector of single characters, and outputting a matrix instead of printing nice ascii art.
```
function(s,C,l=length(s),L=4*l-3,k=2*l-1,y=abs(rep(1:k,L)-l)+abs(rep(1:L,e=k)-k)/2+1)matrix(ifelse(y%%1|y>l,C,s[y]),k)
```
[Try it online!](https://tio.run/##Vc3BCsIwDIDh@95jtHGZ2ulJqKBe9wCCeJijnaO1SlvBgvjqM6IoHn4CXwLxg3Zy0FfXxv7seMANWmmV6@KRB8Bazke2nKGRFU2BSTaHwL26cLEwWENpofhJjUoaKA1MqkLAqYm@v/FeKxsUT3ku7mlp6UHYpT2ggSHLtOMtZ4Ehi5SnespRHQNkYwafE0H0H62n3/WKaP2i9k3sQbBlMDwB)
# [R](https://www.r-project.org/), 161 157 bytes
saved 4 bytes by using ifelse instead of conditionally modifying `y`
```
function(S,C,l=nchar(S),L=4*l-3,k=2*l-1,y=abs(rep(1:L,k)-k)/2+abs(rep(1:k,e=L)-l)+1)cat(rbind(matrix(ifelse(y%%1|y>l,C,el(strsplit(S,''))[y]),L),'
'),sep='')
```
[Try it online!](https://tio.run/##RY3BSsNAEIbveQ0pO2NmrZu2l8KKbdVTwEMvglVI040uWbdhdwUDxVePo0YcGOb/Pgb@MDReD827r5M9etjShpz29WsVYItU6vm5kzNqdcFXUa@rfYRgOlDLklqULU6L/N@1ZHSJ0mGusK4ShL31B3irUrAfYBvjooF@MlGn/spxk3EQU4ids4mbhUB87J@4FUlkAimaTrMcsqzxIPjT@hdB4kLgj1Dfw3z5x8VsvlitNze3d2zPRnudy5M88t6zXI5ytWaoR/jk/DDm6W73zPtrhi8 "R – Try It Online")
## ungolfed and commented
```
function(S,C){
    s=el(strsplit(S,''))
    l=nchar(S)
    L=4*l-3
    k=2*l-1
    y=abs(rep(1:L,k)-k)/2+abs(rep(1:k,e=L)-l)+1 # distance from centre
    y[!!y%%1]=l+1  # set non integers to one more than length of string
    y[y>l]=l+1     # set number beyond length of string to one more than length of string
    M = rbind(matrix(c(s,C)[y],L),'\n') # build matrix and add line returns
    cat(M,sep='') # print the matrix as a string
}
```
hmmm, seems like the longest answer so far!
[Answer]
# [Python 2](https://docs.python.org/2/), ~~97~~ ~~96~~ ~~90~~ 84 bytes
```
def f(s,c):r=range(len(s));return[c.join(c*i+s[:i:-1]+s[i:]+c*i)for i in r[:0:-1]+r]
```
[Try it online!](https://tio.run/##LY1NC4JAEIbv/oqFDu7mR2p12QjSymvXQA3CVtuQXVm3QxD9dZt1HRh43meGmf6jn1Ik4/hgDWrw4NeEqr26i5bhjgk8ELJTTL@VKOrwJbnA9ZJ7Q0E5DeIKgNPKA0UaqRBHXCBV0GiaqWo6mtujDjIbndmY3/SKC406B03gODl2Bw3Yur4busTk2BTEaI7JerNNs@PpnINcWHnwgm8goS/gqHVpBlxb/gFeLa7K8gZtxfgH "Python 2 – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~95~~ ~~84~~ 75 bytes
```
->a,c{(1...2*z=a.size).map{|i|s=a[j=(z-i).abs,z]*c+c*2*j;s.reverse.chop+s}}
```
[Try it online!](https://tio.run/##RcoxDoIwFIDhnVMQJijtS2TUVL2BByAdHk3RkghNH5hYytkrDsbhn77fL9079TKJM3K9lgcAaFiQCGSDqeCJbo02ksR2kGUQtgLsiAfFdK1Zw4YTgTcv48mAfkyupm1Lbpkp79uCZm/He7EDeuL5BVT2pezn11pEMe3d/s9RpQ8 "Ruby – Try It Online")
Takes input string as an array of chars. Returns an array of strings.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~15~~ 11 bytes
```
.sûsζøsýí€û
```
[Try it online!](https://tio.run/##ATAAz/9vc2FiaWX/U/8uc8O7c862w7hzw73DreKCrMO7/8K7/1NxdWFyZSBEaWFtb25kCiA "05AB1E – Try It Online")
or as a [Test Suite](https://tio.run/##yy9OTMpM/W/uFlzscnTB0QX/9YoP7y4@t@3wjuLDew@vfdS05vDu/4d26xzaZv@/uKRIITMvnUuPyxAEuAy4DI2MTUwdnZxdXN24lLkctHVrdPOB2J/LisvRiSuZq44rgks/Jk4/hisCAA)
**Explanation**
```
.s            # push suffixes of input
  û           # palendromize this list
   sζ         # transpose using the second input as filler
     ø        # transpose back
      sý      # merge each on the second input
        í     # reverse each row
         €û   # palendromize each row
```
[Answer]
# [J](http://jsoftware.com/), ~~35 34~~  33 bytes
```
,{~1j1(}:@#"1{:(<*-)1-|+/|)i:@-&#
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/darrDLMMNWqtHJSVDKutNGy0dDUNdWu09Ws0M60cdNWU/2tyKXClJmfkK6jrqSukKagXlxRl5qWrQ8VgtAFYzhAE0KWU1UEyRsYmpo5Ozi6ubujyViB5B23dGt18IPZHl64Dm@zohC5eARbXj4nTj1H/DwA)
Right to left:  
`-&#` Length of \$c\$ minus the length of \$s\$  
`i:` Range from negative **n** to **n**  
`1-|+/|` Absolute value, outer sum with absolute value, subtract from 1  
`{: (<*-)` Compare the matrix with the end of the range (the `-&#`), 0 for less than or equal, 1 otherwise. Also subtract the matrix from the end of range. Multiply together. The double subtraction saves a byte and gives something like this
```
 0  0 _1  0  0
 0 _1 _2 _1  0
_1 _2 _3 _2 _1
 0 _1 _2 _1  0
 0  0 _1  0  0
```
Negative indices start from -1 like in python. The only thing left is to insert the columns of zeroes.
`1j1( #"1` for each row, repeat each element 1 time and pad with one 0  
`}:@`  then drop the last one (zero)  
`,{~`concat \$c\$ and \$s\$ and index into that
Many thanks to Galen Ivanov for the algorithm.
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 39 bytes
```
{1_',/'y,''2{+x,1_|x}/(#x)':1_,/+y,'|x}
```
[Try it online!](https://ngn.bitbucket.io/k#eJydk0uPgjAQx+98ClI3AQIu1scFLoKPqxcPJuJjQ2Ky2U1MPGF8fPYtltLSGZXuECL+5/cf2jJziC505wShcw4cp3/xi4DursUtdDuF50R0F4Q+yzDFspbR5WN9vp+ig/1pF/H++BO7+8PX929cxOf45G1u1nLtEloGiUmPeJZtu6RXBRUPhMk2ESIVCSnT+lJk2rgqmWoyfUk/rf10Jc11exu+wf5gOErSyXQ2Z9vsVNvsIDHHRF4dg2eYAcdLeIoZMJzDE8wAcQGnmEHHJZxghiauwiPMoOJNeIgZJK7DA8wgcAj3MQPHMZhihn9VN1678ckYn7vxVzXuGdXQqiOloWW/C0PraeIGJMTIj/3utXtk94JNfFRNfARiASX+Qgh2IYyhJXiFMEQFCGAdFeARwk1UBQGsonpFDZaoDgJYoDroQ5ijEBxD2Liq0VqNTsDoXI2+llEPqPDbzhJwq37lMAgxR0nK5iev5ifP0zznRdI8yVP+yFXOB+TO+NWDD8o/vEqYZVt21ymXrKrIMvHEi9VqWKdk4iFv65RIVDL7ETmekXook+9ML97zYmXaVrzNH1n882M=)
`{` `}` function with arguments `x` (the string *s*) and `y` (the character *c*)
`|x` reverse `x`
`y,'` prepend `y` to each
`+` transpose
`,/` concat
`1_` drop first char
at this point we have a string of length(`x`) instances of `y` followed by the characters from `x`
`#x` length of `x`
`(#x)':` sliding window of that many consecutive chars
`2{` `}/` do twice
`+x,1_|x` join `x` with the reversed `x` without its first element, and transpose
`y,''` prepend `y` to each each
`,/'` concat each
`1_'` drop one from each
[Answer]
# [Canvas](https://github.com/dzaima/Canvas), 8 [bytes](https://github.com/dzaima/Canvas/blob/master/files/chartable.md)
```
Ｒ±［］／┼┼＊
```
[Try it here!](https://dzaima.github.io/Canvas/?u=JXVGRjMyJUIxJXVGRjNCJXVGRjNEJXVGRjBGJXUyNTNDJXUyNTNDJXVGRjBB,i=JTI3WCUyNyUwQSUyNy8lNUMlNUMlNUUvJTVDJTVDJTI3,v=8)
[7 bytes](https://dzaima.github.io/Canvas/?u=JXVGRjMyJUIxJXVGRjNCJXVGRjNEJXVGRjBGJXUyNTNDJXVGRjBB,i=JTI3LiUyNyUwQSUyN3N0cmluZy8lMjc_,v=8) but mirrors a bunch of chars.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 15 bytes
Returns an array of lines
```
Ôå+ ®¬qV êÃûV ê
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=1OUrIK6scVYg6sP7ViDq&input=InN0cmluZyIKIi4iCi1S)
```
Ôå+ ®¬qV êÃûV ê     :Implicit input of strings U=s & V=c
Ô                   :Reverse U
 å+                 :Prefixes
    ®               :Map
     ¬              :  Split
      qV            :  Join with V
         ê          :  Palindromise
          Ã         :End map
           ûV       :Centre pad each string with V, to the length of the longest
              ê     :Palindromise
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 15 bytes
```
ＵＢηＥθ✂θκ‖Ｏ↑←ＵＥ¹
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z84tcQpMTk7vSi/NC9FI0PTmiugKDOvRMM3sUCjUEchOCczORXEyNbUBMoFpablpCaX@JelFuUAFViFFugoWPmkppUA5VwrSlKBRhhqWv//X1wCNCSdS@@/blkOAA "Charcoal – Try It Online") Link is to verbose version of code. Originally submitted as a [comment on the now deleted sandbox post](https://codegolf.meta.stackexchange.com/questions/2140/sandbox-for-proposed-challenges?cb=1#comment62343_17496). Explanation:
```
ＵＢη
```
Set the background to the second input `c`.
```
Ｅθ✂θκ
```
Map over the first input `s` to generate all suffixes and implicitly print them on separate lines.
```
‖Ｏ↑←
```
Reflect horizontally and vertically.
```
ＵＥ¹
```
Add extra space horizontally.
[Answer]
# [APL (Dyalog Classic)](https://www.dyalog.com/), ~~32~~ 31 bytes
```
(⍉1↓¯1↓⊖⍪1↓⊢)⍣2∘↑(≢⊣),/,¨,2⍴¨⊢¨
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v8/7VHbBI1HvZ2Gj9omH1oPIh91TXvUuwrCWqT5qHex0aOOGY/aJmo86lz0qGuxpo6@zqEVOkaPerccWgFUcWjF///qxSVFmXnp6mnqeupc6oYgAGQbgNhGxiamjk7OLq5uQBFloIiDtm6Nbj4Q@wMFrIACjk5ARrI6l4aOep26Zpp6BFBMPyZOP0YdxAYA "APL (Dyalog Classic) – Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 121 bytes
```
Join[q=Table[(v=Table[#2,2(l-k)])<>Riffle[Join[(h=Reverse)[n=(g=Take)[#,-k]],g[n,-k+1]],#2]<>v,{k,l=Length@#}],Rest@h@q]&
```
[Try it online!](https://tio.run/##LcxBC4MgGMbxrxIKw5htrHOG0G3sMGI3eQ8uTMVyVNJl7LO7l7Hbjz8Pz6yTM7NOftDZinx9@agW8dDPySi2/0FrXrOpCiWUTdv7ccT2WzInerObdTOlioJZ3Ack5VUA4FZFxPGCpDU07c7fgU/iZqJNTtIP8N5sSTq5wCHfVx9TcZaFVZ3Tqx4S3iqyJeyWACcnAjl/AQ "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 16 bytes
*Note: I'll golf it :)*
```
Ôå+ ®¬qVÃùV mê ê
```
[Try it online!](https://tio.run/##AS8A0P9qYXB0///DlMOlKyDCrsKscVbDg8O5ViBtw6ogw6r//ydzdHJpbmcnCicuJyAtUg "Japt – Try It Online")
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 120 bytes
```
param($s,$c)($s,(($l=$s.length-1)..0+1..$l|%{($x=$c*(2*$_))+($s[($_,($l..$_+($_+1)..$l))[$_-ne$l]]-join$c)+$x}))[$l-gt0]
```
[Try it online!](https://tio.run/##TYxdCoMwEITfPUVYtiUxJmofC0LbC/QAaoOIfyVVUaGC2qvbSEG6MCzzMTNt8866vsy0XjEPprVNuuRFsXcwZdujFHWAvdRZXQyl8JmUHvelRD0fJopjgKlNTzYqxrjJhxSVYyomoIxXfCugZixEJeoMdRyLZ1PVZp3juGxci2Lw4nWxrCPmBPqhq@oCiLQAfuR6A5Luzt8OCHiwowsXs2iM7kDOO/38b7jRw42AjOsX "PowerShell – Try It Online")
Some days, having index ranges instead of slices really hurts. Today is one of those days. Due to conjoined ranges messing up when dealing with single elements (e.g. returning 0..0+1..0), special-casing is used to avoid it altogether (at the cost of many bytes).
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 15 bytes
```
Ôå+ ê ®ê ¬qV
ûV
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=1OUrIOogruogrHFWCvtW&input=IkArLXwtby18LU8iCiI6IgoKLVI=)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 11 bytes
```
jÐƤṚzṚŒḄZŒḄ
```
[Try it online!](https://tio.run/##y0rNyan8/z/r8IRjSx7unFUFxEcnPdzREgUm/x9eHlELZO2c8f@/g7ZujW4@EPv/twIA "Jelly – Try It Online")
Left argument: \$s\$.  
Right argument: \$c\$ (as a single character, not as a string).  
Output: List of Jelly strings (appears as a list of lists of 1-char Python strings, replace `ŒṘ` with `Y` to see the `\n`-joined output).
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~82~~ 83 bytes
*+2 bytes thanks Veskah: the single character case bug fixed*
*-1 byte: The rule `Input-string may also be a list of characters` used*
```
$c,$s=$args
($s|%{(-join$s|% s*g $i)+$c*$i++})[($r=$i..0+1..$i)]|%{"$_"[$r]-join$c}
```
[Try it online!](https://tio.run/##ZY3BCoJAGITv@xTD8teqm5teA6F6gR7ALELSNkRjN@ig9uqbUtahwz98/wzD3JrH2djLuaocFUnrKF@QTehkSss8st2s9cJro@sRYYMSpH1JeUBayt5PPTIJaaUiGSs1RNlQ4HTkKZns3ct71zM2pwIKT8b5By3uMNCoUU5mjg220yMiARH/3RSvINaDIQVCiG7U5ku738oSexxGdS8 "PowerShell – Try It Online")
Less golfed:
```
$c,$s=$args
$southEast = $s|%{
    (-join$s|% substring $i) + $c*$i++
}
$range=$i..0+1..$i
$southEast[$range]|%{
    "$_"[$range]-join$c
}
```
[Answer]
# [Pip](https://github.com/dloscutoff/pip), ~~24~~ 20 bytes
```
QPRV:_JbMa@>RV,#aZDb
```
Use the `-l` flag to get human-readable output. [Try it online!](https://tio.run/##K8gs@P8/MCAozCreK8k30cEuKExHOTHKJen///@6Of@LS4oy89L/6wEA "Pip – Try It Online")
### Explanation
```
QPRV:_JbMa@>RV,#aZDb
                      a,b are cmdline args (implicit)
                a     1st cmdline arg (the string)
               #      Length
              ,       Range
            RV        Reverse
         a@>          Take slices of a starting at those indices
                 ZDb  Zip the list of slices together, filling out missing values in
                      the matrix with b (the character)
        M             To each row, map this function:
     _Jb               Join on b
  RV:                 Reverse (making top row the bottom and vice versa)
QP                    Quad-palindromize: reflect downward and rightward, with overlap
```
For example, with inputs of `abcd` and `.`:
```
RV,#a
 [3 2 1 0]
a@>
 ["d" "cd" "bcd" "abcd"]
ZDb
 [['d 'c 'b 'a] ['. 'd 'c 'b] ['. '. 'd 'c] ['. '. '. 'd]]
_JbM
 ["d.c.b.a" "..d.c.b" "....d.c" "......d"]
RV:
 ["......d" "....d.c" "..d.c.b" "d.c.b.a"]
QP
 ["......d......" "....d.c.d...." "..d.c.b.c.d.." "d.c.b.a.b.c.d" "..d.c.b.c.d.." "....d.c.d...." "......d......"]
```
[Answer]
# [Attache](https://github.com/ConorOBrien-Foxx/Attache), 57 bytes
```
${q:=#x-1Bounce!Bounce@Join&y@PadLeft&y&#x=>x[q::(q::0)]}
```
[Try it online!](https://tio.run/##SywpSUzOSP2fpmBl@1@lutDKVrlC19ApvzQvOVURQjl45WfmqVU6BCSm@KSmlahVqilX2NpVRBdaWWkAsYFmbO1/v9TUlOJolYKC5PRYroCizLySkNTiEufE4tTi6Jw0tQRtiCE5aQ5qaToK0VwKQBCtVFwCVJmupKOgpKcUqwMVNAQBkJgBkpiRsYmpo5Ozi6sbSEYZIeOgrVujmw/E/iAJK4SEoxNIwBkhUAfiRyD4@jFx@jFQMa7Y2P8A "Attache – Try It Online") Output is a list of lines.
## Explanation
```
?? parameters: x, y
${
    ?? q is length of x - 1
    q:=#x-1
    ?? Reflect, collapsing middle:
    Bounce!
        ?? Function:
            ?? Reflect,
            Bounce@
            ?? Joined by y,
            Join&y@
            ?? padded to the length of x with y
            PadLeft&y&#x
        ?? Mapped over
        =>
            ?? The elements of x at
            x[
                ?? decreasing range from q to
                q::(
                    ?? each element in the range from q to 0
                    q::0
                )
            ]
}
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 79 bytes
```
->\c{{map {join c,g $_ X||c},g .[^*X+(^$_,)]}o*.comb}
my&g={.[$_-1...0...$_-1]}
```
[Try it online!](https://tio.run/##ZclJC4JAGMbxu59imERcR207FEraco1ugntDipEL2iHR6aub0yGQXnjg5fevbvVjPeQt4BJggEExPdx1eVyB7l5mBcByCtgQOH2PyfgiNxAdiQ/YUBZ8UooIl/mVMHnLpUaHXDZUdISQNo6@PhkSHiIo8LB51lmRQsE0URO3W2Z0jbpOb8KzL88Xy5Vl7w/H0yRuaNxJSq@U486Thmmz7Im9qL3/6BKpXqB60c@HDw "Perl 6 – Try It Online")
Anonymous codeblock that takes input curried (like `f(char)(string)`) and returns a list of lines. I think a different approach would be shorter.
### Explanation:
```
my&g={.[$_-1...0...$_-1]}  # Helper function to palindromise a list
->\c{                                                }  # Code block that takes a char
     {                                       }o*.comb   # And returns a function
                                .[^*X+(^$_,)]  # Get all prefixes with end padding
                                               # e.g. "str" => [["r",Nil,Nil]
                                                                ["t","r",Nil]
                                                                ["s","t","r"]]
                              g   # Palindromise the lsit
       map {                },    # Map each element to
                     $_ X||c      # Replace all Nils with the character
                   g              # Palindromise it
            join c,               # And join by the character
```
[Answer]
# [Perl 5](https://www.perl.org/) with `-lF`, `-M5.010`, 71 bytes
```
$"=<>;$A=abs,$_="@F[$A..$#F]".$"x($A*2),/./,say reverse.$' for-$#F..$#F
```
[Try it online!](https://tio.run/##K0gtyjH9/19FydbGzlrF0TYxqVhHJd5WycEtWsVRT09F2S1WSU9FqUJDxVHLSFNHX09fpzixUqEotSy1qDhVT0VdIS2/SBeoDKz2/38nP79gLsd/@QUlmfl5xf91c9z@6/qa6hkYGgAA "Perl 5 – Try It Online")
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 249 bytes
```
s=>c=>{var r=s.Select((x,_)=>{int k=s.Length;var m=s.Substring(_,k-_).Aggregate("",(a,b)=>a+c+b);return new string(m.Skip(2).Reverse().Concat(m.Skip(1)).ToArray()).PadLeft(2*k-3+m.Length,c).PadRight(4*k-3,c);});return r.Skip(1).Reverse().Concat(r);}
```
[Try it online!](https://tio.run/##hZFdS8MwFIav118R6sUS@zH34Y1dxz7cQCgom6AXw5HGtA1bU0mzqcz612fSdkNQNFA47/O@p@c0JblDcnaYbTnp51IwHttlTRIs7Jsp36ZU4HBD@99rbQ7UAZF/yP0B8Qf7HRZA@Lm7oBtKJIRv9gopzLgEa4UDymOZeDqV6tQ2rIbBlb12VsgdxbGgMZYUmqYNsR2qZmwRK0SeoHIrOOD0FdQ9qbtYsxfYQe6c7qjIKUTuJOMEy6PVRsi9z0ZC4Heoyjv8HNBIws752ulaab2NTUpnzuJEwp62FPGK00RxfNfPMULlDp6hPycEvl4tYLns/3Nf@wiabX1MBJsXTWRr3en2LkfjyfV0pulZRYeW8@Fk6rnV8KqCo7EWpBKfun4s66HZWj61ljUoPCPKBMUkgX@vAzBgHIRobzR@ayhDgOgM1plTSBsg1ZyUvPEgmPpvKfKUKIxaB4yr@1KoMIrDFw "C# (Visual C# Interactive Compiler) – Try It Online")
This must be improvable...
[Answer]
# [JavaScript (Node.js)](https://nodejs.org/en/), 143 bytes
```
(s,c)=>{q=Math.abs;m=(l=s.length*4-3)-1;for(i=j=0;j<l/2;(i=(++i)%l)?0:++j){p=s[q(i-m/2)/2+q(j-m/4)];process.stdout.write((i?"":"\n")+(p?
p:c))}}
```
[Try it online!](https://tio.run/##DcdLDoIwEADQq5gmJjMWCiIrauUEnkBdVERow6d0qi4IZ0d271n91VR540I8jK961WoFiipUl3lSVx1aoZ8kewWdItHVQxPaQx6fMD7K9@jBKKtSac9dksktwLnBfYdlWnBucXaKbhOYuE8yTDI@gd2Y40M6P1Y1kaDwGj9B/LwJNYApGSvYfWDIwZWuqBCXZdXAKHgzNCzaMcFw/QM "JavaScript (Node.js) – Try It Online")
A bit more thinkering would lead to calculating in terms of a one-dimensional array, and less bytes.
[Answer]
# [Kotlin](https://kotlinlang.org), 250 bytes
Note: Kotlin tio currently fails to return a new class so this code gets an null pointer exception. This also occurs for codes I previously posted that worked at that time. I assume it will eventually get fixed, but couldn't find a support contact to report the issue to. It can also be run [here](https://code.sololearn.com/cKA6OO8Rcek5).
```
{s:String,c:Char->val h=s.length*2-1
val w=h*2-1
val m=Array(h){Array(w){c}}
for(i in s.indices)for(r in 0..h-1){val o=(i-Math.abs(h/2-r))*2
if(o>=0){m[r][w/2+o]=s[i].toChar()
m[r][w/2-o]=s[i].toChar()}}
m.map{it.joinToString("")}.joinToString("\n")}
```
[Try it online!](https://tio.run/##nVl7bxs5Dv8/n0J1F7C9tcex@9g7Y11sHs0hh/Z8QLK4HuIsoMzItrbj0aw0E8eXpl@9R@oxmpdz57XRYkL@RFIkxRHpLyKLefJ9NCJnktGMRWQpJMnWXJFwTeOYJSs2PQL2OstSNR2NQhGxlYiXgcpo@IU9AAogQSg2oz9ypjIuEjUa/2UyGU9w2Ue6IyLPQCIjZ1SmLDtC8mWiUi5B293OKLuaE7c8KKvTWsQ9k8tYbI2W0Zt3x@O/vjv@SUs681YawWmemUf8nBCVSZ6siCqRwGRJw4xJEmrqPM@KRcYLhJKI041IoqH6I6eSkZOrs8tLQmVGxFJvxsrlCQH94LRcwhLJQu2AAdnybK1xSy5VVlLZWI5/hSxBHk0ishJIB5dtqYxUQP615uGagId4oniElpUtGqJFofZrSafXRhUYAP6RAblGN28gHErkoCeVLMt25J6ucjYAGlkzEEoTwh7oJo0r7iSKzKzFAxLCc1DxGzwGxWflH8uMVZB4lmcgmXuWYxiy9CzDcOTMs5Dhycqznl3xjI5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Qq@lfPBuOk1/lnMTwyd5pF5wcT9EUHl3de2czq6GtO94ciA7qdfklO2lP1FOmX@TYPrTE6Dz/hfHO5JxmL303MzWID2B7UVjBSh/Bn45v3PgFxyCcZNUNLf40oiYXdtL3r7dAtsLNN8CN7CFmqJ24Wj8NgrpT5rcE4nSeQGTyy15QBEbaGJCJpzF3Hk59KLzKDm4ONcssVDtMaZxAxGezH1GdMQbubmd7iRygYvf6LF0euqFeuB@RnMnZlNFvj2/QSPLmi8Ylc5Xi@Prjt9Ur1uHNKI6Pd6nrRKb3pwYSc@btAv/RCMawXwOuSbhDoSbET@v@rrxigRTr9uHsfqz0O8N61PngxI2Py9WuhoQDcHN@2GvunPFVIdcZWy@agorZvE3We@AQbYM2DFfgDmP45qcgEg4UqyEVe@hXR/bCkU@QJrsYZXBh6TEoBFfka94B5597sxSH3Juc6i@00WtXt7hjDOwPwTrfG0iNV5Bw3OH4MifyXdb6fYyB7WmefnCI5rJO/IfVznTpaYM@18DxdVuCwmPqCdeL7fwE "Kotlin – Try It Online")
[Answer]
# [Gaia](https://github.com/splcurran/Gaia), 19 bytes
```
:ṫl¤┅v;@&Z¦<¦v¦ṫ¦ṫṣ
```
[Try it online!](https://tio.run/##S0/MTPxv9XDHUiCxc3XOoSWPprSWWTuoRR1aZnNoWdmhZUBRMPFw5@L//4tLijLz0rnqAA "Gaia – Try It Online")
Explanation to follow.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 101 bytes
```
s=>c=>[l=s.length-1,...Array(l*2)].map((x,i,a,m=Math.abs)=>a.map((y,j)=>s[m(l-i)+m(l-j)]||c).join(c))
```
[Try it online!](https://tio.run/##JYzBCsIwEETvfoW3ZDVd0GvZgh/gF9Qe1lhrSpqUbCgW/Peq5DQzvJkZeWGxyc25CvHRb0/ahBpLTetJ0PdhyK/qZBDxkhKv2h/O0OHEs9Zv4wybia6cX8h3AWq4kNWMvyDtpH3l4PiXEbrPxwKO0QVtAbZ6t3DaCynJyYVBoczeZa0UFGJJoSo20VML/FYlZkrlRt3Cv21jkOh79HHQGertCw "JavaScript (Node.js) – Try It Online")
[Answer]
# TSQL query, 191 bytes
In MS-SQL Server Management Studio press Ctrl-T before running this query, this will change the output to text.
This script is building up the output from left to right in one long "string", calculating the value to put in each position. The output is limited to 4096 characters.
**Golfed:**
```
SELECT
string_agg(iif(h>k/2,@y,substring(@,h+1,1))+iif(-~n%k=0,'
',@y),'')FROM(SELECT
abs(k/2-n%k)+abs(k/2-n/k)h,*FROM(SELECT
number n,len(@)*2-1k,*FROM spt_values)c)d
WHERE n<k*k and'P'=type
```
**Ungolfed:**
```
USE master
DECLARE 
@y char='.',
@ varchar(20) = 'abcd'
SELECT
  string_agg(iif(h>k/2,@y,substring(@,h+1,1))+iif(-~n%k=0,'
',@y),'')
FROM
(
  SELECT
    abs(k/2-n%k)+abs(k/2-n/k)h,*
  FROM
  (
    SELECT
      number n,
      len(@)*2-1k,*
    FROM spt_values
  )c
)d
WHERE n<k*k and'P'=type
```
I had to make some changes to format the output in the online version.
**[Try it online](https://data.stackexchange.com/stackoverflow/query/1017574/lay-out-the-carpet)**
[Answer]
# [Java (JDK)](http://jdk.java.net/), ~~213~~ ~~199~~ 198 bytes
```
a->b->{int i=0,l=a.length()-1;String s=a,r[]=new String[l-~l],p;for(;i<=l;s=s.substring(1))r[l+i]=r[l-i]=new StringBuffer(p=b.join(b,s.split(""))+b.repeat(2*i++)).reverse()+p.substring(1);return r;}
```
[Try it online!](https://tio.run/##fZNBb5swFMfv@RRP7GIX8EK2XUodrdnW27RDL5NSJhlqMmeOsWyTqsroV89MgJS2Gk8yxvbv2fD/@23ZnsXb@z9HsdOVcbD1Y1I7IUlZq8KJSpGb/iWdzXSdS1FAIZm18J0JBYcZ@NBG7JnjYB1zfn1fiXtw3Dp064xQm3V2GhXMctxntDFsfNVR0duJIX25hBLokcXLPF4ehHIg6DySlBHJ1cb9RjhO0g4GS1lk1hlV/GHIlxeLMMkinZaVQam4ojK11BJb5/YEoARjs5ahyKjvYjFOXtVlyQ3SNCfbSiiURz5RS@FQEGAc5sRwzZlDiwsRhhj74Z4byxEO9YsDUsNdbRSYtDkOAqRnKfyHQS8WmOoBLqEkTGv5iAbh1vMMv55KMjzWs43bR@v4jlS1I94U5aRCfj/8fFIz656nrvdrkHnkkwU62nmkZQaHoPupIIKABE30Pyppo4XmU9Diw8dP16svX7/dtOi7CfRzGP@Nf/hWteTlBHm9aolignhqgZ8TwPu7u1@@vcCatFOtr4LxZd/5Wni@7Mxs7NiYkbsjib3JZ7Vf23gqnnPNvHWvOf4D "Java (JDK) – Try It Online")
`-14 bytes` thanks to @KevinCruijssen  
`-1 byte` thanks to @ceilingcat
### Ungolfed
```
a->
    b-> {
        int i = 0, l = a.length() - 1;
        String s = a, r[]=new String[a.length()*2-1],p;
        for (; i<=l; s=s.substring(1))
            r[l+i]
              = r[l-i++]
              =   new StringBuffer(
                                   p =   String.join(b,s.split(""))
                                       + b.repeat(2*i)
                                  ).reverse()
                + p.substring(1);
        return r;
    }
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `j`, 14 bytes
```
Ṙ¦₅↳ømƛð⁰V⁰jøm
```
[Try it Online!](https://lyxal.pythonanywhere.com?flags=j&code=%E1%B9%98%C2%A6%E2%82%85%E2%86%B3%C3%B8m%C6%9B%C3%B0%E2%81%B0V%E2%81%B0j%C3%B8m&inputs=string%0A%27.%27&header=&footer=)
```
Ṙ              # Reverse
 ¦             # Prefixes
  ₅↳           # Pad right to correct width
    øm         # Mirror
      ƛ        # Map...
       ð⁰V     # Replace spaces with other char
          ⁰j   # Join by other char
            øm # Mirror
               # (j flag) join by newlines.
```
]