Created
June 5, 2025 07:42
-
-
Save jkrumbiegel/735367b82d0f655949faf651bf84ede8 to your computer and use it in GitHub Desktop.
CairoMakie draw into buffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using CairoMakie | |
using CairoMakie.Colors | |
sz = (400, 300) | |
px_per_unit = 2 | |
img = fill(ARGB32(1, 0, 0, 1), ((sz .* px_per_unit) .+ (200, 0))...) | |
surf = CairoMakie.Cairo.CairoImageSurface(img) | |
f = Figure(size = sz) | |
scatter(f[1, 1], cumsum(randn(100))) | |
conf = Makie.merge_screen_config(CairoMakie.ScreenConfig, Dict(:px_per_unit => px_per_unit)) | |
scr = CairoMakie.Screen(f.scene, conf, surf) | |
CairoMakie.cairo_draw(scr, f.scene) | |
save("test.png", img') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment