Skip to content
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
Binary file removed nuget/BitooBitImageEditor.1.0.1.4.nupkg
Binary file not shown.
Binary file added nuget/BitooBitImageEditor.1.0.1.5-beta.nupkg
Binary file not shown.
1 change: 1 addition & 0 deletions src/BitooBitImageEditor.IOS/BitooBitImageEditor.IOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ImageHelper.cs" />
<Compile Include="IOSHapticFeedback.cs" />
<Compile Include="Platform.cs" />
<Compile Include="PlatformHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
26 changes: 26 additions & 0 deletions src/BitooBitImageEditor.IOS/IOSHapticFeedback.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using BitooBitImageEditor.Helper;
using BitooBitImageEditor.IOS;
using UIKit;
using Xamarin.Essentials;
using Xamarin.Forms;

[assembly: Dependency(typeof(IOSHapticFeedback))]
namespace BitooBitImageEditor.IOS
{
class IOSHapticFeedback : IHapticFeedback
{
public void Excute()
{
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
{
var impact = new UIImpactFeedbackGenerator(UIImpactFeedbackStyle.Light);
impact.Prepare();
impact.ImpactOccurred();
impact.Dispose();
}
else
Vibration.Vibrate();
}
}
}
17 changes: 13 additions & 4 deletions src/BitooBitImageEditor/BitooBitImageEditor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions src/BitooBitImageEditor/Croping/CropItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@ public CropItem(string imageName, CropRotateType action)
public string ImageName { get; set; }
public CropRotateType Action { get; set; }


internal static ObservableCollection<CropItem> GetCropItems(bool IsAddAllElements)
{
var collect = new ObservableCollection<CropItem>
{
new CropItem("rotate_right", CropRotateType.CropRotate)
,new CropItem("crop_full", CropRotateType.CropFull)
};
var collect = new ObservableCollection<CropItem> { new CropItem("rotate_right", CropRotateType.CropRotate) };

if (IsAddAllElements)
{
collect.Add(new CropItem("crop_full", CropRotateType.CropFull));
collect.Add(new CropItem("crop_free", CropRotateType.CropFree));
collect.Add(new CropItem("crop_square", CropRotateType.CropSquare));
collect.Add(new CropItem("2_3", CropRotateType.Crop2_3));
Expand Down
3 changes: 0 additions & 3 deletions src/BitooBitImageEditor/Croping/CroppingRectangle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ internal bool TestPointInsideSquare(SKPoint pixelLocation)
SKPoint[] corners = Corners;
float X = pixelLocation.X, Y = pixelLocation.Y;
if (Corners[0].X < X && corners[2].X > X && corners[0].Y < Y && Corners[2].Y > Y)
{
rezult = true;
}

return rezult;
}

Expand Down
17 changes: 10 additions & 7 deletions src/BitooBitImageEditor/Croping/ImageCropperCanvasView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected override void OnPaintSurface(SKPaintSurfaceEventArgs args)
SKSurface surface = args.Surface;
SKCanvas canvas = surface.Canvas;

canvas.Clear();
canvas.Clear(SkiaHelper.backgroundColor);

// Calculate rectangle for displaying bitmap
var rect = SkiaHelper.CalculateRectangle(new SKRect(0, 0, info.Width, info.Height), bitmap);
Expand Down Expand Up @@ -218,13 +218,14 @@ private void Rotate()
{
var rotatedBitmap = new SKBitmap(bitmap.Height, bitmap.Width);

using (var surface = new SKCanvas(rotatedBitmap))
using (var canvas = new SKCanvas(rotatedBitmap))
{
surface.Translate(rotatedBitmap.Width, 0);
surface.RotateDegrees(90);
surface.DrawBitmap(bitmap, 0, 0);
canvas.Translate(rotatedBitmap.Width, 0);
canvas.RotateDegrees(90);
canvas.DrawBitmap(bitmap, 0, 0);
}

bitmap.Dispose();
bitmap = rotatedBitmap;

SetAspectRatio(aspectRatio);
Expand All @@ -247,12 +248,14 @@ protected virtual void Dispose(bool disposing)
if (disposing)
{
aspectRatio = null;
touchPoints?.Clear();
touchPoints = null;
touchPointsInside?.Clear();
touchPointsInside = null;
}

((IDisposable)bitmap).Dispose();

bitmap?.Dispose();
bitmap = null;
disposedValue = true;
}
}
Expand Down
Loading