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 (); }
static void draw (Cairo.Context gr, int width, int height) { double xc = 0.5; double yc = 0.5; double radius = 0.4; double angle1 = 45.0 * (M_PI/180.0); /* angles are specified */ double angle2 = 180.0 * (M_PI/180.0); /* in radians */ gr.Scale (width, height); gr.LineWidth = 0.04; gr.ArcNegative (xc, yc, radius, angle1, angle2); gr.Stroke (); /* draw helping lines */ gr.Color = new Color(1, 0.2, 0.2, 0.6); gr.Arc (xc, yc, 0.05, 0, 2*M_PI); gr.Fill (); gr.LineWidth = 0.03; gr.Arc (xc, yc, radius, angle1, angle1); gr.LineTo (new PointD(xc, yc)); gr.Arc (xc, yc, radius, angle2, angle2); gr.LineTo (new PointD(xc, yc)); gr.Stroke (); }
protected override void DrawFrame (Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor) { // base.DrawFrame (context, lineWidth, lineColor, fillColor); rect = DisplayBox; rect.OffsetDot5(); // HERZUM SPRINT 1.2 // CairoFigures.CurvedRectangle(context, rect, 30); CairoFigures.AngleFrame(context, rect, 0,0,0,0); // END HERZUM SPRINT 1.2 Cairo.Color fillColorOrigin; fillColorOrigin = fillColor; lineWidth = 1; fillColor = new Cairo.Color (1.0, 1.0, 1.0, 1.0); context.Color = fillColor; context.FillPreserve(); context.Color = lineColor; context.LineWidth = lineWidth; double[] dash = {2, 0, 2}; context.SetDash (dash, 0); context.Stroke(); rect2 = DisplayBox; rect2.Width = DisplayBox.Width; rect2.Height = 30; rect2.OffsetDot5(); CairoFigures.CurvedRectangle(context, rect2, 30); fillColor = fillColorOrigin; context.Color = fillColor; context.FillPreserve(); context.Color = lineColor; context.LineWidth = lineWidth; context.Stroke(); // HERZUM SPRINT 2.1 // m_applicationContext.MainWindow.ExperimentCanvasPad.LoopNodeControlCurrent = this; // END HERZUM SPRINT 2.1 // HERZUM SPRINT 5.0: TLAB-235 // DrawScope (); DrawScope ("Enter","Exit"); // END HERZUM SPRINT 5.0: TLAB-235 }
/// <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)); } }
private void Draw(Cairo.Context cr, int width, int heigth) { foreach (var path in pathPosition.Keys) { var pPosition = pathPosition[path]; var begin = pPosition.Item1; var end = pPosition.Item2; cr.SetSourceRGB(1, 1, 1); cr.MoveTo(begin.X, begin.Y); cr.LineTo(end.X, end.Y); cr.Stroke(); cr.SetSourceRGB(0, 0, 0); } foreach (var path in pathPosition.Keys) { var pPosition = pathPosition[path]; var begin = pPosition.Item1; var end = pPosition.Item2; if (path is BlockingPath) { var blockingPath = path as BlockingPath; if (blockingPath.IsBlocked) { cr.SetSourceRGB(1, 0, 0); } else { cr.SetSourceRGB(0, 1, 0); } cr.Rectangle(new Cairo.Rectangle(end.X - 6, end.Y - 6, 12, 12)); cr.Fill(); cr.SetSourceRGB(0, 0, 0); } else if (path is SourcePath) { var sourcePath = path as SourcePath; cr.MoveTo(begin.X, begin.Y); cr.TextPath(sourcePath.Queue.ToString()); cr.Fill(); } foreach (var vehicle in path.VehiclePosition.Keys) { var position = path.VehiclePosition[vehicle]; var r = position / path.Length; var x = begin.X + (end.X - begin.X) * r; var y = begin.Y + (end.Y - begin.Y) * r; cr.Arc(x, y, 5, 0, 2 * Math.PI); cr.Fill(); } } cr.Stroke(); }
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; }
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; }
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 (); }
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 (); }
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 (); }
static void DrawIcon (MonoTextEditor editor, Cairo.Context cr, DocumentLine lineSegment, double x, double y, double width, double height) { if (lineSegment.IsBookmarked) { var color1 = editor.ColorStyle.Bookmarks.Color; var color2 = editor.ColorStyle.Bookmarks.SecondColor; DrawRoundRectangle (cr, x + 1, y + 1, 8, width - 4, height - 4); // FIXME: VV: Remove gradient features using (var pat = new Cairo.LinearGradient (x + width / 4, y, x + width / 2, y + height - 4)) { pat.AddColorStop (0, color1); pat.AddColorStop (1, color2); cr.SetSource (pat); cr.FillPreserve (); } // FIXME: VV: Remove gradient features using (var pat = new Cairo.LinearGradient (x, y + height, x + width, y)) { pat.AddColorStop (0, color2); //pat.AddColorStop (1, color1); cr.SetSource (pat); cr.Stroke (); } } }
public override void BasicDraw(Cairo.Context context) { context.Rectangle(DisplayBox.X, DisplayBox.Y, DisplayBox.Width, DisplayBox.Height); context.Stroke(); classname.BasicDraw(context); }
public static void RenderLine(Cairo.Context g, Cairo.Color c, double lw, double x0, double y0, double x1, double y1) { g.Save(); g.Color = c; g.LineWidth = 3; g.MoveTo(x0, y0); g.LineTo(x1, y1); g.Stroke(); g.Restore(); }
void DrawHand (double fThickness, double length, Cairo.Color color, double radians, Cairo.Context e) { e.MoveTo (new Cairo.PointD (center.X - (length / 9 * Math.Sin (radians)), center.Y + (length / 9 * Math.Cos (radians)))); e.LineTo (new Cairo.PointD (center.X + (length * Math.Sin (radians)), center.Y - (length * Math.Cos (radians)))); e.ClosePath (); e.LineCap = Cairo.LineCap.Round; e.LineJoin = Cairo.LineJoin.Round; e.Color = color; e.LineWidth = fThickness; e.Stroke (); }
protected override void DrawFrame (Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor) { RectangleD rect = DisplayBox; rect.OffsetDot5(); CairoFigures.AngleFrame(context, rect, 15, 0, 15, 0); context.Color = fillColor; context.FillPreserve(); context.Color = lineColor; context.LineWidth = lineWidth; context.Stroke(); }
public override void Draw(Cairo.Context cr) { cr.Save(); cr.Color = new Color(1.0, 1.0, 1.0); cr.Rectangle(X0, Y0, X1 - X0, Y1 - Y0); cr.Fill(); cr.Color = new Color(0.0, 0.0, 0.0); cr.Rectangle(X0, Y0, X1 - X0, Y1 - Y0); cr.Stroke(); cr.Restore(); }
void DrawFace (Cairo.PointD center, double radius, Cairo.Context e) { e.Arc (center.X, center.Y, radius, 0, 360); Cairo.Gradient pat = new Cairo.LinearGradient (100, 200, 200, 100); pat.AddColorStop (0, Generator.ConvertC (new Eto.Drawing.Color (240, 240, 230, 75))); pat.AddColorStop (1, Generator.ConvertC (new Eto.Drawing.Color (0, 0, 0, 50))); e.LineWidth = 0.1; e.Pattern = pat; e.FillPreserve (); e.Stroke (); }
public static void DrawTriangle(Cairo.Context g, double x, double y, int width, int height, Cairo.Color color) { g.Color = color; g.MoveTo(x, y); g.LineTo(x + width/2, y-height); g.LineTo(x - width/2, y-height); g.ClosePath(); g.Fill(); g.Stroke(); }
public static void DrawLine(Cairo.Context g, double x1, double y1, double x2, double y2, int width, Cairo.Color color) { g.Color = color; g.Operator = Operator.Over; g.LineWidth = width; g.MoveTo(x1, y1); g.LineTo(x2,y2); g.Stroke(); }
static void DrawFace (Cairo.PointD center, double radius, Cairo.Context e) { e.Arc (center.X, center.Y, radius, 0, 360); Cairo.Gradient pat = new Cairo.LinearGradient (100, 200, 200, 100); pat.AddColorStop (0, Eto.Drawing.Color.FromArgb (240, 240, 230, 75).ToCairo ()); pat.AddColorStop (1, Eto.Drawing.Color.FromArgb (0, 0, 0, 50).ToCairo ()); e.LineWidth = 0.1; e.Pattern = pat; e.FillPreserve (); e.Stroke (); }
protected override void DrawFrame (Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor) { RectangleD rect = DisplayBox; rect.OffsetDot5(); context.Rectangle(GdkCairoHelper.CairoRectangle(rect)); context.Color = fillColor; context.FillPreserve(); context.Color = lineColor; context.LineWidth = lineWidth; context.Stroke(); }
public void draw(Cairo.Context cr) { cr.LineWidth = 3; cr.SetSourceRGB(0, 0.9, 0.0); //cr.Translate (l1.P1.X, l1.P1.Y); cr.MoveTo(position); cr.LineTo (position.X + width, position.Y); cr.LineTo (position.X + width, position.Y + height); cr.LineTo (position.X, position.Y + height); cr.LineTo (position.X, position.Y); cr.Stroke (); }
public override void Draw (Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, LineMetrics metrics, int startOffset, int endOffset) { this.editor = editor; var line = editor.GetLine (loc.Line); if (line == null) return; var x = editor.ColumnToX (line, loc.Column) - editor.HAdjustment.Value + editor.TextViewMargin.XOffset + editor.TextViewMargin.TextStartPosition; cr.Rectangle (Math.Floor (x) + 0.5, Math.Floor (metrics.LineYRenderStartPosition) + 0.5 + (line == editor.GetLineByOffset (startOffset) ? editor.LineHeight - tagMarkerHeight - 1 : 0), tagMarkerWidth * cr.LineWidth, tagMarkerHeight * cr.LineWidth); if (HslColor.Brightness (editor.ColorStyle.PlainText.Background) < 0.5) { cr.SetSourceRGBA (0.8, 0.8, 1, 0.9); } else { cr.SetSourceRGBA (0.2, 0.2, 1, 0.9); } cr.Stroke (); }
static void draw (Cairo.Context gr, int width, int height) { gr.Scale (width, height); gr.LineWidth = 0.04; 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 (); }
public void DrawIcon (TextEditor editor, Cairo.Context cr, LineSegment lineSegment, int lineNumber, double x, double y, double width, double height) { if (lineSegment.IsBookmarked) { Cairo.Color color1 = editor.ColorStyle.BookmarkColor1; Cairo.Color color2 = editor.ColorStyle.BookmarkColor2; DrawRoundRectangle (cr, x + 1, y + 1, 8, width - 4, height - 4); Cairo.Gradient pat = new Cairo.LinearGradient (x + width / 4, y, x + width / 2, y + height - 4); pat.AddColorStop (0, color1); pat.AddColorStop (1, color2); cr.Pattern = pat; cr.FillPreserve (); pat = new Cairo.LinearGradient (x, y + height, x + width, y); pat.AddColorStop (0, color2); //pat.AddColorStop (1, color1); cr.Pattern = pat; cr.Stroke (); } }
void IIconBarMarker.DrawBackground (TextEditor ed, Cairo.Context cr, DocumentLine line, int lineNumber, double x, double y, double width, double height) { cr.Rectangle (x, y, width, height); cr.Color = LineColor.SecondColor; cr.Fill (); cr.MoveTo (x + width - 0.5, y); cr.LineTo (x + width - 0.5, y + height); cr.Color = LineColor.BorderColor; cr.Stroke (); if (cache.CurrentSelectedTextMarker != null && cache.CurrentSelectedTextMarker != this) { cr.Rectangle (x, y, width, height); cr.Color = new Cairo.Color (ed.ColorStyle.IndicatorMargin.Color.R, ed.ColorStyle.IndicatorMargin.Color.G, ed.ColorStyle.IndicatorMargin.Color.B, 0.5); cr.Fill (); } }
static void draw (Cairo.Context gr, int width, int height) { gr.Scale (width, height); gr.LineWidth = 0.04; gr.SelectFontFace ("Sans", FontSlant.Normal, FontWeight.Bold); gr.SetFontSize (0.35); gr.MoveTo ( new PointD(0.04, 0.53) ); gr.ShowText ("Hello"); gr.MoveTo ( new PointD(0.27, 0.65) ); gr.TextPath ("void"); gr.ColorRgb = new Color (0.5, 0.5, 1, 0); gr.FillPreserve (); gr.ColorRgb = new Color (0, 0, 0, 0); gr.LineWidth = 0.01; gr.Stroke (); gr.Color = new Color (1,0.2,0.2, 0.6); gr.Arc (0.04, 0.53, 0.02, 0, 2*M_PI); gr.Arc (0.27, 0.65, 0.02, 0, 2*M_PI); gr.Fill (); }
protected void DrawLeftBorder (Cairo.Context cr) { cr.MoveTo (0.5, 0); cr.LineTo (0.5, Allocation.Height); if (TextEditor.ColorStyle != null) { var col = (HslColor)TextEditor.ColorStyle.PlainText.Background; if (!Platform.IsWindows) { col.L *= 0.88; } cr.SetSourceColor (col); } cr.Stroke (); }
void DrawIndicator (Cairo.Context cr, Cairo.Color color, Cairo.Color borderColor) { var width = Allocation.Width; int diameter = Math.Min (width, (int)IndicatorHeight) - indicatorPadding * 2; var x1 = Math.Round (width / 2d); double y1 = indicatorPadding + diameter / 2; if (diameter % 2 == 0) { x1 += 0.5; y1 += 0.5; } cr.Arc (x1, y1, diameter / 2d, 0, 2 * Math.PI); if (Platform.IsWindows) { using (var pattern = new Cairo.SolidPattern (color)) { cr.SetSource (pattern); cr.FillPreserve (); } } else { using (var pattern = new Cairo.RadialGradient (x1, y1, width / 2, x1 - width, y1 - width, width)) { pattern.AddColorStop (0, borderColor); pattern.AddColorStop (1, color); cr.SetSource (pattern); cr.FillPreserve (); } } cr.SetSourceColor (borderColor); cr.Stroke (); }
void DrawProgressBar (Cairo.Context context, double progress, Gdk.Rectangle bounding, StatusArea.RenderArg arg) { LayoutRoundedRectangle (context, new Gdk.Rectangle (bounding.X, bounding.Y, (int) (bounding.Width * progress), bounding.Height)); context.Clip (); LayoutRoundedRectangle (context, bounding); context.Color = Styles.WithAlpha (Styles.StatusBarProgressBackgroundColor, Styles.StatusBarProgressBackgroundColor.A * arg.ProgressBarAlpha); context.FillPreserve (); context.ResetClip (); context.Color = Styles.WithAlpha (Styles.StatusBarProgressOutlineColor, Styles.StatusBarProgressOutlineColor.A * arg.ProgressBarAlpha); context.LineWidth = 1; context.Stroke (); }