mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
984 B
32 lines
984 B
// <copyright file="GenericFactory.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
namespace ImageSharp.Tests
|
|
{
|
|
using System;
|
|
|
|
/// <summary>
|
|
/// Utility class to create specialized subclasses of generic classes (eg. <see cref="Image"/>)
|
|
/// Used as parameter for <see cref="WithMemberFactoryAttribute"/> -based factory methods
|
|
/// </summary>
|
|
public class GenericFactory<TColor>
|
|
where TColor : struct, IPixel<TColor>
|
|
{
|
|
public virtual Image<TColor> CreateImage(int width, int height)
|
|
{
|
|
return new Image<TColor>(width, height);
|
|
}
|
|
|
|
public virtual Image<TColor> CreateImage(byte[] bytes)
|
|
{
|
|
return new Image<TColor>(bytes);
|
|
}
|
|
|
|
public virtual Image<TColor> CreateImage(Image<TColor> other)
|
|
{
|
|
return new Image<TColor>(other);
|
|
}
|
|
}
|
|
}
|