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


C# Cairo.MoveTo方法代码示例

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


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

示例1: DrawHorizontalSectionIndicator

        protected void DrawHorizontalSectionIndicator(string text, Cairo.Context cr, Pango.Layout layout, double x, double y, double w, out double h)
        {
            cr.MoveTo(x,y);
            cr.LineTo(x,y+SectionSerifeWidth*2);
            cr.MoveTo(x,y+SectionSerifeWidth);
            cr.LineTo(x+w,y+SectionSerifeWidth);
            cr.MoveTo(x+w,y);
            cr.LineTo(x+w,y+SectionSerifeWidth*2);
            cr.Color = new Cairo.Color(0, 0, 0);
            cr.LineWidth = 1;
            cr.Stroke();

            layout.Width = (int)(w*Pango.Scale.PangoScale);
            layout.Alignment = Pango.Alignment.Center;
            layout.SetText (text);
            layout.Ellipsize = EllipsizeMode.Middle;
            layout.Justify = true;
            cr.Color = new Cairo.Color(0, 0, 0);
            cr.MoveTo(x,y+SectionSerifeWidth*2);
            Pango.CairoHelper.ShowLayout (cr, layout);

            int lw,lh;
            layout.GetPixelSize(out lw, out lh);
            h=(double)lh+SectionSerifeWidth*2;
        }
开发者ID:konne88,项目名称:MyInventory,代码行数:25,代码来源:PaperPreview.cs

示例2: draw

	static void draw (Cairo.Context gr, int width, int height)
	{
		gr.Scale (width, height);
		gr.LineWidth = 0.04;
		
		gr.MoveTo ( new PointD (0.5, 0.1) );
		gr.LineTo ( new PointD (0.9, 0.9) );
		gr.RelLineTo ( new Distance (-0.4, 0.0) );
		gr.CurveTo ( new PointD (0.2, 0.9),
			     new PointD ( 0.2, 0.5),
			     new PointD (0.5, 0.5)
			     );
		gr.ClosePath ();
		
		gr.MoveTo ( new PointD (0.25, 0.1) );
		gr.RelLineTo ( new Distance (0.2, 0.2) );
		gr.RelLineTo ( new Distance ( -0.2, 0.2) );
		gr.RelLineTo ( new Distance (-0.2, -0.2) );
		gr.ClosePath ();	       
		
		gr.Color = new Color (0, 0, 1, 1);
		gr.FillPreserve ();
		gr.Color = new Color ( 0, 0, 0, 1);
		gr.Stroke ();
	}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:25,代码来源:fillstroke.cs

示例3: draw

	static void draw (Cairo.Context gr, int width, int height)
	{
		int w, h;
		ImageSurface image;
		
		gr.Scale (width, height);
		gr.LineWidth = 0.04;
		
		gr.Arc (0.5, 0.5, 0.3, 0, 2*M_PI);
		gr.Clip ();
		gr.NewPath ();
		
		image = new ImageSurface("data/e.png");
		w = image.Width;
		h = image.Height;
		
		gr.Scale (1.0/w, 1.0/h);
		
		image.Show (gr, 0, 0);
		
		image.Destroy();
		
		gr.Arc (0.5, 0.5, 0.3, 0, 2 * M_PI);
		gr.Clip ();
		
		gr.NewPath ();
		gr.Rectangle (new PointD (0, 0), 1, 1);
		gr.Fill ();
		gr.Color = new Color (0, 1, 0, 1);
		gr.MoveTo ( new PointD (0, 0) );
		gr.LineTo ( new PointD (1, 1) );
		gr.MoveTo ( new PointD (1, 0) );
		gr.LineTo ( new PointD (0, 1) );
		gr.Stroke ();
	}
开发者ID:nlhepler,项目名称:mono,代码行数:35,代码来源:clip_img.cs

