option explicit

makeFaceSlices 1
makeFaceSlices 2
makeFaceSlices 3
makeFaceSlices 4
makeFaceSlices 5
makeFaceSlices 6

function makeFaceSlices(pFace)
    dim oFS
    set oFS=createobject("scripting.filesystemobject")
    if not oFS.FolderExists("Face") then oFS.CreateFolder "Face"
    set oFS=nothing
    
    dim x,y,slice
    dim picSlice,brush,pen
    dim r,g,b
    
    Set picSlice = createobject("ASPPicture.Picture")
    
    for slice=0 to 255
        picSlice.Init 256,256
        
        for x=0 to 255
            for y=0 to 255
                if pFace=1 then
                    picSlice.PutPoint x,y,RGB(255-slice,y,255-x)
                elseif pFace=2 then
                    picSlice.PutPoint x,y,RGB(x,y,255-slice)
                elseif pFace=3 then
                    picSlice.PutPoint x,y,RGB(slice,y,x)
                elseif pFace=4 then
                    picSlice.PutPoint x,y,RGB(255-x,y,slice)
                elseif pFace=5 then
                    picSlice.PutPoint x,y,RGB(y,slice,255-x)
                elseif pFace=6 then
                    picSlice.PutPoint x,y,RGB(255-y,255-slice,255-x)
                end if
            next
        next
        
        picSlice.SaveFile "Face\" & pFace & "-" & setDigits(slice,3) & ".png"
    next
    set picSlice=nothing
end function

function setDigits(pVal,pDigits)
    dim strVal
    strVal=pVal
    setDigits=string(pDigits-len(strVal),"0") & strVal
end function

