📄 11_shade-pl
字号:
#!/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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -