|
|
|
@ -399,8 +399,15 @@ namespace SixLabors.ImageSharp.Formats.Webp.BitWriter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public override void WriteEncodedImageToStream(Stream stream, ExifProfile exifProfile, uint width, uint height) |
|
|
|
/// <summary>
|
|
|
|
/// Writes the encoded image to the stream.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="stream">The stream to write to.</param>
|
|
|
|
/// <param name="exifProfile">The exif profile.</param>
|
|
|
|
/// <param name="width">The width of the image.</param>
|
|
|
|
/// <param name="height">The height of the image.</param>
|
|
|
|
/// <param name="hasAlpha">Flag indicating, if a alpha channel is present.</param>
|
|
|
|
public void WriteEncodedImageToStream(Stream stream, ExifProfile exifProfile, uint width, uint height, bool hasAlpha) |
|
|
|
{ |
|
|
|
bool isVp8X = false; |
|
|
|
byte[] exifBytes = null; |
|
|
|
@ -433,7 +440,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.BitWriter |
|
|
|
riffSize += WebpConstants.TagSize + WebpConstants.ChunkHeaderSize + vp8Size; |
|
|
|
|
|
|
|
// Emit headers and partition #0
|
|
|
|
this.WriteWebpHeaders(stream, size0, vp8Size, riffSize, isVp8X, width, height, exifProfile); |
|
|
|
this.WriteWebpHeaders(stream, size0, vp8Size, riffSize, isVp8X, width, height, exifProfile, hasAlpha); |
|
|
|
bitWriterPartZero.WriteToStream(stream); |
|
|
|
|
|
|
|
// Write the encoded image to the stream.
|
|
|
|
@ -616,14 +623,14 @@ namespace SixLabors.ImageSharp.Formats.Webp.BitWriter |
|
|
|
while (it.Next()); |
|
|
|
} |
|
|
|
|
|
|
|
private void WriteWebpHeaders(Stream stream, uint size0, uint vp8Size, uint riffSize, bool isVp8X, uint width, uint height, ExifProfile exifProfile) |
|
|
|
private void WriteWebpHeaders(Stream stream, uint size0, uint vp8Size, uint riffSize, bool isVp8X, uint width, uint height, ExifProfile exifProfile, bool hasAlpha) |
|
|
|
{ |
|
|
|
this.WriteRiffHeader(stream, riffSize); |
|
|
|
|
|
|
|
// Write VP8X, header if necessary.
|
|
|
|
if (isVp8X) |
|
|
|
{ |
|
|
|
this.WriteVp8XHeader(stream, exifProfile, width, height); |
|
|
|
this.WriteVp8XHeader(stream, exifProfile, width, height, hasAlpha); |
|
|
|
} |
|
|
|
|
|
|
|
this.WriteVp8Header(stream, vp8Size); |
|
|
|
|