Skip to content
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

1.2.9.7 #139

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ ___Please star ⭐ if you like it, helps very much!___

## What's New

### Nuget 1.2.9.6
### Nuget 1.2.9.7
for SkiaSharp 2.88.9-preview.2.2
* Added gestures delegate `OnGestures` to SkiaLayout.
* HotFix for SkiaCarousel always setting index at 0 upon initialization.
* HotFix for random crash accessing disposed LoadedImageSource.
* [HotFix](https://github.com/taublast/DrawnUi.Maui/issues/136) for loading images from StreamImageSource
Expand Down Expand Up @@ -123,6 +124,7 @@ V3 preview: subclassed `SkiaShaderEffect`, implementing `ISkiaGestureProcessor`,

## Development Notes

* To compile the v3 version that supports NEW SHADERS you must set `<UseSkiaSharp3>true</UseSkiaSharp3>` inside `Directory.Build.props` file.
* All files to be consumed (images etc) must be placed inside the MAUI app Resources/Raw folder, subfolders allowed. If you need to load from the native app folder use prefix "file://".
* Accessibility support is compatible and is on the roadmap.

Expand Down Expand Up @@ -716,19 +718,20 @@ It will render a mask over its children when hovered, think of it as an inverted

## Published Apps powered by DrawnUI For .Net MAUI

### Bug ID: Insect Identifier AI

_Totally drawn with just one root view `Canvas` and `SkiaShell` for navigation. First ever drawn MAUI app!_

GooglePlay: https://play.google.com/store/apps/details?id=com.niroapps.insects

### Racebox

_MAUI pages with canvases, custom navigation. All scrolls, cells collections, maps, buttons, labels and custom controls are drawn._

iOS: https://apps.apple.com/us/app/racebox-vehicle-dynamics/id6444165250
GooglePlay: https://play.google.com/store/apps/details?id=com.raceboxcompanion.app

### Bug ID: Insect Identifier AI

_Totally drawn with just one root view `Canvas` and `SkiaShell` for navigation. First ever drawn MAUI app!_

__Ooops looks like the app API went dead, client maybe abandoned the project due to AI detecting stuff better than dedicated neural networks!__

GooglePlay: https://play.google.com/store/apps/details?id=com.niroapps.insects




4 changes: 2 additions & 2 deletions dev/github_uploadnugets.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ REM Define the source directory for the packages
set "source_dir=E:\Nugets"

REM Define the list of file masks for the packages
set "mask[1]=DrawnUi.Maui*.1.2.9.6*.nupkg"
set "mask[2]=AppoMobi.Maui.DrawnUi.1.2.9.6*.*nupkg"
set "mask[1]=DrawnUi.Maui*.1.2.9.7*.nupkg"
set "mask[2]=AppoMobi.Maui.DrawnUi.1.2.9.7*.*nupkg"
set "mask_count=2"

REM Loop through each file mask
Expand Down
6 changes: 3 additions & 3 deletions dev/nuget_uploadnugets.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ REM Define the source directory for the packages
set "source_dir=E:\Nugets"

REM Define the list of file masks for the packages
set "mask[1]=DrawnUi.Maui*.1.2.9.6*.nupkg"
set "mask[2]=AppoMobi.Maui.DrawnUi.1.2.9.6*.*nupkg"
set "mask[1]=DrawnUi.Maui*.1.2.9.7*.nupkg"
set "mask[2]=AppoMobi.Maui.DrawnUi.1.2.9.7*.*nupkg"
set "mask_count=2"

REM Loop through each file mask
Expand All @@ -24,7 +24,7 @@ for /L %%i in (1,1,%mask_count%) do (
REM Loop through each package file matching the mask in the source directory
for %%f in ("!source_dir!\!file_mask!") do (
echo Uploading "%%f" to NUGET.ORG with API key.
nuget push "%%f" -Source https://api.nuget.org/v3/index.json -ApiKey %APIKEY%
nuget push "%%f" -Source https://api.nuget.org/v3/index.json -ApiKey %APIKEY% -SkipDuplicate
if errorlevel 1 (
echo An error occurred while uploading "%%f".
) else (
Expand Down
2 changes: 1 addition & 1 deletion src/Addons/DrawnUi.Maui.Camera/DrawnUi.Maui.Camera.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

<!--production-->
<ItemGroup Condition="'$(UseNuget)' == 'true'">
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.9.6" />
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.9.7" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Addons/DrawnUi.Maui.Game/DrawnUi.Maui.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

<!--production-->
<ItemGroup Condition="'$(UseNuget)' == 'true'">
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.9.6" />
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.9.7" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<!--production-->
<ItemGroup Condition="'$(UseNuget)' == 'true'">
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.9.6" />
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.9.7" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Addons/DrawnUi.Maui.Rive/DrawnUi.Maui.Rive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

<!--production-->
<ItemGroup Condition="'$(UseNuget)' == 'true'">
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.9.6" />
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.9.7" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<!--production-->
<ItemGroup Condition="'$(UseNuget)' == 'true'">
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.9.6" />
<PackageReference Include="AppoMobi.Maui.DrawnUi" Version="1.2.9.7" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

<PropertyGroup Condition="'$(UseSkiaSharp3)' != 'true'">
<PackageReleaseNotes>Using SkiaSharp 2.xx. Checkout the DrawnUi Sandbox project for usage example.</PackageReleaseNotes>
<Version>1.2.9.6</Version>
<Version>1.2.9.7</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(UseSkiaSharp3)' == 'true'">
<DefineConstants>$(DefineConstants);SKIA3</DefineConstants>
<PackageReleaseNotes>Using SkiaSharp 3-preview. New handlers, SKSL, WinUI hardware acceleration etc..</PackageReleaseNotes>
<Version>1.3.55.1-pre</Version>
<Version>1.3.56.1-pre</Version>
</PropertyGroup>

</Project>
19 changes: 7 additions & 12 deletions src/Engine/Draw/Base/SkiaControl.Shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@
/// <param name="cancel"></param>
/// <param name="onStopped"></param>
/// <returns></returns>
public Task AnimateRangeAsync(Action<double> callback, double start, double end, double length = 250, Easing easing = null,

Check warning on line 588 in src/Engine/Draw/Base/SkiaControl.Shared.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has badly formed XML -- 'Expected an end tag for element 'summary'.'
CancellationToken cancel = default,
bool applyEndValueOnStop = false)
{
Expand Down Expand Up @@ -1398,7 +1398,7 @@
/// <summary>
/// Use clipping area from another control
/// </summary>
public new SkiaControl ClipFrom

Check warning on line 1401 in src/Engine/Draw/Base/SkiaControl.Shared.cs

View workflow job for this annotation

GitHub Actions / build

The member 'SkiaControl.ClipFrom' does not hide an accessible member. The new keyword is not required.
{
get { return (SkiaControl)GetValue(ClipFromProperty); }
set { SetValue(ClipFromProperty, value); }
Expand Down Expand Up @@ -5858,19 +5858,14 @@
{
if (shadow != null && paint != null)
{

if (LastShadow == null || LastShadow.Shadow != shadow ||
LastShadow.Scale != scale)
var kill = LastShadow;
LastShadow = new()
{
var kill = LastShadow;
LastShadow = new()
{
Filter = CreateShadow(shadow, scale),
Scale = scale,
Shadow = shadow
};
DisposeObject(kill);
}
Filter = CreateShadow(shadow, scale),
Scale = scale,
Shadow = shadow
};
DisposeObject(kill);

var old = paint.ImageFilter;
paint.ImageFilter = LastShadow.Filter;
Expand Down
86 changes: 0 additions & 86 deletions src/Engine/Draw/Layout/SkiaLayout.Grid.Structure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,92 +5,6 @@

namespace DrawnUi.Maui.Draw;

public static class FluentExtensions
{
public static T With<T>(this T view, Action<T> action) where T : SkiaControl
{
action?.Invoke(view);
return view;
}

public static T WithParent<T>(this T view, IDrawnBase parent) where T : SkiaControl
{
parent.AddSubView(view);
return view;
}

public static T CenterX<T>(this T view) where T : SkiaControl
{
view.HorizontalOptions = LayoutOptions.Center;
return view;
}

public static T CenterY<T>(this T view) where T : SkiaControl
{
view.VerticalOptions = LayoutOptions.Center;
return view;
}

}

public static class GridExtensions
{
public static T WithRow<T>(this T view, int row) where T : SkiaControl
{
Grid.SetRow(view, row);
return view;
}

public static T WithColumn<T>(this T view, int column) where T : SkiaControl
{
Grid.SetColumn(view, column);
return view;
}

public static T WithRowSpan<T>(this T view, int rowSpan) where T : SkiaControl
{
Grid.SetRowSpan(view, rowSpan);
return view;
}

public static T WithColumnSpan<T>(this T view, int columnSpan) where T : SkiaControl
{
Grid.SetColumnSpan(view, columnSpan);
return view;
}

public static SkiaLayout WithColumnDefinitions(this SkiaLayout grid, string columnDefinitions)
{
var converter = new ColumnDefinitionCollectionTypeConverter();

if (converter.CanConvertFrom(typeof(string)))
{
var columns = (ColumnDefinitionCollection)converter.ConvertFromInvariantString(columnDefinitions);
grid.ColumnDefinitions = columns;
}
else
{
throw new InvalidOperationException("ColumnDefinitionCollectionTypeConverter cannot convert from string.");
}
return grid;
}
public static SkiaLayout WithRowDefinitions(this SkiaLayout grid, string definitions)
{
var converter = new ColumnDefinitionCollectionTypeConverter();

if (converter.CanConvertFrom(typeof(string)))
{
var defs = (RowDefinitionCollection)converter.ConvertFromInvariantString(definitions);
grid.RowDefinitions = defs;
}
else
{
throw new InvalidOperationException("RowDefinitionCollectionTypeConverter cannot convert from string.");
}
return grid;
}
}

public partial class SkiaLayout
{
public class SkiaGridStructure
Expand Down
26 changes: 26 additions & 0 deletions src/Engine/Draw/Layout/SkiaLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@ namespace DrawnUi.Maui.Draw

public partial class SkiaLayout : SkiaControl, ISkiaGestureListener, ISkiaGridLayout
{
/// <summary>
/// For easier code-behind use
/// </summary>
/// <param name="args"></param>
/// <param name="apply"></param>
/// <returns></returns>
public override ISkiaGestureListener OnSkiaGestureEvent(SkiaGesturesParameters args, GestureEventProcessingInfo apply)
{
if (!CanDraw)
return null;

if (OnGestures != null)
{
return OnGestures(args, apply);
}

return base.OnSkiaGestureEvent(args, apply);
}

/// <summary>
/// Delegate for use instead of calling base.OnSkiaGestureEvent
/// </summary>
public Func<SkiaGesturesParameters, GestureEventProcessingInfo, ISkiaGestureListener> OnGestures;

public override bool IsGestureForChild(SkiaControlWithRect child, SKPoint point)
{
if (this.IsStack)
Expand Down Expand Up @@ -978,6 +1002,8 @@ public override void OnDisposing()
StackStructure?.Clear();
StackStructureMeasured?.Clear();

OnGestures = null;

base.OnDisposing();
}

Expand Down
89 changes: 89 additions & 0 deletions src/Engine/Internals/Extensions/FluentExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
namespace DrawnUi.Maui.Draw
{
public static class FluentExtensions
{
public static T With<T>(this T view, Action<T> action) where T : SkiaControl
{
action?.Invoke(view);
return view;
}

public static T WithParent<T>(this T view, IDrawnBase parent) where T : SkiaControl
{
parent.AddSubView(view);
return view;
}

public static T CenterX<T>(this T view) where T : SkiaControl
{
view.HorizontalOptions = LayoutOptions.Center;
return view;
}

public static T CenterY<T>(this T view) where T : SkiaControl
{
view.VerticalOptions = LayoutOptions.Center;
return view;
}


#region GRID

public static T WithRow<T>(this T view, int row) where T : SkiaControl
{
Grid.SetRow(view, row);
return view;
}

public static T WithColumn<T>(this T view, int column) where T : SkiaControl
{
Grid.SetColumn(view, column);
return view;
}

public static T WithRowSpan<T>(this T view, int rowSpan) where T : SkiaControl
{
Grid.SetRowSpan(view, rowSpan);
return view;
}

public static T WithColumnSpan<T>(this T view, int columnSpan) where T : SkiaControl
{
Grid.SetColumnSpan(view, columnSpan);
return view;
}

public static SkiaLayout WithColumnDefinitions(this SkiaLayout grid, string columnDefinitions)
{
var converter = new ColumnDefinitionCollectionTypeConverter();

if (converter.CanConvertFrom(typeof(string)))
{
var columns = (ColumnDefinitionCollection)converter.ConvertFromInvariantString(columnDefinitions);
grid.ColumnDefinitions = columns;
}
else
{
throw new InvalidOperationException("ColumnDefinitionCollectionTypeConverter cannot convert from string.");
}
return grid;
}
public static SkiaLayout WithRowDefinitions(this SkiaLayout grid, string definitions)
{
var converter = new ColumnDefinitionCollectionTypeConverter();

if (converter.CanConvertFrom(typeof(string)))
{
var defs = (RowDefinitionCollection)converter.ConvertFromInvariantString(definitions);
grid.RowDefinitions = defs;
}
else
{
throw new InvalidOperationException("RowDefinitionCollectionTypeConverter cannot convert from string.");
}
return grid;
}

#endregion
}
}
Loading
Loading