本文整理匯總了Java中com.lowagie.text.pdf.PdfContentByte.resetRGBColorStroke方法的典型用法代碼示例。如果您正苦於以下問題:Java PdfContentByte.resetRGBColorStroke方法的具體用法?Java PdfContentByte.resetRGBColorStroke怎麽用?Java PdfContentByte.resetRGBColorStroke使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.lowagie.text.pdf.PdfContentByte
的用法示例。
在下文中一共展示了PdfContentByte.resetRGBColorStroke方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: tableLayout
import com.lowagie.text.pdf.PdfContentByte; //導入方法依賴的package包/類
/**
* @see com.lowagie.text.pdf.PdfPTableEvent#tableLayout(com.lowagie.text.pdf.PdfPTable,
* float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[])
*/
public void tableLayout(PdfPTable table, float[][] width, float[] height, int headerRows, int rowStart,
PdfContentByte[] canvases) {
float widths[] = width[0];
float x1 = widths[0];
float x2 = widths[widths.length - 1];
float y1 = height[0];
float y2 = height[height.length - 1];
PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
canvas.setRGBColorStroke(0x00, 0x00, 0xFF);
canvas.rectangle(x1, y1, x2 - x1, y2 - y1);
canvas.stroke();
canvas.resetRGBColorStroke();
}
示例2: cellLayout
import com.lowagie.text.pdf.PdfContentByte; //導入方法依賴的package包/類
/**
* @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell,
* com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
*/
public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {
float x1 = position.getLeft() + 2;
float x2 = position.getRight() - 2;
float y1 = position.getTop() - 2;
float y2 = position.getBottom() + 2;
PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
canvas.setRGBColorStroke(0xFF, 0x00, 0x00);
canvas.rectangle(x1, y1, x2 - x1, y2 - y1);
canvas.stroke();
canvas.resetRGBColorStroke();
}
示例3: main
import com.lowagie.text.pdf.PdfContentByte; //導入方法依賴的package包/類
/**
* Draws some shapes.
*/
@Test
public void main() throws Exception {
// step 1: creation of a document-object
Document document = new Document();
try {
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter writer = PdfWriter.getInstance(document, PdfTestBase.getOutputStream( "shapes.pdf"));
// step 3: we open the document
document.open();
// step 4: we grab the ContentByte and do some stuff with it
PdfContentByte cb = writer.getDirectContent();
// an example of a rectangle with a diagonal in very thick lines
cb.setLineWidth(10f);
// draw a rectangle
cb.rectangle(100, 700, 100, 100);
// add the diagonal
cb.moveTo(100, 700);
cb.lineTo(200, 800);
// stroke the lines
cb.stroke();
// an example of some circles
cb.setLineDash(3, 3, 0);
cb.setRGBColorStrokeF(0f, 255f, 0f);
cb.circle(150f, 500f, 100f);
cb.stroke();
cb.setLineWidth(5f);
cb.resetRGBColorStroke();
cb.circle(150f, 500f, 50f);
cb.stroke();
// example with colorfill
cb.setRGBColorFillF(0f, 255f, 0f);
cb.moveTo(100f, 200f);
cb.lineTo(200f, 250f);
cb.lineTo(400f, 150f);
// because we change the fill color BEFORE we stroke the triangle
// the color of the triangle will be red instead of green
cb.setRGBColorFillF(255f, 0f, 0f);
cb.closePathFillStroke();
cb.sanityCheck();
}
catch(DocumentException de) {
System.err.println(de.getMessage());
}
catch(IOException ioe) {
System.err.println(ioe.getMessage());
}
// step 5: we close the document
document.close();
}