当前位置: 首页>>代码示例>>C#>>正文


C# Context.NewPath方法代码示例

本文整理汇总了C#中Cairo.Context.NewPath方法的典型用法代码示例。如果您正苦于以下问题:C# Context.NewPath方法的具体用法?C# Context.NewPath怎么用?C# Context.NewPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cairo.Context的用法示例。


在下文中一共展示了Context.NewPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

 /// <summary>
 /// Draws black in the areas outside the view.
 /// Assumes that controlBounds is starting at (0, 0) in upper left corner.
 /// </summary>
 /// <param name="context">A context to perform drawing.</param>
 /// <param name="controlBounds">Bounds of the control.</param>
 /// <param name="view">The bounds of the view.</param>
 public static void Draw(Context context, Rectangle controlBounds, Rectangle view)
 {
     context.Color = new Cairo.Color (0.0, 0.0, 0.0);
     context.NewPath ();
     context.Rectangle (0.0, 0.0, view.X, controlBounds.Height);
     var wRight = controlBounds.Width - view.X - view.Width;
     context.Rectangle (view.X + view.Width, 0.0, wRight, controlBounds.Height);
     context.Rectangle (view.X, 0.0, view.Width, view.Y);
     var hBottom = controlBounds.Height - view.Y - view.Height;
     context.Rectangle (view.X, view.Y + view.Height, view.Width, hBottom);
     context.Fill ();
 }
开发者ID:bvssvni,项目名称:csharp-sketch,代码行数:19,代码来源:CairoCanvasViewModule.cs

示例2: Execute

		public void Execute(Context ctx)
		{
			PointD point;
			var first = true;

			using (var mpath = ctx.CopyPath())
			{
				var path = mpath.GetPath();

				for (var i = 0; i < path.num_data; )
				{
					var hdr = path.GetPathHeader(i); //hdr.Dump();

					switch (hdr.type)
					{
						case NativePath.cairo_path_data_type_t.CAIRO_PATH_MOVE_TO:
							if (first)
							{
								ctx.NewPath();
								first = false;
							}
							point = path.GetPathPoint(i + 1);
							ctx.MoveTo(WarpPoint(point));
							break;
						case NativePath.cairo_path_data_type_t.CAIRO_PATH_LINE_TO:
							point = path.GetPathPoint(i + 1);
							ctx.LineTo(WarpPoint(point));
							break;
						case NativePath.cairo_path_data_type_t.CAIRO_PATH_CURVE_TO:
							var p1 = WarpPoint(path.GetPathPoint(i + 1));
							var p2 = WarpPoint(path.GetPathPoint(i + 2));
							var p3 = WarpPoint(path.GetPathPoint(i + 3));
							ctx.CurveTo(p1, p2, p3);
							break;
						case NativePath.cairo_path_data_type_t.CAIRO_PATH_CLOSE_PATH:
							ctx.ClosePath();
							break;
					}

					i += hdr.length;
				}
			}
		}
开发者ID:pruiz,项目名称:Mono.CairoWarp,代码行数:43,代码来源:Warp.cs

