Exemplo n.º 1
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            DirectWriteFactory f = DirectWriteFactory.Create(DirectWriteFactoryType.Shared);

            _textFormat = f.CreateTextFormat("Verdana", 110, FontWeight.Normal, FontStyle.Normal, FontStretch.Normal);
            _textFormat.ParagraphAlignment = ParagraphAlignment.Far;
            _textFormat.TextAlignment      = TextAlignment.Center;

            ClientSize = new System.Drawing.Size(600, 600);
            _factory   = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None, FactoryVersion.Auto);

            _renderTarget = _factory.CreateWindowRenderTarget(this, PresentOptions.None, RenderTargetProperties.Default);
            AntialiasMode     amode  = _renderTarget.AntialiasMode;
            TextAntialiasMode tamode = _renderTarget.TextAntialiasMode;

            _strokeBrush = _renderTarget.CreateSolidColorBrush(Color.FromKnown(Colors.Cyan, 1));
            try
            {
                _strokeStyle = _factory.CreateStrokeStyle(new StrokeStyleProperties1(LineCapStyle.Flat,
                                                                                     LineCapStyle.Flat, LineCapStyle.Round, LineJoin.Miter, 10, DashStyle.Dot, 0, StrokeTransformType.Normal), null);
            }
            catch (NotSupportedException)
            {
                _strokeStyle = _factory.CreateStrokeStyle(new StrokeStyleProperties(LineCapStyle.Flat,
                                                                                    LineCapStyle.Flat, LineCapStyle.Round, LineJoin.Miter, 10, DashStyle.Dot, 0), null);
            }
            Resize += new EventHandler(MainWindow_Resize);
        }
Exemplo n.º 2
0
 protected virtual void OnCreateDeviceIndependentResources(Direct2DFactory factory)
 {
     if (CreateDeviceIndependentResources != null)
     {
         CreateDeviceIndependentResources(this, EventArgs.Empty);
     }
 }
Exemplo n.º 3
0
 private async void MainWindow_Load(object sender, EventArgs e)
 {
     if (_dxgiDevice != null)
     {
         CleanUp();
     }
     _dxgiDevice = DxgiDevice.CreateDevice();
     _factory    = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);
     using (Device device = _factory.CreateDevice(_dxgiDevice))
     {
         _deviceContext = device.CreateDeviceContext(DeviceContextOptions.None);
         using (DxgiAdapter adapter = _dxgiDevice.GetAdapter())
             using (DxgiFactory factory = adapter.GetFactory())
             {
                 _swapChain = factory.CreateSwapChainForHwnd(_dxgiDevice, Handle);
                 _dxgiDevice.MaximumFrameLatency = 1;
                 _swapChain.GetBuffer(0, out _surface);
                 _bitmap = _deviceContext.CreateBitmapFromDxgiSurface(_surface);
                 _deviceContext.SetTarget(_bitmap);
                 _brush  = _deviceContext.CreateSolidColorBrush(Color.FromRGB(0.1f, 0.75f, 0.5f, 1f));
                 _brush1 = _deviceContext.CreateSolidColorBrush(Color.FromRGB(0.1f, 0.5f, 0.75f, 1f));
             }
     }
     _directWriteFactory = DirectWriteFactory.Create(DirectWriteFactoryType.Shared);
     await CreatePoints();
 }
Exemplo n.º 4
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);
            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola", 72);
            this._textFormat.TextAlignment = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;
            float width = ClientSize.Width / dpiScaleX;
            float height = ClientSize.Height / dpiScaleY;
            this._textLayout = DirectWriteFactory.CreateTextLayout("Click on this text Click on this text", this._textFormat, width, height);
            this._textAnalyzer = DirectWriteFactory.CreateTextAnalyzer();
            this._source = new MyTextSource("Click on this text Click on this text");
            using (FontCollection coll = this._textFormat.FontCollection)
            {
                int count = coll.Count;
                for (int index = 0; index < count; ++index)
                {
                    using (FontFamily ff = coll[index])
                    {
                        using (Font font = ff.GetFirstMatchingFont(FontWeight.Normal, FontStretch.Normal, FontStyle.Normal))
                        {
                            LocalizedStrings ls = font.FaceNames;
                            LocalizedStrings desc = font.GetInformationalStrings(InformationalStringId.Designer);

                            int cultureIndex = ls.FindCulture(CultureInfo.CurrentCulture);
                            string faceName = ls[cultureIndex];
                            FontMetrics metrics = font.Metrics;
                        }
                    }
                }
            }
            this._textAnalyzer.AnalyzeLineBreakpoints(_source, 0, (uint)_source.Text.Length);
            this._textAnalyzer.AnalyzeScript(_source, 0, (uint)_source.Text.Length);
        }
Exemplo n.º 5
0
 private void CreateDeviceIndependentResources()
 {
     this._factory      = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);
     this._renderTarget = this._factory.CreateWindowRenderTarget(this);
     OnCreateDeviceIndependentResources(this._factory);
     this._deviceIndependedResourcesCreated = true;
 }
Exemplo n.º 6
0
        public Geometry CreateGeometry(Direct2DFactory factory)
        {
            PathGeometry geometry = factory.CreatePathGeometry();

            //using (GeometrySink sink = geometry.Open())
            //{
            //    sink.BeginFigure(Project(this._points[0]), FigureBegin.Hollow);
            //    for (int index = 1; index < this._points.Length; ++index)
            //    {
            //        sink.AddLine(Project(this._points[index]));
            //    }
            //    sink.EndFigure(FigureEnd.Open);
            //    sink.Close();
            //}
            List <Geometry> list = new List <Geometry>();

            //list.Add(geometry);

            for (int index = 0; index < _points.Length; ++index)
            {
                EllipseGeometry ellipse = factory.CreateEllipseGeometry(new Ellipse(Project(_points[index]), 5, 5));
                list.Add(ellipse);
            }

            GeometryGroup group = factory.CreateGeometryGroup(FillMode.Winding, list.ToArray());

            return(group);
        }
