public void Draw(CanvasDrawingSession canvas) { Color color = new Color(); if (TravellingLeftward) { color.R = 51; color.B = 255; color.G = 51; color.A = 255; } else { color.R = 204; color.B = 0; color.G = 0; color.A = 255; } Rect rect = new Rect(GetCarColumn(), GetCarRow(), CAR_WIDTH, CAR_HEIGTH); canvas.FillRectangle(rect, color); canvas.DrawRectangle(rect, color); //canvas.DrawRectangle(8*64, 10*64, 64, 64, Colors.Red); canvas.DrawRectangle((int)GetCarColumn(), (int)GetCarRow(), CAR_WIDTH, CAR_HEIGTH, Colors.Blue); }
public void draw(CanvasDrawingSession canvas) { // color selector canvas.DrawRectangle(selector_color, Colors.White); canvas.FillRectangle(selector_color, Colors.Blue); // song selector canvas.DrawRectangle(selector_music, Colors.White); canvas.FillRectangle(selector_music, Colors.LimeGreen); }
public override void Draw(CanvasDrawingSession session) { if (this.exists) { int per = (int)((100 * this.duration) / this.maxDuration); CanvasTextFormat textFormat = new CanvasTextFormat(); textFormat.FontSize = 15; Vector2 textPos = new Vector2((float)(this.position.X + (this.size.Width / 2) - textFormat.FontSize), (float)(this.position.Y + (this.size.Height / 2) - textFormat.FontSize)); session.DrawText(per.ToString() + "%", textPos, this.c, textFormat); Rect rect = new Rect(); rect.X = this.position.X; rect.Y = this.position.Y; rect.Width = this.size.Width; rect.Height = this.size.Height; if (rectShapeEnable) { session.DrawRectangle(rect, this.c); } else { session.DrawCircle((float)(rect.X + (rect.Width / 2)), (float)(rect.Y + (rect.Width / 2)), (float)rect.Width / 2, this.c); } Rect rayon = new Rect(); int r_w = (int)((size.Width * 2) - (((size.Width * 2) * this.duration) / this.maxDuration)); int r_h = (int)((size.Height * 2) - (((size.Height * 2) * this.duration) / this.maxDuration)); rayon.X = this.position.X - ((r_w - this.size.Width) / 2); rayon.Y = this.position.Y - ((r_h - this.size.Height) / 2); rayon.Width = r_w; rayon.Height = r_h; byte alpha = (byte)(255 - ((255 * this.duration) / this.maxDuration)); if (rectShapeEnable) { session.DrawRectangle(rayon, Color.FromArgb(alpha, 0, 255, 0)); } else { session.DrawCircle((float)(rayon.X + (rayon.Width / 2)), (float)(rayon.Y + (rayon.Width / 2)), (float)rayon.Width / 2, Color.FromArgb(alpha, 0, 255, 0)); } if (this.isHover) { CanvasTextFormat f = new CanvasTextFormat(); f.FontSize = 10; int cpd = (int)(this.clickCount > 0 ? this.duration / this.clickCount : 0); int cpdper = (int)(cpd * 100 / this.maxDuration); string info = "now (%): " + per + "/100 \nnow: " + this.duration + "\nend: " + this.maxDuration + "\nclick: " + this.clickCount + "\ncpd:" + cpd + "\ncpd(%): " + cpdper + "\n(" + this.positionHover.X + ";" + this.positionHover.Y + ")"; session.DrawText(info, this.positionHover, this.c, f); } } }
public void Render(CanvasDrawingSession session, bool renderControls) { #if DRAW_OUTLINE session.DrawRectangle(RenderBounds.ToRect(), Colors.Green); if (Parent != null) { session.DrawRectangle(RenderBoundsWithParent.ToRect(), Colors.Blue); } #endif bodyGeometry.Render(this, session, Resources.FindColor(Node), renderControls); }
public override void Render(Win2DRenderable renderable, CanvasDrawingSession session, Win2DColor color, bool renderSelection) { var borderBrush = renderable.Resources.ThemeDarkBrush(color); var backgroundBrush = renderable.Node.IsSelected ? renderable.Resources.ThemeLightBrush(color) : renderable.Resources.ThemeNormalBrush(color); var bounds = renderable.RenderBounds.ToRect(); if (borderRadius > 0) { session.FillRoundedRectangle(bounds, borderRadius, borderRadius, backgroundBrush); session.DrawRoundedRectangle(bounds, borderRadius, borderRadius, borderBrush); } else { session.FillRectangle(bounds, backgroundBrush); session.DrawRectangle(bounds, borderBrush); } RenderIcon(renderable, session); RenderText(renderable, session); RenderCheckBox(renderable, session); if (!renderSelection) { return; } if (renderable.Node.IsSelected) { var rect = Rect2.Deflate(renderable.RenderBounds, SelectionMargin).ToRect(); if (borderRadius > 0) { session.DrawRoundedRectangle(rect, borderRadius * 1.4f, borderRadius * 1.4f, borderBrush, 2f, SelectionStrokeStyle); } else { session.DrawRectangle(rect, borderBrush, 2f, SelectionStrokeStyle); } } RenderExpandButton(renderable, session); RenderNotesButton(renderable, session); }
public void Draw(CanvasDrawingSession ds, int frameCounter, float width, float height) { var sz = sourceBitmap.Size; Rect sourceRect = new Rect( sz.Width * 0.25 + Math.Sin(frameCounter * 0.02) * (sz.Width * 0.5), sz.Height * 0.25 + Math.Cos(frameCounter * 0.01) * (sz.Height * 0.5), sz.Width * 0.5, sz.Height * 0.5); double y = DrawSourceImage(ds, sourceRect, width); double displayWidth = width / 2; double x = displayWidth; double destHeight = (height - y) / 3; Rect bitmapDestRect = new Rect(x, y + 5, displayWidth, destHeight - 10); y += destHeight; Rect bitmapDestRect2 = new Rect(x, y + 5, displayWidth, destHeight - 10); y += destHeight; Rect effectDestRect = new Rect(x, y + 5, displayWidth, destHeight - 10); var format = new CanvasTextFormat() { FontSize = 14, HorizontalAlignment = CanvasHorizontalAlignment.Right, VerticalAlignment = CanvasVerticalAlignment.Center }; ds.DrawText("D2D DrawBitmap", 0, (float)bitmapDestRect.Y, (float)displayWidth - 10, (float)destHeight, Colors.White, format); ds.DrawText("D2D DrawImage (bitmap)", 0, (float)bitmapDestRect2.Y, (float)displayWidth - 10, (float)destHeight, Colors.White, format); ds.DrawText("D2D DrawImage (effect)", 0, (float)effectDestRect.Y, (float)displayWidth - 10, (float)destHeight, Colors.White, format); ds.FillRectangle(bitmapDestRect, fillPattern); ds.FillRectangle(bitmapDestRect2, fillPattern); ds.FillRectangle(effectDestRect, fillPattern); ds.DrawImage(sourceBitmap, bitmapDestRect, sourceRect); ds.DrawImage(sourceBitmap, bitmapDestRect2, sourceRect, 1, CanvasImageInterpolation.Cubic); ds.DrawImage(sourceEffect, effectDestRect, sourceRect); ds.DrawRectangle(bitmapDestRect, Colors.Yellow, 1, hairline); ds.DrawRectangle(bitmapDestRect2, Colors.Yellow, 1, hairline); ds.DrawRectangle(effectDestRect, Colors.Yellow, 1, hairline); }
private static void DrawRectangleInternal( CanvasDrawingSession ds, Color brush, Color pen, CanvasStrokeStyle ss, bool isStroked, bool isFilled, ref Rect2 rect, double strokeWidth) { if (isFilled) { ds.FillRectangle( (float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height, brush); } if (isStroked) { ds.DrawRectangle( (float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height, pen, (float)strokeWidth, ss); } }
protected void canvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args) { this.EnsureResources(sender, args); CanvasDrawingSession ds = args.DrawingSession; float height = (float)(sender.ActualHeight * _gaugeGridHeight); float yTop = (float)(sender.ActualHeight - height) / 2F; float xRight = (float)(sender.ActualWidth * _gaugeGridWidth); float xLeft = xRight - c_gaugeWidth; Rect rect = new Rect(xLeft, yTop, c_gaugeWidth, height); ds.DrawRectangle(rect, this.GaugePointerColor, c_boxThickness); xLeft += 2F * c_boxThickness; height -= 4F * c_boxThickness; yTop += 2F * c_boxThickness; float increment = (float)(height / (this.MaxValue - this.MinValue)); yTop = (float)(yTop + height - ((this.Value - this.MinValue) * increment)); height = (float)(height * this.PercentFull); height = Math.Max(1, height); rect = new Rect(xLeft, yTop, c_gaugeWidth - 4 * c_boxThickness, height); ds.FillRectangle(rect, this.GaugePointerColor); }
internal virtual void drawRect(int x, int y, int w, int h, int stroke) { //using (createAlphaLayer()) //{ graphics.DrawRectangle(x, y, w, h, Color.FromArgb((byte)alpha, c.R, c.G, c.B), stroke); //} }
public void draw(CanvasDrawingSession g2d) { Color fillbrush = color; g2d.FillRectangle(pickRect, fillbrush); g2d.DrawRectangle(pickRect, blackpen, linesize); }
internal virtual void drawRect(int x, int y, int w, int h, int stroke) { using (createAlphaLayer()) { graphics.DrawRectangle(x, y, w, h, c, stroke); } }
public void Draw(CanvasDrawingSession graphics, float scale) { var stickness = 1; var radius = 8; CanvasStrokeStyle style = new CanvasStrokeStyle(); style.DashCap = CanvasCapStyle.Square; style.DashStyle = CanvasDashStyle.Dash; style.StartCap = CanvasCapStyle.Round; style.EndCap = CanvasCapStyle.Round; graphics.FillRectangle(Region, Color.FromArgb(100, 0XFF, 0XFF, 0XFF)); graphics.DrawRectangle(Region, DrawColor, stickness); //矩形 if (Width > 50 && Height > 50) //当满足条件时 绘制九宫格 { graphics.DrawLine((float)Left, (float)(Top + (Height / 3)), (float)(Left + Width), (float)(Top + Height / 3), Colors.Orange, 0.3f, style); graphics.DrawLine((float)Left, (float)(Top + (Height * 2 / 3)), (float)(Left + Width), (float)(Top + Height * 2 / 3), Colors.Orange, 0.3f, style); graphics.DrawLine((float)(Left + Width / 3), (float)Top, (float)(Left + Width / 3), (float)(Top + Height), Colors.Orange, 0.3f, style); graphics.DrawLine((float)(Left + Width * 2 / 3), (float)Top, (float)(Left + Width * 2 / 3), (float)(Top + Height), Colors.Orange, 0.3f, style); } graphics.FillCircle((float)Left, (float)Top, radius, DrawColor); //× graphics.DrawLine((float)Left - 4, (float)Top - 4, (float)Left + 4, (float)Top + 4, Colors.White); graphics.DrawLine((float)Left - 4, (float)Top + 4, (float)Left + 4, (float)Top - 4, Colors.White); graphics.FillCircle((float)(Left + Width), (float)Top, radius, DrawColor); //√ graphics.DrawLine((float)(Left + Width - 4), (float)(Top - 1), (float)(Left + Width), (float)(Top + 3), Colors.White); graphics.DrawLine((float)(Left + Width), (float)(Top + 3), (float)(Left + Width + 4), (float)(Top - 4), Colors.White); graphics.FillCircle((float)(Left + Width), (float)(Top + Height), radius, DrawColor); //缩放 graphics.DrawLine((float)(Left + Width - 4), (float)(Top + Height - 4), (float)(Left + Width + 4), (float)(Top + Height + 4), Colors.White); graphics.DrawLine((float)(Left + Width - 4), (float)(Top + Height - 4), (float)(Left + Width - 4), (float)(Top + Height), Colors.White); graphics.DrawLine((float)(Left + Width - 4), (float)(Top + Height - 4), (float)(Left + Width), (float)(Top + Height - 4), Colors.White); graphics.DrawLine((float)(Left + Width + 4), (float)(Top + Height + 4), (float)(Left + Width), (float)(Top + Height + 4), Colors.White); graphics.DrawLine((float)(Left + Width + 4), (float)(Top + Height + 4), (float)(Left + Width + 4), (float)(Top + Height), Colors.White); }
private void DrawBackground(Rect rect, CanvasDrawingSession session) { CanvasBitmap bitmapToDraw = null; switch (_boardTheme) { case BoardTheme.SolidColor: session.FillRectangle(rect, _sharedBoardControlState.BoardColor.ToUWPColor()); break; case BoardTheme.OakWood: bitmapToDraw = oakBitmap; break; case BoardTheme.KayaWood: bitmapToDraw = kayaBitmap; break; case BoardTheme.SabakiBoard: bitmapToDraw = sabakiBoardBitmap; break; } if (bitmapToDraw != null) { session.DrawImage(bitmapToDraw, rect); } session.DrawRectangle(rect, Colors.Black, 2); }
/// <summary> /// 绘制 /// </summary> /// <param name="graphics"></param> public void Draw(CanvasDrawingSession graphics, float scale) { if (Image != null) { graphics.DrawImage(Image, new Rect((X - (Width / 2)) * scale, (Y - (Height / 2)) * scale, Width * scale, Height * scale)); } //else //{ // graphics.DrawText("loading...", ((float)X - 12) * scale, ((float)Y - 2) * scale, Colors.Orange, new Microsoft.Graphics.Canvas.Text.CanvasTextFormat() { FontSize = 11 }); //} if (Editing && scale == 1) //如果是编辑状态 且 没有缩放 { graphics.DrawRectangle(new Rect(X - Width / 2 - 2, Y - Height / 2 - 2, Width + 4, Height + 4), Windows.UI.Colors.White, 0.5f, new CanvasStrokeStyle() { DashStyle = CanvasDashStyle.DashDot }); graphics.FillCircle((float)(X - Width / 2 - 2), (float)(Y - Height / 2 - 2), 8, Colors.White); //取消 graphics.DrawLine((float)(X - Width / 2 - 2) - 4, (float)(Y - Height / 2 - 2) - 4, (float)(X - Width / 2 - 2) + 4, (float)(Y - Height / 2 - 2) + 4, Colors.Black); graphics.DrawLine((float)(X - Width / 2 - 2) - 4, (float)(Y - Height / 2 - 2) + 4, (float)(X - Width / 2 - 2) + 4, (float)(Y - Height / 2 - 2) - 4, Colors.Black); graphics.FillCircle((float)(X + Width / 2 + 2), (float)(Y + Height / 2 + 2), 8, Colors.White); //缩放 graphics.DrawLine((float)(X + Width / 2 + 2 - 4), (float)(Y + Height / 2 + 2 - 4), (float)(X + Width / 2 + 2 + 4), (float)(Y + Height / 2 + 2 + 4), Colors.Black); graphics.DrawLine((float)(X + Width / 2 + 2 - 4), (float)(Y + Height / 2 + 2 - 4), (float)(X + Width / 2 + 2 - 4), (float)(Y + Height / 2 + 2), Colors.Black); graphics.DrawLine((float)(X + Width / 2 + 2 - 4), (float)(Y + Height / 2 + 2 - 4), (float)(X + Width / 2 + 2), (float)(Y + Height / 2 + 2 - 4), Colors.Black); graphics.DrawLine((float)(X + Width / 2 + 2 + 4), (float)(Y + Height / 2 + 2 + 4), (float)(X + Width / 2 + 2), (float)(Y + Height / 2 + 2 + 4), Colors.Black); graphics.DrawLine((float)(X + Width / 2 + 2 + 4), (float)(Y + Height / 2 + 2 + 4), (float)(X + Width / 2 + 2 + 4), (float)(Y + Height / 2 + 2), Colors.Black); } }
public void Render(Win2DRenderable renderable, CanvasDrawingSession session) { using (session.StackTransform(Matrix3x2.CreateTranslation(renderPosition))) { #if DRAW_OUTLINE session.DrawRectangle(0, 0, renderSize.X, renderSize.Y, Colors.Purple); #endif session.FillRectangle(0, 0, renderSize.X, renderSize.Y, Colors.White); session.DrawRectangle(0, 0, renderSize.X, renderSize.Y, Colors.Black); if (renderable.Node.IsChecked) { RenderCheck(session); } } }
internal void DrawHandle_sub(CanvasDrawingSession win2d, float x, float y, bool ellipse, Color color) { bool fill = false; int size = 4; if (ellipse) { if (fill) { win2d.FillEllipse(x, y, size, size, color); } else { win2d.DrawEllipse(x, y, size, size, color); } } else { Rect r = new Rect(x - size, y - size, size * 2, size * 2); if (fill) { win2d.FillRectangle(r, color); } else { win2d.DrawRectangle(r, color); } } }
public void Draw(CanvasDrawingSession graphics) { CanvasDevice device = CanvasDevice.GetSharedDevice(); var builder = new CanvasPathBuilder(device); var brush = new CanvasSolidColorBrush(graphics, drawingColor); graphics.DrawRectangle(x, y, width, height, brush, drawingSize); }
/// <summary> /// Draw the bitmap and healthbar of the hero /// </summary> /// <param name="cds"></param> public override void Draw(CanvasDrawingSession cds) { base.Draw(cds); //Draw Healthbar cds.DrawRectangle(HealthBar, Colors.Red); cds.FillRectangle((float)HealthBar.Left, (float)HealthBar.Top, (float)HealthBar.Width * CurrentHealth / MaxHealth, (float)HealthBar.Height, Colors.Red); }
public void Render(Win2DRenderable renderable, CanvasDrawingSession session) { #if DRAW_OUTLINE session.DrawRectangle(renderBounds.ToRect(), Colors.Turquoise); #endif var color = renderable.Node.HasNotes ? Colors.Black : Colors.Gray; session.DrawText(Glyph, renderPosition.X, renderPosition.Y, color, TextFormat); }
private void RenderCircle(CanvasDrawingSession session) { #if DRAW_OUTLINE session.DrawRectangle(renderBounds.ToRect(), Colors.Orange); #endif session.FillCircle(renderCenter, renderRadius, Colors.White); session.DrawCircle(renderCenter, renderRadius, Colors.DarkGray); }
void FillRectangle(Rect rect, Color color) { if (!isWireframe) { currentDrawingSession.FillRectangle(rect, color); } else { currentDrawingSession.DrawRectangle(rect, Colors.Black); } }
public void DrawRect(double x1, double y1, double x2, double y2, Paint paint) { UpdateDrawingSessionWithFlags(paint.Flags); _drawingSession.Transform = GetCurrentTransform(); var brush = new CanvasSolidColorBrush(_device, paint.Color); if (paint.Style == Paint.PaintStyle.Stroke) { _drawingSession.DrawRectangle((float)x1, (float)y1, (float)(x2 - x1), (float)(y2 - y1), brush, paint.StrokeWidth, GetCanvasStrokeStyle(paint)); } else { _drawingSession.FillRectangle((float)x1, (float)y1, (float)(x2 - x1), (float)(y2 - y1), brush); } if (paint.Xfermode.Mode == PorterDuff.Mode.Clear) { _drawingSession.Flush(); } }
void canvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args) { CanvasTextFormat centeredTextFormat = new CanvasTextFormat(); centeredTextFormat.HorizontalAlignment = CanvasHorizontalAlignment.Center; centeredTextFormat.VerticalAlignment = CanvasVerticalAlignment.Center; centeredTextFormat.FontSize = 30; if (photoCanvasBitmap != null) { CanvasRenderTarget tempRenderTarget = new CanvasRenderTarget(sender, photoCanvasBitmap.Size); using (CanvasDrawingSession ds = tempRenderTarget.CreateDrawingSession()) { // Begin by drawing the captured photo into the temporary render target ds.DrawImage(photoCanvasBitmap, new System.Numerics.Vector2(0, 0)); foreach (Face face in lastCapturedFaces) { Rect faceRect = new Rect(face.FaceRectangle.Left, face.FaceRectangle.Top, face.FaceRectangle.Width, face.FaceRectangle.Height); ds.DrawRectangle(faceRect, Colors.Red); CanvasPathBuilder pathBuilder = new CanvasPathBuilder(sender); Vector2 startingPoint = new Vector2((float)(faceRect.Left + faceRect.Width / 2), (float)faceRect.Top); pathBuilder.BeginFigure(startingPoint); pathBuilder.AddLine(startingPoint - new Vector2(Math.Max(70.0f, (float)faceRect.Width / 2), 10)); pathBuilder.AddLine(startingPoint - new Vector2(Math.Max(70.0f, (float)faceRect.Width / 2), 50)); pathBuilder.AddLine(startingPoint + new Vector2(Math.Max(70.0f, (float)faceRect.Width / 2), -50)); pathBuilder.AddLine(startingPoint + new Vector2(Math.Max(70.0f, (float)faceRect.Width / 2), -10)); pathBuilder.EndFigure(CanvasFigureLoop.Closed); // Draw the speech bubble above the face CanvasGeometry geometry = CanvasGeometry.CreatePath(pathBuilder); ds.FillGeometry(geometry, Colors.Yellow); // Draw the person's age and gender above the face String descString = face.Attributes.Gender.ToString() + ", " + face.Attributes.Age.ToString(); ds.DrawText(descString, startingPoint - new Vector2(0, 30), Colors.Orange, centeredTextFormat); } } // End by drawing the rendertarget into the center of the screen double imageScale = Math.Min(sender.RenderSize.Width / photoCanvasBitmap.Size.Width, sender.RenderSize.Height / tempRenderTarget.Size.Height); double newWidth = imageScale * tempRenderTarget.Size.Width; double newHeight = imageScale * tempRenderTarget.Size.Height; Rect targetRect = new Rect((sender.RenderSize.Width - newWidth) / 2, (sender.RenderSize.Height - newHeight) / 2, newWidth, newHeight); args.DrawingSession.DrawImage(tempRenderTarget, targetRect); } else { args.DrawingSession.DrawText("Processing...", (float)(sender.Size.Width / 2), (float)(sender.Size.Height / 2), Colors.White, centeredTextFormat); } }
public override void Draw(ICanvasResourceCreator creator, CanvasDrawingSession ds) { if (IsFill) { ds.FillRectangle(Bounds, PenAttribute.GetBrush(creator)); } else { ds.DrawRectangle(Bounds, PenAttribute.GetBrush(creator), PenAttribute.StrokeWidth, StrokeStyle); } }
private void DrawSpline(CanvasControl sender, CanvasDrawingSession ds, Vector2 startPoint, Vector2 controlPoint1, Vector2 controlPoint2, Vector2 endPoint, Color color) { var strokeThickness = 2f; // Draw the spline using (var pathBuilder = new CanvasPathBuilder(sender)) { pathBuilder.BeginFigure(startPoint); pathBuilder.AddCubicBezier(controlPoint1, controlPoint2, endPoint); pathBuilder.EndFigure(CanvasFigureLoop.Open); var geometry = CanvasGeometry.CreatePath(pathBuilder); ds.DrawGeometry(geometry, Vector2.Zero, color, strokeThickness); } // Draw Control Points if (_showControlPoints) { var strokeStyle = new CanvasStrokeStyle() { DashStyle = CanvasDashStyle.Dot }; ds.DrawLine(startPoint, controlPoint1, color, strokeThickness, strokeStyle); var rect1 = new Rect(controlPoint1.X - 3, controlPoint1.Y - 3, 6, 6); ds.FillRectangle(rect1, Colors.Beige); ds.DrawRectangle(rect1, color, strokeThickness); ds.DrawLine(endPoint, controlPoint2, color, strokeThickness, strokeStyle); var rect2 = new Rect(controlPoint2.X - 3, controlPoint2.Y - 3, 6, 6); ds.FillRectangle(rect2, Colors.Beige); ds.DrawRectangle(rect2, color, strokeThickness); } // Draw EndPoints ds.DrawCircle(startPoint, 5, color, strokeThickness); ds.FillCircle(startPoint, 5, Colors.Beige); ds.DrawCircle(endPoint, 5, color, strokeThickness); ds.FillCircle(endPoint, 5, Colors.Beige); }
public void Draw(CanvasDrawingSession graphics) { CanvasDevice device = CanvasDevice.GetSharedDevice(); var builder = new CanvasPathBuilder(device); var brush = new CanvasSolidColorBrush(graphics, drawingColor); var strokeStyle = new CanvasStrokeStyle() { DashStyle = CanvasDashStyle.Dash, DashOffset = 5f }; graphics.DrawRectangle(x, y, width, height, brush, drawingSize, strokeStyle); }
/// <summary>Draw Rectangle to canvas according to region</summary> public void DrawRectangle(float x, float y, float width, float height) { if (_fillColor.A > 0) { _session.FillRectangle(x, y, width, height, _fillColor); } if (_strokeColor.A > 0) { _session.DrawRectangle(x, y, width, height, _strokeColor, _strokeWidth, _strokeStyle); } }
public void draw(CanvasDrawingSession canvas) { //Draw body segment Rect rectForBodySegment = new Rect(); rectForBodySegment.X = x; rectForBodySegment.Y = y; rectForBodySegment.Width = l; rectForBodySegment.Height = l; canvas.DrawRectangle(rectForBodySegment, bodySegmentColor); canvas.FillRectangle(rectForBodySegment, bodySegmentColor); }
public void draw(CanvasDrawingSession canvas) { //Draw cover Rect recForCover = new Rect(); recForCover.X = X; recForCover.Y = Y; recForCover.Width = L; recForCover.Height = L; canvas.DrawRectangle(recForCover, coverColor); canvas.FillRectangle(recForCover, coverColor); }
private void DrawSelectionBoundingRect(CanvasDrawingSession ds) { if (selectionBoundingRect == null || selectionBoundingRect.Value.Width == 0 || selectionBoundingRect.Value.Height == 0 || selectionBoundingRect.Value.IsEmpty) { return; } ds.DrawRectangle(selectionBoundingRect.Value, Colors.Magenta); }