Skip to content

Commit fee581c

Browse files
Made ImageResizer static
Fixed #383
1 parent 65293ff commit fee581c

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/SharedMauiCoreLibrary/Platforms/Android/Services/ImageResizerService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public partial class ImageResizerService
77
{
88
// Source: https://github.com/xamarin/xamarin-forms-samples/blob/master/XamFormsImageResize/XamFormsImageResize/ImageResizer.cs
99
[SupportedOSPlatform(SPlatforms.AndroidVersion)]
10-
public partial byte[] ResizeImage(byte[] imageData, float width, float height)
10+
public static partial byte[] ResizeImage(byte[] imageData, float width, float height)
1111
{
1212
// Load the bitmap
1313
Bitmap? originalImage = BitmapFactory.DecodeByteArray(imageData, 0, imageData.Length);

src/SharedMauiCoreLibrary/Platforms/MacCatalyst/Services/ImageResizerService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public partial class ImageResizerService
1010
// Source: https://github.com/xamarin/xamarin-forms-samples/blob/master/XamFormsImageResize/XamFormsImageResize/ImageResizer.cs
1111
[SupportedOSPlatform(SPlatforms.IOSVersion)]
1212
[SupportedOSPlatform(SPlatforms.MACCatalystVersion)]
13-
public partial byte[] ResizeImage(byte[] imageData, float width, float height)
13+
public static partial byte[] ResizeImage(byte[] imageData, float width, float height)
1414
{
1515
UIImage? originalImage = ImageFromByteArray(imageData);
1616
if (originalImage is null) return [];
@@ -51,7 +51,7 @@ public partial byte[] ResizeImage(byte[] imageData, float width, float height)
5151
return [];
5252
}
5353

54-
UIImage? ImageFromByteArray(byte[] data)
54+
static UIImage? ImageFromByteArray(byte[] data)
5555
{
5656
if (data is null)
5757
{

src/SharedMauiCoreLibrary/Platforms/Windows/Services/ImageResizerService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace AndreasReitberger.Shared.Core.Services
55
public partial class ImageResizerService
66
{
77
[SupportedOSPlatform(SPlatforms.WindowsVersion)]
8-
public partial byte[] ResizeImage(byte[] imageData, float width, float height)
8+
public static partial byte[] ResizeImage(byte[] imageData, float width, float height)
99
{
1010
ImageSource image = ImageSource.FromStream(() => new MemoryStream(imageData));
1111
throw new NotImplementedException("Not implemented yet!");

src/SharedMauiCoreLibrary/Platforms/iOS/Services/ImageResizerService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public partial class ImageResizerService
1010
// Source: https://github.com/xamarin/xamarin-forms-samples/blob/master/XamFormsImageResize/XamFormsImageResize/ImageResizer.cs
1111
[SupportedOSPlatform(SPlatforms.IOSVersion)]
1212
[SupportedOSPlatform(SPlatforms.MACCatalystVersion)]
13-
public partial byte[] ResizeImage(byte[] imageData, float width, float height)
13+
public static partial byte[] ResizeImage(byte[] imageData, float width, float height)
1414
{
1515
UIImage? originalImage = ImageFromByteArray(imageData);
1616
if (originalImage is null) return [];
@@ -51,7 +51,7 @@ public partial byte[] ResizeImage(byte[] imageData, float width, float height)
5151
return [];
5252
}
5353

54-
UIImage? ImageFromByteArray(byte[] data)
54+
static UIImage? ImageFromByteArray(byte[] data)
5555
{
5656
if (data is null)
5757
{

src/SharedMauiCoreLibrary/Services/ImageResizerService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#if ANDROID || IOS || MACCATALYST || WINDOWS
55
public partial class ImageResizerService
66
{
7-
public partial byte[] ResizeImage(byte[] imageData, float width, float height = -1);
7+
public static partial byte[] ResizeImage(byte[] imageData, float width, float height = -1);
88
}
99
#endif
1010
}

0 commit comments

Comments
 (0)