mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-08-20 04:31:25 +08:00
fix colorspace error when form xobject contains a transparency group (#1088)
* fix colorspace error when form xobject contains a transparency group when a form xobject contains a reference to a group xobject this can only be used to change attributes of the transparency imaging model. the old code was setting the main colorspaces incorrectly causing errors when the transparency component had a different number of channels. this was causing #1071 in addition to the failure in file 0000355.pdf of the test corpus * add master integration tests for corpus group 0000 * tidy up actions * remove invalid reference in echo * move new action to different branch
This commit is contained in:
parent
31658ca020
commit
e3388ec6b6
@ -511,21 +511,22 @@
|
||||
startState.AlphaConstantNonStroking = 1.0;
|
||||
startState.AlphaConstantStroking = 1.0;
|
||||
|
||||
// TODO: the /CS colorspace of the transparency group should not affect the main colorspace, only the transparent imaging model.
|
||||
if (formGroupToken.TryGet(NameToken.Cs, PdfScanner, out NameToken? csNameToken))
|
||||
{
|
||||
startState.ColorSpaceContext!.SetNonStrokingColorspace(csNameToken);
|
||||
// startState.ColorSpaceContext!.SetNonStrokingColorspace(csNameToken);
|
||||
}
|
||||
else if (formGroupToken.TryGet(NameToken.Cs, PdfScanner, out ArrayToken? csArrayToken)
|
||||
&& csArrayToken.Length > 0)
|
||||
{
|
||||
if (csArrayToken.Data[0] is NameToken firstColorSpaceName)
|
||||
{
|
||||
startState.ColorSpaceContext!.SetNonStrokingColorspace(firstColorSpaceName, formGroupToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("Invalid color space in Transparency Group XObjects.");
|
||||
}
|
||||
//if (csArrayToken.Data[0] is NameToken firstColorSpaceName)
|
||||
//{
|
||||
// startState.ColorSpaceContext!.SetNonStrokingColorspace(firstColorSpaceName, formGroupToken);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// throw new InvalidOperationException("Invalid color space in Transparency Group XObjects.");
|
||||
//}
|
||||
}
|
||||
|
||||
bool isolated = false;
|
||||
|
Loading…
Reference in New Issue
Block a user