[Git][java-team/xmlgraphics-commons][upstream] New upstream version 2.7
Mathieu Malaterre (@malat)
gitlab at salsa.debian.org
Wed Nov 2 14:17:51 GMT 2022
Mathieu Malaterre pushed to branch upstream at Debian Java Maintainers / xmlgraphics-commons
Commits:
3691ecc3 by Mathieu Malaterre at 2022-11-02T15:14:05+01:00
New upstream version 2.7
- - - - -
14 changed files:
- NOTICE
- README
- build.properties
- build.xml
- − lib/build/mockito-core-1.8.5.jar
- lib/build/mockito-core-1.8.5.LICENCE.txt → lib/build/mockito-core-2.28.2.LICENCE.txt
- lib/build/mockito-core-1.8.5.NOTICE.txt → lib/build/mockito-core-2.28.2.NOTICE.txt
- + lib/build/mockito-core-2.28.2.jar
- pom.xml
- src/main/java/org/apache/xmlgraphics/image/loader/ImageFlavor.java
- src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java
- src/main/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java
- src/test/java/org/apache/xmlgraphics/ps/FormGeneratorTestCase.java
- src/test/java/org/apache/xmlgraphics/ps/ImageEncodingHelperTestCase.java
Changes:
=====================================
NOTICE
=====================================
@@ -1,5 +1,5 @@
Apache XML Graphics Commons
-Copyright 2006-2021 The Apache Software Foundation
+Copyright 2006-2022 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
=====================================
README
=====================================
@@ -1,4 +1,4 @@
-$Id: README 1885379 2021-01-12 09:32:59Z ssteiner $
+$Id: README 1896948 2022-01-12 10:37:20Z ssteiner $
==============================================================================
APACHE XML GRAPHICS COMMONS - README
@@ -82,6 +82,11 @@ License labeling (according to http://www.apache.org/legal/3party.html):
For more detailed info about the changes, please see:
http://xmlgraphics.apache.org/commons/changes.html
+Version 2.7
+--------------
+
+Minor release to be used with FOP 2.7
+
Version 2.6
--------------
=====================================
build.properties
=====================================
@@ -34,7 +34,7 @@
## ===================================================================
## 3. Project specific properties
-version = 2.6
+version = 2.7
## Allows you to switch off the compilation of the internal image
## codecs which depend on Sun-private classes. Setting this to true
=====================================
build.xml
=====================================
@@ -25,7 +25,7 @@
<property name="Name" value="Apache XML Graphics Commons"/>
<property name="name" value="xmlgraphics-commons"/>
- <property name="year" value="1999-2021"/>
+ <property name="year" value="1999-2022"/>
<property name="javac.debug" value="on"/>
<property name="javac.optimize" value="off"/>
=====================================
lib/build/mockito-core-1.8.5.jar deleted
=====================================
Binary files a/lib/build/mockito-core-1.8.5.jar and /dev/null differ
=====================================
lib/build/mockito-core-1.8.5.LICENCE.txt → lib/build/mockito-core-2.28.2.LICENCE.txt
=====================================
=====================================
lib/build/mockito-core-1.8.5.NOTICE.txt → lib/build/mockito-core-2.28.2.NOTICE.txt
=====================================
=====================================
lib/build/mockito-core-2.28.2.jar
=====================================
Binary files /dev/null and b/lib/build/mockito-core-2.28.2.jar differ
=====================================
pom.xml
=====================================
@@ -4,7 +4,7 @@
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>xmlgraphics-commons</artifactId>
- <version>2.6</version>
+ <version>2.7</version>
<name>${project.groupId}:${project.artifactId}</name>
<description>XML Graphics Commons</description>
<url>http://xmlgraphics.apache.org/commons/</url>
@@ -68,7 +68,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>1.8.5</version>
+ <version>2.28.2</version>
<scope>test</scope>
</dependency>
<dependency>
=====================================
src/main/java/org/apache/xmlgraphics/image/loader/ImageFlavor.java
=====================================
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-/* $Id: ImageFlavor.java 829060 2009-10-23 13:42:53Z jeremias $ */
+/* $Id: ImageFlavor.java 1894758 2021-11-05 13:34:47Z ssteiner $ */
package org.apache.xmlgraphics.image.loader;
@@ -55,6 +55,8 @@ public class ImageFlavor {
/** An image in form of a raw EPS (Encapsulated PostScript) file/stream */
public static final ImageFlavor RAW_EPS = new MimeEnabledImageFlavor(RAW,
MimeConstants.MIME_EPS);
+ public static final ImageFlavor RAW_PDF = new MimeEnabledImageFlavor(RAW, MimeConstants.MIME_PDF);
+
/** An image in form of a raw LZW file/stream */
public static final ImageFlavor RAW_LZW = new ImageFlavor("RawLZW");
/** An image in form of a raw CCITTFax stream */
=====================================
src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java
=====================================
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-/* $Id: AbstractImageSessionContext.java 1796008 2017-05-24 08:16:01Z ssteiner $ */
+/* $Id: AbstractImageSessionContext.java 1895651 2021-12-07 08:03:10Z ssteiner $ */
package org.apache.xmlgraphics.image.loader.impl;
@@ -29,6 +29,8 @@ import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.MalformedURLException;
import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageInputStream;
@@ -59,11 +61,16 @@ public abstract class AbstractImageSessionContext implements ImageSessionContext
private static boolean noSourceReuse;
static {
- //TODO Temporary measure to track down a problem
- //See: http://markmail.org/message/k6mno3jsxmovaz2e
- String noSourceReuseString = System.getProperty(
- AbstractImageSessionContext.class.getName() + ".no-source-reuse");
- noSourceReuse = Boolean.valueOf(noSourceReuseString);
+ noSourceReuse = AccessController.doPrivileged(
+ new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ //See: http://markmail.org/message/k6mno3jsxmovaz2e
+ String noSourceReuseString = System.getProperty(
+ AbstractImageSessionContext.class.getName() + ".no-source-reuse");
+ return Boolean.valueOf(noSourceReuseString);
+ }
+ }
+ );
}
private final FallbackResolver fallbackResolver;
=====================================
src/main/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java
=====================================
@@ -15,10 +15,12 @@
* limitations under the License.
*/
-/* $Id: ImageEncodingHelper.java 1713619 2015-11-10 11:55:53Z ssteiner $ */
+/* $Id: ImageEncodingHelper.java 1896317 2021-12-23 14:30:49Z ssteiner $ */
package org.apache.xmlgraphics.ps;
+import java.awt.Color;
+import java.awt.Graphics2D;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
@@ -487,8 +489,18 @@ public class ImageEncodingHelper {
private final RenderedImage img;
- public RenderedImageEncoder(RenderedImage img) {
- this.img = img;
+ public RenderedImageEncoder(RenderedImage ri) {
+ if (ri instanceof BufferedImage && ((BufferedImage) ri).getType() == BufferedImage.TYPE_4BYTE_ABGR) {
+ BufferedImage convertedImg =
+ new BufferedImage(ri.getWidth(), ri.getHeight(), BufferedImage.TYPE_INT_RGB);
+ Graphics2D g = (Graphics2D) convertedImg.getGraphics();
+ g.setBackground(Color.WHITE);
+ g.clearRect(0, 0, ri.getWidth(), ri.getHeight());
+ g.drawImage((BufferedImage)ri, 0, 0, null);
+ g.dispose();
+ ri = convertedImg;
+ }
+ img = ri;
}
public void writeTo(OutputStream out) throws IOException {
=====================================
src/test/java/org/apache/xmlgraphics/ps/FormGeneratorTestCase.java
=====================================
@@ -21,9 +21,9 @@ package org.apache.xmlgraphics.ps;
import java.awt.Color;
import java.awt.Dimension;
+import java.awt.Graphics2D;
import java.awt.color.ColorSpace;
-
import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage;
@@ -100,4 +100,28 @@ public class FormGeneratorTestCase {
//FlateDecode at DataSource so executed on page load rather than document load so viewer loads faster
Assert.assertTrue(test.contains("/DataSource form:Data /FlateDecode filter\n"));
}
+
+ @Test
+ public void testAlphaImage() throws IOException {
+ Assert.assertEquals(buildPSImage(BufferedImage.TYPE_4BYTE_ABGR), buildPSImage(BufferedImage.TYPE_INT_RGB));
+ }
+
+ private String buildPSImage(int type) throws IOException {
+ Dimension2D dimension = new Dimension2DDouble(1, 1);
+ BufferedImage im = new BufferedImage(1, 1, type);
+ Graphics2D g = (Graphics2D) im.getGraphics();
+ if (type == BufferedImage.TYPE_4BYTE_ABGR) {
+ g.setBackground(new Color(0, 0, 0, 0));
+ } else {
+ g.setBackground(Color.white);
+ }
+ g.clearRect(0, 0, im.getWidth(), im.getHeight());
+ g.drawImage(im, 0, 0, null);
+ g.dispose();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ImageFormGenerator formImageGen = new ImageFormGenerator("form", "title", dimension, im, false);
+ PSGenerator gen = new PSGenerator(out);
+ formImageGen.generate(gen);
+ return out.toString("utf-8");
+ }
}
=====================================
src/test/java/org/apache/xmlgraphics/ps/ImageEncodingHelperTestCase.java
=====================================
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-/* $Id: ImageEncodingHelperTestCase.java 1732019 2016-02-24 05:01:10Z gadams $ */
+/* $Id: ImageEncodingHelperTestCase.java 1896578 2021-12-31 12:22:29Z ssteiner $ */
package org.apache.xmlgraphics.ps;
@@ -34,8 +34,8 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyObject;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -140,7 +140,7 @@ public class ImageEncodingHelperTestCase {
return null;
}
};
- when(raster.getDataElements(anyInt(), anyInt(), anyInt(), anyInt(), anyObject()))
+ when(raster.getDataElements(anyInt(), anyInt(), anyInt(), anyInt(), any()))
.thenAnswer(ans);
ByteArrayOutputStream optimized = new ByteArrayOutputStream();
View it on GitLab: https://salsa.debian.org/java-team/xmlgraphics-commons/-/commit/3691ecc3a071d8665f51f02626215e2b6f5a9f9a
--
View it on GitLab: https://salsa.debian.org/java-team/xmlgraphics-commons/-/commit/3691ecc3a071d8665f51f02626215e2b6f5a9f9a
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20221102/d953ac55/attachment.htm>
More information about the pkg-java-commits
mailing list