-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from TheEightBot/feature/image-processing
- Loading branch information
Showing
21 changed files
with
1,696 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:effects="clr-namespace:AuroraControls.Effects;assembly=AuroraControls" | ||
x:Class="AuroraControls.TestApp.ImageProcessing"> | ||
<ContentPage.Content> | ||
<StackLayout HorizontalOptions="FillAndExpand" | ||
VerticalOptions="FillAndExpand"> | ||
<Button Text="Change Effects" | ||
Clicked="Handle_Clicked" /> | ||
<Label Text="Blur Amount" /> | ||
<Slider Minimum="0" | ||
Maximum="10" | ||
ValueChanged="Handle_ValueChanged" /> | ||
<Image x:Name="image" | ||
Source="https://api.floodmagazine.com/wp-content/uploads/2016/07/Steve_Brule-2016-Marc_Lemoine-2.png" | ||
HorizontalOptions="FillAndExpand" | ||
VerticalOptions="FillAndExpand"> | ||
<Image.Effects> | ||
<effects:ImageProcessingEffect x:Name="ImageProcessingEffect" /> | ||
</Image.Effects> | ||
</Image> | ||
</StackLayout> | ||
</ContentPage.Content> | ||
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AuroraControls.TestApp; | ||
|
||
public partial class ImageProcessing : ContentPage | ||
{ | ||
private List<AuroraControls.ImageProcessing.ImageProcessingBase> _imageProcessing = new(); | ||
|
||
private int _index = 0; | ||
|
||
private AuroraControls.ImageProcessing.Blur _blur; | ||
private AuroraControls.ImageProcessing.Circular _circular; | ||
private AuroraControls.ImageProcessing.Grayscale _grayscale; | ||
private AuroraControls.ImageProcessing.Invert _invert; | ||
private AuroraControls.ImageProcessing.Scale _scale; | ||
private AuroraControls.ImageProcessing.Sepia _sepia; | ||
|
||
private Random _rngesus = new Random(Guid.NewGuid().GetHashCode()); | ||
|
||
public ImageProcessing() | ||
{ | ||
InitializeComponent(); | ||
|
||
_blur = new AuroraControls.ImageProcessing.Blur { }; | ||
_circular = new AuroraControls.ImageProcessing.Circular(); | ||
_grayscale = new AuroraControls.ImageProcessing.Grayscale(); | ||
_invert = new AuroraControls.ImageProcessing.Invert(); | ||
_scale = new AuroraControls.ImageProcessing.Scale(); | ||
_sepia = new AuroraControls.ImageProcessing.Sepia(); | ||
|
||
this._imageProcessing.AddRange([_blur, _circular, _grayscale, _invert, _scale, _sepia]); | ||
} | ||
|
||
private void Handle_ValueChanged(object sender, ValueChangedEventArgs e) | ||
{ | ||
_blur.BlurAmount = e.NewValue; | ||
} | ||
|
||
private void Handle_Clicked(object sender, System.EventArgs e) | ||
{ | ||
if (_index > _imageProcessing.Count - 1) | ||
{ | ||
_index = 0; | ||
} | ||
|
||
var processingEffect = this._imageProcessing.ElementAt(_index); | ||
|
||
if (ImageProcessingEffect.ImageProcessingEffects.Contains(processingEffect)) | ||
{ | ||
ImageProcessingEffect.ImageProcessingEffects.Remove(processingEffect); | ||
} | ||
|
||
ImageProcessingEffect.ImageProcessingEffects.Add(processingEffect); | ||
|
||
_index++; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.