Ejemplo n.º 1
0
        public override void Render(Cairo.Context c)
        {
            InvalidateBound();

            c.Save();
            c.FillRectangle(AbsoluteBound, section.BackgroundColor.ToCairoColor());



            Rectangle r = new Rectangle(AbsoluteBound.X, AbsoluteBound.Y, parentReport.Width, SectionheaderHeight);

            Cairo.Gradient pat = new Cairo.LinearGradient(0, AbsoluteBound.Y, 0, AbsoluteBound.Y + SectionheaderHeight);
            pat.AddColorStop(0, sectionHeaderColor);
            pat.AddColorStop(1, sectionHeaderColor1);
            c.FillRectangle(r, pat);
            c.DrawText(new Cairo.PointD(r.X + 3, r.Y + 3), "Tahoma", Cairo.FontSlant.Normal, Cairo.FontWeight.Normal, 11, blackColor, 600, Section.Name);
            c.FillRectangle(GripperAbsoluteBound, SectionGripperColor);
            c.Translate(AbsoluteDrawingStartPoint.X, AbsoluteDrawingStartPoint.Y);

            for (int j = 0; j < Controls.Count; j++)
            {
                var ctrl = Controls [j];
                ctrl.Render(c);
            }

            c.Restore();
        }
        public void Render(Cairo.Context c, Control control)
        {
            TextBlock textBlock = control as TextBlock;
            Rectangle borderRect;

            c.Save();
            borderRect = new Rectangle(textBlock.Location.X, textBlock.Location.Y, textBlock.Width, textBlock.Height);
            if (!textBlock.CanGrow || DesignMode)
            {
                c.ClipRectangle(borderRect);
            }

            var rect = c.DrawTextBlock(textBlock, false);

            if (!DesignMode && (textBlock.CanGrow && rect.Height > textBlock.Height || textBlock.CanShrink && rect.Height < textBlock.Height))
            {
                borderRect = new Rectangle(textBlock.Location.X, textBlock.Location.Y, textBlock.Width, rect.Height);
            }
            else
            {
                borderRect = new Rectangle(textBlock.Location.X, textBlock.Location.Y, textBlock.Width, textBlock.Height);
            }

            c.FillRectangle(borderRect, textBlock.BackgroundColor.ToCairoColor());
            c.DrawTextBlock(textBlock, true);
            c.DrawInsideBorder(borderRect, textBlock.Border, true);
            c.Restore();
        }
