Fixes 2343 - LineCanvas not respecting X and Y of clip bounds#2344
Fixes 2343 - LineCanvas not respecting X and Y of clip bounds#2344tig merged 8 commits intogui-cs:developfrom
Conversation
tig
left a comment
There was a problem hiding this comment.
How come you didn't include the unit test I provided in my Issue?
I have use case where the I want to draw outside of View.Bounds and I need to be able to pass Draw a bounds that is larger than View.Bounds.
|
Changing this to draft while I have time to think about this more deeply set => Frame = new Rect (frame.Location, value.Size);And it's getter explicitly sets the point to 0: get => new Rect (Point.Empty, Frame.Size);235114e is definetly needed to fix My feeling is that with |
|
View.bounds also defines the nominal clip region too. Thinking about it more i don't really require this to be about view.bounds. What I need is an api that takes a rect and renders the canvas to it. I actually modified LineCanvas.Draw at one point in my adventures to treat rect as Screen relative if the view param was null. But I backed that out because I could figure how to make it work (now I know this was because of THIS issue). Lol. |
|
Ok. /// <summary>
/// Draws all the lines that lie within the <paramref name="sourceRect"/> onto
/// the <paramref name="view"/> client area at given <paramref name="drawOffset"/>.
/// This method should be called from
/// <see cref="View.Redraw(Rect)"/>.
/// </summary>
/// <param name="view"></param>
/// <param name="sourceRect">The area of the canvas to draw.</param>
/// <param name="drawOffset">The point within the client area of
/// <paramref name="view"/> to draw at.</param>
public void Draw (View view, Rect sourceRect, Point? drawOffset = null)
{
...
}I've updated your test to The new draw method implementation changes the following:
This method uses
We could add a public void DrawToScreen(Rect sourceRect, Point? screenDrawOffset = null) |
Let me ask this question:
The ONLY place you reference I've been thinking a ton about the current (Oh, and, BTW, referring to I think a primitive drawing API like |
|
Fair points. This is definitely worth exploring to get a good API. LineCanvas is indeed a primitive self contained class. Originally the 'output' method of the class was only the public method I added I can delete the |
Do you mean you want less references to "screen" (e.g. ScreenToView, ViewToScreen)... Frame is not the same as screen. Views can be nested and the Frame property is just the location within the immediate parent's client area. So they are 3 separate things (client area, frame and screen). I think there is still value in using the 'screen' terminology for what you get when you use |
|
Ok have switched to Dictionary as return type of So should be super easy to use in any context regardless of whether it is client area or screen coordinates or writing out to a file etc etc. Since we have not done any releases this should just be a breaking change for the split container PR (which will be easy to fix). |
Fixes #2343 -
GenerateImageno longer assumes clip area starts at 0,0Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)