private void RefreshEffect() //todo: if we add support for multiple effects on a same element, return the string instead of directly setting the property. { if (_parentUIElement != null && INTERNAL_VisualTreeManager.IsElementInVisualTree(_parentUIElement)) { var domStyle = INTERNAL_HtmlDomManager.GetFrameworkElementOuterStyleForModification(_parentUIElement); double x, y; GetXYPositionFromDirectionAndDepth(out x, out y); double opacity = this.Opacity; if (opacity > 1.0) { opacity = 1.0; } else if (opacity < 0.0) { opacity = 0.0; } if (_parentUIElement is TextBlock) { domStyle.textShadow = x.ToString() + "px " + y.ToString() + "px " + BlurRadius.ToString() + "px " + Color.FromArgb(Convert.ToByte(opacity * 255d), Color.R, Color.G, Color.B).INTERNAL_ToHtmlString(1d); //Color.INTERNAL_ToHtmlString(); } else { domStyle.boxShadow = x.ToString() + "px " + y.ToString() + "px " + BlurRadius.ToString() + "px " + Color.FromArgb(Convert.ToByte(opacity * 255d), Color.R, Color.G, Color.B).INTERNAL_ToHtmlString(1d); //Color.INTERNAL_ToHtmlString(); domStyle.borderCollapse = "separate"; // This is required for IE only. If this property is not set or equal to "collapse", the shadow does not render at all on IE. See: http://stackoverflow.com/questions/9949396/css-box-shadow-not-working-in-ie domStyle.borderSpacing = "0px"; // This is required to fix a bug that comes with the line above: a 2 px margin appears around the children of the element, which can lead to some elements overflowing relative to those children when they shouldn't. } } }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("IsAnimatable", true, out subEle); subEle.Value = IsAnimatable.ToString(); ele.TryPathTo("Duration", true, out subEle); subEle.Value = Duration.ToString("G15"); ele.TryPathTo("HDR/EyeAdaptSpeed/Mult", true, out subEle); subEle.Value = HDREyeAdaptSpeedMult.ToString(); ele.TryPathTo("HDR/EyeAdaptSpeed/Add", true, out subEle); subEle.Value = HDREyeAdaptSpeedAdd.ToString(); ele.TryPathTo("HDR/Bloom/BlurRadius/Mult", true, out subEle); subEle.Value = HDRBloomBlurRadiusMult.ToString(); ele.TryPathTo("HDR/Bloom/BlurRadius/Add", true, out subEle); subEle.Value = HDRBloomBlurRadiusAdd.ToString(); ele.TryPathTo("HDR/Bloom/Threshold/Mult", true, out subEle); subEle.Value = HDRBloomThresholdMult.ToString(); ele.TryPathTo("HDR/Bloom/Threshold/Add", true, out subEle); subEle.Value = HDRBloomThresholdAdd.ToString(); ele.TryPathTo("HDR/Bloom/Scale/Mult", true, out subEle); subEle.Value = HDRBloomScaleMult.ToString(); ele.TryPathTo("HDR/Bloom/Scale/Add", true, out subEle); subEle.Value = HDRBloomScaleAdd.ToString(); ele.TryPathTo("HDR/TargetLum/Min/Mult", true, out subEle); subEle.Value = HDRTargetLumMinMult.ToString(); ele.TryPathTo("HDR/TargetLum/Min/Add", true, out subEle); subEle.Value = HDRTargetLumMinAdd.ToString(); ele.TryPathTo("HDR/TargetLum/Max/Mult", true, out subEle); subEle.Value = HDRTargetLumMaxMult.ToString(); ele.TryPathTo("HDR/TargetLum/Max/Add", true, out subEle); subEle.Value = HDRTargetLumMaxAdd.ToString(); ele.TryPathTo("HDR/SunlightScale/Mult", true, out subEle); subEle.Value = HDRSunlightScaleMult.ToString(); ele.TryPathTo("HDR/SunlightScale/Add", true, out subEle); subEle.Value = HDRSunlightScaleAdd.ToString(); ele.TryPathTo("HDR/SkyScale/Mult", true, out subEle); subEle.Value = HDRSkyScaleMult.ToString(); ele.TryPathTo("HDR/SkyScale/Add", true, out subEle); subEle.Value = HDRSkyScaleAdd.ToString(); ele.TryPathTo("Unknown1", true, out subEle); subEle.Value = Unknown1.ToHex(); ele.TryPathTo("Cinematic/Saturation/Mult", true, out subEle); subEle.Value = CinematicSaturationMult.ToString(); ele.TryPathTo("Cinematic/Saturation/Add", true, out subEle); subEle.Value = CinematicSaturationAdd.ToString(); ele.TryPathTo("Cinematic/Brightness/Mult", true, out subEle); subEle.Value = CinematicBrightnessMult.ToString(); ele.TryPathTo("Cinematic/Brightness/Add", true, out subEle); subEle.Value = CinematicBrightnessAdd.ToString(); ele.TryPathTo("Cinematic/Contrast/Mult", true, out subEle); subEle.Value = CinematicContrastMult.ToString(); ele.TryPathTo("Cinematic/Contrast/Add", true, out subEle); subEle.Value = CinematicContrastAdd.ToString(); ele.TryPathTo("Unknown2", true, out subEle); subEle.Value = Unknown2.ToHex(); ele.TryPathTo("TintColor", true, out subEle); TintColor.WriteXML(subEle, master); ele.TryPathTo("BlurRadius", true, out subEle); subEle.Value = BlurRadius.ToString(); ele.TryPathTo("DoubleVisionStrength", true, out subEle); subEle.Value = DoubleVisionStrength.ToString(); ele.TryPathTo("RadialBlur/Strength", true, out subEle); subEle.Value = RadialBlurStrength.ToString(); ele.TryPathTo("RadialBlur/RampUp", true, out subEle); subEle.Value = RadialBlurRampUp.ToString(); ele.TryPathTo("RadialBlur/Start", true, out subEle); subEle.Value = RadialBlurStart.ToString(); ele.TryPathTo("RadialBlur/UseTarget", true, out subEle); subEle.Value = RadialBlurUseTarget.ToString(); ele.TryPathTo("RadialBlur/Center/X", true, out subEle); subEle.Value = RadialBlurCenterX.ToString(); ele.TryPathTo("RadialBlur/Center/Y", true, out subEle); subEle.Value = RadialBlurCenterY.ToString(); ele.TryPathTo("DepthOfField/Strength", true, out subEle); subEle.Value = DepthOfFieldStrength.ToString(); ele.TryPathTo("DepthOfField/Distance", true, out subEle); subEle.Value = DepthOfFieldDistance.ToString(); ele.TryPathTo("DepthOfField/Range", true, out subEle); subEle.Value = DepthOfFieldRange.ToString(); ele.TryPathTo("DepthOfField/UseTarget", true, out subEle); subEle.Value = DepthOfFieldUseTarget.ToString(); ele.TryPathTo("RadialBlur/RampDown", true, out subEle); subEle.Value = RadialBlurRampDown.ToString(); ele.TryPathTo("RadialBlur/DownStart", true, out subEle); subEle.Value = RadialBlurDownStart.ToString(); ele.TryPathTo("FadeColor", true, out subEle); FadeColor.WriteXML(subEle, master); ele.TryPathTo("MotionBlurStrength", true, out subEle); subEle.Value = MotionBlurStrength.ToString(); }