示例3: DrawTab

		void DrawTab (Context ctx, DockNotebookTab tab, Gdk.Rectangle allocation, Gdk.Rectangle tabBounds, bool highlight, bool active, bool dragging, Pango.Layout la)
		{
			// This logic is stupid to have here, should be in the caller!
			if (dragging) {
				tabBounds.X = (int)(tabBounds.X + (dragX - tabBounds.X) * dragXProgress);
				tabBounds.X = Clamp (tabBounds.X, tabStartX, tabEndX - tabBounds.Width);
			}
			int padding = LeftRightPadding;
			padding = (int)(padding * Math.Min (1.0, Math.Max (0.5, (tabBounds.Width - 30) / 70.0)));

			ctx.LineWidth = 1;
			LayoutTabBorder (ctx, allocation, tabBounds.Width, tabBounds.X, 0, active);
			ctx.ClosePath ();
			using (var gr = new LinearGradient (tabBounds.X, TopBarPadding, tabBounds.X, allocation.Bottom)) {
				if (active) {
					gr.AddColorStop (0, Styles.BreadcrumbGradientStartColor.MultiplyAlpha (tab.Opacity));
					gr.AddColorStop (1, Styles.BreadcrumbBackgroundColor.MultiplyAlpha (tab.Opacity));
				} else {
					gr.AddColorStop (0, CairoExtensions.ParseColor ("f4f4f4").MultiplyAlpha (tab.Opacity));
					gr.AddColorStop (1, CairoExtensions.ParseColor ("cecece").MultiplyAlpha (tab.Opacity));
				}
				ctx.SetSource (gr);
			}
			ctx.Fill ();

			ctx.SetSourceColor (new Cairo.Color (1, 1, 1, .5).MultiplyAlpha (tab.Opacity));
			LayoutTabBorder (ctx, allocation, tabBounds.Width, tabBounds.X, 1, active);
			ctx.Stroke ();

			ctx.SetSourceColor (Styles.BreadcrumbBorderColor.MultiplyAlpha (tab.Opacity));
			LayoutTabBorder (ctx, allocation, tabBounds.Width, tabBounds.X, 0, active);
			ctx.StrokePreserve ();

			if (tab.GlowStrength > 0) {
				Gdk.Point mouse = tracker.MousePosition;
				using (var rg = new RadialGradient (mouse.X, tabBounds.Bottom, 0, mouse.X, tabBounds.Bottom, 100)) {
					rg.AddColorStop (0, new Cairo.Color (1, 1, 1, 0.4 * tab.Opacity * tab.GlowStrength));
					rg.AddColorStop (1, new Cairo.Color (1, 1, 1, 0));

					ctx.SetSource (rg);
					ctx.Fill ();
				}
			} else {
				ctx.NewPath ();
			}

			// Render Close Button (do this first so we can tell how much text to render)

			var ch = allocation.Height - TopBarPadding - BottomBarPadding + CloseImageTopOffset;
			var crect = new Gdk.Rectangle (tabBounds.Right - padding - CloseButtonSize + 3,
				            tabBounds.Y + TopBarPadding + (ch - CloseButtonSize) / 2,
				            CloseButtonSize, CloseButtonSize);
			tab.CloseButtonAllocation = crect;
			tab.CloseButtonAllocation.Inflate (2, 2);

			bool closeButtonHovered = tracker.Hovered && tab.CloseButtonAllocation.Contains (tracker.MousePosition) && tab.WidthModifier >= 1.0f;
			bool drawCloseButton = tabBounds.Width > 60 || highlight || closeButtonHovered;
			if (drawCloseButton) {
				DrawCloseButton (ctx, new Gdk.Point (crect.X + crect.Width / 2, crect.Y + crect.Height / 2), closeButtonHovered, tab.Opacity, tab.DirtyStrength);
			}

			// Render Text
			int w = tabBounds.Width - (padding * 2 + CloseButtonSize);
			if (!drawCloseButton)
				w += CloseButtonSize;

			int textStart = tabBounds.X + padding;

			ctx.MoveTo (textStart, tabBounds.Y + TopPadding + TextOffset + VerticalTextSize);
			if (!MonoDevelop.Core.Platform.IsMac && !MonoDevelop.Core.Platform.IsWindows) {
				// This is a work around for a linux specific problem.
				// A bug in the proprietary ATI driver caused TAB text not to draw.
				// If that bug get's fixed remove this HACK asap.
				la.Ellipsize = Pango.EllipsizeMode.End;
				la.Width = (int)(w * Pango.Scale.PangoScale);
				ctx.SetSourceColor (tab.Notify ? new Cairo.Color (0, 0, 1) : Styles.TabBarActiveTextColor);
				Pango.CairoHelper.ShowLayoutLine (ctx, la.GetLine (0));
			} else {
				// ellipses are for space wasting ..., we cant afford that
				using (var lg = new LinearGradient (textStart + w - 5, 0, textStart + w + 3, 0)) {
					var color = tab.Notify ? new Cairo.Color (0, 0, 1) : Styles.TabBarActiveTextColor;
					color = color.MultiplyAlpha (tab.Opacity);
					lg.AddColorStop (0, color);
					color.A = 0;
					lg.AddColorStop (1, color);
					ctx.SetSource (lg);
					Pango.CairoHelper.ShowLayoutLine (ctx, la.GetLine (0));
				}
			}
			la.Dispose ();
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:91,代码来源:TabStrip.cs

示例4: DrawTab

		void DrawTab (Context ctx, DockNotebookTab tab, Gdk.Rectangle allocation, Gdk.Rectangle tabBounds, bool highlight, bool active, bool dragging, Pango.Layout la)
		{
			// This logic is stupid to have here, should be in the caller!
			if (dragging) {
				tabBounds.X = (int)(tabBounds.X + (dragX - tabBounds.X) * dragXProgress);
				tabBounds.X = Clamp (tabBounds.X, tabStartX, tabEndX - tabBounds.Width);
			}
			double rightPadding = (active ? TabActivePadding.Right : TabPadding.Right) - (LeanWidth / 2);
			rightPadding = (rightPadding * Math.Min (1.0, Math.Max (0.5, (tabBounds.Width - 30) / 70.0)));
			double leftPadding = (active ? TabActivePadding.Left : TabPadding.Left) - (LeanWidth / 2);
			leftPadding = (leftPadding * Math.Min (1.0, Math.Max (0.5, (tabBounds.Width - 30) / 70.0)));
			double bottomPadding = active ? TabActivePadding.Bottom : TabPadding.Bottom;

			DrawTabBackground (this, ctx, allocation, tabBounds.Width, tabBounds.X, active);

			ctx.LineWidth = 1;
			ctx.NewPath ();

			// Render Close Button (do this first so we can tell how much text to render)

			var closeButtonAlloation = new Cairo.Rectangle (tabBounds.Right - rightPadding - (tabCloseImage.Width / 2) - CloseButtonMarginRight,
			                                 tabBounds.Height - bottomPadding - tabCloseImage.Height - CloseButtonMarginBottom,
			                                 tabCloseImage.Width, tabCloseImage.Height);
			
			tab.CloseButtonActiveArea = closeButtonAlloation.Inflate (2, 2);

			bool closeButtonHovered = tracker.Hovered && tab.CloseButtonActiveArea.Contains (tracker.MousePosition);
			bool tabHovered = tracker.Hovered && tab.Allocation.Contains (tracker.MousePosition);
			bool drawCloseButton = active || tabHovered;

			if (!closeButtonHovered && tab.DirtyStrength > 0.5) {
				ctx.DrawImage (this, tabDirtyImage, closeButtonAlloation.X, closeButtonAlloation.Y);
				drawCloseButton = false;
			}

			if (drawCloseButton)
				ctx.DrawImage (this, tabCloseImage.WithAlpha ((closeButtonHovered ? 1.0 : 0.5) * tab.Opacity), closeButtonAlloation.X, closeButtonAlloation.Y);
			
			// Render Text
			double tw = tabBounds.Width - (leftPadding + rightPadding);
			if (drawCloseButton || tab.DirtyStrength > 0.5)
				tw -= closeButtonAlloation.Width / 2;

			double tx = tabBounds.X + leftPadding;
			var baseline = la.GetLine (0).Layout.GetPixelBaseline ();
			double ty = tabBounds.Height - bottomPadding - baseline;

			ctx.MoveTo (tx, ty);
			if (!MonoDevelop.Core.Platform.IsMac && !MonoDevelop.Core.Platform.IsWindows) {
				// This is a work around for a linux specific problem.
				// A bug in the proprietary ATI driver caused TAB text not to draw.
				// If that bug get's fixed remove this HACK asap.
				la.Ellipsize = Pango.EllipsizeMode.End;
				la.Width = (int)(tw * Pango.Scale.PangoScale);
				ctx.SetSourceColor ((tab.Notify ? Styles.TabBarNotifyTextColor : (active ? Styles.TabBarActiveTextColor : Styles.TabBarInactiveTextColor)).ToCairoColor ());
				Pango.CairoHelper.ShowLayout (ctx, la.GetLine (0).Layout);
			} else {
				// ellipses are for space wasting ..., we cant afford that
				using (var lg = new LinearGradient (tx + tw - 10, 0, tx + tw, 0)) {
					var color = (tab.Notify ? Styles.TabBarNotifyTextColor : (active ? Styles.TabBarActiveTextColor : Styles.TabBarInactiveTextColor)).ToCairoColor ();
					color = color.MultiplyAlpha (tab.Opacity);
					lg.AddColorStop (0, color);
					color.A = 0;
					lg.AddColorStop (1, color);
					ctx.SetSource (lg);
					Pango.CairoHelper.ShowLayout (ctx, la.GetLine (0).Layout);
				}
			}
            la.Dispose ();
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:70,代码来源:TabStrip.cs

示例5: OnDrawn

			protected override bool OnDrawn (Context ctx)
			{
				int w, h;
				this.GdkWindow.GetSize (out w, out h);
				var bounds = new Xwt.Rectangle (0.5, 0.5, w - 1, h - 1);
				var backgroundColor = Xwt.Drawing.Color.FromBytes (230, 230, 230, 230);
				var black = Xwt.Drawing.Color.FromBytes (60, 60, 60);

				// We clear the surface with a transparent color if possible
				if (supportAlpha)
					ctx.SetSourceRGBA (1.0, 1.0, 1.0, 0.0);
				else
					ctx.SetSourceRGB (1.0, 1.0, 1.0);
				ctx.Operator = Operator.Source;
				ctx.Paint ();
				
				var calibratedRect = RecalibrateChildRectangle (bounds);
				// Fill it with one round rectangle
				RoundRectangle (ctx, calibratedRect, radius);
				ctx.LineWidth = 1;
				ctx.SetSourceRGBA (black.Red, black.Green, black.Blue, black.Alpha);
				ctx.StrokePreserve ();
				ctx.SetSourceRGBA (backgroundColor.Red, backgroundColor.Green, backgroundColor.Blue, backgroundColor.Alpha);
				ctx.Fill ();
				
				// Triangle
				// We first begin by positionning ourselves at the top-center or bottom center of the previous rectangle
				var arrowX = bounds.Center.X;
				var arrowY = arrowPosition == Xwt.Popover.Position.Top ? calibratedRect.Top + ctx.LineWidth : calibratedRect.Bottom - ctx.LineWidth;
				ctx.NewPath ();
				ctx.MoveTo (arrowX, arrowY);
				// We draw the rectangle path
				DrawTriangle (ctx);
				// We use it
				ctx.SetSourceRGBA (black.Red, black.Green, black.Blue, black.Alpha);
				ctx.StrokePreserve ();
				ctx.ClosePath ();
				ctx.SetSourceRGBA (backgroundColor.Red, backgroundColor.Green, backgroundColor.Blue, backgroundColor.Alpha);
				ctx.Fill ();

				return base.OnDrawn (ctx);
			}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:42,代码来源:PopoverBackend.cs

示例6: DrawShape

        void DrawShape(Context g, int width, int height)
        {
            int inner_x = radius + border + inner;
            int cx = Center.X;
            int cy = Center.Y;

            g.Operator = Operator.Source;
            g.SetSource (new SolidPattern (new Cairo.Color (0,0,0,0)));
            g.Rectangle (0, 0, width, height);
            g.Paint ();

            g.NewPath ();
            g.Translate (cx, cy);
            g.Rotate (angle);

            g.SetSource (new SolidPattern (new Cairo.Color (0.2, 0.2, 0.2, .6)));
            g.Operator = Operator.Over;
            g.Rectangle (0, - (border + inner), inner_x, 2 * (border + inner));
            g.Arc (inner_x, 0, inner + border, 0, 2 * Math.PI);
            g.Arc (0, 0, radius + border, 0, 2 * Math.PI);
            g.Fill ();

            g.SetSource (new SolidPattern (new Cairo.Color (0, 0, 0, 1.0)));
            g.Operator = Operator.DestOut;
            g.Arc (inner_x, 0, inner, 0, 2 * Math.PI);
            #if true
            g.Fill ();
            #else
            g.FillPreserve ();

            g.Operator = Operator.Over;
            RadialGradient rg = new RadialGradient (inner_x - (inner * 0.3), inner * 0.3 , inner * 0.1, inner_x, 0, inner);
            rg.AddColorStop (0, new Cairo.Color (0.0, 0.2, .8, 0.5));
            rg.AddColorStop (0.7, new Cairo.Color (0.0, 0.2, .8, 0.1));
            rg.AddColorStop (1.0, new Cairo.Color (0.0, 0.0, 0.0, 0.0));
            g.Source = rg;
            g.Fill ();
            rg.Destroy ();
            #endif
            g.Operator = Operator.Over;
            g.Matrix = new Matrix ();
            g.Translate (cx, cy);
            if (source != null)
            CairoHelper.SetSourcePixbuf (g, source, -source.Width / 2, -source.Height / 2);

            g.Arc (0, 0, radius, 0, 2 * Math.PI);
            g.Fill ();

            if (overlay != null) {
                CairoHelper.SetSourcePixbuf (g, overlay, -overlay.Width / 2, -overlay.Height / 2);
                g.Arc (0, 0, radius, angle, angle + Math.PI);
                g.ClosePath ();
                g.FillPreserve ();
                g.SetSource (new SolidPattern (new Cairo.Color (1.0, 1.0, 1.0, 1.0)));
                g.Stroke ();
            }
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:57,代码来源:Loupe.cs

示例7: CheckTextExtents

 /** FAST */
 public static bool CheckTextExtents(Context cr, TextExtents te, double x, double y)
 {
     bool retval = false;
     cr.Save ();
       PointD pt = cr.CurrentPoint;
       cr.NewPath ();
       cr.Rectangle (pt.X, pt.Y, te.Width, te.Height);
       cr.IdentityMatrix ();
       retval = cr.InFill (x, y);
       if (ShowTextExtents) {
     cr.Operator = Operator.Over;
     cr.Color = new Color (1,0.5,1,0.5);
     cr.LineWidth = 0.5;
     cr.Stroke ();
       }
     cr.Restore ();
     cr.MoveTo (pt.X, pt.Y);
     return retval;
 }
开发者ID:kig,项目名称:filezoo,代码行数:20,代码来源:helpers.cs

示例8: clip

		public void clip(Context cr, int width, int height)
		{
			Normalize (cr, width, height);

			cr.Arc(0.5, 0.5, 0.3, 0, 2 * Math.PI);
			cr.Clip();

			cr.NewPath();  // current path is not consumed by cairo_clip()
			cr.Rectangle(0, 0, 1, 1);
			cr.Fill();
			cr.Color = new Color (0, 1, 0);
			cr.MoveTo(0, 0);
			cr.LineTo(1, 1);
			cr.MoveTo(1, 0);
			cr.LineTo(0, 1);
			cr.Stroke();
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:17,代码来源:Snippets.cs

示例9: xxx_clip_rectangle

		public void xxx_clip_rectangle(Context cr, int width, int height)
		{
			Normalize (cr, width, height);

			cr.NewPath();
			cr.MoveTo(.25, .25);
			cr.LineTo(.25, .75);
			cr.LineTo(.75, .75);
			cr.LineTo(.75, .25);
			cr.LineTo(.25, .25);
			cr.ClosePath();

			cr.Clip();

			cr.MoveTo(0, 0);
			cr.LineTo(1, 1);
			cr.Stroke();
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:18,代码来源:Snippets.cs

示例10: clip_image

		public void clip_image(Context cr, int width, int height)
		{
			Normalize (cr, width, height);
			cr.Arc (0.5, 0.5, 0.3, 0, 2*Math.PI);
			cr.Clip ();
			cr.NewPath (); // path not consumed by clip()

			ImageSurface image = new ImageSurface ("data/romedalen.png");
			int w = image.Width;
			int h = image.Height;

			cr.Scale (1.0/w, 1.0/h);

			cr.SetSourceSurface (image, 0, 0);
			cr.Paint ();

			image.Destroy ();
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:18,代码来源:Snippets.cs

示例11: ClickSortBar

 /** FAST */
 bool ClickSortBar(Context cr, double x, double y)
 {
     cr.NewPath ();
     cr.MoveTo (0.0, 0.0);
     TextExtents te;
     cr.Color = ActiveColor;
     cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * 0.4 );
     Helpers.DrawText (cr, ToolbarTitleFontFamily, ToolbarTitleFontSize, SortLabel);
     cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * -0.4 );
     foreach (SortHandler sf in SortFields) {
       cr.Color = (SortField == sf) ? ActiveColor : InActiveColor;
       te = Helpers.GetTextExtents (
     cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, sf.Name);
       if (Helpers.CheckTextExtents(cr, te, x, y)) {
     SortField = sf;
     ResetZoom ();
     UpdateLayout ();
     return true;
       }
       Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, sf.Name);
       Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, " ");
     }
     return false;
 }
开发者ID:kig,项目名称:filezoo,代码行数:25,代码来源:filezoo.cs

示例12: DrawSortBar

 /** FAST */
 void DrawSortBar(Context cr)
 {
     cr.NewPath ();
     cr.MoveTo (0.0, 0.0);
     cr.Color = ActiveColor;
     cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * 0.4 );
     Helpers.DrawText (cr, ToolbarTitleFontFamily, ToolbarTitleFontSize, SortLabel);
     cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * -0.4 );
     foreach (SortHandler sf in SortFields) {
       cr.Color = (SortField == sf) ? ActiveColor : InActiveColor;
       Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, sf.Name);
       Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, " ");
     }
 }
