Exemplo n.º 1
0
        protected virtual void ApplyBoundingRectInternal(ICanvas canvas,
                                                         Vector2f minPosition, Vector2f maxPosition)
        {
            Rectf rect = new Rectf(minPosition, maxPosition);

            this.shape   = rect;
            this.outline = rect;
        }
Exemplo n.º 2
0
        public static void RenderBorderAndArea(ICanvas canvas, IShapef shape, IPathf border,
                                               Area.AreaStyle style, Area.AreaStyle nextStyle, float alpha)
        {
            // We first fill background.
            {
                // We create background fill.
                ITransform mappingTransform;
                IMapper    mapper;
                IFill      fill = BackgroundStyle.Merge(style != null ? style.Background : null,
                                                        nextStyle != null ? nextStyle.Background : null, alpha,
                                                        out mappingTransform, out mapper);

                if (fill != null)
                {
                    if (mappingTransform != null)
                    {
                        canvas.TextureTransform = mappingTransform;
                    }

                    // We fill shape
                    canvas.FillShape(fill, shape, mapper);

                    // Must reset.
                    if (mappingTransform != null)
                    {
                        canvas.TextureTransform = null;
                    }
                }
            }

            // Now we add border over it.

            {
                ITransform transform;
                IMapper    mapper;
                Pen        pen = BorderStyle.Merge(style != null ? style.Border : null,
                                                   nextStyle != null ? nextStyle.Border : null, alpha, out transform, out mapper);

                if (pen != null && pen.Fill != null)
                {
                    if (transform != null)
                    {
                        canvas.TextureTransform = transform;
                    }

                    canvas.DrawShape(pen, border, mapper);

                    if (transform != null)
                    {
                        canvas.TextureTransform = null;
                    }
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Pen with path initialization.
 /// </summary>
 /// <param name="pen"></param>
 /// <param name="mesh"></param>
 /// <param name="mapper"></param>
 public IconData([NotNull] Pen pen, [NotNull] IPathf path, IMapper mapper)
 {
     this.pen    = pen;
     this.path   = path;
     this.mapper = mapper;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Icon data with fill and mesh.
 /// </summary>
 /// <param name="fill"></param>
 /// <param name="mesh"></param>
 public IconData([NotNull] Pen pen, [NotNull] IPathf path)
     : this(pen, path, null)
 {
 }