Exemplo n.º 7
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);
            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola", 72);
            this._textFormat.TextAlignment      = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;
            float width  = ClientSize.Width / dpiScaleX;
            float height = ClientSize.Height / dpiScaleY;

            this._textLayout   = DirectWriteFactory.CreateTextLayout("Click on this text Click on this text", this._textFormat, width, height);
            this._textAnalyzer = DirectWriteFactory.CreateTextAnalyzer();
            this._source       = new MyTextSource("Click on this text Click on this text");
            using (FontCollection coll = this._textFormat.FontCollection)
            {
                int count = coll.Count;
                for (int index = 0; index < count; ++index)
                {
                    using (FontFamily ff = coll[index])
                    {
                        using (Font font = ff.GetFirstMatchingFont(FontWeight.Normal, FontStretch.Normal, FontStyle.Normal))
                        {
                            LocalizedStrings ls   = font.FaceNames;
                            LocalizedStrings desc = font.GetInformationalStrings(InformationalStringId.Designer);

                            int         cultureIndex = ls.FindCulture(CultureInfo.CurrentCulture);
                            string      faceName     = ls[cultureIndex];
                            FontMetrics metrics      = font.Metrics;
                        }
                    }
                }
            }
            this._textAnalyzer.AnalyzeLineBreakpoints(_source, 0, (uint)_source.Text.Length);
            this._textAnalyzer.AnalyzeScript(_source, 0, (uint)_source.Text.Length);
        }
Exemplo n.º 8
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);

            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola",
                FontWeight.Normal,
                FontStyle.Normal,
                FontStretch.Normal,
                72);

            this._textFormat.TextAlignment = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;

            float width = ClientSize.Width / _dpiScaleX;
            float height = ClientSize.Height / _dpiScaleY;

            this._textLayout = DirectWriteFactory.CreateTextLayout(
                _text,
                this._textFormat,
                width,
                height);

            this._textLayout.SetFontSize(100, new TextRange(20, 6));
            this._textLayout.SetUnderline(true, new TextRange(20, 11));
            this._textLayout.SetFontWeight(FontWeight.Bold, new TextRange(20, 11));

            using (Typography typography = DirectWriteFactory.CreateTypography())
            {
                typography.AddFontFeature(FontFeatureTag.StylisticSet7, 1);
                this._textLayout.SetTypography(typography, new TextRange(0, _text.Length));
            }
        }
Exemplo n.º 9
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);

            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola",
                                                                   FontWeight.Normal,
                                                                   FontStyle.Normal,
                                                                   FontStretch.Normal,
                                                                   72);

            this._textFormat.TextAlignment      = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;

            float width  = ClientSize.Width / _dpiScaleX;
            float height = ClientSize.Height / _dpiScaleY;

            this._textLayout = DirectWriteFactory.CreateTextLayout(
                _text,
                this._textFormat,
                width,
                height);

            using (Typography typography = DirectWriteFactory.CreateTypography())
            {
                typography.AddFontFeature(FontFeatureTag.StylisticSet7, 1);
                this._textLayout.SetTypography(typography, new TextRange(0, _text.Length));
            }

            Bitmap bitmap = RenderTarget.CreateBitmap(this.GetType(), "heart.png");

            this._bitmapInlineObject = new BitmapInlineObject(RenderTarget, bitmap);

            this._textLayout.SetInlineObject(this._bitmapInlineObject, new TextRange(2, 1));
        }
Exemplo n.º 10
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);

            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola",
                FontWeight.Normal,
                FontStyle.Normal,
                FontStretch.Normal,
                72);

            this._textFormat.TextAlignment = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;

            float width = ClientSize.Width / _dpiScaleX;
            float height = ClientSize.Height / _dpiScaleY;

            this._textLayout = DirectWriteFactory.CreateTextLayout(
                _text,
                this._textFormat,
                width,
                height);

            using (Typography typography = DirectWriteFactory.CreateTypography())
            {
                typography.AddFontFeature(FontFeatureTag.StylisticSet7, 1);
                this._textLayout.SetTypography(typography, new TextRange(0, _text.Length));
            }

            Bitmap bitmap = RenderTarget.CreateBitmap(this.GetType(), "heart.png");

            this._bitmapInlineObject = new BitmapInlineObject(RenderTarget, bitmap);

            this._textLayout.SetInlineObject(this._bitmapInlineObject, new TextRange(2, 1));
        }
Exemplo n.º 11
0
 private void MainWindow_Load(object sender, EventArgs e)
 {
     if (_dxgiDevice != null)
     {
         CleanUp();
     }
     _dxgiDevice = DxgiDevice.CreateDevice();
     _factory    = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);
     using (Device device = _factory.CreateDevice(_dxgiDevice))
     {
         _deviceContext = device.CreateDeviceContext(DeviceContextOptions.None);
         using (DxgiAdapter adapter = _dxgiDevice.GetAdapter())
             using (DxgiFactory factory = adapter.GetFactory())
             {
                 _swapChain = factory.CreateSwapChainForHwnd(_dxgiDevice, Handle);
                 _dxgiDevice.MaximumFrameLatency = 1;
                 _swapChain.GetBuffer(0, out _surface);
                 _bitmap = _deviceContext.CreateBitmapFromDxgiSurface(_surface);
                 _deviceContext.SetTarget(_bitmap);
             }
         for (int index = 0; index < _brushes.Length; ++index)
         {
             _pens[index]    = _deviceContext.CreateSolidColorBrush(GetRandomColor(_random, 1));
             _brushes[index] = _deviceContext.CreateSolidColorBrush(GetRandomColor(_random, 0.25f));
         }
     }
     _directWriteFactory = DirectWriteFactory.Create(DirectWriteFactoryType.Shared);
 }
