--setFont when changed in options menu
function setFont()
    message:SetFont(Media:Fetch("font", KillingBlowAnnouncer:GetFont(info)), KillingBlowAnnouncer:GetFontSize(info), KillingBlowAnnouncer:GetOutline(info))
end

--setColors when changed in options menu
function setColors()
    if (KillingBlowAnnouncer:EnableSnap(info) == true) then
        message:Clear()
        message:AddMessage(KillingBlowAnnouncer:GetKillingMessage(info),KillingBlowAnnouncer:GetRed(info),KillingBlowAnnouncer:GetGreen(info),KillingBlowAnnouncer:GetBlue(info))
    end
end

--setTime when changed in options menu
function setTime()
    if (KillingBlowAnnouncer:EnableSnap(info) == false) then
        message:SetTimeVisible(KillingBlowAnnouncer:GetVisibleTime(info))
        message:SetFadeDuration(KillingBlowAnnouncer:GetFadeTime(info))
    end
end

--setKillingMsg when changed in options menu
function setKillingMsg()
    if (KillingBlowAnnouncer:EnableSnap(info) == true) then
        message:Clear()
        message:AddMessage(KillingBlowAnnouncer:GetKillingMessage(info),KillingBlowAnnouncer:GetRed(info),KillingBlowAnnouncer:GetGreen(info),KillingBlowAnnouncer:GetBlue(info))
    end
end

--Snap killing blow message frame to window when enabled and when disabled clear and set timevisible back to normal
function snapMessage()
    --EnableSnap is false then set back to database value else if edit mode is true then set time to 10000
    if (KillingBlowAnnouncer:EnableSnap(info) == false) then
        message:SetTimeVisible(KillingBlowAnnouncer:GetVisibleTime(info))
        message:Clear()
    else
        message:SetTimeVisible(10000)
        message:AddMessage(KillingBlowAnnouncer:GetKillingMessage(info),KillingBlowAnnouncer:GetRed(info),KillingBlowAnnouncer:GetGreen(info),KillingBlowAnnouncer:GetBlue(info))
    end

end

--Method for fading the killing blow message in and out
function fade()
    --set duration it takes to finish the fade in and fade out
    i = KillingBlowAnnouncer:GetFadeInTime(info)
    if(i == 0) then
        i = 0.1
    end

    o = KillingBlowAnnouncer:GetFadeOutTime(info)
    if(o == 0) then
        o = 0.1
    end

    alphaIn:SetDuration(i)
    alphaOut:SetDuration(o)

    --set delay for waiting when fadein ends
    alphaIn:SetEndDelay(KillingBlowAnnouncer:GetEndDelay(info))

    imageAnimationIn:SetScript("OnPlay", function(self)
        image:Show();
    end)

    alphaIn:SetScript("OnPlay", function(self)
        alphaIn:SetChange(1)
    end)

    alphaOut:SetScript("OnPlay", function(self)
        alphaOut:SetChange(-1)
    end)

    imageAnimationIn:SetScript("OnFinished", function(self)
        imageObj:SetAlpha(1)
        imageAnimationOut:Play();
    end)

    imageAnimationOut:SetScript("OnFinished", function(self)
        imageObj:SetAlpha(-1)
        image:Hide();

        if(KillingBlowAnnouncer:GetKBIDebug(info) == true) then
            fade();
        end
    end)

    imageAnimationIn:Play();
end

function resizeKBIImage(w,h)
    image:SetSize(w,h)
end