private async Task <RenderDTO> CreateRenderItemWithUIElement_Effect(UIElementState uies, string effectClass, RenderDTO parentRenderTreeItem) { EffectDTO edto = new EffectDTO(); edto.IsRenderable = uies.IsRenderable; edto.AggregateId = uies.AggregateId; edto.Grouping1 = uies.Grouping1; if (parentRenderTreeItem != null) { edto.MainTranslation = parentRenderTreeItem.EffectDTO.MainTranslation; edto.MainScale = parentRenderTreeItem.EffectDTO.MainScale; } else { edto.MainTranslation = new Vector3(0); edto.MainScale = new Vector3(1); } switch (effectClass) { case "SharpDX.Direct2D1.Effects.AffineTransform2D": break; case "SharpDX.Direct2D1.Effects.ArithmeticComposite": break; case "SharpDX.Direct2D1.Effects.Atlas": break; case "SharpDX.Direct2D1.Effects.BitmapSourceEffect": #region bitmap source try { if (uies.udfString2 == "PicturesLibrary") { var asset = await LoadAssetAsync(_deviceManager.WICFactory, uies.udfString1, uies.AggregateId, path : "PicturesLibrary"); edto.Effect = new SharpDX.Direct2D1.Effects.BitmapSource(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("WicBitmapSource", asset.Item1); uies.Width = asset.Item2.Width; uies.Height = asset.Item2.Height; } else if (uies.udfString2 == "PublicPicturesLibrary") { var asset = await LoadAssetAsync(_deviceManager.WICFactory, uies.udfString1, uies.AggregateId, path : "PublicPicturesLibrary"); edto.Effect = new SharpDX.Direct2D1.Effects.BitmapSource(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("WicBitmapSource", asset.Item1); uies.Width = asset.Item2.Width; uies.Height = asset.Item2.Height; } else { var asset = await LoadAssetAsync(_deviceManager.WICFactory, uies.udfString1, uies.AggregateId); edto.Effect = new SharpDX.Direct2D1.Effects.BitmapSource(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("WicBitmapSource", asset.Item1); uies.Width = asset.Item2.Width; uies.Height = asset.Item2.Height; } } catch { var asset = LoadAssetAsync(_deviceManager.WICFactory, "Assets\\StartDemo\\Backgrounds\\green1.jpg", uies.AggregateId); edto.Effect = new SharpDX.Direct2D1.Effects.BitmapSource(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("WicBitmapSource", asset.Result.Item1); uies.Width = asset.Result.Item2.Width; uies.Height = asset.Result.Item2.Height; } #endregion break; case "SharpDX.Direct2D1.Effects.Blend": break; case "SharpDX.Direct2D1.Effects.Border": break; case "SharpDX.Direct2D1.Effects.Brightness": #region brightness edto.Effect = new SharpDX.Direct2D1.Effects.Brightness(_deviceManager.ContextDirect2D); ((SharpDX.Direct2D1.Effects.Brightness)edto.Effect).WhitePoint = new Vector2((float)uies.udfDouble1, (float)uies.udfDouble2); ((SharpDX.Direct2D1.Effects.Brightness)edto.Effect).BlackPoint = new Vector2((float)uies.udfDouble3, (float)uies.udfDouble4); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.ColorManagement": break; case "SharpDX.Direct2D1.Effects.ColorMatrix": break; case "SharpDX.Direct2D1.Effects.Composite": #region composite if (!string.IsNullOrEmpty(uies.Grouping2) && !string.IsNullOrEmpty(uies.udfString2)) { edto.Effect = new SharpDX.Direct2D1.Effects.Composite(_deviceManager.ContextDirect2D); if (!string.IsNullOrEmpty(uies.Grouping2)) { var found = _renderTree.Where(x => x.EffectDTO != null && x.EffectDTO.AggregateId == uies.Grouping2); if (found != null && found.Count() > 0) { edto.Effect.SetInputEffect(0, found.First().EffectDTO.Effect, true); } else { edto.Effect.SetInputEffect(1, parentRenderTreeItem.EffectDTO.Effect, true); } } else { edto.Effect.SetInputEffect(1, parentRenderTreeItem.EffectDTO.Effect, true); } if (!string.IsNullOrEmpty(uies.udfString2)) { var found = _renderTree.Where(x => x.EffectDTO != null && x.EffectDTO.AggregateId == uies.udfString2); if (found != null && found.Count() > 0) { edto.Effect.SetInputEffect(1, found.First().EffectDTO.Effect, true); } else { edto.Effect.SetInputEffect(1, parentRenderTreeItem.EffectDTO.Effect, true); } } else { edto.Effect.SetInputEffect(1, parentRenderTreeItem.EffectDTO.Effect, true); } } #endregion break; case "SharpDX.Direct2D1.Effects.ConvolveMatrix": #region convolve matrix edto.Effect = new SharpDX.Direct2D1.Effects.ConvolveMatrix(_deviceManager.ContextDirect2D); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); if (!string.IsNullOrEmpty(uies.udfString2)) //matrix { var parts = uies.udfString2.Split("|".ToCharArray()); if (parts.Length == 9) { float[] matrix = new float[9] { float.Parse(parts[0]), float.Parse(parts[1]), float.Parse(parts[2]), float.Parse(parts[3]), float.Parse(parts[4]), float.Parse(parts[5]), float.Parse(parts[6]), float.Parse(parts[7]), float.Parse(parts[8]), }; ((SharpDX.Direct2D1.Effects.ConvolveMatrix)edto.Effect).KernelMatrix = matrix; } //edto.Effect.SetInput(0, parentRenderTreeItem.EffectDTO.Effect.Output, true); //var kernelmatrix = new float[9] { 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f }; //((SharpDX.Direct2D1.Effects.ConvolveMatrix)edto.Effect).KernelMatrix = kernelmatrix; } else { ((SharpDX.Direct2D1.Effects.ConvolveMatrix)edto.Effect).KernelMatrix = new float[9] { 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f }; } #endregion break; case "SharpDX.Direct2D1.Effects.Crop": #region crop edto.Effect = new SharpDX.Direct2D1.Effects.Crop(_deviceManager.ContextDirect2D); ((SharpDX.Direct2D1.Effects.Crop)edto.Effect).Rectangle = new Vector4((float)uies.udfDouble1, (float)uies.udfDouble2, (float)uies.udfDouble3, (float)uies.udfDouble4); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.DirectionalBlur": #region directional blur edto.Effect = new SharpDX.Direct2D1.Effects.DirectionalBlur(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("StandardDeviation", (float)uies.udfDouble1); edto.Effect.SetValueByName("Angle", (float)uies.udfDouble2); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.DiscreteTransfer": break; case "SharpDX.Direct2D1.Effects.DisplacementMap": break; case "SharpDX.Direct2D1.Effects.DistantDiffuse": break; case "SharpDX.Direct2D1.Effects.DistantSpecular": break; case "SharpDX.Direct2D1.Effects.DpiCompensation": break; case "SharpDX.Direct2D1.Effects.Flood": #region flood edto.Effect = new SharpDX.Direct2D1.Effects.Flood(_deviceManager.ContextDirect2D); ((SharpDX.Direct2D1.Effects.Flood)edto.Effect).Color = new Color4((float)uies.udfDouble1, (float)uies.udfDouble2, (float)uies.udfDouble3, (float)uies.udfDouble4); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.GammaTransfer": break; case "SharpDX.Direct2D1.Effects.GaussianBlur": #region gaussian blur edto.Effect = new SharpDX.Direct2D1.Effects.GaussianBlur(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("StandardDeviation", (float)uies.udfDouble1); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.Histogram": break; case "SharpDX.Direct2D1.Effects.HueRotate": #region hue rotate edto.Effect = new SharpDX.Direct2D1.Effects.HueRotation(_deviceManager.ContextDirect2D); edto.Effect.SetValue(0, (float)uies.udfDouble1); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.LinearTransfer": break; case "SharpDX.Direct2D1.Effects.LuminanceToAlpha": break; case "SharpDX.Direct2D1.Effects.Morphology": break; case "SharpDX.Direct2D1.Effects.NamespaceDoc": break; case "SharpDX.Direct2D1.Effects.PointDiffuse": break; case "SharpDX.Direct2D1.Effects.PointSpecular": break; case "SharpDX.Direct2D1.Effects.Premultiply": break; case "SharpDX.Direct2D1.Effects.Saturation": #region saturation edto.Effect = new SharpDX.Direct2D1.Effects.Saturation(_deviceManager.ContextDirect2D); edto.Effect.SetValue(0, (float)uies.udfDouble1); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.Scale": #region scale SharpDX.Direct2D1.Effects.Scale ef = new SharpDX.Direct2D1.Effects.Scale(_deviceManager.ContextDirect2D); ef.BorderMode = SharpDX.Direct2D1.BorderMode.Soft; ef.Cached = false; ef.ScaleAmount = new Vector2((float)uies.udfDouble1, (float)uies.udfDouble2); ef.CenterPoint = new Vector2((float)uies.udfDouble3, (float)uies.udfDouble4); edto.Effect = ef; edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.Shadow": #region shadow edto.Effect = new SharpDX.Direct2D1.Effects.Shadow(_deviceManager.ContextDirect2D); edto.Effect.SetValue(0, (float)uies.udfDouble1); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.SpotDiffuse": break; case "SharpDX.Direct2D1.Effects.SpotSpecular": break; case "SharpDX.Direct2D1.Effects.TableTransfer": break; case "SharpDX.Direct2D1.Effects.Tile": #region tile edto.Effect = new SharpDX.Direct2D1.Effects.Tile(_deviceManager.ContextDirect2D); ((SharpDX.Direct2D1.Effects.Tile)edto.Effect).Rectangle = new Vector4((float)uies.udfDouble1, (float)uies.udfDouble2, (float)uies.udfDouble3, (float)uies.udfDouble4); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.Transform3D": break; case "SharpDX.Direct2D1.Effects.Turbulence": break; case "SharpDX.Direct2D1.Effects.UnPremultiply": break; } RenderDTO _newRenderDto; if (parentRenderTreeItem != null) { _newRenderDto = new RenderDTO() { EffectDTO = edto, Type = eRenderType.Effect, Order = parentRenderTreeItem.Order } } ; else { _newRenderDto = new RenderDTO() { EffectDTO = edto, Type = eRenderType.Effect, Order = 1 } }; _renderTree.Add(_newRenderDto); return(_newRenderDto); }
/// <summary> /// Create a new Bitmap Effect /// </summary> /// <param name="assetUri"></param> /// <param name="aggregateId"></param> private void AddImageByUri(string assetUri, string aggregateId) { var uistate = AppDatabase.Current.RetrieveUIElementState(aggregateId); if (uistate != null && uistate.Count() > 0) { //Background Image Size2 backgroundImageSize; SharpDX.WIC.FormatConverter backgroundImageFormatConverter = null; using (backgroundImageFormatConverter) { LoadAsset(assetUri, out backgroundImageFormatConverter, out backgroundImageSize); EffectDTO edto = new EffectDTO(); edto.Effect = new SharpDX.Direct2D1.Effects.BitmapSource(_deviceManager.ContextDirect2D); edto.IsRenderable = uistate[0].IsRenderable; //false; edto.AggregateId = aggregateId; edto.Effect.SetValueByName("WicBitmapSource", backgroundImageFormatConverter); //edto.MainTranslation = new Vector3(); //edto.MainScale = new Vector3(1, 1, 1); edto.MainTranslation = new Vector3((float)uistate[0].Left, (float)uistate[0].Top, (float)0); edto.MainScale = new Vector3((float)uistate[0].Scale, (float)uistate[0].Scale, 0); _renderTree.Add(new RenderDTO() { EffectDTO = edto, Type = eRenderType.Effect, Order = _renderTree.Count() + 1 }); AppDatabase.Current.UpdateUIElementStateField(aggregateId, "Width", backgroundImageSize.Width, sendAggregateUpdateMessage: false); AppDatabase.Current.UpdateUIElementStateField(aggregateId, "Height", backgroundImageSize.Height, sendAggregateUpdateMessage: false); //uistate[0].width,uistate[0].height } NumberFramesToRender = 5; //TurnOnRenderingBecauseThereAreRenderableEffects(); //AppDatabase.Current.AddUpdateUIElementState(aggregateId, 0, 0, backgroundImageSize.Width, backgroundImageSize.Height, 1, false, 0, 0); } ////Background Image //DrawingSize backgroundImageSize; //SharpDX.WIC.FormatConverter backgroundImageFormatConverter = null; //using (backgroundImageFormatConverter) //{ // LoadAsset(assetUri, out backgroundImageFormatConverter, out backgroundImageSize); // EffectDTO edto = new EffectDTO(); // edto.Effect = new SharpDX.Direct2D1.Effects.BitmapSourceEffect(_deviceManager.ContextDirect2D); // edto.IsRenderable = false; // edto.AggregateId = aggregateId; // edto.Effect.SetValueByName("WicBitmapSource", backgroundImageFormatConverter); // edto.MainTranslation = new Vector3(); // edto.MainScale = new Vector3(1, 1, 1); // _renderTree.Add(new RenderDTO() { EffectDTO = edto, Type = 1, Order = _renderTree.Count() + 1 }); //} //NumberFramesToRender = 5; //TurnOnRenderingBecauseThereAreRenderableEffects(); //AppDatabase.Current.AddUpdateUIElementState(aggregateId, 0, 0, backgroundImageSize.Width, backgroundImageSize.Height, 1, false, 0, 0); }
private async Task<RenderDTO> CreateRenderItemWithUIElement_Effect(UIElementState uies, string effectClass, RenderDTO parentRenderTreeItem) { EffectDTO edto = new EffectDTO(); edto.IsRenderable = uies.IsRenderable; edto.AggregateId = uies.AggregateId; edto.Grouping1 = uies.Grouping1; if (parentRenderTreeItem != null) { edto.MainTranslation = parentRenderTreeItem.EffectDTO.MainTranslation; edto.MainScale = parentRenderTreeItem.EffectDTO.MainScale; } else { edto.MainTranslation = new Vector3(0); edto.MainScale = new Vector3(1); } switch (effectClass) { case "SharpDX.Direct2D1.Effects.AffineTransform2D": break; case "SharpDX.Direct2D1.Effects.ArithmeticComposite": break; case "SharpDX.Direct2D1.Effects.Atlas": break; case "SharpDX.Direct2D1.Effects.BitmapSourceEffect": #region bitmap source try { if (uies.udfString2 == "PicturesLibrary") { var asset = await LoadAssetAsync(_deviceManager.WICFactory, uies.udfString1, uies.AggregateId, path: "PicturesLibrary"); edto.Effect = new SharpDX.Direct2D1.Effects.BitmapSource(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("WicBitmapSource", asset.Item1); uies.Width = asset.Item2.Width; uies.Height = asset.Item2.Height; } else if (uies.udfString2 == "PublicPicturesLibrary") { var asset = await LoadAssetAsync(_deviceManager.WICFactory, uies.udfString1, uies.AggregateId, path: "PublicPicturesLibrary"); edto.Effect = new SharpDX.Direct2D1.Effects.BitmapSource(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("WicBitmapSource", asset.Item1); uies.Width = asset.Item2.Width; uies.Height = asset.Item2.Height; } else { var asset = await LoadAssetAsync(_deviceManager.WICFactory, uies.udfString1, uies.AggregateId); edto.Effect = new SharpDX.Direct2D1.Effects.BitmapSource(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("WicBitmapSource", asset.Item1); uies.Width = asset.Item2.Width; uies.Height = asset.Item2.Height; } } catch { var asset = LoadAssetAsync(_deviceManager.WICFactory, "Assets\\StartDemo\\Backgrounds\\green1.jpg", uies.AggregateId); edto.Effect = new SharpDX.Direct2D1.Effects.BitmapSource(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("WicBitmapSource", asset.Result.Item1); uies.Width = asset.Result.Item2.Width; uies.Height = asset.Result.Item2.Height; } #endregion break; case "SharpDX.Direct2D1.Effects.Blend": break; case "SharpDX.Direct2D1.Effects.Border": break; case "SharpDX.Direct2D1.Effects.Brightness": #region brightness edto.Effect = new SharpDX.Direct2D1.Effects.Brightness(_deviceManager.ContextDirect2D); ((SharpDX.Direct2D1.Effects.Brightness)edto.Effect).WhitePoint = new Vector2((float)uies.udfDouble1, (float)uies.udfDouble2); ((SharpDX.Direct2D1.Effects.Brightness)edto.Effect).BlackPoint = new Vector2((float)uies.udfDouble3, (float)uies.udfDouble4); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.ColorManagement": break; case "SharpDX.Direct2D1.Effects.ColorMatrix": break; case "SharpDX.Direct2D1.Effects.Composite": #region composite if (!string.IsNullOrEmpty(uies.Grouping2) && !string.IsNullOrEmpty(uies.udfString2)) { edto.Effect = new SharpDX.Direct2D1.Effects.Composite(_deviceManager.ContextDirect2D); if (!string.IsNullOrEmpty(uies.Grouping2)) { var found = _renderTree.Where(x => x.EffectDTO != null && x.EffectDTO.AggregateId == uies.Grouping2); if (found != null && found.Count() > 0) edto.Effect.SetInputEffect(0, found.First().EffectDTO.Effect, true); else edto.Effect.SetInputEffect(1, parentRenderTreeItem.EffectDTO.Effect, true); } else edto.Effect.SetInputEffect(1, parentRenderTreeItem.EffectDTO.Effect, true); if (!string.IsNullOrEmpty(uies.udfString2)) { var found = _renderTree.Where(x => x.EffectDTO != null && x.EffectDTO.AggregateId == uies.udfString2); if (found != null && found.Count() > 0) edto.Effect.SetInputEffect(1, found.First().EffectDTO.Effect, true); else edto.Effect.SetInputEffect(1, parentRenderTreeItem.EffectDTO.Effect, true); } else edto.Effect.SetInputEffect(1, parentRenderTreeItem.EffectDTO.Effect, true); } #endregion break; case "SharpDX.Direct2D1.Effects.ConvolveMatrix": #region convolve matrix edto.Effect = new SharpDX.Direct2D1.Effects.ConvolveMatrix(_deviceManager.ContextDirect2D); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); if (!string.IsNullOrEmpty(uies.udfString2)) //matrix { var parts = uies.udfString2.Split("|".ToCharArray()); if (parts.Length == 9) { float[] matrix = new float[9]{ float.Parse(parts[0]), float.Parse(parts[1]), float.Parse(parts[2]), float.Parse(parts[3]), float.Parse(parts[4]), float.Parse(parts[5]), float.Parse(parts[6]), float.Parse(parts[7]), float.Parse(parts[8]), }; ((SharpDX.Direct2D1.Effects.ConvolveMatrix)edto.Effect).KernelMatrix = matrix; } //edto.Effect.SetInput(0, parentRenderTreeItem.EffectDTO.Effect.Output, true); //var kernelmatrix = new float[9] { 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f }; //((SharpDX.Direct2D1.Effects.ConvolveMatrix)edto.Effect).KernelMatrix = kernelmatrix; } else { ((SharpDX.Direct2D1.Effects.ConvolveMatrix)edto.Effect).KernelMatrix = new float[9] { 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f }; } #endregion break; case "SharpDX.Direct2D1.Effects.Crop": #region crop edto.Effect = new SharpDX.Direct2D1.Effects.Crop(_deviceManager.ContextDirect2D); ((SharpDX.Direct2D1.Effects.Crop)edto.Effect).Rectangle = new Vector4((float)uies.udfDouble1, (float)uies.udfDouble2, (float)uies.udfDouble3, (float)uies.udfDouble4); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.DirectionalBlur": #region directional blur edto.Effect = new SharpDX.Direct2D1.Effects.DirectionalBlur(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("StandardDeviation", (float)uies.udfDouble1); edto.Effect.SetValueByName("Angle", (float)uies.udfDouble2); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.DiscreteTransfer": break; case "SharpDX.Direct2D1.Effects.DisplacementMap": break; case "SharpDX.Direct2D1.Effects.DistantDiffuse": break; case "SharpDX.Direct2D1.Effects.DistantSpecular": break; case "SharpDX.Direct2D1.Effects.DpiCompensation": break; case "SharpDX.Direct2D1.Effects.Flood": #region flood edto.Effect = new SharpDX.Direct2D1.Effects.Flood(_deviceManager.ContextDirect2D); ((SharpDX.Direct2D1.Effects.Flood)edto.Effect).Color = new Color4((float)uies.udfDouble1, (float)uies.udfDouble2, (float)uies.udfDouble3, (float)uies.udfDouble4); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.GammaTransfer": break; case "SharpDX.Direct2D1.Effects.GaussianBlur": #region gaussian blur edto.Effect = new SharpDX.Direct2D1.Effects.GaussianBlur(_deviceManager.ContextDirect2D); edto.Effect.SetValueByName("StandardDeviation", (float)uies.udfDouble1); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.Histogram": break; case "SharpDX.Direct2D1.Effects.HueRotate": #region hue rotate edto.Effect = new SharpDX.Direct2D1.Effects.HueRotation(_deviceManager.ContextDirect2D); edto.Effect.SetValue(0, (float)uies.udfDouble1); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.LinearTransfer": break; case "SharpDX.Direct2D1.Effects.LuminanceToAlpha": break; case "SharpDX.Direct2D1.Effects.Morphology": break; case "SharpDX.Direct2D1.Effects.NamespaceDoc": break; case "SharpDX.Direct2D1.Effects.PointDiffuse": break; case "SharpDX.Direct2D1.Effects.PointSpecular": break; case "SharpDX.Direct2D1.Effects.Premultiply": break; case "SharpDX.Direct2D1.Effects.Saturation": #region saturation edto.Effect = new SharpDX.Direct2D1.Effects.Saturation(_deviceManager.ContextDirect2D); edto.Effect.SetValue(0, (float)uies.udfDouble1); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.Scale": #region scale SharpDX.Direct2D1.Effects.Scale ef = new SharpDX.Direct2D1.Effects.Scale(_deviceManager.ContextDirect2D); ef.BorderMode = SharpDX.Direct2D1.BorderMode.Soft; ef.Cached = false; ef.ScaleAmount = new Vector2((float)uies.udfDouble1, (float)uies.udfDouble2); ef.CenterPoint = new Vector2((float)uies.udfDouble3, (float)uies.udfDouble4); edto.Effect = ef; edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.Shadow": #region shadow edto.Effect = new SharpDX.Direct2D1.Effects.Shadow(_deviceManager.ContextDirect2D); edto.Effect.SetValue(0, (float)uies.udfDouble1); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.SpotDiffuse": break; case "SharpDX.Direct2D1.Effects.SpotSpecular": break; case "SharpDX.Direct2D1.Effects.TableTransfer": break; case "SharpDX.Direct2D1.Effects.Tile": #region tile edto.Effect = new SharpDX.Direct2D1.Effects.Tile(_deviceManager.ContextDirect2D); ((SharpDX.Direct2D1.Effects.Tile)edto.Effect).Rectangle = new Vector4((float)uies.udfDouble1, (float)uies.udfDouble2, (float)uies.udfDouble3, (float)uies.udfDouble4); edto.Effect.SetInputEffect(0, parentRenderTreeItem.EffectDTO.Effect, true); #endregion break; case "SharpDX.Direct2D1.Effects.Transform3D": break; case "SharpDX.Direct2D1.Effects.Turbulence": break; case "SharpDX.Direct2D1.Effects.UnPremultiply": break; } RenderDTO _newRenderDto; if(parentRenderTreeItem!=null) _newRenderDto = new RenderDTO() { EffectDTO = edto, Type = eRenderType.Effect , Order = parentRenderTreeItem.Order }; else _newRenderDto = new RenderDTO() { EffectDTO = edto, Type = eRenderType.Effect, Order = 1}; _renderTree.Add(_newRenderDto); return _newRenderDto; }