Exemplo n.º 12
0
 protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
 {
     base.OnCreateDeviceIndependentResources(factory);
     this._textFormat = DirectWriteFactory.CreateTextFormat("Verdana", FontWeight.Bold, FontStyle.Normal, FontStretch.Normal, 10.5f);
     this._textFormat.ParagraphAlignment = ParagraphAlignment.Near;
     this._textFormat.TextAlignment = TextAlignment.Center;
 }
Exemplo n.º 13
0
 private void CleanUpDeviceIndependentResources()
 {
     if (this._deviceIndependedResourcesCreated)
     {
         OnCleanUpDeviceIndependentResources();
     }
     if (this._imagingFactory != null)
     {
         this._imagingFactory.Dispose();
         this._imagingFactory = null;
     }
     if (this._directWriteFactory != null)
     {
         this._directWriteFactory.Dispose();
         this._directWriteFactory = null;
     }
     if (this._renderTarget != null)
     {
         this._renderTarget.Dispose();
         this._renderTarget = null;
     }
     if (this._factory != null)
     {
         this._factory.Dispose();
         this._factory = null;
     }
 }
Exemplo n.º 14
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);

            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola", 72);

            this._textFormat.TextAlignment      = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;

            float width  = ClientSize.Width / _dpiScaleX;
            float height = ClientSize.Height / _dpiScaleY;

            this._textLayout = DirectWriteFactory.CreateTextLayout(
                _text,
                this._textFormat,
                width,
                height);

            this._textLayout.SetFontSize(100, new TextRange(20, 6));
            this._textLayout.SetUnderline(true, new TextRange(20, 11));
            this._textLayout.SetFontWeight(FontWeight.Bold, new TextRange(20, 11));

            using (Typography typography = DirectWriteFactory.CreateTypography())
            {
                typography.AddFontFeature(FontFeatureTag.StylisticSet7, 1);
                this._textLayout.SetTypography(typography, new TextRange(0, _text.Length));
            }
        }
Exemplo n.º 15
0
 protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
 {
     base.OnCreateDeviceIndependentResources(factory);
     this._textFormat = DirectWriteFactory.CreateTextFormat("Verdana", 10.5f, FontWeight.Bold, FontStyle.Normal, FontStretch.Normal);
     this._textFormat.ParagraphAlignment = ParagraphAlignment.Near;
     this._textFormat.TextAlignment      = TextAlignment.Center;
 }
Exemplo n.º 16
0
 public CustomTextRenderer(Direct2DFactory factory, WindowRenderTarget renderTarget, SolidColorBrush outlineBrush, BitmapBrush fillBrush)
 {
     _factory = factory;
     _renderTarget = renderTarget;
     _outlineBrush = outlineBrush;
     _fillBrush = fillBrush;
 }
Exemplo n.º 17
0
 public CustomTextRenderer(Direct2DFactory factory, WindowRenderTarget renderTarget, SolidColorBrush outlineBrush, BitmapBrush fillBrush)
 {
     _factory      = factory;
     _renderTarget = renderTarget;
     _outlineBrush = outlineBrush;
     _fillBrush    = fillBrush;
 }
Exemplo n.º 18
0
 void MainWindow_Load(object sender, EventArgs e)
 {
     this._factory = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);
     StrokeStyleProperties ssp = new StrokeStyleProperties(LineCapStyle.Round, LineCapStyle.Round,
         LineCapStyle.Round, LineJoin.Round, 10, DashStyle.Solid, 0);
     this._strokeStyle = this._factory.CreateStrokeStyle(ssp, null);
     this._renderTarget = this._factory.CreateWindowRenderTarget(this);
     this.Resize += new EventHandler(MainWindow_Resize);
 }
Exemplo n.º 19
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);

            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola", 72);

            this._textFormat.TextAlignment      = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;
        }
Exemplo n.º 20
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);
            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola", 72);
            this._textFormat.TextAlignment      = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;

            System.Globalization.CultureInfo ci = this._textFormat.Culture;
            Trimming trimming = this._textFormat.Trimming;
        }
Exemplo n.º 21
0
        void MainWindow_Load(object sender, EventArgs e)
        {
            this._factory = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);
            StrokeStyleProperties ssp = new StrokeStyleProperties(LineCapStyle.Round, LineCapStyle.Round,
                                                                  LineCapStyle.Round, LineJoin.Round, 10, DashStyle.Solid, 0);

            this._strokeStyle  = this._factory.CreateStrokeStyle(ssp, null);
            this._renderTarget = this._factory.CreateWindowRenderTarget(this);
            this.Resize       += new EventHandler(MainWindow_Resize);
        }
Exemplo n.º 22
0
 protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
 {
     base.OnCreateDeviceIndependentResources(factory);
     this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola", 72);
     this._textFormat.TextAlignment = TextAlignment.Center;
     this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;
     float width = ClientSize.Width / dpiScaleX;
     float height = ClientSize.Height / dpiScaleY;
     this._textLayout = DirectWriteFactory.CreateTextLayout("Click on this text", this._textFormat, width, height);
 }
