diff --git a/src/ImageSharp/IImage.cs b/src/ImageSharp/IImage.cs index b9e2cee61..fb251cfd5 100644 --- a/src/ImageSharp/IImage.cs +++ b/src/ImageSharp/IImage.cs @@ -4,7 +4,7 @@ using System; namespace SixLabors.ImageSharp -{ +{ /// /// Encapsulates the properties and methods that describe an image. /// diff --git a/src/ImageSharp/Image.cs b/src/ImageSharp/Image.cs new file mode 100644 index 000000000..6bea675b9 --- /dev/null +++ b/src/ImageSharp/Image.cs @@ -0,0 +1,40 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using SixLabors.ImageSharp.Formats; +using SixLabors.ImageSharp.Metadata; +using SixLabors.ImageSharp.PixelFormats; + +namespace SixLabors.ImageSharp +{ + internal interface IImageVisitor + { + void Visit(Image image) + where TPixel : struct, IPixel; + } + + public abstract partial class Image : IImage + { + /// + public PixelTypeInfo PixelType { get; } + + /// + public abstract int Width { get; } + + /// + public abstract int Height { get; } + + /// + public ImageMetadata Metadata { get; } + + protected Image(PixelTypeInfo pixelType, ImageMetadata metadata) + { + this.PixelType = pixelType; + this.Metadata = metadata ?? new ImageMetadata(); + } + + public abstract void Dispose(); + + internal abstract void ApplyVisitor(IImageVisitor visitor); + } +} \ No newline at end of file diff --git a/src/ImageSharp/Image{TPixel}.cs b/src/ImageSharp/Image{TPixel}.cs index f2bef78e1..2cf389d37 100644 --- a/src/ImageSharp/Image{TPixel}.cs +++ b/src/ImageSharp/Image{TPixel}.cs @@ -220,6 +220,11 @@ namespace SixLabors.ImageSharp /// public void Dispose() => this.Frames.Dispose(); + internal override void ApplyVisitor(IImageVisitor visitor) + { + visitor.Visit(this); + } + /// public override string ToString() => $"Image<{typeof(TPixel).Name}>: {this.Width}x{this.Height}"; diff --git a/src/ImageSharp/Processing/IImageProcessingContext{TPixel}.cs b/src/ImageSharp/Processing/IImageProcessingContext{TPixel}.cs index 4897cc58b..72b78b32a 100644 --- a/src/ImageSharp/Processing/IImageProcessingContext{TPixel}.cs +++ b/src/ImageSharp/Processing/IImageProcessingContext{TPixel}.cs @@ -8,6 +8,11 @@ using SixLabors.Primitives; namespace SixLabors.ImageSharp.Processing { + public interface IImageProcessingContext + { + + } + /// /// An interface to queue up image operations to apply to an image. /// diff --git a/src/ImageSharp/Processing/ProcessingExtensions.cs b/src/ImageSharp/Processing/ProcessingExtensions.cs index 9d06c61d4..c96b97111 100644 --- a/src/ImageSharp/Processing/ProcessingExtensions.cs +++ b/src/ImageSharp/Processing/ProcessingExtensions.cs @@ -13,6 +13,11 @@ namespace SixLabors.ImageSharp.Processing /// public static class ProcessingExtensions { + public static void Mutate(this Image source, Action operation) + { + + } + /// /// Applies the given operation to the mutable image. /// Useful when we need to extract information like Width/Height to parametrize the next operation working on the chain. diff --git a/src/ImageSharp/Processing/Processors/IImageProcessor.cs b/src/ImageSharp/Processing/Processors/IImageProcessor.cs index d7fe0465b..78800affb 100644 --- a/src/ImageSharp/Processing/Processors/IImageProcessor.cs +++ b/src/ImageSharp/Processing/Processors/IImageProcessor.cs @@ -6,6 +6,12 @@ using SixLabors.Primitives; namespace SixLabors.ImageSharp.Processing.Processors { + public interface IImageProcessor + { + IImageProcessor CreatePixelSpecificProcessor() + where TPixel : struct, IPixel; + } + /// /// Encapsulates methods to alter the pixels of an image. ///