diff --git a/src/cairo_backends.jl b/src/cairo_backends.jl index 8a03b805..b23d6a2b 100644 --- a/src/cairo_backends.jl +++ b/src/cairo_backends.jl @@ -284,11 +284,11 @@ function push_property_frame(img::Image, properties::Vector{Property}) isp = isscalar.(properties) scalar_properties = Dict{Type, Property}(typeof(x)=>x for x in properties[isp]) vector_properties = Dict{Type, Property}(typeof(x)=>x for x in properties[.!isp]) - + kt = [Property{FillOpacityPrimitive}, Property{FillPrimitive}] if haskey(scalar_properties, kt[1]) && haskey(vector_properties, kt[2]) alpha = scalar_properties[kt[1]].primitives[1].value - vector_properties[kt[1]] = fillopacity(fill(alpha, length(vector_properties[kt[2]].primitives))) + vector_properties[kt[1]] = fillopacity(fill(alpha, length(vector_properties[kt[2]].primitives))) pop!(scalar_properties, kt[1]) end @@ -297,7 +297,7 @@ function push_property_frame(img::Image, properties::Vector{Property}) frame.vector_properties = vector_properties push!(img.property_stack, frame) isempty(scalar_properties) && return - + save_property_state(img) for (_, property) in scalar_properties apply_property(img, property.primitives[1]) diff --git a/src/pgf_backend.jl b/src/pgf_backend.jl index 50bfd32e..0b42951f 100644 --- a/src/pgf_backend.jl +++ b/src/pgf_backend.jl @@ -466,6 +466,7 @@ function push_property_frame(img::PGF, properties::Vector{Property}) push!(scalar_properties, property) push!(applied_properties, typeof(property)) frame.has_scalar_properties = true + img.vector_properties[typeof(property)] = nothing else frame.vector_properties[typeof(property)] = property img.vector_properties[typeof(property)] = property diff --git a/src/svg.jl b/src/svg.jl index ad96a2cc..766d8ec9 100644 --- a/src/svg.jl +++ b/src/svg.jl @@ -244,7 +244,7 @@ function SVG(out::IO, has_current_id = false, id_count = 0, jsheader = Set{AbstractString}(), - jsmodules = Set{Tuple{AbstractString, AbstractString}}((("Snap.svg", "Snap"),)), + jsmodules = Set{Tuple{AbstractString, AbstractString}}((("Snap.svg", "Snap"),)), scripts = AbstractString[], withjs = jsmode != :none, panelcoords = ()) @@ -684,7 +684,7 @@ function print_property(img::SVG, property::JSCallPrimitive) end # Print the property at the given index in each vector property -function print_vector_properties(img::SVG, idx::Int, supress_fill::Bool=false) +function print_vector_properties(img::SVG, idx::Int, suppress_fill::Bool=false) if haskey(img.vector_properties, JSCall) if haskey(img.vector_properties, SVGID) img.current_id = img.vector_properties[SVGID].primitives[idx].value @@ -699,7 +699,7 @@ function print_vector_properties(img::SVG, idx::Int, supress_fill::Bool=false) for (propertytype, property) in img.vector_properties if property === nothing || - (propertytype == Fill && supress_fill) + (propertytype == Fill && suppress_fill) continue end @@ -1110,6 +1110,7 @@ function push_property_frame(img::SVG, properties::Vector{Property}) push!(scalar_properties, property) push!(applied_properties, typeof(property)) frame.has_scalar_properties = true + img.vector_properties[typeof(property)] = nothing else frame.vector_properties[typeof(property)] = property img.vector_properties[typeof(property)] = property @@ -1200,7 +1201,7 @@ function Compose.draw(img::SVG, prim::ArcPrimitive, idx::Int) y2 = ry*sin(prim.angle2) dθ = prim.angle2 - prim.angle1 dθ += 2π*(dθ<0) - + indent(img) img.indentation += 1 print(img.out, "namespace(svgxml)])) + # there should only be a single color (because green should clobber the red + # and blue colors) + @test length(fillcolors) == 1 + # make sure it's green + @test fillcolors[1] == "rgba(0,128,0,1)" +end \ No newline at end of file