Exemplo n.º 23
0
        public void Render(RenderTarget target)
        {
            Direct2DFactory factory = target.GetFactory();
            Color           red     = Color.FromRGB(128, 64, 64);
            Color           white   = Color.FromRGB(255, 255, 255);

            foreach (var star in _stars)
            {
                Vector4           location = star.Location;
                Nullable <PointF> locN     = Project(location);
                if (locN != null)
                {
                    location = location * Transform;
                    PointF locV = locN.Value;
                    double r    = Math.Sqrt(location.X * location.X + location.Y * location.Y + (location.Z - PointOfView) * (location.Z - PointOfView));
                    double rv   = Math.Sqrt(locV.X * locV.X + locV.Y * locV.Y + PointOfView * PointOfView);
                    double k    = (rv / r);
                    k = k > 1 ? 1 : (k < 0 ? 0 : k);
                    float radius = (float)(star.Radius * rv / r);
                    if (radius > 0.5f)
                    {
                        if (locV.X > 0 && locV.X < ViewPortSize.Width && locV.Y > 0 && locV.Y < ViewPortSize.Height)
                        {
                            using (EllipseGeometry ellipse = factory.CreateEllipseGeometry(new Ellipse(locV, radius, radius)))
                            {
                                float   hue   = (float)k;
                                Vector4 color = new Vector4((hue + 0.45f) % 1, 1f, 0.5f, 1);
                                Color   rgb   = XMath.ColorHslToRgb(color);
                                Color   w     = white.AdjustBrightness((float)Math.Sqrt(k));
                                rgb = Color.Lerp(w, rgb, (float)k);
                                if (radius > 3)
                                {
                                    Color rgb2 = rgb.AdjustBrightness(0.2f);
                                    using (GradientStopCollection coll = target.CreateGradientStopCollection(new GradientStop[] { new GradientStop(0, rgb), new GradientStop(1, rgb2) }))
                                    {
                                        using (Brush brush = target.CreateRadialGradientBrush(new RadialGradientBrushProperties(locV, new PointF(radius / 22f, -radius / 2f), radius, radius),
                                                                                              new BrushProperties(1, Matrix3x2.Identity), coll))
                                        {
                                            target.FillGeometry(brush, ellipse);
                                        }
                                    }
                                }
                                else
                                {
                                    using (SolidColorBrush brush = target.CreateSolidColorBrush(rgb))
                                    {
                                        target.FillGeometry(brush, ellipse);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 24
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);
            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola", 72);
            this._textFormat.TextAlignment      = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;
            float width  = ClientSize.Width / dpiScaleX;
            float height = ClientSize.Height / dpiScaleY;

            this._textLayout = DirectWriteFactory.CreateTextLayout("Click on this text", this._textFormat, width, height);
        }
Exemplo n.º 25
0
 protected override void OnRender(WindowRenderTarget renderTarget)
 {
     renderTarget.Clear(Color.FromKnown(Colors.Black, 1));
     using (EllipseGeometry geometry = Direct2DFactory.CreateEllipseGeometry(new Graphics.Direct2D.Ellipse(ClientSize.Width / 2, ClientSize.Height / 2, ClientSize.Width / 2 - 25, ClientSize.Height / 2 - 25)))
     {
         using (SolidColorBrush brush = renderTarget.CreateSolidColorBrush(Color.FromKnown(Colors.Red, 1)))
         {
             renderTarget.DrawGeometry(brush, 50, geometry);
         }
     }
 }
Exemplo n.º 26
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);
            this._textFormat = DirectWriteFactory.CreateTextFormat("Verdana", FontWeight.Normal, FontStyle.Normal, FontStretch.Normal, 10.5f);
            this._textFormat.TextAlignment = TextAlignment.Center;

            float[] dashes = new float[] { 1, 1, 2, 3, 5 };
            this._strokeStyle = factory.CreateStrokeStyle(
                new StrokeStyleProperties(LineCapStyle.Flat, LineCapStyle.Flat, LineCapStyle.Round, LineJoin.Round, 10, DashStyle.Custom, 0),
                dashes);
            CreateGeometries(factory);
        }
Exemplo n.º 27
0
 private void CreateDeviceIndependentResources()
 {
     try {
         this._factory      = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);
         this._renderTarget = this._factory.CreateWindowRenderTarget(this);
         OnCreateDeviceIndependentResources(this._factory);
         this._deviceIndependedResourcesCreated = true;
     } catch (Exception ex) {
         Debug.WriteLine(ex.ToString());
         throw;
     }
 }
Exemplo n.º 28
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);
            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola",
                FontWeight.Normal,
                FontStyle.Normal,
                FontStretch.Normal,
                72);
            this._textFormat.TextAlignment = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;

            System.Globalization.CultureInfo ci = this._textFormat.Culture;
            Trimming trimming = this._textFormat.Trimming;
        }
Exemplo n.º 29
0
 protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
 {
     base.OnCreateDeviceIndependentResources(factory);
     this._pathGeometry = factory.CreatePathGeometry();
     using (GeometrySink sink = this._pathGeometry.Open())
     {
         sink.SetFillMode(FillMode.Winding);
         sink.BeginFigure(new PointF(20, 50), FigureBegin.Filled);
         sink.AddLine(new PointF(130, 50));
         sink.AddLine(new PointF(20, 130));
         sink.AddLine(new PointF(80, 0));
         sink.AddLine(new PointF(130, 130));
         sink.EndFigure(FigureEnd.Closed);
         sink.Close();
     }
 }
