當前位置: 首頁>>代碼示例>>Java>>正文


Java Rectangle.cloneNonPositionParameters方法代碼示例

本文整理匯總了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;
}
 
開發者ID:albfernandez,項目名稱:itext2,代碼行數:22,代碼來源:PdfCell.java

示例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);
		}
	}
}
 
開發者ID:albfernandez,項目名稱:itext2,代碼行數:37,代碼來源:PdfPRow.java


注:本文中的com.lowagie.text.Rectangle.cloneNonPositionParameters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。