开发者ID:kig,项目名称:filezoo,代码行数:15,代码来源:filezoo.cs

示例13: DrawMainView

    /* Draw main view */
    /** BLOCKING */
    void DrawMainView(Context cr, uint width, uint height)
    {
        cr.Save ();
          cr.NewPath ();
          cr.IdentityMatrix ();
          DrawToolbars (cr, width, height);
          cr.NewPath ();
          cr.IdentityMatrix ();
          Rectangle targetBox = Transform (cr, width, height);
          DrawCurrentDir(cr, targetBox);
        cr.Restore ();

        dirLatencyProfiler.Stop ();
        if (FirstFrameOfDir) {
          dirLatencyProfiler.Time ("Directory latency");
          FirstFrameOfDir = false;
        }
        if (Helpers.StartupProfiler.Watch.IsRunning) {
          Helpers.StartupProfiler.Time ("Draw complete");
          Helpers.StartupProfiler.Total ("Startup complete");
          Helpers.StartupProfiler.Stop ();
          if (QuitAfterFirstFrame) Application.Quit ();
        }
    }
开发者ID:kig,项目名称:filezoo,代码行数:26,代码来源:filezoo.cs

示例14: DrawBreadcrumb

 /** FAST */
 void DrawBreadcrumb(Context cr, uint width)
 {
     cr.NewPath ();
     cr.MoveTo (0.0, 0.0);
     Profiler p = new Profiler ();
     p.Time("In breadcrumb");
     TextExtents te = Helpers.GetTextExtents (cr, BreadcrumbFontFamily, BreadcrumbFontSize, String.Join(dirSep, CurrentDirPath.Split(Helpers.DirSepC)) + dirSep);
     p.Time("GetTextExtents");
     cr.Color = Renderer.DirectoryFGColor;
     cr.Save ();
       double areaWidth = width-BreadcrumbMarginLeft-BreadcrumbMarginRight;
       cr.Rectangle (0,0,areaWidth, te.Height);
       cr.Clip ();
       cr.Translate (Math.Min(0,areaWidth-te.Width), 0);
       cr.MoveTo (0.0, 0.0);
       if (CurrentDirPath == Helpers.RootDir) {
     Helpers.DrawText (cr, BreadcrumbFontFamily, BreadcrumbFontSize, rootChar);
       } else {
     p.Time("start DrawText");
     foreach (string s in CurrentDirPath.Split(Helpers.DirSepC)) {
       Helpers.DrawText (cr, BreadcrumbFontFamily, BreadcrumbFontSize, s == "" ? rootChar : (s+dirSep));
     }
     p.Time("DrawText");
       }
     cr.Restore ();
 }
