protected override void DrawSubCell(SKCanvas g, TextureTile tile, Direction direction, Color c) { var baseArea = GetTileArea(tile); var tileArea = GetSubTileAreaForDirection(direction, baseArea); g.DrawRectangle(c, new IntRect(tileArea.X, tileArea.Y, tileArea.Width - 1, tileArea.Height - 1)); }
void DrawBorder(SKCanvas graphics) { if ((grid.FormattingMetaData.Border ?? 1) > 0) { Color color = grid.FormattingMetaData.BorderColor ?? Colors.Gainsboro; graphics.DrawRectangle(color, new IntRect(Offset.X, Offset.Y, Size.Width, Size.Height)); } }
/// <summary> /// Draws a focus rectangle. /// </summary> public static void DrawFocusRectangle(this SKCanvas canvas, int x, int y, int width, int height, int inset = 0) { // Draw a white rectangle canvas.DrawRectangle(x + inset, y + inset, width - (2 * inset) - 1, height - (2 * inset) - 1, SKColors.White); // Draw a black dashed rectangle on top of it var effect = SKPathEffect.CreateDash(new[] { 1f, 1f }, 0); using var paint = new SKPaint { Color = SKColors.Black, IsStroke = true, StrokeWidth = 1, PathEffect = effect }; canvas.DrawRect(x + inset, y + inset, width - (2 * inset) - 1, height - (2 * inset) - 1, paint); }
public override void Draw(SKCanvas g, TextureTile tile) { DrawCellFrame(g, tile); var pen = Grid.TextureTileFormattingMetaData.TileOutlineColor ?? Preferences.DefaultTileColor; // to be pixel perfect, the rectangle size must be reduced by one so that the // line is drawing within the tile area. var tileArea = GetTileArea(tile); g.DrawRectangle(pen, tileArea); DrawSelectorHint(g, tile); DrawAnchor(g, tile); }
public static void DrawPixel(this SKCanvas g, Color color, int x1, int y1) { g.DrawRectangle(color, new IntRect(x1, y1, 1, 1)); }