mirror of https://github.com/SixLabors/ImageSharp
Browse Source
touches #89 Former-commit-id: 730e210c4daeffe003c86faba3d62e17fe437cff Former-commit-id: eec47cf2178eeff36597c1980b72f834410af164pull/17/head
17 changed files with 143 additions and 84 deletions
@ -1,27 +1,35 @@ |
|||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="ImageProcessorBootstrapperTests.cs" company="James South">
|
// <copyright file="ImageProcessorBootrapperTests.cs" company="James South">
|
||||
// Copyright (c) James South.
|
// Copyright (c) James South.
|
||||
// Licensed under the Apache License, Version 2.0.
|
// Licensed under the Apache License, Version 2.0.
|
||||
// </copyright>
|
// </copyright>
|
||||
|
// <summary>
|
||||
|
// Test harness for the ImageProcessor bootstrapper tests
|
||||
|
// </summary>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
|
||||
namespace ImageProcessor.UnitTests.Configuration |
namespace ImageProcessor.UnitTests.Configuration |
||||
{ |
{ |
||||
using System; |
using System; |
||||
using System.Linq; |
using System.Linq; |
||||
|
|
||||
using FluentAssertions; |
using FluentAssertions; |
||||
using NUnit.Framework; |
|
||||
|
|
||||
using ImageProcessor.Configuration; |
using ImageProcessor.Configuration; |
||||
|
|
||||
|
using NUnit.Framework; |
||||
|
|
||||
/// <summary>
|
/// <summary>
|
||||
/// Test harness for the ImageProcessor bootstrapper tests
|
/// Test harness for the ImageProcessor bootstrapper tests
|
||||
/// </summary>
|
/// </summary>
|
||||
[TestFixture] |
[TestFixture] |
||||
public class ImageProcessorBootrapperTests |
public class ImageProcessorBootstrapperTests |
||||
{ |
{ |
||||
|
/// <summary>
|
||||
|
/// Test to see that the bootstrapper singleton is instantiated.
|
||||
|
/// </summary>
|
||||
[Test] |
[Test] |
||||
public void BoostrapperSingletonIsInstantiated() |
public void BootstrapperSingletonIsInstantiated() |
||||
{ |
{ |
||||
ImageProcessorBootstrapper.Instance.SupportedImageFormats.Count().Should().BeGreaterThan(0, "because there should be supported image formats"); |
ImageProcessorBootstrapper.Instance.SupportedImageFormats.Count().Should().BeGreaterThan(0, "because there should be supported image formats"); |
||||
|
|
||||
@ -1,24 +0,0 @@ |
|||||
|
|
||||
|
|
||||
namespace ImageProcessor.Common.Extensions |
|
||||
{ |
|
||||
using System.Drawing; |
|
||||
using System.Drawing.Imaging; |
|
||||
|
|
||||
public static class ImageExtensions |
|
||||
{ |
|
||||
public static Image ChangePixelFormat(this Image image, PixelFormat format) |
|
||||
{ |
|
||||
Bitmap clone = new Bitmap(image.Width, image.Height, format); |
|
||||
clone.SetResolution(image.HorizontalResolution, image.VerticalResolution); |
|
||||
|
|
||||
using (Graphics graphics = Graphics.FromImage(clone)) |
|
||||
{ |
|
||||
graphics.DrawImage(image, new Rectangle(0, 0, clone.Width, clone.Height)); |
|
||||
} |
|
||||
|
|
||||
image = new Bitmap(clone); |
|
||||
return image; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue