public void DrawText(IBrush foreground, Point origin, IFormattedTextImpl text)
 {
     using (var paint = CreatePaint(foreground, text.Measure()))
     {
         var textImpl = (FormattedTextImpl)text;
         textImpl.Draw(this, Canvas, origin.ToSKPoint(), paint);
     }
 }
Exemple #2
0
 /// <inheritdoc />
 public void DrawText(IBrush foreground, Point origin, IFormattedTextImpl text)
 {
     using (var paint = CreatePaint(foreground, text.Bounds.Size))
     {
         var textImpl = (FormattedTextImpl)text;
         textImpl.Draw(this, Canvas, origin.ToSKPoint(), paint, _canTextUseLcdRendering);
     }
 }
Exemple #3
0
 public ArcRender(Rect bounds,
                  IFormattedTextImpl textImpl,
                  int stroke_w, float angle1,
                  float angle2,
                  Color strokeColor) : base(bounds, textImpl)
 {
     stroke      = stroke_w;
     StrokeColor = strokeColor;
     _angle1     = angle1;
     _angle2     = angle2;
 }
Exemple #4
0
        /// <summary>
        /// Draws text.
        /// </summary>
        /// <param name="foreground">The foreground brush.</param>
        /// <param name="origin">The upper-left corner of the text.</param>
        /// <param name="text">The text.</param>
        public void DrawText(IBrush foreground, Point origin, IFormattedTextImpl text)
        {
            var layout = ((FormattedTextImpl)text).Layout;

            _context.MoveTo(origin.X, origin.Y);

            using (var b = SetBrush(foreground, new Size(0, 0)))
            {
                Pango.CairoHelper.ShowLayout(_context, layout);
            }
        }
        /// <inheritdoc/>
        public void DrawText(IBrush foreground, Point origin, IFormattedTextImpl text)
        {
            var next = NextDrawAs <TextNode>();

            if (next == null || !next.Item.Equals(Transform, foreground, origin, text))
            {
                Add(new TextNode(Transform, foreground, origin, text, CreateChildScene(foreground)));
            }
            else
            {
                ++_drawOperationindex;
            }
        }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextNode"/> class.
 /// </summary>
 /// <param name="transform">The transform.</param>
 /// <param name="foreground">The foreground brush.</param>
 /// <param name="origin">The draw origin.</param>
 /// <param name="text">The text to draw.</param>
 /// <param name="childScenes">Child scenes for drawing visual brushes.</param>
 public TextNode(
     Matrix transform,
     IBrush foreground,
     Point origin,
     IFormattedTextImpl text,
     IDictionary <IVisual, Scene> childScenes = null)
 {
     Bounds      = new Rect(origin, text.Size).TransformToAABB(transform);
     Transform   = transform;
     Foreground  = foreground?.ToImmutable();
     Origin      = origin;
     Text        = text;
     ChildScenes = childScenes;
 }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextNode"/> class.
 /// </summary>
 /// <param name="transform">The transform.</param>
 /// <param name="foreground">The foreground brush.</param>
 /// <param name="origin">The draw origin.</param>
 /// <param name="text">The text to draw.</param>
 /// <param name="childScenes">Child scenes for drawing visual brushes.</param>
 public TextNode(
     Matrix transform,
     IBrush foreground,
     Point origin,
     IFormattedTextImpl text,
     IDictionary <IVisual, Scene> childScenes = null)
     : base(text.Bounds.Translate(origin), transform, null)
 {
     Transform   = transform;
     Foreground  = foreground?.ToImmutable();
     Origin      = origin;
     Text        = text;
     ChildScenes = childScenes;
 }
        /// <summary>
        /// Draws text.
        /// </summary>
        /// <param name="foreground">The foreground brush.</param>
        /// <param name="origin">The upper-left corner of the text.</param>
        /// <param name="text">The text.</param>
        public void DrawText(IBrush foreground, Point origin, IFormattedTextImpl text)
        {
            if (!string.IsNullOrEmpty(text.Text))
            {
                var impl = (FormattedTextImpl)text;

                using (var brush = CreateBrush(foreground, impl.Bounds.Size))
                    using (var renderer = new AvaloniaTextRenderer(this, _deviceContext, brush.PlatformBrush))
                    {
                        if (brush.PlatformBrush != null)
                        {
                            impl.TextLayout.Draw(renderer, (float)origin.X, (float)origin.Y);
                        }
                    }
            }
        }
 public TestServices With(
     IAssetLoader assetLoader                      = null,
     IFocusManager focusManager                    = null,
     IInputManager inputManager                    = null,
     Func <IKeyboardDevice> keyboardDevice         = null,
     IKeyboardNavigationHandler keyboardNavigation = null,
     ILayoutManager layoutManager                  = null,
     Func <IMouseDevice> mouseDevice               = null,
     IRuntimePlatform platform                     = null,
     IPlatformRenderInterface renderInterface      = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     ICursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null,
     PlatformHotkeyConfiguration platformHotkeyConfiguration = null,
     IFontManagerImpl fontManagerImpl     = null,
     IFormattedTextImpl formattedTextImpl = null)
 {
     return(new TestServices(
                assetLoader: assetLoader ?? AssetLoader,
                focusManager: focusManager ?? FocusManager,
                inputManager: inputManager ?? InputManager,
                keyboardDevice: keyboardDevice ?? KeyboardDevice,
                keyboardNavigation: keyboardNavigation ?? KeyboardNavigation,
                layoutManager: layoutManager ?? LayoutManager,
                mouseDevice: mouseDevice ?? MouseDevice,
                platform: platform ?? Platform,
                renderInterface: renderInterface ?? RenderInterface,
                scheduler: scheduler ?? Scheduler,
                standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
                styler: styler ?? Styler,
                theme: theme ?? Theme,
                threadingInterface: threadingInterface ?? ThreadingInterface,
                windowingPlatform: windowingPlatform ?? WindowingPlatform,
                windowImpl: windowImpl ?? WindowImpl,
                platformHotkeyConfiguration: platformHotkeyConfiguration ?? PlatformHotkeyConfiguration,
                fontManagerImpl: fontManagerImpl ?? FontManagerImpl,
                formattedTextImpl: formattedTextImpl ?? FormattedTextImpl));
 }
 public TestServices(
     IAssetLoader assetLoader                      = null,
     IFocusManager focusManager                    = null,
     IInputManager inputManager                    = null,
     Func <IKeyboardDevice> keyboardDevice         = null,
     IKeyboardNavigationHandler keyboardNavigation = null,
     ILayoutManager layoutManager                  = null,
     Func <IMouseDevice> mouseDevice               = null,
     IRuntimePlatform platform                     = null,
     IPlatformRenderInterface renderInterface      = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     ICursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null,
     PlatformHotkeyConfiguration platformHotkeyConfiguration = null,
     IFontManagerImpl fontManagerImpl     = null,
     IFormattedTextImpl formattedTextImpl = null)
 {
     AssetLoader           = assetLoader;
     FocusManager          = focusManager;
     InputManager          = inputManager;
     KeyboardDevice        = keyboardDevice;
     KeyboardNavigation    = keyboardNavigation;
     LayoutManager         = layoutManager;
     MouseDevice           = mouseDevice;
     Platform              = platform;
     RenderInterface       = renderInterface;
     Scheduler             = scheduler;
     StandardCursorFactory = standardCursorFactory;
     Styler                      = styler;
     Theme                       = theme;
     ThreadingInterface          = threadingInterface;
     WindowImpl                  = windowImpl;
     WindowingPlatform           = windowingPlatform;
     PlatformHotkeyConfiguration = platformHotkeyConfiguration;
     FontManagerImpl             = fontManagerImpl;
     FormattedTextImpl           = formattedTextImpl;
 }
