[DONE]Incorporate Eric Schaeffer's fix to tables in static-content
[DONE] Incorporate Kelly Campell's fixes to GifJpegImage
[PARTIAL] Incorporate Eric Schaeffer's further table fixes
-Incorporate Eric Schaeffer's background colour implementation
+[DONE] Incorporate Eric Schaeffer's background colour implementation
+ (actually used different approach with background colour as trait)
Other Bugs to fix:
</datatype>
<default>false</default>
</property>
+ <property>
+ <name>background-color</name>
+ <class-name>BackgroundColor</class-name>
+ <inherited>false</inherited>
+ <datatype>ColorType</datatype>
+ <default>transparent</default>
+ </property>
</property-list>
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
/** the blue component */
protected float blue;
+ /** the alpha component */
+ protected float alpha = 0;
+
/**
* set the colour given a particular String specifying either a
* colour name or #RGB or #RRGGBB
this.red = 0.7f;
this.green = 0.5f;
this.blue = 0;
+ } else if (value.toLowerCase().equals("transparent")) {
+ this.red = 0;
+ this.green = 0;
+ this.blue = 0;
+ this.alpha = 1;
} else {
this.red = 0;
this.green = 0;
public float red() {
return this.red;
}
+
+ public float alpha() {
+ return this.alpha;
+ }
}
propertyTable.put("href",HRef.maker());
propertyTable.put("column-width",ColumnWidth.maker());
propertyTable.put("keep-with-next",KeepWithNext.maker());
+ propertyTable.put("background-color",BackgroundColor.maker());
propertyTable.put("height",SVGLength.maker());
propertyTable.put("width",SVGLength.maker());
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
+import org.apache.fop.datatypes.*;
import org.apache.fop.apps.FOPException;
public class Block extends FObjMixed {
int spaceAfter;
int textIndent;
int keepWithNext;
+ ColorType backgroundColor;
BlockArea blockArea;
this.properties.get("text-indent").getLength().mvalue();
this.keepWithNext =
this.properties.get("keep-with-next").getEnum();
+ this.backgroundColor =
+ this.properties.get("background-color").getColorType();
if (area instanceof BlockArea) {
area.end();
if (this.isInTableCell) {
startIndent += forcedStartOffset;
- endIndent = area.getAllocationWidth() - startIndent -
- forcedWidth;
+ endIndent = area.getAllocationWidth() - forcedWidth -
+ forcedStartOffset;
}
this.marker = 0;
area.spaceLeft(), startIndent, endIndent,
textIndent, align, alignLast, lineHeight);
blockArea.setPage(area.getPage());
+ blockArea.setBackgroundColor(backgroundColor);
blockArea.start();
int numChildren = this.children.size();
if (this.isInTableCell) {
startIndent += forcedStartOffset;
- endIndent = area.getAllocationWidth() - startIndent -
- forcedWidth;
+ endIndent = area.getAllocationWidth() - forcedWidth -
+ forcedStartOffset;
}
this.marker = 0;
area.addDisplaySpace(spaceBefore);
}
+ if (this.isInLabel) {
+ startIndent += bodyIndent;
+ endIndent += (area.getAllocationWidth() -
+ distanceBetweenStarts - startIndent) +
+ labelSeparation;
+ }
+
+ if (this.isInListBody) {
+ startIndent += bodyIndent + distanceBetweenStarts;
+ }
+
+ if (this.isInTableCell) {
+ startIndent += forcedStartOffset;
+ endIndent += area.getAllocationWidth() - forcedWidth -
+ forcedStartOffset;
+ }
+
RuleArea ruleArea = new RuleArea(fs,
area.getAllocationWidth(),
area.spaceLeft(),
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
+import org.apache.fop.datatypes.*;
import org.apache.fop.apps.FOPException;
// Java
int endIndent;
int spaceBefore;
int spaceAfter;
+ ColorType backgroundColor;
Vector columns = new Vector();
int currentColumnNumber = 0;
this.properties.get("space-before.optimum").getLength().mvalue();
this.spaceAfter =
this.properties.get("space-after.optimum").getLength().mvalue();
+ this.backgroundColor =
+ this.properties.get("background-color").getColorType();
+
if (area instanceof BlockArea) {
area.end();
}
area.spaceLeft(), startIndent, endIndent, 0,
0, 0, 0);
blockArea.setPage(area.getPage());
+ blockArea.setBackgroundColor(backgroundColor);
blockArea.start();
// added by Eric Schaeffer
// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
+import org.apache.fop.datatypes.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
int endIndent;
int spaceBefore;
int spaceAfter;
+ ColorType backgroundColor;
Vector columns;
this.properties.get("space-before.optimum").getLength().mvalue();
this.spaceAfter =
this.properties.get("space-after.optimum").getLength().mvalue();
+ this.backgroundColor =
+ this.properties.get("background-color").getColorType();
+
if (area instanceof BlockArea) {
area.end();
}
area.spaceLeft(), startIndent, endIndent, 0,
0, 0, 0);
blockArea.setPage(area.getPage());
+ blockArea.setBackgroundColor(backgroundColor);
blockArea.start();
int numChildren = this.children.size();
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.*;
public class TableCell extends FObj {
int endIndent;
int spaceBefore;
int spaceAfter;
+ ColorType backgroundColor;
protected int startOffset;
protected int width;
this.properties.get("space-before.optimum").getLength().mvalue();
this.spaceAfter =
this.properties.get("space-after.optimum").getLength().mvalue();
+ this.backgroundColor =
+ this.properties.get("background-color").getColorType();
+
if (area instanceof BlockArea) {
area.end();
}
area.spaceLeft(), startIndent, endIndent, 0,
0, 0, 0);
blockArea.setPage(area.getPage());
+ blockArea.setBackgroundColor(backgroundColor);
blockArea.start();
// added by Eric Schaeffer
// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
+import org.apache.fop.datatypes.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
int endIndent;
int spaceBefore;
int spaceAfter;
+ ColorType backgroundColor;
int widthOfCellsSoFar = 0;
int largestCellHeight = 0;
this.properties.get("space-before.optimum").getLength().mvalue();
this.spaceAfter =
this.properties.get("space-after.optimum").getLength().mvalue();
+ this.backgroundColor =
+ this.properties.get("background-color").getColorType();
+
if (area instanceof BlockArea) {
area.end();
}
area.spaceLeft(), startIndent, endIndent, 0,
0, 0, 0);
blockArea.setPage(area.getPage());
+ blockArea.setBackgroundColor(backgroundColor);
blockArea.start();
int numChildren = this.children.size();
package org.apache.fop.layout;
+// FOP
+import org.apache.fop.datatypes.*;
+
// Java
import java.util.Vector;
/* the page this area is on */
protected Page page;
+ protected ColorType backgroundColor;
+
public Area (FontState fontState) {
this.fontState = fontState;
}
return this.page;
}
+ public ColorType getBackgroundColor() {
+ return this.backgroundColor;
+ }
+
public void increaseHeight(int amount) {
this.currentHeight += amount;
}
this.page = page;
}
+ public void setBackgroundColor(ColorType bgColor) {
+ this.backgroundColor = bgColor;
+ }
+
public int spaceLeft() {
return maxHeight - currentHeight;
}
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
Software Foundation, please see <http://www.apache.org/>.
*/
+
package org.apache.fop.render.pdf;
// FOP
import org.apache.fop.image.ImageArea;
import org.apache.fop.image.FopImage;
import org.apache.fop.layout.*;
+import org.apache.fop.datatypes.*;
import org.apache.fop.svg.*;
import org.apache.fop.pdf.*;
* @param areaTree the laid-out area tree
* @param writer the PrintWriter to write the PDF with
*/
- public void render(AreaTree areaTree, PrintWriter writer) throws IOException {
+ public void render(AreaTree areaTree, PrintWriter writer)
+ throws IOException {
System.err.println("rendering areas to PDF");
this.pdfResources = this.pdfDoc.getResources();
Enumeration e = areaTree.getPages().elements();
int ry = this.currentYPosition;
int w = area.getContentWidth();
int h = area.getHeight();
+ ColorType bg = area.getBackgroundColor();
+ if (bg.alpha() == 0) {
+ this.addRect(rx, ry, w, -h,
+ bg.red(), bg.green(), bg.blue(),
+ bg.red(), bg.green(), bg.blue());
+ }
Enumeration e = area.getChildren().elements();
while (e.hasMoreElements()) {
Box b = (Box) e.nextElement();