Ejemplo n.º 3
0
        public CellRendererSurface(int width, int height)
        {
            // TODO: Respect cell padding (Xpad and Ypad).
            SetFixedSize(width, height);

            transparent = new Cairo.ImageSurface(Cairo.Format.ARGB32, width, height);
            Cairo.Color gray = new Cairo.Color(.75, .75, .75);

            // Create checkerboard background
            int grid_width = 4;

            using (Cairo.Context g = new Cairo.Context(transparent)) {
                g.Color = new Cairo.Color(1, 1, 1);
                g.Paint();

                for (int y = 0; y < height; y += grid_width)
                {
                    for (int x = 0; x < width; x += grid_width)
                    {
                        if ((x / grid_width % 2) + (y / grid_width % 2) == 1)
                        {
                            g.FillRectangle(new Cairo.Rectangle(x, y, grid_width, grid_width), gray);
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void Render(Cairo.Context c, MonoReports.Model.Controls.Control control)
        {
            SubReport subreport = control as SubReport;
            Rectangle borderRect;

            c.Save();
            borderRect = new Rectangle(subreport.Location.X, subreport.Location.Y, subreport.Width, subreport.Height);
            c.ClipRectangle(borderRect);
            borderRect = new Rectangle(subreport.Location.X, subreport.Location.Y, subreport.Width, subreport.Height);
            c.FillRectangle(borderRect, subreport.BackgroundColor.ToCairoColor());
            c.Restore();
        }
Ejemplo n.º 5
0
 private static void Draw(LayoutGroup group, Cairo.Context context, bool needClip)
 {
     if (needClip)
     {
         var rect  = group.Rect;
         var style = group.Style;
         context.Rectangle(rect.X + style.PaddingLeft + style.BorderLeft, rect.Y + style.PaddingTop + style.BorderTop,
                           rect.Width - style.PaddingHorizontal - style.BorderHorizontal, rect.Height - style.PaddingVertical - style.BorderVertical);
         //context.StrokePreserve();
         context.Clip();
     }
     foreach (var entry in @group.Entries)
     {
         if (entry.HorizontallyStretched || entry.VerticallyStretched)
         {
             context.FillRectangle(entry.Rect, CairoEx.ColorLightBlue);
         }
         else if (entry.IsFixedWidth || entry.IsFixedHeight)
         {
             context.FillRectangle(entry.Rect, CairoEx.ColorOrange);
         }
         else
         {
             context.FillRectangle(entry.Rect, CairoEx.ColorPink);
         }
         context.StrokeRectangle(entry.Rect, CairoEx.ColorBlack);
         var innerGroup = entry as LayoutGroup;
         if (innerGroup != null)
         {
             context.Save();
             Draw(innerGroup, context, needClip);
             context.Restore();
         }
     }
     if (needClip)
     {
         context.ResetClip();
     }
 }
Ejemplo n.º 6
0
        public void Render(Cairo.Context c, MonoReports.Model.Controls.Control control)
        {
            Image     image = control as Image;
            Rectangle borderRect;

            c.Save();
            borderRect = new Rectangle(image.Location.X, image.Location.Y, image.Width, image.Height);
            c.ClipRectangle(borderRect);
            borderRect = new Rectangle(image.Location.X, image.Location.Y, image.Width, image.Height);
            c.FillRectangle(borderRect, image.BackgroundColor.ToCairoColor());
            if (PixbufRepository.ContainsKey(image.ImageKey))
            {
                var pixbuf = PixbufRepository[image.ImageKey];
                c.DrawPixbuf(pixbuf, image.Location.ToCairoPointD(), image.Offset.ToCairoPointD());
            }
            c.DrawInsideBorder(borderRect, image.Border, true);
            c.Restore();
        }
Ejemplo n.º 7
0
        protected virtual void OnPreviewDrawingareaExposeEvent(object o, Gtk.ExposeEventArgs args)
        {
            DrawingArea area = (DrawingArea)o;

            if (designService.Report.Pages.Count > 0)
            {
                Cairo.Context cr = Gdk.CairoHelper.Create(area.GdkWindow);
                cr.Antialias           = Cairo.Antialias.None;
                reportRenderer.Context = cr;
                Cairo.Rectangle r = new Cairo.Rectangle(0, 0, designService.Report.WidthWithMargins, designService.Report.HeightWithMargins);
                cr.FillRectangle(r, backgroundPageColor);
                cr.Translate(designService.Report.Margin.Left, designService.Report.Margin.Top);
                reportRenderer.RenderPage(designService.Report.Pages [pageNumber]);
                area.SetSizeRequest((int)designService.Report.HeightWithMargins, (int)designService.Report.HeightWithMargins + 5);

                (cr as IDisposable).Dispose();
            }
        }
Ejemplo n.º 8
0
        protected override Rectangle DrawShape(Rectangle rect, Layer l)
        {
            Rectangle dirty;

            using (Context g = new Context (l.Surface)) {
                g.AppendPath (PintaCore.Layers.SelectionPath);
                g.FillRule = FillRule.EvenOdd;
                g.Clip ();

                g.Antialias = Antialias.Subpixel;

                if (FillShape && StrokeShape)
                    dirty = g.FillStrokedRectangle (rect, fill_color, outline_color, BrushWidth);
                else if (FillShape)
                    dirty = g.FillRectangle (rect, outline_color);
                else
                    dirty = g.DrawRectangle (rect, outline_color, BrushWidth);
            }

            return dirty;
        }
Ejemplo n.º 9
0
        public CellRendererSurface(int width, int height)
        {
            // TODO: Respect cell padding (Xpad and Ypad).
            SetFixedSize (width, height);

            transparent = new Cairo.ImageSurface (Cairo.Format.ARGB32, width, height);
            Cairo.Color gray = new Cairo.Color (.75, .75, .75);

            // Create checkerboard background
            int grid_width = 4;

            using (Cairo.Context g = new Cairo.Context (transparent)) {
                g.Color = new Cairo.Color (1, 1, 1);
                g.Paint ();

                for (int y = 0; y < height; y += grid_width)
                    for (int x = 0; x < width; x += grid_width)
                        if ((x / grid_width % 2) + (y / grid_width % 2) == 1)
                            g.FillRectangle (new Cairo.Rectangle (x, y, grid_width, grid_width), gray);
            }
        }
Ejemplo n.º 10
0
        protected override Rectangle DrawShape(Rectangle rect, Layer l)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            Rectangle dirty;

            using (Context g = new Context (l.Surface)) {
                g.AppendPath (doc.SelectionPath);
                g.FillRule = FillRule.EvenOdd;
                g.Clip ();

                g.Antialias = UseAntialiasing ? Antialias.Subpixel : Antialias.None;

                if (FillShape && StrokeShape)
                    dirty = g.FillStrokedRectangle (rect, fill_color, outline_color, BrushWidth);
                else if (FillShape)
                    dirty = g.FillRectangle (rect, outline_color);
                else
                    dirty = g.DrawRectangle (rect, outline_color, BrushWidth);
            }

            return dirty;
        }
Ejemplo n.º 11
0
 public override void OnAfterDraw(Context c)
 {
     if(currentSection != null)
         c.FillRectangle (currentSection.GripperAbsoluteBound, currentSection.SectionGripperColor);
 }