public static void RenderTiled(this Cairo.Context self, Gdk.Pixbuf source, Gdk.Rectangle area, Gdk.Rectangle clip, double opacity = 1)
 {
     Gdk.CairoHelper.SetSourcePixbuf(self, source, area.X, area.Y);
     cairo_pattern_set_extend(self.Pattern.Pointer, CairoExtend.CAIRO_EXTEND_REPEAT);
     self.Rectangle(clip.ToCairoRect());
     self.Clip();
     self.PaintWithAlpha(opacity);
     self.ResetClip();
 }
        public static void RenderTiled(this Cairo.Context self, Gdk.Pixbuf source, Gdk.Rectangle area, Gdk.Rectangle clip, double opacity = 1)
        {
            Gdk.CairoHelper.SetSourcePixbuf(self, source, area.X, area.Y);
            //NOTE: Mono.Cairo.Context.Pattern returns an object than cannot be safely disposed, so P/Invoke directly
            var pattern = cairo_get_source(self.Handle);

            cairo_pattern_set_extend(pattern, CairoExtend.CAIRO_EXTEND_REPEAT);
            self.Rectangle(clip.ToCairoRect());
            self.Clip();
            self.PaintWithAlpha(opacity);
            self.ResetClip();
        }
示例#3
0
        void DrawTabs(Pango.Layout la, Gdk.Window win, Gdk.GC gc, Cairo.Context cairo, int currentTab)
        {
            int tx = ALeft + Xpad;
            int ty = ATop + Ypad;



            float left = 0;

            for (int i = 0; i < mTabs.Count(); i++)
            {
                var t        = mTabs.ElementAt(i);
                int x1       = (int)(tx + left + 0.5f);
                var cliprect = new Gdk.Rectangle(x1, 0, (int)(t.CurrentWidth + 0.5f), Allocation.Height);
                gc.ClipRectangle = cliprect;
                cairo.Rectangle(cliprect.ToCairoRect());
                cairo.Clip();

                Color color;
                if (i == ActiveIndex && t.DockItemTitleTab.Active)
                {
                    color = Style.Background(StateType.Selected);
                }
                else if (i == currentTab)
                {
                    color = Style.Background(StateType.Normal);
                }
                else
                {
                    color = Style.Mid(StateType.Normal);
                }

                DrawRectangle(cairo, cliprect.X, cliprect.Y, cliprect.Width, cliprect.Height, color.ToCairo(), true);

                x1 += space;
                if (t.Image != null)
                {
                    win.DrawPixbuf(gc, t.Image, 0, 0, x1, (Allocation.Height - t.Image.Height + Ypad) / 2, -1, -1, Gdk.RgbDither.None, 0, 0);
                    x1 += t.Image.Width;
                    x1 += space;
                }

                la.SetMarkup(t.Label);
                DrawText(win, gc, x1, ty, System.Drawing.Color.Black.ToGdk(), la);
                left += t.CurrentWidth;

                gc.ClipRectangle = new Gdk.Rectangle(0, 0, Allocation.Width, Allocation.Height);
                cairo.ResetClip();
            }
        }