pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1571009 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java
Date Sun, 23 Feb 2014 13:41:18 GMT
Author: tilman
Date: Sun Feb 23 13:41:18 2014
New Revision: 1571009

URL: http://svn.apache.org/r1571009
Log:
PDFBOX-1877: type 3 shading (radial shading): fix handling of values not in the domain

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java?rev=1571009&r1=1571008&r2=1571009&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java
Sun Feb 23 13:41:18 2014
@@ -209,20 +209,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;
                             }
                         }
                     }



Mime
View raw message