-
Notifications
You must be signed in to change notification settings - Fork 69
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 #916 from WildernessLabs/feature/xpt2046
Feature/xpt2046
- Loading branch information
Showing
20 changed files
with
537 additions
and
124 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
52 changes: 52 additions & 0 deletions
52
...dow.Foundation.Libraries_and_Frameworks/Graphics.MicroLayout/Driver/Controls/Crosshair.cs
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,52 @@ | ||
namespace Meadow.Foundation.Graphics.MicroLayout; | ||
|
||
/// <summary> | ||
/// Represents a circle in the user interface. | ||
/// </summary> | ||
public class Crosshair : ThemedControl | ||
{ | ||
private Color _foreColor = Color.Black; | ||
private int _lineWidth; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Crosshair"/> class with the specified dimensions and center point. | ||
/// </summary> | ||
/// <param name="centerX">The X coordinate of the crosshair's center.</param> | ||
/// <param name="centerY">The Y coordinate of the crosshair's center.</param> | ||
/// <param name="size">The with and height of the crosshair.</param> | ||
/// <param name="linewidth">The line width of the crosshair</param> | ||
public Crosshair(int centerX, int centerY, int size = 20, int linewidth = 3) | ||
: base(centerX, centerY, size, size) | ||
{ | ||
_lineWidth = linewidth; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override void ApplyTheme(DisplayTheme theme) | ||
{ | ||
if (theme != null) | ||
{ | ||
if (theme.ForegroundColor != null) this.ForeColor = theme.ForegroundColor.Value; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the foreground color of the Crosshair. | ||
/// </summary> | ||
public Color ForeColor | ||
{ | ||
get => _foreColor; | ||
set => SetInvalidatingProperty(ref _foreColor, value); | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override void OnDraw(MicroGraphics graphics) | ||
{ | ||
if (ForeColor != Color.Transparent) | ||
{ | ||
// position is the center of the crosshair | ||
graphics.DrawRectangle(Left - Width / 2, Top - _lineWidth / 2, Width, _lineWidth, ForeColor, true); | ||
graphics.DrawRectangle(Left - _lineWidth / 2, Top - Height / 2, _lineWidth, Height, ForeColor, true); | ||
} | ||
} | ||
} |
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
Binary file removed
BIN
-26 KB
...n.Libraries_and_Frameworks/Graphics.MicroLayout/Samples/Ili9488Charts_Sample/libmpsse.dll
Binary file not shown.
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
Binary file removed
BIN
-26 KB
...ndation.Libraries_and_Frameworks/Graphics.MicroLayout/Samples/MAX7219_Sample/libmpsse.dll
Binary file not shown.
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
Oops, something went wrong.