PaintView.MAUI
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package PaintView.MAUI --version 1.0.0
NuGet\Install-Package PaintView.MAUI -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PaintView.MAUI" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PaintView.MAUI --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PaintView.MAUI, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PaintView.MAUI as a Cake Addin #addin nuget:?package=PaintView.MAUI&version=1.0.0 // Install PaintView.MAUI as a Cake Tool #tool nuget:?package=PaintView.MAUI&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PaintView.MAUI
A View control for paint using touch controls.
PaintView
A multiplatform control for paint with the finders, mouse or pointers. The view has properties for use it as a clear drawing area or use his control buttons:
Properties:
/// Binding property for use this control in MVVM.
public GestureRecognizerView Self
/// Drawing area backgroud color
public new Color BackgroundColor
/// Show/Hide color selector button.
public bool ShowColorSelector
/// Show/Hide pointer size selector button.
public bool ShowPointerSelector
/// Show/Hide undo and redo buttons.
public bool ShowUndoRedoButtons
/// Show/Hide figures draw toolbar.
public bool ShowFigureButtons
/// Sets the size for control buttons.
public float ButtonsSize
/// Sets the border color for control buttons.
public Color ButtonsBorderColor
/// Sets the background color for control buttons.
public Color ButtonsBackgroundColor
/// Sets the background color for control buttons selected in toolbar.
public Color SelectedButtonBackgroundColor
/// Sets the drawing color.
public Color SelectedColor
/// Sets the drawing pointer size.
public float SelectedPointer
/// If true, control buttons are hidden while user draws.
public bool HideButtonsOnDrawing
/// Minimun movement distante for start to draw.
public float MinDistanceBetweenDrawingPoints
/// Colors list to show in the palette.
public List<Color> Palette
/// Pointers sizes list to show in the pointer selector.
public List<float> Pointers
Events:
/// Initialize the Paint view.
public void Reset(bool clearNoUnDoDraws = true)
/// Gets a bytes[] representation from drawing area snapshot.
public async Task<byte[]> GetSnapshotBytesAsync(SKEncodedImageFormat format = SKEncodedImageFormat.Png, int quality = 100)
/// Gets an image representation from drawing area snapshot.
public async Task<ImageSource> GetSnapshotAsync(SKEncodedImageFormat format = SKEncodedImageFormat.Png, int quality = 100)
/// Undo the drawing steps indicated.
public void UnDo(int steps = 1);
/// Redo the drawing steps indicated.
public void ReDo(int steps = 1)
/// Draws a line in the indicates coordinates.
public void DrawLine(Point start, Point end, Color color, float pointerSize, bool canBeUnDo = true)
/// Draws an oval in the indicates coordinates.
public void DrawOval(Point start, Point end, Color strokeColor, Color fillColor, float pointerSize, bool canBeUnDo = true)
/// Draws a rectangle in the indicates coordinates.
public void DrawRect(Point start, Point end, Color strokeColor, Color fillColor, float pointerSize, bool canBeUnDo = true)
Install and configure PaintView
Download and Install PaintView.MAUI NuGet package on your application.
Initialize the plugin in your
MauiProgram.cs
:// Add the using to the top using PaintView.MAUI; public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() .UsePaintView(); // Add the use of the plugging return builder.Build(); }
Using PaintView
In XAML, make sure to add the right XML namespace:
xmlns:pv="clr-namespace:PaintView.MAUI;assembly=PaintView.MAUI"
Use the control:
<Grid>
<pv:PaintView Grid.Row="0" HorizontalOptions="Fill" VerticalOptions="Fill" BackgroundColor="White"
ShowColorSelector="True" ShowPointerSelector="True" ShowUndoRedoButtons="True"
ButtonsSize="40"
BindingContext="{x:Reference mpage}" Self="{Binding PaintView}"/>
</Grid>
Use the events:
private void Button_Clicked(object sender, EventArgs e)
{
PaintView.Reset();
}
private async void Button_Clicked_1(object sender, EventArgs e)
{
image.Source = await PaintView.GetSnapshotAsync();
}
private void Button_Clicked_2(object sender, EventArgs e)
{
PaintView.UnDo();
}
private void Button_Clicked_3(object sender, EventArgs e)
{
PaintView.ReDo();
}
private void Button_Clicked_4(object sender, EventArgs e)
{
PaintView.DrawRect(new(200, 100), new(300, 200), Colors.Black, Colors.Cyan, 2);
PaintView.DrawOval(new(200, 100), new(300, 200), Colors.Black, Colors.Cyan, 2, false);
PaintView.DrawLine(new(200, 100), new(300, 200), Colors.Black, 2);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-android33.0 is compatible. net7.0-ios was computed. net7.0-ios16.1 is compatible. net7.0-maccatalyst was computed. net7.0-maccatalyst16.1 is compatible. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net7.0-windows10.0.19041 is compatible. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- GestureRecognizerView.MAUI (>= 1.0.0)
- SkiaSharp.Views.Maui.Controls (>= 2.88.3)
-
net7.0-android33.0
- GestureRecognizerView.MAUI (>= 1.0.0)
- SkiaSharp.Views.Maui.Controls (>= 2.88.3)
-
net7.0-ios16.1
- GestureRecognizerView.MAUI (>= 1.0.0)
- SkiaSharp.Views.Maui.Controls (>= 2.88.3)
-
net7.0-maccatalyst16.1
- GestureRecognizerView.MAUI (>= 1.0.0)
- SkiaSharp.Views.Maui.Controls (>= 2.88.3)
-
net7.0-windows10.0.19041
- GestureRecognizerView.MAUI (>= 1.0.0)
- SkiaSharp.Views.Maui.Controls (>= 2.88.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.