-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds LineCanvas #2281
Adds LineCanvas #2281
Conversation
@tznind how about to do the same feature for double lines and for rounded corners, single and double lines? |
Should be pretty easy to add a setting for rounded corners on the class. It already supports double lines and mixing and matching single and double lines. |
Great. The |
💘 |
Why StraightLineCanvas? Why not just LineCanvas? I can't imagine (probably because I'm dum) anything but straight lines in a TUI. |
Hmn its not great is it... I was trying to articulate that it only supports I think you are right though and we can probably just go with And who knows maybe down the line we do add support for other line types e.g. with braille: |
I've marked this ready. There is room for improvement later on e.g. when making a T that goes from a double line down to a single line you can use ╨ but the number of combinations gets big fast and it would need quite a bit of work to implement them all. We can always go down that route later. |
You are right. I think for now you can force to all borders being single or double (vertical and horizontal). When you have time then you will have a lot of work 😃. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this puppy ready?
Rename Drawing Scenario Make API simpler by directly referencing Application.Driver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome.
One question @tznind - have you considered how ConsoleDriver.DrawFrame would be re-factored to use this?
Thanks for review and merge. I'll take a look into refactoring frame drawing, should cut down the code quite a bit but will have to be careful not to make mistakes and add good code coverage. Currently would be something like the below. But could add helper methods to LineCanvas to make it less verbose. var canvas = new LineCanvas();
canvas.AddLine(new Point(region.X + paddingLeft,fleft),fwidth,Orientation.Horizontal,borderStyle);
canvas.AddLine(new Point(ftop,fleft),fheight,Orientation.Vertical,borderStyle);
// TODO: Add lower left lines up and left
var bmp = canvas.GenerateImage(region);
for(int y=0;y< bmp.GetLength(0) ;y++)
for(int x=0;x< bmp.GetLength(1) ;x++)
{
var rune = bmp[y,x];
if(rune.HasValue)
{
AddRuneAt (region.X + x, region.Y + y, rune.Value);
}
} |
Fixes #_____ - Adds new class for drawing connected lines in arbitrary configurations
Pull Request checklist:
CTRL-K-D
to automatically reformat your files before committing.dotnet test
before commit///
style comments)