Browse Source

Move PhysicalChunkData to Chunks namespace

af/merge-core
Jason Nelson 8 years ago
parent
commit
05a0ca20d9
  1. 8
      src/ImageSharp/Formats/Png/Chunks/PhysicalChunkData.cs
  2. 5
      src/ImageSharp/Formats/Png/PngEncoderCore.cs

8
src/ImageSharp/Formats/Png/Chunks/PngPhysicalChunkData.cs → src/ImageSharp/Formats/Png/Chunks/PhysicalChunkData.cs

@ -3,16 +3,16 @@ using System.Buffers.Binary;
using SixLabors.ImageSharp.Common.Helpers; using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.MetaData; using SixLabors.ImageSharp.MetaData;
namespace SixLabors.ImageSharp.Formats.Png namespace SixLabors.ImageSharp.Formats.Png.Chunks
{ {
/// <summary> /// <summary>
/// The pHYs chunk specifies the intended pixel size or aspect ratio for display of the image. /// The pHYs chunk specifies the intended pixel size or aspect ratio for display of the image.
/// </summary> /// </summary>
internal readonly struct PngPhysicalChunkData internal readonly struct PhysicalChunkData
{ {
public const int Size = 9; public const int Size = 9;
public PngPhysicalChunkData(uint x, uint y, byte unitSpecifier) public PhysicalChunkData(uint x, uint y, byte unitSpecifier)
{ {
this.XAxisPixelsPerUnit = x; this.XAxisPixelsPerUnit = x;
this.YAxisPixelsPerUnit = y; this.YAxisPixelsPerUnit = y;
@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.Formats.Png
/// </summary> /// </summary>
/// <param name="meta">The metadata.</param> /// <param name="meta">The metadata.</param>
/// <returns>The constructed PngPhysicalChunkData instance.</returns> /// <returns>The constructed PngPhysicalChunkData instance.</returns>
public static PngPhysicalChunkData FromMetadata(ImageMetaData meta) public static PhysicalChunkData FromMetadata(ImageMetaData meta)
{ {
byte unitSpecifier = 0; byte unitSpecifier = 0;
uint x; uint x;

5
src/ImageSharp/Formats/Png/PngEncoderCore.cs

@ -9,7 +9,6 @@ using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.Formats.Png.Filters; using SixLabors.ImageSharp.Formats.Png.Filters;
using SixLabors.ImageSharp.Formats.Png.Zlib; using SixLabors.ImageSharp.Formats.Png.Zlib;
using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.Memory;
@ -674,9 +673,9 @@ namespace SixLabors.ImageSharp.Formats.Png
/// <param name="meta">The image meta data.</param> /// <param name="meta">The image meta data.</param>
private void WritePhysicalChunk(Stream stream, ImageMetaData meta) private void WritePhysicalChunk(Stream stream, ImageMetaData meta)
{ {
PngPhysicalChunkData.FromMetadata(meta).WriteTo(this.chunkDataBuffer); PhysicalChunkData.FromMetadata(meta).WriteTo(this.chunkDataBuffer);
this.WriteChunk(stream, PngChunkType.Physical, this.chunkDataBuffer, 0, PngPhysicalChunkData.Size); this.WriteChunk(stream, PngChunkType.Physical, this.chunkDataBuffer, 0, PhysicalChunkData.Size);
} }
/// <summary> /// <summary>

Loading…
Cancel
Save