<Bug pattern="SF_SWITCH_FALLTHROUGH"/>
</Match>
<Match>
- <Class name="org.apache.fop.render.java2d.Java2DBorderPainter"/>
+ <Class name="org.apache.fop.render.java2d.Java2DGraphicsPainter"/>
<Method name="drawLine"/>
<Bug pattern="SF_SWITCH_FALLTHROUGH"/>
</Match>
private void includeObject(AbstractNamedAFPObject namedObj, AFPDataObjectInfo dataObjectInfo) {
// create the include object
- AFPResourceInfo resourceInfo = dataObjectInfo.getResourceInfo();
String objectName = namedObj.getName();
AbstractCachedObject cachedObject;
* numbers.
*/
int PR_X_NUMBER_CONVERSION_FEATURES = 285;
-
+
/** Scope for table header */
int PR_X_HEADER_COLUMN = 286;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
-import org.apache.fop.util.CompareUtil;
/**
* Stores all common border and padding properties.
* @param bpsStart the border traits associated with start edge
* @param bpsEnd the border traits associated with end edge
* @param level of bidirectional embedding
- * @param innerBackgroundColor the background color of the block
+ * @param innerBackgroundColor the background color of the block
*/
protected void drawBorders( // CSOK: ParameterNumber
float startx, float starty, float width, float height,
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import org.apache.fop.afp.AFPDitheredRectanglePainter;
private int roundedCornerCount = 0;
- /** Medium Map referenced on previous page **/
- private String lastMediumMap;
private static enum Location {
ELSEWHERE, IN_DOCUMENT_HEADER, FOLLOWING_PAGE_SEQUENCE, IN_PAGE_HEADER
}
// Make a unique id
StringBuffer idBuilder = new StringBuffer("RC");
- String tmp = Integer.toHexString(roundedCornerCount).toUpperCase();
+ String tmp = Integer.toHexString(roundedCornerCount).toUpperCase(Locale.ENGLISH);
if (tmp.length() > 6) {
//Will never happen
//log.error("Rounded corners cache capacity exceeded");
GeneralPath cut = new GeneralPath();
cut.moveTo(0, 0);
- float borderWidthRatio = ((float) beforeWidth) / startWidth;
- if (beforeWidth * startRadius > startWidth * beforeRadius) {
- cut.lineTo(startRadius, borderWidthRatio * startRadius);
- cut.lineTo(startRadius, 0);
-
- } else {
- cut.lineTo(startRadius, borderWidthRatio * startRadius);
- cut.lineTo(startRadius, 0);
- }
-
+ cut.lineTo(startRadius, ((float) startRadius * beforeWidth) / startWidth);
+ cut.lineTo(startRadius, 0);
clip.intersect(new Area(cut));
clip.transform(transform);
return clip;
GeneralPath cut = new GeneralPath();
cut.moveTo(0, 0);
- float borderWidthRatio = ((float) beforeWidth) / startWidth;
- if (beforeWidth * startRadius > startWidth * beforeRadius) {
- cut.lineTo(startRadius, borderWidthRatio * startRadius);
- cut.lineTo(startRadius, 0);
-
- } else {
- cut.lineTo(startRadius, borderWidthRatio * startRadius);
- cut.lineTo(startRadius, 0);
- }
-
+ cut.lineTo(startRadius, ((float) startRadius * beforeWidth) / startWidth);
+ cut.lineTo(startRadius, 0);
clip.subtract(new Area(cut));
clip.transform(transform);
return clip;
hints.put(ImageHandlerUtil.CONVERSION_MODE, ImageHandlerUtil.CONVERSION_MODE_BITMAP);
hints.put("TARGET_RESOLUTION",
- new Integer(context.getPaintingState().getResolution()));
+ Integer.valueOf(context.getPaintingState().getResolution()));
try {
* @throws IOException if an I/O error occurs
*/
void cubicBezierTo(int p1x, int p1y, int p2x, int p2y, int p3x, int p3y) throws IOException;
-}
\ No newline at end of file
+}
/** TODO remove before integration*/
public static final String ROUNDED_CORNERS = "fop.round-corners";
- /** TODO Use a class to model border instead of an array
- * convention index of top, bottom, right and left borders */
- protected static final int TOP = 0, RIGHT = 1, BOTTOM = 2, LEFT = 3;
- /** TODO Use a class to model border corners instead of an array
- convention index of top-left, top-right, bottom-right and bottom-left border corners*/
- protected static final int TOP_LEFT = 0, TOP_RIGHT = 1, BOTTOM_RIGHT = 2, BOTTOM_LEFT = 3;
+ // TODO Use a class to model border instead of an array
+ /** Convention index of before top */
+ protected static final int TOP = 0;
+
+ /** Convention index of right border */
+ protected static final int RIGHT = 1;
+
+ /** Convention index of bottom border */
+ protected static final int BOTTOM = 2;
+
+ /** Convention index of left border */
+ protected static final int LEFT = 3;
+
+ // TODO Use a class to model border corners instead of an array
+ /** Convention index of top-left border corners */
+ protected static final int TOP_LEFT = 0;
+
+ /** Convention index of top-right-end border corners */
+ protected static final int TOP_RIGHT = 1;
+
+ /** Convention index of bottom-right border corners */
+ protected static final int BOTTOM_RIGHT = 2;
+
+ /** Convention index of bottom-left border corners */
+ protected static final int BOTTOM_LEFT = 3;
private final GraphicsPainter graphicsPainter;
int outerx = startx - clipw[LEFT];
int clipx = outerx + clipw[LEFT];
int innerx = outerx + bw[LEFT];
-
+
saveGraphicsState();
moveTo(clipx, ey1);
final int width = borderRect.width - start.getClippedWidth() - end.getClippedWidth();
final int height = borderRect.height - before.getClippedWidth() - after.getClippedWidth();
//Determine scale factor if any adjacent elliptic corners overlap
- double cornerCorrectionFactor = calculateCornerScaleCorrection(width, height, before, after, start, end);
+ double cornerCorrectionFactor = calculateCornerScaleCorrection(width, height, before, after, start,
+ end);
drawBorderSegment(start, before, end, 0, width, startx, starty, cornerCorrectionFactor);
drawBorderSegment(before, end, after, 1, height, startx + width, starty, cornerCorrectionFactor);
- drawBorderSegment(end, after, start, 2, width, startx + width, starty + height, cornerCorrectionFactor);
+ drawBorderSegment(end, after, start, 2, width, startx + width, starty + height,
+ cornerCorrectionFactor);
drawBorderSegment(after, start, before, 3, height, startx, starty + height, cornerCorrectionFactor);
}
private static final Corner SQUARE = new Corner(0, 0, null, 0, 0, 0, 0);
/** The radius of the elliptic corner in the x direction */
- protected final int radiusX;
+ private final int radiusX;
/** The radius of the elliptic corner in the y direction */
- protected final int radiusY;
+ private final int radiusY;
/** The start and end angles of the corner ellipse */
private final CornerAngles angles;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
-import org.apache.batik.parser.AWTTransformProducer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.batik.parser.AWTTransformProducer;
+
import org.apache.xmlgraphics.xmp.Metadata;
import org.apache.xmlgraphics.xmp.schemas.DublinCoreAdapter;
import org.apache.xmlgraphics.xmp.schemas.DublinCoreSchema;
this.painter.restoreGraphicsState();
this.currentPath = null;
}
-
-}
\ No newline at end of file
+}
boolean startOrBefore, int style, Color col) {
float w = x2 - x1;
float h = y2 - y1;
+ float colFactor;
switch (style) {
case Constants.EN_DASHED:
generator.setColor(col);
break;
case Constants.EN_GROOVE:
case Constants.EN_RIDGE:
- {
- float colFactor = (style == Constants.EN_GROOVE ? 0.4f : -0.4f);
+ colFactor = (style == Constants.EN_GROOVE ? 0.4f : -0.4f);
generator.setSolidLine();
if (horz) {
Color uppercol = ColorUtil.lightenColor(col, -colFactor);
.strokeLine(xm1 + w3 + w3, y1, xm1 + w3 + w3, y2);
}
break;
- }
case Constants.EN_INSET:
case Constants.EN_OUTSET:
- {
- float colFactor = (style == Constants.EN_OUTSET ? 0.4f : -0.4f);
+ colFactor = (style == Constants.EN_OUTSET ? 0.4f : -0.4f);
generator.setSolidLine();
Color c = col;
if (horz) {
.strokeLine(xm1, y1, xm1, y2);
}
break;
- }
case Constants.EN_HIDDEN:
break;
default:
String xS = format(xStart);
String xE = format(xEnd);
String yS = format(yStart);
- String yE = format(yEnd);
if (style == RuleStyle.GROOVE) {
addLine("m", xS, yS)
.addLine("l", xE, yS)
import org.apache.fop.fo.Constants;
import org.apache.fop.render.intermediate.ArcToBezierCurveTransformer;
import org.apache.fop.render.intermediate.BezierCurvePainter;
-import org.apache.fop.render.intermediate.BorderPainter;
import org.apache.fop.render.intermediate.GraphicsPainter;
import org.apache.fop.traits.RuleStyle;
import org.apache.fop.util.ColorUtil;
gen.useColor(col);
if (horz) {
float unit = Math.abs(2 * h);
- int rep = (int)(w / unit);
+ int rep = (int) (w / unit);
if (rep % 2 == 0) {
rep++;
}
drawLine(gen, x1, ym, x2, ym);
} else {
float unit = Math.abs(2 * w);
- int rep = (int)(h / unit);
+ int rep = (int) (h / unit);
if (rep % 2 == 0) {
rep++;
}
gen.useLineCap(1); //Rounded!
if (horz) {
float unit = Math.abs(2 * h);
- int rep = (int)(w / unit);
+ int rep = (int) (w / unit);
if (rep % 2 == 0) {
rep++;
}
drawLine(gen, x1, ym, x2, ym);
} else {
float unit = Math.abs(2 * w);
- int rep = (int)(h / unit);
+ int rep = (int) (h / unit);
if (rep % 2 == 0) {
rep++;
}
*/
public class BorderProps implements Serializable {
- private static final long serialVersionUID = 7053576586478548795L;
+ private static final long serialVersionUID = 8022237892391068187L;
public enum Mode {
SEPARATE("separate") {
return true;
} else {
if (obj instanceof BorderProps) {
- BorderProps other = (BorderProps)obj;
+ BorderProps other = (BorderProps) obj;
return (style == other.style)
&& org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(
color, other.color)
return sbuf.toString();
}
- private static class BorderPropsDeserializer {
+ private static final class BorderPropsDeserializer {
private static final BorderPropsDeserializer INSTANCE = new BorderPropsDeserializer();
m.find();
int width = Integer.parseInt(m.group());
Mode mode = Mode.SEPARATE;
- if ( m.find()) {
+ if (m.find()) {
String ms = m.group();
if (Mode.COLLAPSE_INNER.value.equalsIgnoreCase(ms)) {
mode = Mode.COLLAPSE_INNER;