本文整理匯總了Java中com.lowagie.text.Rectangle.cloneNonPositionParameters方法的典型用法代碼示例。如果您正苦於以下問題:Java Rectangle.cloneNonPositionParameters方法的具體用法?Java Rectangle.cloneNonPositionParameters怎麽用?Java Rectangle.cloneNonPositionParameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.lowagie.text.Rectangle
的用法示例。
在下文中一共展示了Rectangle.cloneNonPositionParameters方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: rectangle
import com.lowagie.text.Rectangle; //導入方法依賴的package包/類
/**
* Gets a Rectangle that is altered to fit on the page.
*
* @param top the top position
* @param bottom the bottom position
* @return a <CODE>Rectangle</CODE>
*/
public Rectangle rectangle(float top, float bottom) {
Rectangle tmp = new Rectangle(getLeft(), getBottom(), getRight(), getTop());
tmp.cloneNonPositionParameters(this);
if (getTop() > top) {
tmp.setTop(top);
tmp.setBorder(border - (border & TOP));
}
if (getBottom() < bottom) {
tmp.setBottom(bottom);
tmp.setBorder(border - (border & BOTTOM));
}
return tmp;
}
示例2: writeBorderAndBackground
import com.lowagie.text.Rectangle; //導入方法依賴的package包/類
/**
* Writes the border and background of one cell in the row.
*
* @param xPos The x-coordinate where the table starts on the canvas
* @param yPos The y-coordinate where the table starts on the canvas
* @param currentMaxHeight The height of the cell to be drawn.
* @param cell
* @param canvases
* @since 2.1.6 extra parameter currentMaxHeight
*/
public void writeBorderAndBackground(float xPos, float yPos, float currentMaxHeight, PdfPCell cell, PdfContentByte[] canvases) {
Color background = cell.getBackgroundColor();
if (background != null || cell.hasBorders()) {
// Add xPos resp. yPos to the cell's coordinates for absolute coordinates
float right = cell.getRight() + xPos;
float top = cell.getTop() + yPos;
float left = cell.getLeft() + xPos;
float bottom = top - currentMaxHeight;
if (background != null) {
PdfContentByte backgr = canvases[PdfPTable.BACKGROUNDCANVAS];
backgr.setColorFill(background);
backgr.rectangle(left, bottom, right - left, top - bottom);
backgr.fill();
}
if (cell.hasBorders()) {
Rectangle newRect = new Rectangle(left, bottom, right, top);
// Clone non-position parameters except for the background color
newRect.cloneNonPositionParameters(cell);
newRect.setBackgroundColor(null);
// Write the borders on the line canvas
PdfContentByte lineCanvas = canvases[PdfPTable.LINECANVAS];
lineCanvas.rectangle(newRect);
}
}
}