-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from jetelain/rounded-rectangle
Support for rounded rectangle in drawing primitives
- Loading branch information
Showing
9 changed files
with
120 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
| ||
|
||
|
||
namespace MapToolkit.Drawing.MemoryRender | ||
{ | ||
internal class DrawRoundedRectangle : IDrawOperation | ||
{ | ||
public DrawRoundedRectangle(Vector topLeft, Vector bottomRight, MemDrawStyle style, float radius) | ||
{ | ||
TopLeft = topLeft; | ||
BottomRight = bottomRight; | ||
Style = style; | ||
Radius = radius; | ||
} | ||
|
||
public Vector TopLeft { get; } | ||
|
||
public Vector BottomRight { get; } | ||
|
||
public MemDrawStyle Style { get; } | ||
|
||
public float Radius { get; } | ||
|
||
public Vector Min => TopLeft; | ||
|
||
public Vector Max => BottomRight; | ||
|
||
public void Draw(MemDrawContext context) | ||
{ | ||
context.Target.DrawRoundedRectangle(TopLeft, BottomRight, context.MapStyle(Style), Radius); | ||
} | ||
|
||
public void DrawClipped(MemDrawClipped context) | ||
{ | ||
context.Target.DrawRoundedRectangle(TopLeft, BottomRight, context.MapStyle(Style), Radius); | ||
} | ||
|
||
public IDrawOperation Scale(MemDrawScale context) | ||
{ | ||
return new DrawRoundedRectangle(TopLeft * context.Scale, BottomRight * context.Scale, context.MapStyle(Style), (float)(Radius * context.Scale)); | ||
} | ||
|
||
public IEnumerable<IDrawOperation> Simplify(double lengthSquared) | ||
{ | ||
yield return this; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters