Skip to content

Commit

Permalink
Merge branch 'master' into as/cairomesh2d
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 authored Oct 10, 2024
2 parents b9c2756 + 2828d67 commit 24f92ed
Show file tree
Hide file tree
Showing 149 changed files with 3,599 additions and 1,385 deletions.
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These are supported funding model platforms

github: [SimonDanisch]
patreon: # Replace with a single Patreon username
github: [MakieOrg, SimonDanisch]
patreon: SimonDanisch # Replace with a single Patreon username
open_collective: simon-danisch
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
Expand Down
24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
<!--
* Any PR that is not ready for review should be created as a draft PR.
* Please don't force push to PRs, it removes the history, creates bad notifications, and we will squash and merge in the end anyways.
* Feel free to ping for a review when it passes all tests after a few days (@simondanisch, @ffreyer). We can't guarantee a review in a certain time frame, but we can guarantee to forget about PRs after a while.
* Allowing write access on the PR makes things more convenient, since we can make edits to the PR directly and update it if it gets out of sync with `master` (should be automatic if not disabled).
* Please understand, that some PRs will take very long to get merged. You can do a few things to optimize the time to get it merged:
* The more tests you add, the easier it is to see that your change works without putting the work on us.
* The clearer the problem being solved the easier. A PR best only addresses one bug fix or feature.
* The more you explain the motivation or describe your feature (best with pictures), the easier it will be for us to priorize the PR.
* Changes with more ambigious benefits are best discussed in a github [discussion](https://github.com/MakieOrg/Makie.jl/discussions) before a PR.
* What deserves a unit test or a reference image test isn't easy to decide, but here are a few pointers:
* Makie unit tests are preferable, since they're fast to execute and easy to maintain, so if you can add tests to `Makie/src/test`
* For new recipes or any changes that may get rendered differently by the backends, one should add a reference image test to the best fitting file in `Makie\ReferenceTests\src\tests\**` looking like this:
```julia
@reference_test "name of test" begin
# code of test
...
# make sure the last line is a Figure, FigureAxisPlot or Scene
end
```
Adding a reference image test will let your PR fail with the status "n reference images missing", which a maintainer will need to approve and fix.
Ideally, a comment with a screenshot of the expected output of the reference image test should be added to the PR.
We prefer one reference image test with many subplots over multiple reference image tests.
-->
# Description

Fixes # (issue)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install Julia
uses: julia-actions/setup-julia@v2
with:
version: '1'
version: '1.10'
- uses: julia-actions/cache@v2
- name: Build and deploy docs
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
version:
- '1.6'
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compilation-benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- uses: julia-actions/setup-julia@v2
with:
version: '1'
version: '1.10'
arch: x64
- uses: julia-actions/cache@v2
- name: Benchmark
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/reference_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
version:
- '1.6'
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
matrix:
version:
- '1.6'
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
matrix:
version:
- '1.6'
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down Expand Up @@ -172,15 +172,15 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: ReferenceImages_WGLMakie_1
name: ReferenceImages_WGLMakie_1.10
path: ./ReferenceImages/WGLMakie
- uses: actions/download-artifact@v4
with:
name: ReferenceImages_CairoMakie_1
name: ReferenceImages_CairoMakie_1.10
path: ./ReferenceImages/CairoMakie
- uses: actions/download-artifact@v4
with:
name: ReferenceImages_GLMakie_1
name: ReferenceImages_GLMakie_1.10
path: ./ReferenceImages/GLMakie
- name: Consolidate reference image folders
run: |
Expand All @@ -198,9 +198,10 @@ jobs:
# Loop through the directories and concatenate the files, and copy recorded folders
for dir in WGLMakie CairoMakie GLMakie; do
# Concatenate scores.tsv and new_files.txt
# Concatenate scores.tsv, new_files.txt and missing_files.txt
cat "${baseDir}/${dir}/scores.tsv" >> "./ReferenceImagesCombined/scores.tsv"
cat "${baseDir}/${dir}/new_files.txt" >> "./ReferenceImagesCombined/new_files.txt"
cat "${baseDir}/${dir}/missing_files.txt" >> "./ReferenceImagesCombined/missing_files.txt"
# Copy recorded folder
mkdir -p "./ReferenceImagesCombined/recorded/${dir}/"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/relocatability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rprmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down
71 changes: 70 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,67 @@

## [Unreleased]

- Fix relocatability of GLMakie [#4461](https://github.com/MakieOrg/Makie.jl/pull/4461).

## [0.21.13] - 2024-10-07

- Optimize SpecApi, re-use Blocks better and add API to access the created block objects [#4354](https://github.com/MakieOrg/Makie.jl/pull/4354).
- Fix `merge(attr1, attr2)` modifying nested attributes in `attr1` [#4416](https://github.com/MakieOrg/Makie.jl/pull/4416)
- Fixed issue with CairoMakie rendering scene backgrounds at the wrong position [#4425](https://github.com/MakieOrg/Makie.jl/pull/4425)
- Fix incorrect inverse transformation in `position_on_plot` for lines, causing incorrect tooltip placement in DataInspector [#4402](https://github.com/MakieOrg/Makie.jl/pull/4402)
- Added new `Checkbox` block [#4336](https://github.com/MakieOrg/Makie.jl/pull/4336).
- Added ability to override legend element attributes by pairing labels or plots with override attributes [#4427](https://github.com/MakieOrg/Makie.jl/pull/4427).
- Added threshold before a drag starts which improves false negative rates for clicks. `Button` can now trigger on click and not mouse-down which is the canonical behavior in other GUI systems [#4336](https://github.com/MakieOrg/Makie.jl/pull/4336).
- `PolarAxis` font size now defaults to global figure `fontsize` in the absence of specific `Axis` theming [#4314](https://github.com/MakieOrg/Makie.jl/pull/4314)
- `MultiplesTicks` accepts new option `strip_zero=true`, allowing labels of the form `0x` to be `0` [#4372](https://github.com/MakieOrg/Makie.jl/pull/4372)
- Make near/far of WGLMakie JS 3d camera dynamic, for better depth_shift scaling [#4430](https://github.com/MakieOrg/Makie.jl/pull/4430).

## [0.21.12] - 2024-09-28

- Fix NaN handling in WGLMakie [#4282](https://github.com/MakieOrg/Makie.jl/pull/4282).
- Show DataInspector tooltip on NaN values if `nan_color` has been set to other than `:transparent` [#4310](https://github.com/MakieOrg/Makie.jl/pull/4310)
- Fix `linestyle` not being used in `triplot` [#4332](https://github.com/MakieOrg/Makie.jl/pull/4332)
- Fix voxel clipping not being based on voxel centers [#4397](https://github.com/MakieOrg/Makie.jl/pull/4397)
- Parsing `Q` and `q` commands in svg paths with `BezierPath` is now supported [#4413](https://github.com/MakieOrg/Makie.jl/pull/4413)

## [0.21.11] - 2024-09-13

- Hot fixes for 0.21.10 [#4356](https://github.com/MakieOrg/Makie.jl/pull/4356).
- Set `Voronoiplot`'s preferred axis type to 2D in all cases [#4349](https://github.com/MakieOrg/Makie.jl/pull/4349)

## [0.21.10] - 2024-09-12

- Introduce `heatmap(Resampler(large_matrix))`, allowing to show big images interactively [#4317](https://github.com/MakieOrg/Makie.jl/pull/4317).
- Make sure we wait for the screen session [#4316](https://github.com/MakieOrg/Makie.jl/pull/4316).
- Fix for absrect [#4312](https://github.com/MakieOrg/Makie.jl/pull/4312).
- Fix attribute updates for SpecApi and SpecPlots (e.g. ecdfplot) [#4265](https://github.com/MakieOrg/Makie.jl/pull/4265).
- Bring back `poly` convert arguments for matrix with points as row [#4258](https://github.com/MakieOrg/Makie.jl/pull/4258).
- Fix gl_ClipDistance related segfault on WSL with GLMakie [#4270](https://github.com/MakieOrg/Makie.jl/pull/4270).
- Added option `label_position = :center` to place labels centered over each bar [#4274](https://github.com/MakieOrg/Makie.jl/pull/4274).
- `plotfunc()` and `func2type()` support functions ending with `!` [#4275](https://github.com/MakieOrg/Makie.jl/pull/4275).
- Fixed Boundserror in clipped multicolor lines in CairoMakie [#4313](https://github.com/MakieOrg/Makie.jl/pull/4313)
- Fix float precision based assertions error in GLMakie.volume [#4311](https://github.com/MakieOrg/Makie.jl/pull/4311)
- Support images with reversed axes [#4338](https://github.com/MakieOrg/Makie.jl/pull/4338)

## [0.21.9] - 2024-08-27

- Hotfix for colormap + color updates [#4258](https://github.com/MakieOrg/Makie.jl/pull/4258).

## [0.21.8] - 2024-08-26

- Fix selected list in `WGLMakie.pick_sorted` [#4136](https://github.com/MakieOrg/Makie.jl/pull/4136).
- Apply px per unit in `pick_closest`/`pick_sorted` [#4137](https://github.com/MakieOrg/Makie.jl/pull/4137).
- Support plot(interval, func) for rangebars and band [#4102](https://github.com/MakieOrg/Makie.jl/pull/4102).
- Fixed the broken OpenGL state cleanup for clip_planes which may cause plots to disappear randomly [#4157](https://github.com/MakieOrg/Makie.jl/pull/4157)
- Reduce updates for image/heatmap, improving performance [#4130](https://github.com/MakieOrg/Makie.jl/pull/4130).
- Add an informative error message to `save` when no backend is loaded [#4177](https://github.com/MakieOrg/Makie.jl/pull/4177)
- Fix rendering of `band` with NaN values [#4178](https://github.com/MakieOrg/Makie.jl/pull/4178).
- Fix plotting of lines with OffsetArrays across all backends [#4242](https://github.com/MakieOrg/Makie.jl/pull/4242).

## [0.21.7] - 2024-08-19

- Hot fix for 1D heatmap [#4147](https://github.com/MakieOrg/Makie.jl/pull/4147).

## [0.21.6] - 2024-08-14

- Fix RectangleZoom in WGLMakie [#4127](https://github.com/MakieOrg/Makie.jl/pull/4127)
Expand Down Expand Up @@ -35,6 +96,7 @@
- Update JS OrbitControls to match Julia OrbitControls [#4084](https://github.com/MakieOrg/Makie.jl/pull/4084).
- Fix `select_point()` [#4101](https://github.com/MakieOrg/Makie.jl/pull/4101).
- Fix `absrect()` and `select_rectangle()` [#4110](https://github.com/MakieOrg/Makie.jl/issues/4110).
- Allow segment-specific radius for `pie` plot [#4028](https://github.com/MakieOrg/Makie.jl/pull/4028).

## [0.21.5] - 2024-07-07

Expand Down Expand Up @@ -561,7 +623,14 @@ All other changes are collected [in this PR](https://github.com/MakieOrg/Makie.j
- Fixed rendering of `heatmap`s with one or more reversed ranges in CairoMakie, as in `heatmap(1:10, 10:-1:1, rand(10, 10))` [#1100](https://github.com/MakieOrg/Makie.jl/pull/1100).
- Fixed volume slice recipe and added docs for it [#1123](https://github.com/MakieOrg/Makie.jl/pull/1123).

[Unreleased]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.6...HEAD
[Unreleased]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.13...HEAD
[0.21.13]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.12...v0.21.13
[0.21.12]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.11...v0.21.12
[0.21.11]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.10...v0.21.11
[0.21.10]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.9...v0.21.10
[0.21.9]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.8...v0.21.9
[0.21.8]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.7...v0.21.8
[0.21.7]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.6...v0.21.7
[0.21.6]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.5...v0.21.6
[0.21.5]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.4...v0.21.5
[0.21.4]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.3...v0.21.4
Expand Down
4 changes: 2 additions & 2 deletions CairoMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CairoMakie"
uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
author = ["Simon Danisch <sdanisch@gmail.com>"]
version = "0.12.6"
version = "0.12.13"

[deps]
CRC32c = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
Expand All @@ -24,7 +24,7 @@ FileIO = "1.1"
FreeType = "3, 4.0"
GeometryBasics = "0.4.11"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.21.6"
Makie = "=0.21.13"
PrecompileTools = "1.0"
julia = "1.3"

Expand Down
16 changes: 10 additions & 6 deletions CairoMakie/src/infrastructure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,25 @@ function prepare_for_scene(screen::Screen, scene::Scene)
end

function draw_background(screen::Screen, scene::Scene)
w, h = Makie.widths(viewport(Makie.root(scene))[])
return draw_background(screen, scene, h)
end

function draw_background(screen::Screen, scene::Scene, root_h)
cr = screen.context
Cairo.save(cr)
if scene.clear[]
bg = scene.backgroundcolor[]
Cairo.set_source_rgba(cr, red(bg), green(bg), blue(bg), alpha(bg));
r = viewport(scene)[]
Cairo.rectangle(cr, origin(r)..., widths(r)...) # background
# Makie has (0,0) at bottom left, Cairo at top left. Makie extends up,
# Cairo down. Negative height breaks other backgrounds
x, y = origin(r); w, h = widths(r)
Cairo.rectangle(cr, x, root_h - y - h, w, h) # background
fill(cr)
end
Cairo.restore(cr)
foreach(child_scene-> draw_background(screen, child_scene), scene.children)
foreach(child_scene-> draw_background(screen, child_scene, root_h), scene.children)
end

function draw_plot(scene::Scene, screen::Screen, primitive::Plot)
Expand Down Expand Up @@ -179,7 +187,3 @@ end
function draw_atomic(::Scene, ::Screen, x)
@warn "$(typeof(x)) is not supported by cairo right now"
end

function draw_atomic(::Scene, ::Screen, x::Makie.PlotList)
# Doesn't need drawing
end
46 changes: 35 additions & 11 deletions CairoMakie/src/overrides.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,26 +216,50 @@ end
# gradients as well via `mesh` we have to intercept the poly use #
################################################################################

function band_segment_ranges(lowerpoints, upperpoints)
ranges = UnitRange{Int}[]
start = nothing

for i in eachindex(lowerpoints, upperpoints)
if isnan(lowerpoints[i]) || isnan(upperpoints[i])
if start !== nothing && i - start > 1 # more than one point
push!(ranges, start:i-1)
end
start = nothing
elseif start === nothing
start = i
elseif i == lastindex(lowerpoints)
push!(ranges, start:i)
end
end
return ranges
end

function draw_plot(scene::Scene, screen::Screen,
band::Band{<:Tuple{<:AbstractVector{<:Point2},<:AbstractVector{<:Point2}}})

if !(band.color[] isa AbstractArray)
basecolor = to_cairo_color(band.color[], band)
color = coloralpha(basecolor, alpha(basecolor) * band.alpha[])
upperpoints = band[1][]
lowerpoints = band[2][]
points = vcat(lowerpoints, reverse(upperpoints))

model = band.model[]
space = to_value(get(band, :space, :data))
points = clip_poly(band.clip_planes[], points, space, model)
points = project_position.(Ref(band), space, points, Ref(model))
Cairo.move_to(screen.context, points[1]...)
for p in points[2:end]
Cairo.line_to(screen.context, p...)

upperpoints = band[1][]
lowerpoints = band[2][]

for rng in band_segment_ranges(lowerpoints, upperpoints)
points = vcat(@view(lowerpoints[rng]), reverse(@view(upperpoints[rng])))
points = clip_poly(band.clip_planes[], points, space, model)
points = project_position.(Ref(band), space, points, Ref(model))
Cairo.move_to(screen.context, points[1]...)
for p in points[2:end]
Cairo.line_to(screen.context, p...)
end
Cairo.close_path(screen.context)
set_source(screen.context, color)
Cairo.fill(screen.context)
end
Cairo.close_path(screen.context)
set_source(screen.context, color)
Cairo.fill(screen.context)
else
for p in band.plots
draw_plot(scene, screen, p)
Expand Down
Loading

0 comments on commit 24f92ed

Please sign in to comment.