improving image editor
This commit is contained in:
parent
40abf0311e
commit
89890a4e94
5 changed files with 215 additions and 310 deletions
|
|
@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -43,7 +44,13 @@ using Newtonsoft.Json;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
public class ImageObject3D : AssetObject3D, IObject3DControlsProvider
|
||||
public interface IImageProvider
|
||||
{
|
||||
ImageBuffer Image { get; }
|
||||
}
|
||||
|
||||
[HideMeterialAndColor]
|
||||
public class ImageObject3D : AssetObject3D, IImageProvider, IObject3DControlsProvider
|
||||
{
|
||||
private const double DefaultSizeMm = 60;
|
||||
|
||||
|
|
@ -58,22 +65,15 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
Name = "Image".Localize();
|
||||
}
|
||||
|
||||
public override string AssetPath
|
||||
{
|
||||
get => _assetPath;
|
||||
set
|
||||
{
|
||||
if (_assetPath != value)
|
||||
{
|
||||
_assetPath = value;
|
||||
_image = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanFlatten => false;
|
||||
|
||||
[GoogleSearch]
|
||||
public string ImageSearch { get; set; } = "";
|
||||
|
||||
|
||||
[DisplayName("")]
|
||||
[JsonIgnore]
|
||||
[ImageDisplay(Margin = new int[] { 30, 3, 30, 3 }, MaxXSize = 400, Stretch = true)]
|
||||
public ImageBuffer Image
|
||||
{
|
||||
get
|
||||
|
|
@ -108,10 +108,15 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
// send the invalidate on image change
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Image));
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
|
||||
return _image;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public bool Invert
|
||||
|
|
@ -123,12 +128,33 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
_invert = value;
|
||||
_image = null;
|
||||
var _ = Image;
|
||||
|
||||
Invalidate(InvalidateType.Image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[DisplayName("Open new image")]
|
||||
[Description("Open")]
|
||||
public override string AssetPath
|
||||
{
|
||||
get => _assetPath;
|
||||
set
|
||||
{
|
||||
if (_assetPath != value)
|
||||
{
|
||||
_assetPath = value;
|
||||
_image = null;
|
||||
|
||||
InitMesh(this.Image);
|
||||
|
||||
this.Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddObject3DControls(Object3DControlsLayer object3DControlsLayer)
|
||||
{
|
||||
object3DControlsLayer.AddControls(ControlTypes.Standard2D);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue