Coloring regions defined with path in Luxor

I am working on a new logo for the PeaceFounder project and giving Luxor a chance. So far, I have managed to get a frame in the way I want it to be (representing two interlinked elements in a rope):


which is achieved with the following code:

using Luxor

w = 8

background("black")
sethue("white")
setline(w)
	
A = Point(-50, 0)
B = Point(50, 0)
C = Point(50, -100)
D = Point(150+w/2, -100)
F = Point(-50, +100)
E = Point(-150-w/2, +100)
	
carc2r(B, C, A, :stroke)
carc2r(A, F, B, :stroke)
carc2r(C, B, D, :stroke)
carc2r(F, A, E, :stroke)

line(A, B, :stroke)
line(E, F, :stroke)
line(C, D, :stroke)

As a next step, I want to explore colouring the two closed regions with a colored gradient, providing spatial dimension. However, I need help to define the area that can be coloured. This seems very simple, and I see examples making use of that, but over the evening, I haven’t managed to progress on the issue.

I eventually I found the relevant place in the documentation: Luxor.jl/docs/src/explanation/pathspolygons.md at master · JuliaGraphics/Luxor.jl · GitHub which helped me to produce:

using Luxor

function make_path()

    A = Point(-50, 0)
    B = Point(50, 0)
    C = Point(50, -100)
    D = Point(150+w/2, -100)

    move(A)
    line(B)
    carc2r(C, B, D)
    line(C)
    carc2r(B, C, A)

end

Drawing(600, 600, "filled_triangle.png")
origin(Point(300, 300)) # Set the origin to the center of the drawing area
background("antiquewhite")

sethue("orange")
make_path()
fillpath()

sethue("purple")
translate(-100, +100)
make_path()
fillpath()

finish()

1 Like