예제 #1
0
        public void FillRectangle(float x, float y, float width, float height, Colour colour)
        {
            var renderTarget = renderTargetProvider.RenderTarget;

            if (renderTarget != null && !renderTarget.IsDisposed)
            {
                var brush = colourFactory.CreateSolidColourBrush(colour);
                renderTarget.FillRectangle(new RectangleF(x, y, width, height), brush);
            }
        }
예제 #2
0
        public void Draw(string text, float x, float y, float maximumWidth, float maximumHeight,
                         string fontFamily, float fontSize, Colour colour)
        {
            var renderTarget = renderTargetProvider.RenderTarget;

            if (renderTarget != null && !renderTarget.IsDisposed)
            {
                var textFormat = textFormatFactory.CreateTextFormat(fontFamily, fontSize);
                var textLayout = textLayoutFactory.CreateTextLayout(textFormat, text, maximumWidth, maximumHeight);
                var brush      = colourFactory.CreateSolidColourBrush(colour);

                if (textFormat != null && textLayout != null && brush != null)
                {
                    renderTarget.DrawText(text, textFormat, new RectangleF(x, y, maximumWidth, maximumHeight), brush);
                }
            }
        }