southpolenator / SharpDebug

C# debugging automation tool
MIT License
92 stars 30 forks source link

example of using drawing interface #42

Open kapilth opened 4 years ago

kapilth commented 4 years ago

Are there examples on how to use the drawing interface?

southpolenator commented 4 years ago

In interactive mode you can write something like this:

// Import IGraphics extensions and Color struct
using SharpDebug.Drawing.Interfaces;

// Create canvas
var canvas = Graphics.CreateCanvas();

// Create some objects
var circle = Grapchics.CreateCircle(Color.Cyan, 100, 100, 10);
var line = Grapchics.CreateLine(Color.Gray, 10, 10, 200, 200);

// Add objects to canvas
canvas.AddDrawing(circle);
canvas.AddDrawing(line);

// Show canvas on screen
canvas.Dump();

You can find more about drawing function by looking at IGraphics interface and by looking at IGraphics extension methods.

Basic idea of drawing interfaces is that you want to visualize some existing data using primitive objects and don't care if you are in UI thread, remote debugging, etc. If you are executing some computer vision algorithm and you want to debug it, you can visualize image and draw results on top of it at every breakpoint. You can also use scripts not to type it over and over again.