You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2014/02/23 14:42:00 UTC
svn commit: r1571010 -
/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java
Author: tilman
Date: Sun Feb 23 13:42:00 2014
New Revision: 1571010
URL: http://svn.apache.org/r1571010
Log:
PDFBOX-1877: type 3 shading (radial shading): fix handling of values not in the domain
Modified:
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java?rev=1571010&r1=1571009&r2=1571010&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java Sun Feb 23 13:42:00 2014
@@ -252,20 +252,28 @@ public class RadialShadingContext implem
{
inputValue = inputValues[1];
}
- // both are not in the domain (is this correct, or is there some miscalculation??)
+ // both are not in the domain
else
{
- // TODO don't know what to do in such cases. The following works
- // with the given examples
- // choose the smaller if extend[0] is set to true
- if (extend[0])
+ if (extend[0] && extend[1])
{
- inputValue = Math.min(inputValues[0], inputValues[1]);
+ inputValue = Math.max(inputValues[0], inputValues[1]);
+ }
+ else if (extend[0])
+ {
+ inputValue = inputValues[0];
+ }
+ else if (extend[1])
+ {
+ inputValue = inputValues[1];
+ }
+ else if (background != null)
+ {
+ useBackground = true;
}
- // choose the bigger one in all other cases
else
{
- inputValue = Math.max(inputValues[0], inputValues[1]);
+ continue;
}
}
}