From e8fd5a794f244c850499f24f52cd9c6ff8535cc4 Mon Sep 17 00:00:00 2001 From: Tobias Knopp Date: Tue, 10 Oct 2023 15:16:33 +0000 Subject: [PATCH] add missing file --- src/Optional/CairoMakie.jl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/Optional/CairoMakie.jl diff --git a/src/Optional/CairoMakie.jl b/src/Optional/CairoMakie.jl new file mode 100644 index 0000000..640f420 --- /dev/null +++ b/src/Optional/CairoMakie.jl @@ -0,0 +1,15 @@ +import .CairoMakie: Figure + +function Base.convert(t::Type{PngImage}, plot::CairoMakie.Figure) + pb = PipeBuffer() + show(pb, MIME("image/png"), plot) + return PngImage(pb) +end + +preprocess(name, plot::CairoMakie.Figure, data) = preprocess(name, convert(PngImage, plot), data) +preprocess(name, plots::AbstractArray{<:CairoMakie.Figure}, data) = begin + for (i, plot)=enumerate(plots) + preprocess(name*"/$i", plot, data) + end + return data +end