aboutsummaryrefslogtreecommitdiffstats
path: root/src/java-1.4/org/apache/fop
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2008-03-18 15:01:43 +0000
committerVincent Hennebert <vhennebert@apache.org>2008-03-18 15:01:43 +0000
commitbc8128695c25fdeb81f4e15aacc7247200a420d2 (patch)
treef31ced186a0e447b52dadbd6cef177bd095472f7 /src/java-1.4/org/apache/fop
parentb0644700fd13beb3286888fbea4dd4a0461d6d54 (diff)
downloadxmlgraphics-fop-bc8128695c25fdeb81f4e15aacc7247200a420d2.tar.gz
xmlgraphics-fop-bc8128695c25fdeb81f4e15aacc7247200a420d2.zip
Merged revisions 636400-636405,636407-638388 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ........ r636403 | vhennebert | 2008-03-12 16:24:48 +0000 (Wed, 12 Mar 2008) | 2 lines Updated copyright years ........ r637075 | vhennebert | 2008-03-14 12:19:45 +0000 (Fri, 14 Mar 2008) | 4 lines Bugzilla #44412: Bugfix: When there was a forced break after a block with (conditional) borders the border-after wasn't painted. Changes made by Jeremias ........ r637119 | jeremias | 2008-03-14 14:41:03 +0000 (Fri, 14 Mar 2008) | 2 lines Bugzilla #44412: Bugfix: The before border of a block is no longer swallowed if its first child issues a break-before. ........ r637791 | jeremias | 2008-03-17 08:59:51 +0000 (Mon, 17 Mar 2008) | 3 lines Removed old image adapters. Removed support for Java 1.3 building as it didn't work anymore anyway. Added a check to require Java 1.4 for building. ........ r637857 | jeremias | 2008-03-17 12:24:33 +0000 (Mon, 17 Mar 2008) | 3 lines Partially reverted revision 637791: Restored JAI as a required dependency for distribution builds (used for error diffusion dithering in the PCL Renderer). It is optional otherwise. Updated the licensing info and release notes to make the changes clear. ........ r637993 | vhennebert | 2008-03-17 17:48:44 +0000 (Mon, 17 Mar 2008) | 3 lines Bugzilla #44621: when the after border of a cell, in the trailing case, is bigger than in the normal case, the generated sequence of Knuth elements was wrong, leading to content being swallowed This is a partial fix only: the content is no longer swallowed, but the penalty is wrong (shorter than it should be). This will lead to the table overflowing the region-body without warning. ........ r638048 | vhennebert | 2008-03-17 20:00:36 +0000 (Mon, 17 Mar 2008) | 2 lines Changed the documentation to reflect the move to Java 1.4 as a minimum requirement ........ r638308 | vhennebert | 2008-03-18 10:26:32 +0000 (Tue, 18 Mar 2008) | 2 lines Simplified the getNextKnuthElements method a little bit ........ r638316 | vhennebert | 2008-03-18 11:06:59 +0000 (Tue, 18 Mar 2008) | 2 lines Removed the 'jdk1.4' suffix appended to the binary artifacts. There's no point in making the distinction anymore since there is only one binary now ........ r638317 | vhennebert | 2008-03-18 11:08:29 +0000 (Tue, 18 Mar 2008) | 2 lines Updated the probable date of the release ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@638396 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java-1.4/org/apache/fop')
-rw-r--r--src/java-1.4/org/apache/fop/image/ImageIOImage.java237
-rw-r--r--src/java-1.4/org/apache/fop/image/JpegImageIOImage.java161
-rw-r--r--src/java-1.4/org/apache/fop/svg/GraphicsConfiguration.java51
3 files changed, 0 insertions, 449 deletions
diff --git a/src/java-1.4/org/apache/fop/image/ImageIOImage.java b/src/java-1.4/org/apache/fop/image/ImageIOImage.java
deleted file mode 100644
index 7ec6b9004..000000000
--- a/src/java-1.4/org/apache/fop/image/ImageIOImage.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.image;
-
-// AWT
-import java.awt.Color;
-import java.awt.color.ColorSpace;
-import java.awt.image.ColorModel;
-import java.awt.image.IndexColorModel;
-import java.awt.image.BufferedImage;
-import java.util.Iterator;
-
-// ImageIO
-import javax.imageio.ImageIO;
-import javax.imageio.ImageReadParam;
-import javax.imageio.ImageReader;
-import javax.imageio.metadata.IIOMetadata;
-import javax.imageio.stream.ImageInputStream;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.fop.util.UnitConv;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * FopImage object using ImageIO.
- * @see AbstractFopImage
- * @see FopImage
- */
-public class ImageIOImage extends AbstractFopImage {
-
- private byte[] softMask = null;
-
- /**
- * Creates a new ImageIOImage.
- * @param info the image info from the ImageReader
- */
- public ImageIOImage(FopImage.ImageInfo info) {
- super(info);
- if ("image/png".equals(info.mimeType)
- || "image/tiff".equals(info.mimeType)) {
- this.loaded = 0; //TODO The PNG and TIFF Readers cannot read the resolution, yet.
- }
- }
-
- /**
- * @see org.apache.fop.image.AbstractFopImage#loadDimensions()
- */
- protected boolean loadDimensions() {
- if (this.bitmaps == null) {
- return loadBitmap();
- }
- return true;
- }
-
- private Element getChild(Element el, String name) {
- NodeList nodes = el.getElementsByTagName(name);
- if (nodes.getLength() > 0) {
- return (Element)nodes.item(0);
- } else {
- return null;
- }
- }
-
- /** @see org.apache.fop.image.AbstractFopImage#loadBitmap() */
- protected boolean loadBitmap() {
- if (this.bitmaps != null) {
- return true;
- }
- try {
- inputStream.reset();
- ImageInputStream imgStream = ImageIO.createImageInputStream(inputStream);
- Iterator iter = ImageIO.getImageReaders(imgStream);
- if (!iter.hasNext()) {
- log.error("No ImageReader found.");
- return false;
- }
- ImageReader reader = (ImageReader)iter.next();
- ImageReadParam param = reader.getDefaultReadParam();
- reader.setInput(imgStream, true, false);
- BufferedImage imageData = reader.read(0, param);
-
- //Read image resolution
- IIOMetadata iiometa = reader.getImageMetadata(0);
- if (iiometa != null && iiometa.isStandardMetadataFormatSupported()) {
- Element metanode = (Element)iiometa.getAsTree("javax_imageio_1.0");
- Element dim = getChild(metanode, "Dimension");
- if (dim != null) {
- Element child;
- child = getChild(dim, "HorizontalPixelSize");
- if (child != null) {
- this.dpiHorizontal = UnitConv.IN2MM
- / Float.parseFloat(child.getAttribute("value"));
- }
- child = getChild(dim, "VerticalPixelSize");
- if (child != null) {
- this.dpiVertical = UnitConv.IN2MM
- / Float.parseFloat(child.getAttribute("value"));
- }
- }
- }
- imgStream.close();
- reader.dispose();
-
- this.height = imageData.getHeight();
- this.width = imageData.getWidth();
-
- ColorModel cm = imageData.getColorModel();
- this.bitsPerPixel = cm.getComponentSize(0); //only use first, we assume all are equal
- //this.colorSpace = cm.getColorSpace();
- //We currently force the image to sRGB
- this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
-
- int[] tmpMap = imageData.getRGB(0, 0, this.width,
- this.height, null, 0, this.width);
-
- if (cm.hasAlpha()) {
- // java.awt.Transparency. BITMASK or OPAQUE or TRANSLUCENT
- int transparencyType = cm.getTransparency();
-
- if (transparencyType == java.awt.Transparency.OPAQUE) {
- this.isTransparent = false;
- } else if (transparencyType == java.awt.Transparency.BITMASK) {
- if (cm instanceof IndexColorModel) {
- this.isTransparent = false;
- byte[] alphas = new byte[
- ((IndexColorModel) cm).getMapSize()];
- byte[] reds = new byte[
- ((IndexColorModel) cm).getMapSize()];
- byte[] greens = new byte[
- ((IndexColorModel) cm).getMapSize()];
- byte[] blues = new byte[
- ((IndexColorModel) cm).getMapSize()];
- ((IndexColorModel) cm).getAlphas(alphas);
- ((IndexColorModel) cm).getReds(reds);
- ((IndexColorModel) cm).getGreens(greens);
- ((IndexColorModel) cm).getBlues(blues);
- for (int i = 0;
- i < ((IndexColorModel) cm).getMapSize();
- i++) {
- if ((alphas[i] & 0xFF) == 0) {
- this.isTransparent = true;
- this.transparentColor = new Color(
- (int)(reds[i] & 0xFF),
- (int)(greens[i] & 0xFF),
- (int)(blues[i] & 0xFF));
- break;
- }
- }
- } else {
- //TODO Is there another case?
- this.isTransparent = false;
- }
- } else {
- // TRANSLUCENT
- this.softMask = new byte[width * height];
- imageData.getAlphaRaster().getDataElements(
- 0, 0, width, height, this.softMask);
- this.isTransparent = false;
- }
- } else {
- this.isTransparent = false;
- }
-
- // Should take care of the ColorSpace and bitsPerPixel
- this.bitmaps = new byte[this.width * this.height * 3];
- for (int i = 0; i < this.height; i++) {
- for (int j = 0; j < this.width; j++) {
- int p = tmpMap[i * this.width + j];
- int r = (p >> 16) & 0xFF;
- int g = (p >> 8) & 0xFF;
- int b = (p) & 0xFF;
- this.bitmaps[3 * (i * this.width + j)]
- = (byte)(r & 0xFF);
- this.bitmaps[3 * (i * this.width + j) + 1]
- = (byte)(g & 0xFF);
- this.bitmaps[3 * (i * this.width + j) + 2]
- = (byte)(b & 0xFF);
- }
- }
-
- } catch (Exception ex) {
- log.error("Error while loading image: " + ex.getMessage(), ex);
- return false;
- } finally {
- IOUtils.closeQuietly(inputStream);
- inputStream = null;
- }
- return true;
- }
-
- /** @see org.apache.fop.image.AbstractFopImage#loadOriginalData() */
- protected boolean loadOriginalData() {
- if (inputStream == null && getBitmaps() != null) {
- return false;
- } else {
- return loadDefaultOriginalData();
- }
- }
-
- /** @see org.apache.fop.image.FopImage#hasSoftMask() */
- public boolean hasSoftMask() {
- if (this.bitmaps == null && this.raw == null) {
- loadBitmap();
- }
-
- return (this.softMask != null);
- }
-
- /** @see org.apache.fop.image.FopImage#getSoftMask() */
- public byte[] getSoftMask() {
- if (this.bitmaps == null) {
- loadBitmap();
- }
-
- return this.softMask;
- }
-
-}
-
diff --git a/src/java-1.4/org/apache/fop/image/JpegImageIOImage.java b/src/java-1.4/org/apache/fop/image/JpegImageIOImage.java
deleted file mode 100644
index 86d78f666..000000000
--- a/src/java-1.4/org/apache/fop/image/JpegImageIOImage.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.image;
-
-// AWT
-import java.awt.Color;
-import java.awt.image.ColorModel;
-import java.awt.image.IndexColorModel;
-import java.awt.image.BufferedImage;
-
-// ImageIO
-import javax.imageio.ImageIO;
-
-import org.apache.commons.io.IOUtils;
-
-/**
- * FopImage object using ImageIO.
- * Special class to allow the use of JpegImage for those
- * renderers which can embed Jpeg directly but for renderers
- * which require the decoded data this class delivers it.
- * @see AbstractFopImage
- * @see JpegImage
- */
-public class JpegImageIOImage extends JpegImage {
-
- /**
- * Creates a new JpegImageIOImage.
- * @param info the image info from the ImageReader
- */
- public JpegImageIOImage(FopImage.ImageInfo info) {
- super(info);
- }
-
- /**
- * @see org.apache.fop.image.AbstractFopImage#loadDimensions()
- */
- protected boolean loadDimensions() {
- if (this.bitmaps == null) {
- return loadBitmap();
- }
- return true;
- }
-
- /** @see org.apache.fop.image.AbstractFopImage#loadBitmap() */
- protected boolean loadBitmap() {
- try {
- inputStream.reset();
- BufferedImage imageData = ImageIO.read(inputStream);
-
- this.height = imageData.getHeight();
- this.width = imageData.getWidth();
-
- ColorModel cm = imageData.getColorModel();
- this.bitsPerPixel = cm.getComponentSize(0); //only use first, we assume all are equal
- this.colorSpace = cm.getColorSpace();
-
- int[] tmpMap = imageData.getRGB(0, 0, this.width,
- this.height, null, 0, this.width);
-
- if (cm.hasAlpha()) {
- // java.awt.Transparency. BITMASK or OPAQUE or TRANSLUCENT
- int transparencyType = cm.getTransparency();
-
- if (transparencyType == java.awt.Transparency.OPAQUE) {
- this.isTransparent = false;
- } else if (transparencyType == java.awt.Transparency.BITMASK) {
- if (cm instanceof IndexColorModel) {
- this.isTransparent = false;
- byte[] alphas = new byte[
- ((IndexColorModel) cm).getMapSize()];
- byte[] reds = new byte[
- ((IndexColorModel) cm).getMapSize()];
- byte[] greens = new byte[
- ((IndexColorModel) cm).getMapSize()];
- byte[] blues = new byte[
- ((IndexColorModel) cm).getMapSize()];
- ((IndexColorModel) cm).getAlphas(alphas);
- ((IndexColorModel) cm).getReds(reds);
- ((IndexColorModel) cm).getGreens(greens);
- ((IndexColorModel) cm).getBlues(blues);
- for (int i = 0;
- i < ((IndexColorModel) cm).getMapSize();
- i++) {
- if ((alphas[i] & 0xFF) == 0) {
- this.isTransparent = true;
- this.transparentColor = new Color(
- (int)(reds[i] & 0xFF),
- (int)(greens[i] & 0xFF),
- (int)(blues[i] & 0xFF));
- break;
- }
- }
- } else {
- // TRANSLUCENT
- /*
- * this.isTransparent = false;
- * for (int i = 0; i < this.width * this.height; i++) {
- * if (cm.getAlpha(tmpMap[i]) == 0) {
- * this.isTransparent = true;
- * this.transparentColor = new PDFColor(cm.getRed(tmpMap[i]),
- * cm.getGreen(tmpMap[i]), cm.getBlue(tmpMap[i]));
- * break;
- * }
- * }
- * // or use special API...
- */
- this.isTransparent = false;
- }
- } else {
- this.isTransparent = false;
- }
- } else {
- this.isTransparent = false;
- }
-
- // Should take care of the ColorSpace and bitsPerPixel
- this.bitmaps = new byte[this.width * this.height * 3];
- for (int i = 0; i < this.height; i++) {
- for (int j = 0; j < this.width; j++) {
- int p = tmpMap[i * this.width + j];
- int r = (p >> 16) & 0xFF;
- int g = (p >> 8) & 0xFF;
- int b = (p) & 0xFF;
- this.bitmaps[3 * (i * this.width + j)]
- = (byte)(r & 0xFF);
- this.bitmaps[3 * (i * this.width + j) + 1]
- = (byte)(g & 0xFF);
- this.bitmaps[3 * (i * this.width + j) + 2]
- = (byte)(b & 0xFF);
- }
- }
-
- } catch (Exception ex) {
- log.error("Error while loading image: " + ex.getMessage(), ex);
- return false;
- } finally {
- IOUtils.closeQuietly(inputStream);
- inputStream = null;
- }
- return true;
- }
-
-}
-
diff --git a/src/java-1.4/org/apache/fop/svg/GraphicsConfiguration.java b/src/java-1.4/org/apache/fop/svg/GraphicsConfiguration.java
deleted file mode 100644
index a92baed27..000000000
--- a/src/java-1.4/org/apache/fop/svg/GraphicsConfiguration.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-
-package org.apache.fop.svg;
-
-import java.awt.image.VolatileImage;
-
-/**
- * Adapter to allow subclassing java.awt.GraphicsConfiguration without
- * compilation errors.
- * The version for JDK 1.4 needs to add an override for the abstract
- * createCompatibleVolatileImage() method. It can't be overidden
- * for JDK 1.3 because there is no VolatileImage there.
- *
- */
-abstract public class GraphicsConfiguration extends java.awt.GraphicsConfiguration {
-
- /**
- * @see java.awt.GraphicsConfiguration#createCompatibleVolatileImage(int, int)
- * @since JDK 1.4
- */
- public VolatileImage createCompatibleVolatileImage(int width, int height) {
- return null;
- }
-
- /**
- * @see java.awt.GraphicsConfiguration#createCompatibleVolatileImage(int, int, int)
- * @since JDK 1.5
- */
- public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency) {
- return null;
- }
-
-}