aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-03-01 21:57:28 -0800
committerbnewbold <bnewbold@robocracy.org>2016-03-01 21:57:32 -0800
commitd6c2ac682165bfc4c7ecf9fb7027206735e5bfef (patch)
tree26469902a5a18a81b0356a96c1b41417556eab5b /src
parentfa8f048e78bb9965902371f937d761267bd6b63b (diff)
downloadPyX.jl-d6c2ac682165bfc4c7ecf9fb7027206735e5bfef.tar.gz
PyX.jl-d6c2ac682165bfc4c7ecf9fb7027206735e5bfef.zip
fix png and jpeg MIME; export writePSfile and writeGSfile
writePSfile accidentally wasn't wrapped. Unlike the other file writing functions, writeGSfile requires a file path, can't pass an IO object or file descriptor. Enforce this with a type annotation (AbstractString). The above means that png and jpeg writemime() support requires using pipeGS instead of writeGSfile.
Diffstat (limited to 'src')
-rw-r--r--src/PyX.jl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/PyX.jl b/src/PyX.jl
index ce1acd0..55bb610 100644
--- a/src/PyX.jl
+++ b/src/PyX.jl
@@ -42,8 +42,8 @@ writemime(io::IO, ::MIME"application/pdf", c::PyxCanvas) = writePDFfile(c, io)
writemime(io::IO, ::MIME"application/eps", c::PyxCanvas) = writeEPSfile(c, io)
writemime(io::IO, ::MIME"image/eps", c::PyxCanvas) = writeEPSfile(c, io)
writemime(io::IO, ::MIME"application/postscript", c::PyxCanvas) = writePSfile(c, io)
-writemime(io::IO, ::MIME"image/png", c::PyxCanvas) = writeGSfile(c, io, "png16m")
-writemime(io::IO, ::MIME"image/jpeg", c::PyxCanvas) = writeGSfile(c, io, "jpeg")
+writemime(io::IO, ::MIME"image/png", c::PyxCanvas) = write(io, pipeGS(c; device="png16m"))
+writemime(io::IO, ::MIME"image/jpeg", c::PyxCanvas) = write(io, pipeGS(c; device="jpeg"))
####### Exports
export canvas, path, deco, deco_stroked, deco_filled
@@ -54,7 +54,7 @@ export graph, graph_axis, graph_axis_painter, graph_data, graph_style, graph_sty
export graph_graphxyz, graph_data_function
export epsfile, deformer, trafo, attr, metapost_path
export plot, stroke
-export writeEPSfile, writePDFfile, writeGSfile, pipeGS
+export writeEPSfile, writePDFfile, writePSfile, writeGSfile, pipeGS
export pyx_fill, pyx_append, pyx_insert, pyx_text
# See also Python3 section at end
@@ -109,8 +109,10 @@ writeEPSfile(g::PyObject, a...; k...) = g[:writeEPSfile](a...; k...)
writeEPSfile(c::PyxCanvas, a...; k...) = c[:writeEPSfile](a...; k...)
writePDFfile(g::PyObject, a...; k...) = g[:writePDFfile](a...; k...)
writePDFfile(c::PyxCanvas, a...; k...) = c[:writePDFfile](a...; k...)
-writeGSfile(g::PyObject, a...; k...) = g[:writeGSfile](a...; k...)
-writeGSfile(c::PyxCanvas, a...; k...) = c[:writeGSfile](a...; k...)
+writePSfile(g::PyObject, a...; k...) = g[:writePSfile](a...; k...)
+writePSfile(c::PyxCanvas, a...; k...) = c[:writePSfile](a...; k...)
+writeGSfile(g::PyObject, filename::AbstractString, a...; k...) = g[:writeGSfile](filename, a...; k...)
+writeGSfile(c::PyxCanvas, filename::AbstractString, a...; k...) = c[:writeGSfile](filename, a...; k...)
# Some newer features only in recent (Python3) versions of PyX
if PyCall.pyversion > v"3"