Exemplo n.º 30
0
 protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
 {
     base.OnCreateDeviceIndependentResources(factory);
     this._pathGeometry = factory.CreatePathGeometry();
     using (GeometrySink sink = this._pathGeometry.Open())
     {
         sink.SetFillMode(FillMode.Winding);
         sink.BeginFigure(new PointF(20, 50), FigureBegin.Filled);
         sink.AddLine(new PointF(130, 50));
         sink.AddLine(new PointF(20, 130));
         sink.AddLine(new PointF(80, 0));
         sink.AddLine(new PointF(130, 130));
         sink.EndFigure(FigureEnd.Closed);
         sink.Close();
     }
 }
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);

            this._redColorDrawingEffect   = new ColorDrawingEffect(Color.FromARGB(Colors.Red, 1));
            this._greenColorDrawingEffect = new ColorDrawingEffect(Color.FromARGB(Colors.Green, 1));
            this._blueColorDrawingEffect  = new ColorDrawingEffect(Color.FromARGB(Colors.Blue, 1));

            this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola",
                                                                   FontWeight.Normal,
                                                                   FontStyle.Normal,
                                                                   FontStretch.Normal,
                                                                   72);

            this._textFormat.TextAlignment      = TextAlignment.Center;
            this._textFormat.ParagraphAlignment = ParagraphAlignment.Center;

            float width  = ClientSize.Width / _dpiScaleX;
            float height = ClientSize.Height / _dpiScaleY;

            this._textLayout = DirectWriteFactory.CreateTextLayout(
                _text,
                this._textFormat,
                width,
                height);

            this._textLayout.SetFontSize(100, new TextRange(20, 6));

            this._textLayout.SetDrawingEffect(_blueColorDrawingEffect, new TextRange(6, 5));
            this._textLayout.SetDrawingEffect(_redColorDrawingEffect, new TextRange(20, 6));
            this._textLayout.SetDrawingEffect(_greenColorDrawingEffect, new TextRange(26, 5));

            ClientDrawingEffect effect = this._textLayout.GetDrawingEffect(7);

            this._textLayout.SetUnderline(true, new TextRange(20, 11));
            this._textLayout.SetFontWeight(FontWeight.Bold, new TextRange(20, 11));

            using (Typography typography = DirectWriteFactory.CreateTypography())
            {
                typography.AddFontFeature(FontFeatureTag.StylisticSet7, 1);
                this._textLayout.SetTypography(typography, new TextRange(0, _text.Length));
            }
        }
Exemplo n.º 32
0
 private void CleanUpDeviceIndependentResourcesInternal()
 {
     OnCleanUpDeviceIndependentResources();
     if (_imagingFactory != null)
     {
         _imagingFactory.Dispose();
         _imagingFactory = null;
     }
     if (_directWriteFactory != null)
     {
         _directWriteFactory.Dispose();
         _directWriteFactory = null;
     }
     if (_factory != null)
     {
         _factory.Dispose();
         _factory = null;
     }
     _resourcesCreated = false;
 }
Exemplo n.º 33
0
        public Geometry CreateGeometry(Direct2DFactory factory)
        {
            PathGeometry geometry = factory.CreatePathGeometry();

            using (GeometrySink sink = geometry.Open())
            {
                sink.BeginFigure(_points[0], FigureBegin.Hollow);
                sink.AddLines(_points);
                sink.EndFigure(FigureEnd.Open);
                sink.Close();
            }
            Geometry[] list = new Geometry[_points.Length + 1];
            list[0] = geometry;

            for (int index = 0; index < _points.Length; ++index)
            {
                list[index + 1] = factory.CreateEllipseGeometry(new Ellipse(_points[index], 5, 5));
            }
            GeometryGroup group = factory.CreateGeometryGroup(FillMode.Winding, list);

            return(group);
        }
Exemplo n.º 34
0
        private void CreateGeometries(Direct2DFactory factory)
        {
            Ellipse circle1 = new Ellipse(75, 75, 50, 50);

            this._circleGeometry1 = factory.CreateEllipseGeometry(circle1);

            Ellipse circle2 = new Ellipse(125, 75, 50, 50);

            this._circleGeometry2 = factory.CreateEllipseGeometry(circle2);
            // Union
            this._geometryUnion = factory.CreatePathGeometry();
            using (GeometrySink sink = this._geometryUnion.Open())
            {
                this._circleGeometry1.CombineWithGeometry(this._circleGeometry2, CombineMode.Union, Matrix3x2.Identity, 0.25f, sink);
                sink.Close();
            }
            // Intersect
            this._geometryIntersect = factory.CreatePathGeometry();
            using (GeometrySink sink = this._geometryIntersect.Open())
            {
                this._circleGeometry1.CombineWithGeometry(this._circleGeometry2, CombineMode.Intersect, Matrix3x2.Identity, 0.25f, sink);
                sink.Close();
            }
            // Xor
            this._geometryXor = factory.CreatePathGeometry();
            using (GeometrySink sink = this._geometryXor.Open())
            {
                this._circleGeometry1.CombineWithGeometry(this._circleGeometry2, CombineMode.Xor, Matrix3x2.Identity, 0.25f, sink);
                sink.Close();
            }
            // Exclude
            this._geometryExclude = factory.CreatePathGeometry();
            using (GeometrySink sink = this._geometryExclude.Open())
            {
                this._circleGeometry1.CombineWithGeometry(this._circleGeometry2, CombineMode.Exclude, Matrix3x2.Identity, 0.25f, sink);
                sink.Close();
            }
        }
