Skip to content

Commit

Permalink
Refactor using the new CairoMakie scatter marker API
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Jun 5, 2024
1 parent 8ba5147 commit a121926
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ MakieTeXCairoMakieExt = "CairoMakie"

[compat]
Cairo = "1.0.5"
CairoMakie = "0.11.11, 0.12"
CairoMakie = "0.12.2"
Colors = "0.9, 0.10, 0.11, 0.12"
DocStringExtensions = "0.8, 0.9"
Ghostscript_jll = "9"
Glib_jll = "2"
LaTeXStrings = "1"
Makie = "0.20, 0.21"
Makie = "0.21.2"
Poppler_jll = "21.9, 22, 23"
Rsvg = "1"
julia = "1.9"
Expand Down
9 changes: 9 additions & 0 deletions ext/MakieTeXCairoMakieExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ using Colors
using Rsvg
using Base64

# First, we need to override the `cairo_scatter_marker` function to use the CairoMakie version of the marker.
function CairoMakie.cairo_scatter_marker(marker::MakieTeX.AbstractDocument)
return Cached(marker)
end

function CairoMakie.cairo_scatter_marker(marker::MakieTeX.AbstractCachedDocument)
return marker
end

# # Teximg

# Override `is_cairomakie_atomic_plot` to allow `TeXImg` to remain a unit,
Expand Down
8 changes: 2 additions & 6 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,11 @@ The backend-specific functions and rasterizers are kept in the backends' extensi
These functions are generic to the Makie API.
=#
Makie.convert_attribute(x::AbstractCachedDocument, ::Makie.key"marker") = x
Makie.convert_attribute(x::AbstractCachedDocument, ::Makie.key"marker", ::Makie.key"scatter") = x
Makie.to_spritemarker(x::AbstractCachedDocument) = x
Makie.to_spritemarker(x::AbstractCachedDocument) = rasterize(x)
Makie.marker_to_sdf_shape(::AbstractCachedDocument) = Makie.RECTANGLE # this is the same result as the dispatch for `::AbstractMatrix`.
Makie.el32convert(x::AbstractCachedDocument) = rasterize(x)

Makie.convert_attribute(x::AbstractDocument, ::Makie.key"marker") = Cached(x)
Makie.convert_attribute(x::AbstractDocument, ::Makie.key"marker", ::Makie.key"scatter") = Cached(x)
Makie.to_spritemarker(x::AbstractDocument) = Cached(x) # this should never be called
Makie.to_spritemarker(x::AbstractDocument) = rasterize(Cached(x)) # this should never be called

#=
## Concrete type definitions
Expand Down

0 comments on commit a121926

Please sign in to comment.