11_shade-pl
来自「PDF-API2-0.2.3.7_dev.tar.gz」· 代码 · 共 47 行
TXT
47 行
#!/usr/bin/perluse PDF::API2;use Text::PDF::Utils;$pdf=PDF::API2->new;$sh=$pdf->shade; $sh->{ShadingType}=PDFNum(2); $sh->{ColorSpace}=PDFName('DeviceRGB'); $sh->{Coords}=PDFArray(PDFNum(0),PDFNum(0),PDFNum(1),PDFNum(1)); $sh->{Function}=PDFDict(); $sh->{Function}->{FunctionType}=PDFNum(2); $sh->{Function}->{Domain}=PDFArray(PDFNum(0),PDFNum(1)); $sh->{Function}->{C0}=PDFArray(PDFNum(1),PDFNum(1),PDFNum(1)); $sh->{Function}->{C1}=PDFArray(PDFNum(0),PDFNum(0),PDFNum(1)); $sh->{Function}->{N}=PDFNum(1);$pt=$pdf->pattern(-type=>2,-matrix=>[500,0,0,500,0,0],-shading=>$sh);$pt->{Type}=PDFName('Pattern');$pt->{PatternType}=PDFNum(2);$pt->{Matrix}=PDFArray(PDFNum(500),PDFNum(0),PDFNum(0),PDFNum(500),PDFNum(0),PDFNum(0));$pt->{Shading}=$sh; $page = $pdf->page; $page->mediabox(595,842); $gfx=$page->gfx; $gfx->rect(0,0,500,500); $gfx->clip; $gfx->shade($sh,0,0,500,500); $page = $pdf->page; $page->mediabox(595,842); $gfx=$page->gfx; $gfx->fillcolor($pt); $gfx->rect(0,0,500,500); $gfx->fill;$pdf->saveas("$0.pdf");$pdf->end();exit;__END__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?