Use double instead of decimal in IPdfImage's Decode property

This commit is contained in:
BobLd 2024-01-20 16:54:56 +00:00
parent 6103cf13dc
commit 04fc8d696d
6 changed files with 16 additions and 16 deletions

View File

@ -24,7 +24,7 @@
public bool IsImageMask { get; set; }
public IReadOnlyList<decimal> Decode { get; set; }
public IReadOnlyList<double> Decode { get; set; }
public bool Interpolate { get; set; }

View File

@ -3,8 +3,8 @@
using System.Collections.Generic;
using Core;
using Graphics.Colors;
using Graphics.Core;
using UglyToad.PdfPig.Tokens;
using Graphics.Core;
using UglyToad.PdfPig.Tokens;
using XObjects;
/// <summary>
@ -37,7 +37,7 @@
/// </summary>
IReadOnlyList<byte> RawBytes { get; }
/// <summary>
/// <summary>
/// The color rendering intent to be used when rendering the image.
/// </summary>
RenderingIntent RenderingIntent { get; }
@ -60,7 +60,7 @@
/// The value from the image data is then interpolated into the values relevant to the <see cref="ColorSpace"/>
/// using the corresponding values of the decode array.
/// </summary>
IReadOnlyList<decimal> Decode { get; }
IReadOnlyList<double> Decode { get; }
/// <summary>
/// Specifies whether interpolation is to be performed. Interpolation smooths images where a single component in the image
@ -77,12 +77,12 @@
/// <summary>
/// The full dictionary for this image object.
/// </summary>
DictionaryToken ImageDictionary { get; }
DictionaryToken ImageDictionary { get; }
/// <summary>
/// The <see cref="ColorSpaceDetails"/> used to interpret the image.
/// <para>
/// This is not defined where <see cref="IsImageMask"/> is <see langword="true"/> and is optional where the image is JPXEncoded for <see cref="XObjectImage"/>.
/// <para>
/// This is not defined where <see cref="IsImageMask"/> is <see langword="true"/> and is optional where the image is JPXEncoded for <see cref="XObjectImage"/>.
/// </para>
/// </summary>
ColorSpaceDetails ColorSpaceDetails { get; }

View File

@ -35,7 +35,7 @@
public bool IsImageMask { get; }
/// <inheritdoc />
public IReadOnlyList<decimal> Decode { get; }
public IReadOnlyList<double> Decode { get; }
/// <inheritdoc />
public bool IsInlineImage { get; } = true;
@ -62,7 +62,7 @@
internal InlineImage(PdfRectangle bounds, int widthInSamples, int heightInSamples, int bitsPerComponent, bool isImageMask,
RenderingIntent renderingIntent,
bool interpolate,
IReadOnlyList<decimal> decode,
IReadOnlyList<double> decode,
IReadOnlyList<byte> bytes,
IReadOnlyList<IFilter> filters,
DictionaryToken streamDictionary,

View File

@ -100,7 +100,7 @@
var decodeRaw = GetByKeys<ArrayToken>(NameToken.Decode, NameToken.D, false) ?? new ArrayToken(EmptyArray<IToken>.Instance);
var decode = decodeRaw.Data.OfType<NumericToken>().Select(x => x.Data).ToArray();
var decode = decodeRaw.Data.OfType<NumericToken>().Select(x => x.Double).ToArray();
var interpolate = GetByKeys<BooleanToken>(NameToken.Interpolate, NameToken.I, false)?.Data ?? false;

View File

@ -116,12 +116,12 @@
var decodedBytes = supportsFilters ? new Lazy<IReadOnlyList<byte>>(() => streamToken.Decode(filterProvider, pdfScanner))
: null;
var decode = EmptyArray<decimal>.Instance;
var decode = EmptyArray<double>.Instance;
if (dictionary.TryGet(NameToken.Decode, pdfScanner, out ArrayToken decodeArrayToken))
{
decode = decodeArrayToken.Data.OfType<NumericToken>()
.Select(x => x.Data)
.Select(x => x.Double)
.ToArray();
}

View File

@ -45,7 +45,7 @@
public bool IsImageMask { get; }
/// <inheritdoc />
public IReadOnlyList<decimal> Decode { get; }
public IReadOnlyList<double> Decode { get; }
/// <inheritdoc />
public bool Interpolate { get; }
@ -74,7 +74,7 @@
bool isImageMask,
RenderingIntent renderingIntent,
bool interpolate,
IReadOnlyList<decimal> decode,
IReadOnlyList<double> decode,
DictionaryToken imageDictionary,
IReadOnlyList<byte> rawBytes,
Lazy<IReadOnlyList<byte>> bytes,