Exemplo n.º 35
0
        public Geometry CreateGeometry(Direct2DFactory factory)
        {
            PathGeometry geometry = factory.CreatePathGeometry();

            using (GeometrySink sink = geometry.Open())
            {
                sink.BeginFigure(this._points[0], FigureBegin.Hollow);
                for (int index = 1; index < this._points.Length; ++index)
                {
                    sink.AddLine(this._points[index]);
                }
                sink.EndFigure(FigureEnd.Open);
                sink.Close();
            }
            return(geometry);
            //List<Geometry> list = new List<Geometry>();
            //for (int index = 0; index < this.Count; ++index)
            //{
            //    EllipseGeometry ellipse = factory.CreateEllipseGeometry(new Ellipse(this[index], 5, 5));
            //    list.Add(ellipse);
            //}
            //return factory.CreateGeometryGroup(FillMode.Winding, list.ToArray());
        }
Exemplo n.º 36
0
 private void MainWindow_Load(object sender, EventArgs e)
 {
     if (_dxgiDevice != null)
     {
         CleanUp();
     }
     _dxgiDevice = DxgiDevice.CreateDevice();
     _factory    = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);
     using (Device device = _factory.CreateDevice(_dxgiDevice))
     {
         _deviceContext = device.CreateDeviceContext(DeviceContextOptions.None);
         using (DxgiAdapter adapter = _dxgiDevice.GetAdapter())
             using (DxgiFactory factory = adapter.GetFactory())
             {
                 _swapChain = factory.CreateSwapChainForHwnd(_dxgiDevice, Handle);
                 _dxgiDevice.MaximumFrameLatency = 1;
                 _swapChain.GetBuffer(0, out _surface);
                 _bitmap = _deviceContext.CreateBitmapFromDxgiSurface(_surface);
                 _deviceContext.SetTarget(_bitmap);
                 _brush = _deviceContext.CreateSolidColorBrush(Color.FromKnown(Colors.Black, 0.4f));
             }
     }
     uint value = _deviceContext.MaximumBitmapSize;
 }
 private void CreateDeviceIndependentResources()
 {
     try {
         this._factory = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);
         this._renderTarget = this._factory.CreateWindowRenderTarget(this);
         OnCreateDeviceIndependentResources(this._factory);
         this._deviceIndependedResourcesCreated = true;
     } catch (Exception ex) {
         Debug.WriteLine(ex.ToString());
         throw;
     }
 }
Exemplo n.º 38
0
 protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
 {
     base.OnCreateDeviceIndependentResources(factory);
 }
Exemplo n.º 39
0
        void MainWindow_Load(object sender, EventArgs e)
        {
            DirectWriteFactory f = DirectWriteFactory.Create(DirectWriteFactoryType.Shared);
            _textFormat = f.CreateTextFormat("Verdana", null, FontWeight.Normal, FontStyle.Normal, FontStretch.Normal, 110, null);
            _textFormat.ParagraphAlignment = ParagraphAlignment.Far;
            _textFormat.TextAlignment = TextAlignment.Center;

            this.ClientSize = new System.Drawing.Size(600, 600);
            this._factory = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);

            this._renderTarget = this._factory.CreateWindowRenderTarget(this, PresentOptions.None, RenderTargetProperties.Default);
            AntialiasMode amode = this._renderTarget.AntialiasMode;
            TextAntialiasMode tamode = this._renderTarget.TextAntialiasMode;
            this._strokeBrush = this._renderTarget.CreateSolidColorBrush(Color.FromARGB(Colors.Cyan, 1));
            this._strokeStyle = this._factory.CreateStrokeStyle(new StrokeStyleProperties(LineCapStyle.Flat,
                LineCapStyle.Flat, LineCapStyle.Round, LineJoin.Miter, 10, DashStyle.Dot, 0), null);

            this.Resize += new EventHandler(MainWindow_Resize);
        }
