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.3.2 #77

Merged
merged 1 commit into from
Jun 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
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ https://github.com/taublast/DrawnUi.Maui/assets/25801194/3b360229-ce3b-4d33-a85b

## What's new

* New: SvgSpan for SkiaLabel
* Critical fix for release builds native crash while using ImageDoubleBuffered cache
* New: SvgSpan for SkiaLabel.
* Critical fix for Release builds native crash while using ImageDoubleBuffered cache.
* Fixes for: gestures, SkiaMarkdownLabel, SkiaDrawer, SkiaLayout, Canvas and more.
* Added real published apps in the repo Readme.

## Demo Apps

* This repo includes a Sandox project for some custom controls, with playground examples, custom controls, maps etc
* More creating custom controls examples inside the [Engine Demo](https://github.com/taublast/AppoMobi.Maui.DrawnUi.Demo) 🤩 __Updated with latest nuget!__
* A [dynamic arcade game](https://github.com/taublast/AppoMobi.Maui.DrawnUi.SpaceShooter) drawn with this engine, uses preview nuget with SkiaSharp v3.
* A [drawn CollectionView demo](https://github.com/taublast/SurfAppCompareDrawn) where you could see how simple and profitable it is to convert an existing recycled cells list into a drawn one
* For real published apps scroll below Features!

[ShaderEffect.webm](https://github.com/taublast/DrawnUi.Maui/assets/25801194/47c97290-e16b-4928-bfa4-8b29fb0ff8e1)

Expand Down Expand Up @@ -96,6 +98,22 @@ ___Please star ⭐ if you like it!___
* Perspective1
* Perspective2

## 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


## Development Notes

* 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://".
Expand Down
4 changes: 2 additions & 2 deletions dev/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 file mask for the packages
REM set "file_mask=DrawnUi.Maui*.1.2.2.626*.nupkg"
set "file_mask=AppoMobi.Maui.DrawnUi.1.2.2.626*.*nupkg"
set "file_mask=DrawnUi.Maui*.1.2.3.2*.nupkg"
REM set "file_mask=AppoMobi.Maui.DrawnUi.1.2.3.2*.*nupkg"

REM Loop through each package file in the source directory
for %%f in ("%source_dir%\%file_mask%") do (
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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

<PropertyGroup Condition="'$(UseSkiaSharp3)' == 'true'">
Expand Down
2 changes: 2 additions & 0 deletions src/DrawnUi.Maui.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3EEA7F62-9878-451E-A506-28AB7C5DEEB8}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
..\dev\movenugets.bat = ..\dev\movenugets.bat
..\README.md = ..\README.md
ToDo.txt = ToDo.txt
..\dev\uploadnugets.bat = ..\dev\uploadnugets.bat
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrawnUi.Maui", "Engine\DrawnUi.Maui.csproj", "{D76B6239-94A0-482C-A0FF-A764017B7393}"
Expand Down
21 changes: 12 additions & 9 deletions src/Engine/Draw/SkiaControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5011,12 +5011,12 @@ protected virtual bool UseRenderingObject(SkiaDrawingContext context, SKRect rec
{
DisposeObject(RenderObjectPrevious);
RenderObjectPrevious = null;
RenderObjectPreviousNeedsUpdate = false;
}
RenderObjectPreviousNeedsUpdate = false;

if (cache != null)
{
if (!CheckCachedObjectValid(cache, context))
if (!CheckCachedObjectValid(cache, recordArea, context))
{
return false;
}
Expand All @@ -5028,11 +5028,11 @@ protected virtual bool UseRenderingObject(SkiaDrawingContext context, SKRect rec
Monitor.PulseAll(LockDraw);
}

if (UsingCacheType != SkiaCacheType.ImageDoubleBuffered || !NeedUpdateFrontCache)
if (cacheType != SkiaCacheType.ImageDoubleBuffered || !NeedUpdateFrontCache)
return true;
}

if (UsingCacheType == SkiaCacheType.ImageDoubleBuffered)
if (cacheType == SkiaCacheType.ImageDoubleBuffered)
{
lock (LockDraw)
{
Expand Down Expand Up @@ -5267,10 +5267,13 @@ public void DestroyRenderingObject()
RenderObject = null;
}

protected virtual bool CheckCachedObjectValid(CachedObject cache, SkiaDrawingContext context)
protected virtual bool CheckCachedObjectValid(CachedObject cache, SKRect recordingArea, SkiaDrawingContext context)
{
if (cache != null)
{
if (cache.Bounds.Size != recordingArea.Size)
return false;

//check hardware context maybe changed
if (UsingCacheType == SkiaCacheType.GPU && cache.Surface != null &&
cache.Surface.Context != null &&
Expand Down Expand Up @@ -5331,7 +5334,7 @@ public virtual SkiaCacheType UsingCacheType
var width = (int)recordArea.Width;
var height = (int)recordArea.Height;

bool needCreateSurface = !CheckCachedObjectValid(reuseSurfaceFrom, context) || usingCacheType == SkiaCacheType.GPU;
bool needCreateSurface = !CheckCachedObjectValid(reuseSurfaceFrom, recordingArea, context) || usingCacheType == SkiaCacheType.GPU; //never reuse GPU surfaces

SKSurface surface = null;

Expand Down Expand Up @@ -5532,13 +5535,13 @@ void draw(SkiaDrawingContext context)

var usingCacheType = UsingCacheType;

CachedObject oldObject = null;
CachedObject oldObject = null; //reusing this
if (usingCacheType == SkiaCacheType.ImageDoubleBuffered)
{
oldObject = RenderObject;
}
else if (usingCacheType == SkiaCacheType.Image
|| usingCacheType == SkiaCacheType.ImageComposite)
else
if (usingCacheType == SkiaCacheType.Image || usingCacheType == SkiaCacheType.ImageComposite)
{
oldObject = RenderObjectPrevious;
}
Expand Down
Loading