transparency and PDFs

2 views
Skip to first unread message

Malcolm Wallace

unread,
Oct 8, 2010, 7:20:06 AM10/8/10
to Haskell Chart List
I have been playing with adding fully-transparent items into a chart.
This is useful e.g. for a completely transparent background canvas, or
for stacking histogram bars above an apparently empty gap. It works
fine in PNG output, but if I generate a PDF containing such an
element, it fails to load into the Adobe Acrobat reader (7.0 on
Windows), with the error "An unrecognized token '-1.#IND' was found."

Curiously, the PDFs display just fine in Apple's Preview app on my Mac.

Anyone got any ideas? Is it just a bug in Adobe's app?

For the moment, I am working around the issue by using an opacity
value of 0.01 rather than 0.0, which is nearly transparent enough for
most situations.

Regards,
Malcolm

Tim Docker

unread,
Oct 8, 2010, 8:08:24 AM10/8/10
to haskell...@googlegroups.com
I haven't seen this problem, but nor have I played with fully
transparent data in cairo. It looks like it could be a division by
zero problem somewhere.

Can you send me the code to generate such a pdf file? I'm curious as
to how linux handles it.

> --
> You received this message because you are subscribed to the Google
> Groups "Haskell Charts" group.
> To post to this group, send email to haskell...@googlegroups.com.
> To unsubscribe from this group, send email to haskell-chart...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/haskell-charts?hl=en
> .
>

Malcolm Wallace

unread,
Oct 8, 2010, 8:57:09 AM10/8/10
to haskell...@googlegroups.com
Sure, just take any of the examples from the test directory, and apply
the following function to it:

transparentBackground :: Layout1 x y -> Layout1 x y
transparentBackground =
layout1_background ^= solidFillStyle (withOpacity white 0.0)

roco...@theorem.ca

unread,
Oct 12, 2010, 9:46:23 PM10/12/10
to haskell...@googlegroups.com
On Fri, 8 Oct 2010, Malcolm Wallace wrote:

> Sure, just take any of the examples from the test directory, and apply the
> following function to it:
>
> transparentBackground :: Layout1 x y -> Layout1 x y
> transparentBackground =
> layout1_background ^= solidFillStyle (withOpacity white 0.0)

FWIW, you can write "transparent" instead of "foo `withOpacity` 0.0"

--
Russell O'Connor <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''

Reply all
Reply to author
Forward
0 new messages