GiovineItalia / Compose.jl

Declarative vector graphics
http://giovineitalia.github.io/Compose.jl/latest/
Other
248 stars 83 forks source link

Unsupressable output to stdout(?) #440

Open nomadbl opened 12 months ago

nomadbl commented 12 months ago

This follows issue https://github.com/GiovineItalia/Gadfly.jl/issues/1621 Here is a MWE involving only Compose functions, adapted from the example arrow.jl

using Compose
import Cairo, Fontconfig

X =  [0.047 0.87 0.95 0.93;
0.22 0.01 0.21 0.7;
0.86 0.85 0.95 0.21]

point_array = [[(x1,y1), (x2,y2)] for (x1,y1,x2,y2) in zip(X[:,1],X[:,2],X[:,3],X[:,4])]
img = compose(context(),
    (context(), line(point_array), stroke(["red","green","deepskyblue"]), arrow())
)

pb = PipeBuffer();
show(pb, MIME("image/png"), img);

As before, during writing to the PipeBuffer, the following output can be observed on the REPL, which is unwanted behavior - we are not trying to write to stdout:

Compose.Image{Compose.PNGBackend}(IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=false, append=true, size=8139, maxsize=Inf, ptr=1, mark=-1), Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), Cairo.CairoContext(Ptr{Nothing} @0x0000000000000000, Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000000000000, 535.0, 378.0), Ptr{Nothing} @0x00000000018a60d0), 534.5059133378628, 377.9527559055118, RGBA{Float64}(0.0,0.0,0.0,0.0), RGBA{Float64}(0.0,0.0,0.0,1.0), Float64[], LineCapButt(), Compose.LineJoinMiter(), true, 0.3mm, 3.880555555555555mm, "Helvetica Neue,Helvetica,Arial,sans", nothing, false, Compose.ImagePropertyState[], Compose.ImagePropertyFrame[], Dict{Type, Union{Nothing, Compose.Property}}(Compose.Property{Compose.StrokePrimitive} => nothing), true, false, nothing, true, true, 3.7795275590551185, nothing, nothing)