Exemple #11
0
 public DrawOperationBase(Rect bounds, IFormattedTextImpl noSkia)
 {
     Bounds = bounds;
     NoSkia = noSkia;
 }
Exemple #12
0
 public TriangleWheelRender(Rect bounds, Color hue, IFormattedTextImpl noSkia) : base(bounds, noSkia)
 {
     Hue = hue;
 }
Exemple #13
0
 public ColorSquareRender(Rect bounds, IFormattedTextImpl noSkia, Color hueColor, Color strokeColor, int strokeWidth = 10) : base(bounds, noSkia)
 {
     HueColor    = hueColor;
     StrokeColor = strokeColor;
     StrokeWidth = strokeWidth;
 }
Exemple #14
0
 public ColorWheelRender(Rect bounds, IFormattedTextImpl noSkia, float strokeWidth = 20) : base(bounds, noSkia)
 {
     StrokeWidth = strokeWidth;
 }
 public void DrawText(IBrush foreground, Point origin, IFormattedTextImpl text)
 {
 }
Exemple #16
0
 public ColorHSVWheelRender(Rect bounds, IFormattedTextImpl noSKia, float strokeWidth, Color stroke) : base(bounds, noSKia)
 {
     Stroke      = stroke;
     StrokeWidth = strokeWidth;
 }
Exemple #17
0
 public BlurImageRender(MemoryStream data, Rect src, Rect dest, float levelX, float levelY, IFormattedTextImpl noSkia) : base(src, noSkia)
 {
     _data   = data;
     _levelx = levelX;
     _levely = levelY;
     _dest   = dest;
 }