本文整理汇总了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();
}