本文整理汇总了Java中com.lowagie.text.pdf.PdfContentByte.newPath方法的典型用法代码示例。如果您正苦于以下问题:Java PdfContentByte.newPath方法的具体用法?Java PdfContentByte.newPath怎么用?Java PdfContentByte.newPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.pdf.PdfContentByte
的用法示例。
在下文中一共展示了PdfContentByte.newPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.lowagie.text.pdf.PdfContentByte; //导入方法依赖的package包/类
@Test
public void main() throws Exception {
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
PdfWriter writer = PdfWriter.getInstance(document, PdfTestBase.getOutputStream( "shading.pdf"));
document.open();
PdfFunction function1 = PdfFunction.type2(writer, new float[] { 0, 1 },
null, new float[] { .929f, .357f, 1, .298f }, new float[] {
.631f, .278f, 1, .027f }, 1.048f);
PdfFunction function2 = PdfFunction.type2(writer, new float[] { 0, 1 },
null, new float[] { .929f, .357f, 1, .298f }, new float[] {
.941f, .4f, 1, .102f }, 1.374f);
PdfFunction function3 = PdfFunction.type3(writer, new float[] { 0, 1 },
null, new PdfFunction[] { function1, function2 },
new float[] { .708f }, new float[] { 1, 0, 0, 1 });
PdfShading shading = PdfShading.type3(writer,
new CMYKColor(0, 0, 0, 0),
new float[] { 0, 0, .096f, 0, 0, 1 }, null, function3,
new boolean[] { true, true });
PdfContentByte cb = writer.getDirectContent();
cb.moveTo(316.789f, 140.311f);
cb.curveTo(303.222f, 146.388f, 282.966f, 136.518f, 279.122f, 121.983f);
cb.lineTo(277.322f, 120.182f);
cb.curveTo(285.125f, 122.688f, 291.441f, 121.716f, 298.156f, 119.386f);
cb.lineTo(336.448f, 119.386f);
cb.curveTo(331.072f, 128.643f, 323.346f, 137.376f, 316.789f, 140.311f);
cb.clip();
cb.newPath();
cb.saveState();
cb.concatCTM(27.7843f, 0, 0, -27.7843f, 310.2461f, 121.1521f);
cb.paintShading(shading);
cb.restoreState();
cb.sanityCheck();
document.close();
}