Exemplo n.º 40
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);
            this._leftMountainGeometry = factory.CreatePathGeometry();
            using (GeometrySink sink = this._leftMountainGeometry.Open())
            {
                sink.SetFillMode(FillMode.Winding);
                sink.BeginFigure(new PointF(346, 255), FigureBegin.Filled);
                sink.AddLines(
                    new PointF[] {
                        new PointF(267, 177),
                        new PointF(236, 192),
                        new PointF(212, 160),
                        new PointF(156, 255),
                        new PointF(346, 255)
                    });
                sink.EndFigure(FigureEnd.Closed);
                sink.Close();
            }

            this._rightMountainGeometry = factory.CreatePathGeometry();
            using (GeometrySink sink = this._rightMountainGeometry.Open())
            {
                sink.SetFillMode(FillMode.Winding);
                sink.BeginFigure(new PointF(575, 263), FigureBegin.Filled);
                sink.AddLines(
                    new PointF[] {
                        new PointF(481, 146),
                        new PointF(449, 181),
                        new PointF(433, 159),
                        new PointF(401, 214),
                        new PointF(381, 199),
                        new PointF(323, 263),
                        new PointF(575, 263)
                    });
                sink.EndFigure(FigureEnd.Closed);
                sink.Close();
            }

            this._sunGeometry = factory.CreatePathGeometry();
            using (GeometrySink sink = this._sunGeometry.Open())
            {
                sink.SetFillMode(FillMode.Winding);
                sink.BeginFigure(new PointF(270, 255), FigureBegin.Filled);
                sink.AddArc(
                    new ArcSegment(
                        new PointF(440, 255), // end point
                        new SizeF(85, 85),
                        0.0f, // rotation angle
                        SweepDirection.Clockwise,
                        ArcSize.Small));

                sink.EndFigure(FigureEnd.Closed);

                sink.BeginFigure(new PointF(299, 182), FigureBegin.Hollow);
                sink.AddBezier(
                    new BezierSegment(
                       new PointF(299, 182),
                       new PointF(294, 176),
                       new PointF(285, 178)
                       ));
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(276, 179),
                       new PointF(272, 173),
                       new PointF(272, 173)
                       ));
                sink.EndFigure(FigureEnd.Open);

                sink.BeginFigure(
                    new PointF(354, 156),
                    FigureBegin.Hollow
                    );
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(354, 156),
                       new PointF(358, 149),
                       new PointF(354, 142)
                       ));
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(349, 134),
                       new PointF(354, 127),
                       new PointF(354, 127)
                       ));
                sink.EndFigure(FigureEnd.Open);

                sink.BeginFigure(
                    new PointF(322, 164),
                    FigureBegin.Hollow
                    );

                sink.AddBezier(
                   new BezierSegment(
                       new PointF(322, 164),
                       new PointF(322, 156),
                       new PointF(314, 152)
                       ));
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(306, 149),
                       new PointF(305, 141),
                       new PointF(305, 141)
                       ));
                sink.EndFigure(FigureEnd.Open);

                sink.BeginFigure(
                    new PointF(385, 164),
                    FigureBegin.Hollow
                    );
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(385, 164),
                       new PointF(392, 161),
                       new PointF(394, 152)
                       ));
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(395, 144),
                       new PointF(402, 141),
                       new PointF(402, 142)
                       ));
                sink.EndFigure(FigureEnd.Open);

                sink.BeginFigure(
                    new PointF(408, 182),
                    FigureBegin.Hollow
                    );
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(408, 182),
                       new PointF(416, 184),
                       new PointF(422, 178)
                       ));
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(428, 171),
                       new PointF(435, 173),
                       new PointF(435, 173)
                       ));
                sink.EndFigure(FigureEnd.Open);
                sink.Close();
            }
            this._riverGeometry = factory.CreatePathGeometry();
            using (GeometrySink sink = this._riverGeometry.Open())
            {
                sink.SetFillMode(FillMode.Winding);
                sink.BeginFigure(
                    new PointF(183, 392),
                    FigureBegin.Filled
                    );
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(238, 284),
                       new PointF(472, 345),
                       new PointF(356, 303)
                       ));
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(237, 261),
                       new PointF(333, 256),
                       new PointF(333, 256)
                       ));
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(335, 257),
                       new PointF(241, 261),
                       new PointF(411, 306)
                       ));
                sink.AddBezier(
                   new BezierSegment(
                       new PointF(574, 350),
                       new PointF(288, 324),
                       new PointF(296, 392)
                       ));
                sink.EndFigure(FigureEnd.Open);
                sink.Close();
            }
        }
Exemplo n.º 41
0
 protected virtual void OnCreateDeviceIndependentResources(Direct2DFactory factory)
 {
 }
Exemplo n.º 42
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);
            this._textFormat = DirectWriteFactory.CreateTextFormat("Verdana", FontWeight.Normal, FontStyle.Normal, FontStretch.Normal, 10.5f);
            this._textFormat.TextAlignment = TextAlignment.Center;

            float[] dashes = new float[] { 1, 1, 2, 3, 5 };
            this._strokeStyle = factory.CreateStrokeStyle(
                new StrokeStyleProperties(LineCapStyle.Flat, LineCapStyle.Flat, LineCapStyle.Round, LineJoin.Round, 10, DashStyle.Custom, 0),
                dashes);
            CreateGeometries(factory);
        }
Exemplo n.º 43
0
 private void CreateDeviceIndependentResources()
 {
     this._factory = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);
     this._renderTarget = this._factory.CreateWindowRenderTarget(this);
     OnCreateDeviceIndependentResources(this._factory);
     this._deviceIndependedResourcesCreated = true;
 }
        void MainWindow_Load(object sender, EventArgs e)
        {
            _factory = Direct2DFactory.CreateFactory(FactoryType.SingleThreaded, DebugLevel.None);
            _renderTarget = _factory.CreateWindowRenderTarget(pictArea);
            Resize += MainWindow_Resize;

            _frameTimer.Tick += (_, __) => Redraw();
        }
Exemplo n.º 45
0
        private void CreateGeometries(Direct2DFactory factory)
        {
            Ellipse circle1 = new Ellipse(75, 75, 50, 50);
            this._circleGeometry1 = factory.CreateEllipseGeometry(circle1);

            Ellipse circle2 = new Ellipse(125, 75, 50, 50);
            this._circleGeometry2 = factory.CreateEllipseGeometry(circle2);
            // Union
            this._geometryUnion = factory.CreatePathGeometry();
            using (GeometrySink sink = this._geometryUnion.Open())
            {
                this._circleGeometry1.CombineWithGeometry(this._circleGeometry2, CombineMode.Union, Matrix3x2.Identity, 0.25f, sink);
                sink.Close();
            }
            // Intersect
            this._geometryIntersect = factory.CreatePathGeometry();
            using (GeometrySink sink = this._geometryIntersect.Open())
            {
                this._circleGeometry1.CombineWithGeometry(this._circleGeometry2, CombineMode.Intersect, Matrix3x2.Identity, 0.25f, sink);
                sink.Close();
            }
            // Xor
            this._geometryXor = factory.CreatePathGeometry();
            using (GeometrySink sink = this._geometryXor.Open())
            {
                this._circleGeometry1.CombineWithGeometry(this._circleGeometry2, CombineMode.Xor, Matrix3x2.Identity, 0.25f, sink);
                sink.Close();
            }
            // Exclude
            this._geometryExclude = factory.CreatePathGeometry();
            using (GeometrySink sink = this._geometryExclude.Open())
            {
                this._circleGeometry1.CombineWithGeometry(this._circleGeometry2, CombineMode.Exclude, Matrix3x2.Identity, 0.25f, sink);
                sink.Close();
            }
        }
Exemplo n.º 46
0
 protected virtual void OnCreateDeviceIndependentResources(Direct2DFactory factory)
 {
 }