开发者ID:kig,项目名称:filezoo,代码行数:27,代码来源:filezoo.cs

示例15: DrawBackground

 /** FAST */
 void DrawBackground(Context cr, uint width, uint height)
 {
     cr.Save ();
       DrawClear (cr, width, height);
       double t = DateTime.Now.ToFileTime() / 1e7;
       cr.Save ();
     Color ca = Renderer.DirectoryFGColor;
     ca.A = 0.3;
     cr.Color = ca;
     cr.LineWidth = 0.5;
     cr.Translate (270, -50);
     cr.Rotate (0.15);
     for (double y=0; y<6; y++) {
     for (double i=0; i<6-y; i++) {
       cr.Save ();
         double hr = 45;
         double iscale = Math.Sin(-i/20 * Math.PI*2 + CylinderRotation);
         double xscale = Math.Cos(-i/20 * Math.PI*2 + 0.1 + CylinderRotation);
         cr.Translate (iscale * hr * 3, -100 + y*hr*(2*1.732) + hr*(i%2)*1.732);
         hr = 45;
         cr.Scale (xscale, 1);
         cr.NewPath ();
         cr.MoveTo (0, -hr);
         cr.LineTo (0.866*hr, -0.5*hr);
         cr.LineTo (0.866*hr, 0.5*hr);
         cr.LineTo (0, hr);
         cr.LineTo (-0.866*hr, 0.5*hr);
         cr.LineTo (-0.866*hr, -0.5*hr);
         cr.ClosePath ();
         cr.Color = ca;
         cr.Stroke ();
         cr.Color = Renderer.SocketColor;
         cr.Translate (0.75 * -0.866*hr, 0.75 * -0.5*hr);
         double x2 = cr.Matrix.X0, y2 = cr.Matrix.Y0;
         cr.IdentityMatrix ();
         cr.Arc (x2,y2, 1, 0, Math.PI*2);
         cr.Fill ();
       cr.Restore ();
     }
     }
     CylinderRotation += 0.02;
       cr.Restore ();
       if (CurrentDirEntry.InProgress || (t - LastProgress < 3)) {
     if (FirstProgress == 0) { FirstProgress = LastProgress = t; }
     if (CurrentDirEntry.InProgress) LastProgress = t;
     double opacity = Math.Min(3, t-FirstProgress) - Math.Max(0, t-LastProgress);
     t = (t * 0.1) % Math.PI*2;
     Color c = Renderer.RegularFileColor;
     c.A = 0.1*opacity;
     cr.Color = c;
     cr.LineWidth = 1;
     double n = 6;
     double af = Math.PI*2/n;
     double r = 400*(4.4+0.3*cosScale(opacity/3));
     for (double i=0; i<n; i++) {
       cr.Arc (-400*4, 1000/4, r, t+i*af, t+(i+0.7)*af);
       cr.Stroke ();
     }
     for (double i=0; i<n; i++) {
       cr.Arc (-400*4, 1000/4, r+5, -t+i*af, -t+(i+0.7)*af);
       cr.Stroke ();
     }
     if (CurrentDirEntry.InProgress) {
       cr.NewPath ();
         // find FSCache.LastTraversed [or ancestor] y position from model
         // draw line there
       cr.NewPath ();
     }
     LimitedRedraw = true;
       } else {
     FirstProgress = 0;
     LastProgress = 0;
       }
     cr.Restore ();
 }
开发者ID:kig,项目名称:filezoo,代码行数:76,代码来源:filezoo.cs


注:本文中的Cairo.Context.NewPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。