AuburnSounds / printed

Generate PDF/SVG/HTML with D, with a Canvas-style API. Now with a flow document emitter.
36 stars 7 forks source link

PDF + Alpha, alpha not used #15

Closed p0nce closed 5 years ago

p0nce commented 5 years ago

Currently => 100% opaque all the time.

The way to solve it is that for all 256 possible alpha, have a lazy Graphics State Parameters state with autogenerated names, to be used in the content stream with the gs operator. Do that for stroke alpha and fill alpha.

p0nce commented 5 years ago

Example of Graphics State Parameters hash from the spec:

10  0  obj
% Page object
<<   /Type  /Page
/Parent  5 0 R
/Resources  20 0 R
/Contents  40 0 R
>>
endobj
20  0  obj
% Resource dictionary for page
<<   /ProcSet  [ /PDF  /Text ]
/Font  <<  /F1  25 0 R  >>
/ExtGState  <<  /GS1  30 0 R
 /GS2  35 0 R
 >>
>>
endobj
30  0  obj
% First graphics state parameter dictionary
<<   /Type  /ExtGState
/SA  true
/TR  31 0 R
>>
endob
p0nce commented 5 years ago

Fixed in v0.0.7