dmitryshelamov.ui-cropping-image 1.0.0

A simply UI cropping image library for WPF that use adroner layer.

Install-Package dmitryshelamov.ui-cropping-image -Version 1.0.0
dotnet add package dmitryshelamov.ui-cropping-image --version 1.0.0
<PackageReference Include="dmitryshelamov.ui-cropping-image" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add dmitryshelamov.ui-cropping-image --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

UI-Cropping-Image

A simply UI cropping image library for WPF that use adroner layer. Some screenshots:

Interface of sample app

<img src="https://github.com/dmitryshelamov/UI-Cropping-Image/blob/master/cropped-demo.png" width="400">

Cropping result image

<img src="https://github.com/dmitryshelamov/UI-Cropping-Image/blob/master/cropped-result.png" width="400">

Cropping result image info

<img src="https://github.com/dmitryshelamov/UI-Cropping-Image/blob/master/cropped-result-info.png" width="400">

Main Workflow:

  1. Load image
  2. Select cropping area
  3. Crop and save image

Main features:

  • Can draw/redraw cropping rectangle
  • Can move cropping rectangle
  • Can resize cropping rectangle
  • Shadow area outside of cropping rectangle
  • Show current size of cropping rectangle

Basic Setup

XAML:

<Grid x:Name="RootGrid" MouseLeftButtonDown="RootGrid_OnMouseLeftButtonDown">
    <Canvas x:Name="CanvasPanel"
                Grid.Column="1">
        <Border Height="{Binding ElementName=CanvasPanel, Path=ActualHeight}" Width="{Binding ElementName=CanvasPanel, Path=ActualWidth}" Background="LightBlue">
            <Image x:Name = "SourceImage"
                       Stretch="Fill"/>
        </Border>
    </Canvas>
</Grid>

Code Behind:

    public CroppingAdorner CroppingAdorner;

    private void RootGrid_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        CroppingAdorner.CaptureMouse();
        CroppingAdorner.MouseLeftButtonDownEventHandler(sender, e);
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(CanvasPanel);
        CroppingAdorner = new CroppingAdorner(CanvasPanel);
        adornerLayer.Add(CroppingAdorner);
    }

UI-Cropping-Image

A simply UI cropping image library for WPF that use adroner layer. Some screenshots:

Interface of sample app

<img src="https://github.com/dmitryshelamov/UI-Cropping-Image/blob/master/cropped-demo.png" width="400">

Cropping result image

<img src="https://github.com/dmitryshelamov/UI-Cropping-Image/blob/master/cropped-result.png" width="400">

Cropping result image info

<img src="https://github.com/dmitryshelamov/UI-Cropping-Image/blob/master/cropped-result-info.png" width="400">

Main Workflow:

  1. Load image
  2. Select cropping area
  3. Crop and save image

Main features:

  • Can draw/redraw cropping rectangle
  • Can move cropping rectangle
  • Can resize cropping rectangle
  • Shadow area outside of cropping rectangle
  • Show current size of cropping rectangle

Basic Setup

XAML:

<Grid x:Name="RootGrid" MouseLeftButtonDown="RootGrid_OnMouseLeftButtonDown">
    <Canvas x:Name="CanvasPanel"
                Grid.Column="1">
        <Border Height="{Binding ElementName=CanvasPanel, Path=ActualHeight}" Width="{Binding ElementName=CanvasPanel, Path=ActualWidth}" Background="LightBlue">
            <Image x:Name = "SourceImage"
                       Stretch="Fill"/>
        </Border>
    </Canvas>
</Grid>

Code Behind:

    public CroppingAdorner CroppingAdorner;

    private void RootGrid_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        CroppingAdorner.CaptureMouse();
        CroppingAdorner.MouseLeftButtonDownEventHandler(sender, e);
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(CanvasPanel);
        CroppingAdorner = new CroppingAdorner(CanvasPanel);
        adornerLayer.Add(CroppingAdorner);
    }

Release Notes

Initial Release

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 468 3/23/2018