示例4: draw

	static void draw (Cairo.Context gr, int width, int height)
	{
		double x=0.1,  y=0.5;
		double x1=0.4, y1=0.9, x2=0.6, y2=0.1, x3=0.9, y3=0.5;
		
				
		gr.Scale (width, height);
		gr.LineWidth = 0.04;		
		
		gr.MoveTo ( new PointD (x, y) );
		
		gr.CurveTo ( new PointD (x1, y1),
			     new PointD (x2, y2), 
			     new PointD (x3, y3)
			     );
		
		gr.Stroke ();
		
		gr.Color = new Color (1, 0.2, 0.2, 0.6);
		gr.LineWidth = 0.03;
		gr.MoveTo ( new PointD (x, y) );
		gr.LineTo ( new PointD (x1, y1) );
		gr.MoveTo ( new PointD (x2, y2) );
		gr.LineTo ( new PointD (x3, y3) );
		gr.Stroke ();						
	}
开发者ID:nlhepler,项目名称:mono,代码行数:26,代码来源:curve_to.cs

示例5: ShadowedText

        public static void ShadowedText(Cairo.Context g, Cairo.Color c, string text, double x, double y)
        {
            g.Save();

            g.MoveTo(x + SHADOW_SPACING, y + SHADOW_SPACING);
            g.Color = Colors.BLACK;
            g.ShowText(text);

            g.MoveTo(x, y);
            g.Color = c;
            g.ShowText(text);

            g.Restore();
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:14,代码来源:Text.cs

示例6: draw

 public void draw(Cairo.Context cr)
 {
     cr.MoveTo (position);
     cr.SetSourceRGB (0, 1.0, 0);
     cr.Arc (position.X, position.Y, 5, 0, 2 * Math.PI);
     cr.Fill ();
 }
开发者ID:latestversion,项目名称:projects,代码行数:7,代码来源:Player.cs

示例7: RoundedRectangle

        public static void RoundedRectangle(Cairo.Context c, RectangleD rect, double radius)
        {
            if (radius > (rect.Width /2) || radius > (rect.Height / 2)) {
                radius = Math.Min ((rect.Width /2), (rect.Height / 2));
            }

            c.Save ();

            /* Bottom Left */
            c.MoveTo(rect.X, rect.Y + radius);
            c.Arc (rect.X + radius, rect.Y + radius, radius, Math.PI, -Math.PI/2);
            c.LineTo (rect.X2 - radius, rect.Y);

            /* Bottom Right */
            c.Arc (rect.X2 - radius, rect.Y + radius, radius, -Math.PI/2, 0);
            c.LineTo (rect.X2, rect.Y2 - radius);

            /* Top Right */
            c.Arc (rect.X2 - radius, rect.Y2 - radius, radius, 0, Math.PI/2);
            c.LineTo (rect.X + radius, rect.Y2);

            /* Top Left */
            c.Arc(rect.X + radius, rect.Y2 - radius, radius, Math.PI/2, Math.PI);
            c.ClosePath ();

            c.Restore ();
        }
开发者ID:erbriones,项目名称:monodevelop-classdesigner,代码行数:27,代码来源:CairoFigures.cs

示例8: DrawRoundedRectangle

        public static void DrawRoundedRectangle(Cairo.Context gr, double x, double y,
		                                        double width, double height, double radius,
		                                        Cairo.Color color, Cairo.Color borderColor)
        {
            gr.Save();

            if((radius > height / 2) || (radius > width / 2))
                radius = Math.Min(height / 2, width / 2);

            gr.MoveTo(x, y + radius);
            gr.Arc(x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
            gr.LineTo(x + width - radius, y);
            gr.Arc(x + width - radius, y + radius, radius, -Math.PI / 2, 0);
            gr.LineTo(x + width, y + height - radius);
            gr.Arc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
            gr.LineTo(x + radius, y + height);
            gr.Arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
            gr.ClosePath();
            gr.Restore();

            gr.LineJoin = LineJoin.Round;
            gr.Color = borderColor;
            gr.StrokePreserve();
            gr.Color = color;
            gr.Fill();
        }
开发者ID:dineshkummarc,项目名称:longomatch,代码行数:26,代码来源:Cairo.cs

示例9: DrawFrameBorder

        public override void DrawFrameBorder(Cairo.Context cr, Gdk.Rectangle alloc)
        {
            if (IsPanelWidget) {
                return;
            } else if (!IsSourceViewWidget) {
                base.DrawFrameBorder (cr, alloc);
                return;
            }

            cr.SetSourceColor (TextMidColor);
            cr.LineWidth = 1.0;
            cr.Antialias = Cairo.Antialias.None;

            cr.MoveTo (alloc.Right - 1, alloc.Top);
            cr.LineTo (alloc.Right - 1, alloc.Bottom);
            cr.Stroke ();

            if (Widget.Allocation.Bottom < Widget.Toplevel.Allocation.Height) {
                cr.MoveTo (alloc.Left, alloc.Bottom - 1);
                cr.LineTo (alloc.Right, alloc.Bottom - 1);
                cr.Stroke ();
            }

            cr.Antialias = Cairo.Antialias.Default;
        }
开发者ID:dufoli,项目名称:banshee,代码行数:25,代码来源:MediaPanelTheme.cs

示例10: Draw

        /// <summary>
        /// Draw the robot taking into account the center x and y position of the map which
        /// will be different from the true center x and y positions on the drawing context.
        /// This method will result in a red wheeled robot with black tyres being drawn at
        /// the robots location on the map.
        /// 
        /// The scale value is currently unused but it could be useful if the map was scaled
        /// in some way for example a mini-map may be 10 times smaller than the original 
        /// results in 1:10 scale robot.
        /// </summary>
        /// <param name="cairoContext">Cairo context to draw to (assuming a map).</param>
        /// <param name="centerX">Center x position of map to draw onto.</param>
        /// <param name="centerY">Center y position of map to draw onto.</param>
        /// <param name="scale">Scale currently unused.</param>
        public void Draw(Cairo.Context cairoContext, int centerX, int centerY, double scale)
        {
            // Scale up to centimeters.
            int width = (int)(robot.Width * 100);
            int height = (int)(robot.Height * 100);
            int x = (int)(robot.X * 100);
            int y = (int)(robot.Y * 100);

            // Set a red colour.
            cairoContext.SetSourceRGB(255, 0, 0);

            cairoContext.LineWidth = 1.0;
            cairoContext.LineCap = LineCap.Butt;

            cairoContext.Translate (centerX + x, centerY - y);
            cairoContext.Rotate (relativeRotation); // Rotate the robot based on its orientation in radians.

            // Draw the robot as a triangle.
            cairoContext.MoveTo (0, -height / 2);
            cairoContext.LineTo (-width / 2, height / 2);
            cairoContext.LineTo (width / 2, height / 2);
            cairoContext.LineTo (0, -height / 2);
            cairoContext.Stroke ();

            // Reset the drawing context.
            cairoContext.Rotate (-relativeRotation);
            cairoContext.Translate (-(centerX + x), -(centerY - y));
        }
开发者ID:abdulrahman-alhemmy,项目名称:slambot,代码行数:42,代码来源:RobotView.cs

示例11: DrawContent

		public override void DrawContent (Cairo.Context Context, Cairo.Rectangle Area)
		{
			Context.Color = new Color (0, 0, 0);
			Pango.CairoHelper.UpdateLayout (Context, textLayout);
			Context.MoveTo (Area.X, Area.Y);
			Pango.CairoHelper.ShowLayout (Context, textLayout);
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:7,代码来源:SampleTile.cs

示例12: DrawRoundRectangle

		public static void DrawRoundRectangle (Cairo.Context cr, double x, double y, double r, double w, double h)
		{
			const double ARC_TO_BEZIER = 0.55228475;
			double radius_x = r;
			double radius_y = r / 4;
			
			if (radius_x > w - radius_x)
				radius_x = w / 2;
					
			if (radius_y > h - radius_y)
				radius_y = h / 2;
			
			double c1 = ARC_TO_BEZIER * radius_x;
			double c2 = ARC_TO_BEZIER * radius_y;
			
			cr.NewPath ();
			cr.MoveTo (x + radius_x, y);
			cr.RelLineTo (w - 2 * radius_x, 0.0);
			cr.RelCurveTo (c1, 0.0, 
			               radius_x, c2, 
			               radius_x, radius_y);
			cr.RelLineTo (0, h - 2 * radius_y);
			cr.RelCurveTo (0.0, c2, c1 - radius_x, radius_y, -radius_x, radius_y);
			cr.RelLineTo (-w + 2 * radius_x, 0);
			cr.RelCurveTo (-c1, 0, -radius_x, -c2, -radius_x, -radius_y);
			cr.RelLineTo (0, -h + 2 * radius_y);
			cr.RelCurveTo (0.0, -c2, radius_x - c1, -radius_y, radius_x, -radius_y);
			cr.ClosePath ();
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:29,代码来源:BookmarkMarker.cs

示例13: Draw

        /// <summary>
        /// Draw the specified cairoContext, centerX, centerY and scale.
        /// </summary>
        /// <param name="cairoContext">Cairo context.</param>
        /// <param name="centerX">Center x.</param>
        /// <param name="centerY">Center y.</param>
        /// <param name="scale">Scale.</param>
        public void Draw(Cairo.Context cairoContext, int centerX, int centerY, double scale)
        {
            cairoContext.SetSourceRGB (0, 0, 200);
            cairoContext.LineWidth = 1.0;
            cairoContext.LineCap = LineCap.Butt;

            //cairoContext.MoveTo (OriginalX, -OriginalY);
            //int x = centerX;

            //Console.WriteLine ("point: " + (robot.PathPointList [robot.PathPointList.Count-1] [1]*100));

            //if (30 <= (robot.PathPointList [robot.PathPointList.Count - 1] [1] * 100))
            //{
            //robot.Halt ();
            //Console.WriteLine ("\n\n Has Gone 30cm \n\n");
            //}

            for (int i = 1; i < robot.PathPointList.Count; i++)
            {
                cairoContext.MoveTo (centerX + (robot.PathPointList [i - 1] [0] * 100), centerY - (robot.PathPointList [i - 1] [1] * 100));
                cairoContext.LineTo (centerX + (robot.PathPointList [i] [0] * 100), centerY - (robot.PathPointList [i] [1] * 100));
                //	Console.WriteLine (path[0]*100+" , "+ path[1]*100);
                cairoContext.Stroke ();
            }

            foreach (double[] path in robot.PathPointList)
            {
                //cairoContext.MoveTo (centerX - (path[0] * 100), centerY - (path[1] * 100));
            }
        }
开发者ID:abdulrahman-alhemmy,项目名称:slambot,代码行数:37,代码来源:PathView.cs

示例14: OnDrawn

        protected override bool OnDrawn(Cairo.Context cr)
        {
            double step_width = Allocation.Width / (double)steps;
            double step_height = Allocation.Height / (double)steps;
            double h = 1.0;
            double s = 0.0;

            for (int xi = 0, i = 0; xi < steps; xi++) {
                for (int yi = 0; yi < steps; yi++, i++) {
                    double bg_b = (double)(i / 255.0);
                    double fg_b = 1.0 - bg_b;

                    double x = xi * step_width;
                    double y = yi * step_height;

                    cr.Rectangle (x, y, step_width, step_height);
                    cr.Color = CairoExtensions.ColorFromHsb (h, s, bg_b);
                    cr.Fill ();

                    int tw, th;
                    Pango.Layout layout = new Pango.Layout (PangoContext);
                    layout.SetText (((int)(bg_b * 255.0)).ToString ());
                    layout.GetPixelSize (out tw, out th);

                    cr.Translate (0.5, 0.5);
                    cr.MoveTo (x + (step_width - tw) / 2.0, y + (step_height - th) / 2.0);
                    cr.Color = CairoExtensions.ColorFromHsb (h, s, fg_b);
                    PangoCairoHelper.ShowLayout (cr, layout);
                    cr.Translate (-0.5, -0.5);
                }
            }

            return true;
        }
开发者ID:knocte,项目名称:hyena,代码行数:34,代码来源:ShadingTestWindow.cs

示例15: Draw

		internal protected override void Draw (Cairo.Context cr, Cairo.Rectangle area, LineSegment lineSegment, int line, double x, double y, double lineHeight)
		{
			cr.MoveTo (x + 0.5, y);
			cr.LineTo (x + 0.5, y + lineHeight);
			cr.Color = color;
			cr.Stroke ();
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:7,代码来源:DashedLineMargin.cs


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