Ejemplo n.º 1
0
        // -----

        private void DrawBackgroundScaled(UIntPtr hdc, Utf8Str image, background_repeat repeat, ref web_color color, ref position pos, ref border_radiuses borderRadiuses, ref position borderBox, bool isRoot)
        {
            pos.Scale(ScaleFactor);
            borderRadiuses.Scale(ScaleFactor);
            borderBox.Scale(ScaleFactor);
            DrawBackground(hdc, Utf8Util.Utf8PtrToString(image), repeat, ref color, ref pos, ref borderRadiuses, ref borderBox, isRoot);
        }
Ejemplo n.º 2
0
        protected override void DrawBackground(UIntPtr hdc, string image, background_repeat repeat, ref web_color color, ref position pos, ref border_radiuses br, ref position borderBox, bool isRoot)
        {
            var cgColor = color.ToCGColor();
            var rect    = pos.ToRect();

            if (string.IsNullOrEmpty(image))
            {
                CGPath path = new CGPath();
                path.MoveToPoint(rect.Left + br.top_left_x, rect.Top);
                path.AddLineToPoint(rect.Right - br.top_right_x, rect.Top);
                path.AddQuadCurveToPoint(rect.Right, rect.Top, rect.Right, rect.Top + br.top_right_y);
                path.AddLineToPoint(rect.Right, rect.Bottom - br.bottom_right_y);
                path.AddQuadCurveToPoint(rect.Right, rect.Bottom, rect.Right - br.bottom_right_x, rect.Bottom);
                path.AddLineToPoint(rect.Left + br.bottom_left_x, rect.Bottom);
                path.AddQuadCurveToPoint(rect.Left, rect.Bottom, rect.Left, rect.Bottom - br.bottom_left_y);
                path.AddLineToPoint(rect.Left, rect.Top + br.top_left_y);
                path.AddQuadCurveToPoint(rect.Left, rect.Top, rect.Left + br.top_left_x, rect.Top);

                Context.SetFillColor(cgColor);
                Context.AddPath(path);
                Context.FillPath();
            }
            else
            {
                DrawImage(image, rect);
            }
        }
Ejemplo n.º 3
0
 public void assignTo(background val)
 {
     attachment = val._attachment;
     baseurl    = val._baseurl;
     image      = val._image;
     repeat     = val._repeat;
     color      = val._color;
 }
Ejemplo n.º 4
0
 public background_paint()
 {
     color      = new web_color(0, 0, 0, 0);
     position_x = 0;
     position_y = 0;
     position_z = 0; //:h3ml
     attachment = background_attachment.scroll;
     repeat     = background_repeat.repeat;
     is_root    = false;
 }
Ejemplo n.º 5
0
 public background()
 {
     _attachment  = background_attachment.scroll;
     _repeat      = background_repeat.repeat;
     _clip        = background_box.border_box;
     _origin      = background_box.padding_box;
     _color.alpha = 0;
     _color.red   = 0;
     _color.green = 0;
     _color.blue  = 0;
 }
Ejemplo n.º 6
0
 public background_paint(background_paint val)
 {
     image         = val.image;
     baseurl       = val.baseurl;
     attachment    = val.attachment;
     repeat        = val.repeat;
     color         = val.color;
     clip_box      = val.clip_box;
     origin_box    = val.origin_box;
     border_box    = val.border_box;
     border_radius = val.border_radius;
     image_size    = val.image_size;
     position_x    = val.position_x;
     position_y    = val.position_y;
     position_z    = val.position_z; //:h3ml
     is_root       = val.is_root;
 }
Ejemplo n.º 7
0
        protected override void DrawBackground(UIntPtr hdc, string image, background_repeat repeat, ref web_color color, ref position pos, ref border_radiuses br, ref position borderBox, bool isRoot)
        {
            if (pos.width > 0 && pos.height > 0)
            {
                if (!String.IsNullOrEmpty(image))
                {
                    var bitmap = LoadImage(image);
                    if (bitmap != null)
                    {
                        DrawImage(bitmap, new Rect(pos.x, pos.y, pos.width, pos.height));
                    }
                }
                else
                {
                    Rect rect = new Rect(pos.x, pos.y, pos.width, pos.height);

                    var geometry = new PathGeometry();
                    PathSegmentCollection path = new PathSegmentCollection();

                    path.Add(new LineSegment(new Point(rect.Right - br.top_right_x, rect.Top), false));
                    path.Add(new QuadraticBezierSegment(new Point(rect.Right, rect.Top), new Point(rect.Right, rect.Top + br.top_right_y), false));

                    path.Add(new LineSegment(new Point(rect.Right, rect.Bottom - br.bottom_right_y), false));
                    path.Add(new QuadraticBezierSegment(new Point(rect.Right, rect.Bottom), new Point(rect.Right - br.bottom_right_x, rect.Bottom), false));

                    path.Add(new LineSegment(new Point(rect.Left + br.bottom_left_x, rect.Bottom), false));
                    path.Add(new QuadraticBezierSegment(new Point(rect.Left, rect.Bottom), new Point(rect.Left, rect.Bottom - br.bottom_left_y), false));

                    path.Add(new LineSegment(new Point(rect.Left, rect.Top + br.top_left_y), false));
                    path.Add(new QuadraticBezierSegment(new Point(rect.Left, rect.Top), new Point(rect.Left + br.top_left_x, rect.Top), false));

                    geometry.Figures.Add(new PathFigure(new Point(rect.Left + br.top_left_x, rect.Top), path, true));

                    DrawingContext.DrawGeometry(color.GetBrush(), null, geometry);
                }
            }
        }
Ejemplo n.º 8
0
 protected abstract void DrawBackground(UIntPtr hdc, string image, background_repeat repeat, ref web_color color, ref position pos, ref border_radiuses borderRadiuses, ref position borderBox, bool isRoot);