Exemplo n.º 47
0
 private void CleanUpDeviceIndependentResources()
 {
     if(this._deviceIndependedResourcesCreated)
         OnCleanUpDeviceIndependentResources();
     if (this._imagingFactory != null)
     {
         this._imagingFactory.Dispose();
         this._imagingFactory = null;
     }
     if (this._directWriteFactory != null)
     {
         this._directWriteFactory.Dispose();
         this._directWriteFactory = null;
     }
     if (this._renderTarget != null)
     {
         this._renderTarget.Dispose();
         this._renderTarget = null;
     }
     if (this._factory != null)
     {
         this._factory.Dispose();
         this._factory = null;
     }
 }
 protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
 {
     base.OnCreateDeviceIndependentResources(factory);
 }
Exemplo n.º 49
0
        protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory)
        {
            base.OnCreateDeviceIndependentResources(factory);
            this._leftMountainGeometry = factory.CreatePathGeometry();
            using (GeometrySink sink = this._leftMountainGeometry.Open())
            {
                sink.SetFillMode(FillMode.Winding);
                sink.BeginFigure(new PointF(346, 255), FigureBegin.Filled);
                sink.AddLines(
                    new PointF[] {
                    new PointF(267, 177),
                    new PointF(236, 192),
                    new PointF(212, 160),
                    new PointF(156, 255),
                    new PointF(346, 255)
                });
                sink.EndFigure(FigureEnd.Closed);
                sink.Close();
            }

            this._rightMountainGeometry = factory.CreatePathGeometry();
            using (GeometrySink sink = this._rightMountainGeometry.Open())
            {
                sink.SetFillMode(FillMode.Winding);
                sink.BeginFigure(new PointF(575, 263), FigureBegin.Filled);
                sink.AddLines(
                    new PointF[] {
                    new PointF(481, 146),
                    new PointF(449, 181),
                    new PointF(433, 159),
                    new PointF(401, 214),
                    new PointF(381, 199),
                    new PointF(323, 263),
                    new PointF(575, 263)
                });
                sink.EndFigure(FigureEnd.Closed);
                sink.Close();
            }

            this._sunGeometry = factory.CreatePathGeometry();
            using (GeometrySink sink = this._sunGeometry.Open())
            {
                sink.SetFillMode(FillMode.Winding);
                sink.BeginFigure(new PointF(270, 255), FigureBegin.Filled);
                sink.AddArc(
                    new ArcSegment(
                        new PointF(440, 255), // end point
                        new SizeF(85, 85),
                        0.0f,                 // rotation angle
                        SweepDirection.Clockwise,
                        ArcSize.Small));

                sink.EndFigure(FigureEnd.Closed);

                sink.BeginFigure(new PointF(299, 182), FigureBegin.Hollow);
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(299, 182),
                        new PointF(294, 176),
                        new PointF(285, 178)
                        ));
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(276, 179),
                        new PointF(272, 173),
                        new PointF(272, 173)
                        ));
                sink.EndFigure(FigureEnd.Open);

                sink.BeginFigure(
                    new PointF(354, 156),
                    FigureBegin.Hollow
                    );
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(354, 156),
                        new PointF(358, 149),
                        new PointF(354, 142)
                        ));
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(349, 134),
                        new PointF(354, 127),
                        new PointF(354, 127)
                        ));
                sink.EndFigure(FigureEnd.Open);

                sink.BeginFigure(
                    new PointF(322, 164),
                    FigureBegin.Hollow
                    );

                sink.AddBezier(
                    new BezierSegment(
                        new PointF(322, 164),
                        new PointF(322, 156),
                        new PointF(314, 152)
                        ));
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(306, 149),
                        new PointF(305, 141),
                        new PointF(305, 141)
                        ));
                sink.EndFigure(FigureEnd.Open);

                sink.BeginFigure(
                    new PointF(385, 164),
                    FigureBegin.Hollow
                    );
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(385, 164),
                        new PointF(392, 161),
                        new PointF(394, 152)
                        ));
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(395, 144),
                        new PointF(402, 141),
                        new PointF(402, 142)
                        ));
                sink.EndFigure(FigureEnd.Open);

                sink.BeginFigure(
                    new PointF(408, 182),
                    FigureBegin.Hollow
                    );
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(408, 182),
                        new PointF(416, 184),
                        new PointF(422, 178)
                        ));
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(428, 171),
                        new PointF(435, 173),
                        new PointF(435, 173)
                        ));
                sink.EndFigure(FigureEnd.Open);
                sink.Close();
            }
            this._riverGeometry = factory.CreatePathGeometry();
            using (GeometrySink sink = this._riverGeometry.Open())
            {
                sink.SetFillMode(FillMode.Winding);
                sink.BeginFigure(
                    new PointF(183, 392),
                    FigureBegin.Filled
                    );
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(238, 284),
                        new PointF(472, 345),
                        new PointF(356, 303)
                        ));
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(237, 261),
                        new PointF(333, 256),
                        new PointF(333, 256)
                        ));
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(335, 257),
                        new PointF(241, 261),
                        new PointF(411, 306)
                        ));
                sink.AddBezier(
                    new BezierSegment(
                        new PointF(574, 350),
                        new PointF(288, 324),
                        new PointF(296, 392)
                        ));
                sink.EndFigure(FigureEnd.Open);
                sink.Close();
            }
        }
 public CustomTextRendererWithEffects(Direct2DFactory factory, WindowRenderTarget renderTarget, SolidColorBrush defaultBrush)
 {
     _factory = factory;
     _renderTarget = renderTarget;
     _defaultBrush = defaultBrush;
 }