Giter Site home page Giter Site logo

juliagraphics / luxor.jl Goto Github PK

View Code? Open in Web Editor NEW
566.0 14.0 71.0 381.98 MB

Simple drawings using vector graphics; Cairo "for tourists!"

Home Page: http://juliagraphics.github.io/Luxor.jl/

License: Other

Julia 100.00%
graphics vector-graphics drawing diagrams julia luxor cairo simple 2d-graphics visualization

luxor.jl's Introduction

luxor splash image

Documentation Build Status Code Coverage
Build Status
Build Status

PkgEval: PkgEval

Luxor

Luxor is a Julia package for drawing simple static 2D vector graphics. It provides basic drawing functions and utilities for working with shapes, polygons, clipping masks, PNG and SVG images, turtle graphics, and simple animations.

"luxor gallery"

The focus of Luxor is on simplicity and ease of use: it should be easier to use than plain Cairo.jl, with shorter names, fewer underscores, default contexts, and simplified functions.

For more complex and sophisticated graphics in 2D and 3D, Makie.jl is the best choice.

Luxor is thoroughly procedural and static: your code issues a sequence of simple graphics ‘commands’ until you’ve completed a drawing, then the results are saved into a PDF, PNG, SVG, or EPS file.

Tutorials can be found in the documentation, which you find by clicking on the badges above: where is the documentation?

“stable” describes the current release; “development” contains changes that are still in the master branch and may change before the next release.

There are some Luxor-related videos on YouTube, and some Luxor-related blog posts at cormullion.github.io/.

Luxor is designed primarily for drawing static pictures and simple animations. If you want to build complex or elaborate animations, use Javis.jl and Makie.

Luxor isn't interactive: for building interactivity, look at Pluto.jl and Makie.

luxor.jl's People

Contributors

arbitrandomuser avatar beastyblacksmith avatar bryanwweber avatar cormullion avatar davibarreira avatar dependabot[bot] avatar femtocleaner[bot] avatar fonsp avatar gantz-giraffe avatar giggleliu avatar gpucce avatar guo-yong-zhi avatar hustf avatar hyrodium avatar j-adel avatar jeffreypalmer avatar kilacoda avatar kimttfung avatar masonprotter avatar mcbaron avatar oheil avatar osoleve avatar pauljurczak avatar roger-luo avatar scottpjones avatar sov-trotter avatar timholy avatar tkelman avatar visr avatar wikunia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luxor.jl's Issues

Add a boxcenter() function for BoundingBox

only for v0.11.0 and Julia Version 0.7/1.0

  • A new function boxcenter() that returns the center point of a BoundingBox.

So far we've got:

julia> using Luxor

julia> Drawing();

julia> bb = BoundingBox()
 ⤡ Point(-400.0, -400.0) : Point(400.0, 400.0)

julia> boxbottom(bb)
Point(0.0, 400.0)

julia> boxdiagonal(bb)
1131.370849898476

julia> boxheight(bb)
800.0

julia> boxtop(bb)
Point(0.0, -400.0)

julia> boxwidth(bb)
800.0

but I keep needing to find the center point...

  • test
  • docstring
  • addition to manual

Integer division error in Partition

The following Partition can be constructed but not collected:

julia> p = Partition(0.0, 59.99700000000001, 9.969619777722377, 9.969619777722377)
Partition(0.0, 59.99700000000001, 9.969619777722377, 9.969619777722377, 6, 0, 1, 1)

julia> collect(p)
ERROR: DivideError: integer division error

Using Interact.jl and Luxor.jl inside IJulia (Jupyter) notebook

The way to do interactive graphics is like this:

using Interact, Luxor
@manipulate for x in 1:1000, r in 0:0.1:1, g in 0:0.1:1, b in 0:.1:1
    d = Drawing(300, 300, :svg)   # <-------------------------
    origin()
    sethue(Colors.RGB(r, g, b))
    box(O, x, x, :fill)
    finish()
    d  # <------------------------------
end

ie return the in-memory drawing.

screen shot 2017-11-27 at 15 55 55

If you use the file-based method, it doesn't work (the sliders will be hidden). (JuliaGizmos/Interact.jl#196)

There's something amiss with the interaction between IJulia, Jupyter, and Luxor, which should be addressed.

passing more parameters in the Scene function

When using the animate function, the array of Scenes; how can it be used to pass to the different function parameters to 'backdrop'/ 'frame' etc? I would like to pass in data computed in the iterative cycles which is stored in a composite type and although I am not sure this is the best way, to update the state I wish to pass the type through the function calls of each frame

small bug

I was playing with your very nice noise function

you need to change (line 16) in the noise.jl

initsimplexnoise(seed)

to

initnoise(seed)

the above function does not exist

Luxor can not precompile in Julia v0.7

Hi

I tried to use Luxor in Julia v0.7 and I get following error

ERROR: LoadError: LoadError: syntax: invalid escape sequence
Stacktrace:
 [1] include at ./boot.jl:318 [inlined]
 [2] include_relative(::Module, ::String) at ./loading.jl:1071
 [3] include(::Module, ::String) at ./sysimg.jl:29
 [4] include(::String) at /Users/ben/.julia/packages/Luxor/pr7Y/src/Luxor.jl:6
 [5] top-level scope at none:0
 [6] include at ./boot.jl:318 [inlined]
 [7] include_relative(::Module, ::String) at ./loading.jl:1071
 [8] include(::Module, ::String) at ./sysimg.jl:29
 [9] top-level scope at none:0
 [10] eval at ./boot.jl:320 [inlined]
 [11] eval(::Expr) at ./client.jl:394
 [12] top-level scope at ./none:3 [inlined]
 [13] top-level scope at ./<missing>:0
in expression starting at /Users/ben/.julia/packages/Luxor/pr7Y/src/bezierpath.jl:96
in expression starting at /Users/ben/.julia/packages/Luxor/pr7Y/src/Luxor.jl:36
ERROR: Failed to precompile Luxor to /Users/ben/.julia/compiled/v0.7/Luxor/HA9p.ji.
Stacktrace:
 [1] error at ./error.jl:33 [inlined]
 [2] compilecache(::Base.PkgId) at ./loading.jl:1201
 [3] _require(::Base.PkgId) at ./loading.jl:1003
 [4] require(::Base.PkgId) at ./loading.jl:878
 [5] require(::Module, ::Symbol) at ./loading.jl:873

Kind regards

Ben

Support for LaTeX strings

Does Luxor support LaTeX Strings? Any idea how to support it?

This doesn't work (as expected)

using Luxor, LaTeXStrings

@png begin
       fontsize(30)
       text(L"\alpha", O, halign=:center, valign=:middle)
end

How to rotate elements in a local coordinate system?

First of all, this is one of the most insanely good packages I have seen in Julia, awesome work!

I am trying to generate a logo for my GeoStats.jl package and so far this is what I have:

using Luxor

srand(2017)

# Julia colors
darker_purple = (0.584, 0.345, 0.698)
lighter_purple  = (0.667, 0.475, 0.757)
darker_green  = (0.22, 0.596, 0.149)
lighter_green  = (0.376, 0.678, 0.318)
darker_red  = (0.796, 0.235, 0.2)
lighter_red  = (0.835, 0.388, 0.361)

purples = (darker_purple, lighter_purple)
greens = (darker_green, lighter_green)
reds = (darker_red, lighter_red)

# Logo size
w = 800; h = 250
Drawing(w, h, "GeoStats.png")

# Draw axes
oᵥ = 10; oₕ = 30
translate(Point(oᵥ,oₕ))
axes()

# Draw random points
for i=1:300
    color = rand([purples, greens, reds])
    pos = Point(rand(10:w),rand(10:h))
    radius = 4
    sethue(color[1]); circle(pos, .65*radius, :fill)
    sethue(color[2]); circle(pos, .75*radius, :stroke)
end

# Draw ellipses
origin()
tiles = Tiler(w, h, 10, 10)
sethue("black")
for (pos, n) in tiles
    if n in [29]
        gsave()
        a = 100; b = 50
        sethue("black")
        ellipse(pos, a, b, :stroke)
        arrow(pos, pos + Point(a/2,0))
        arrow(pos, pos + Point(0,b/2))
        grestore()
    end
end

# Draw GeoStats.jl
origin()
translate(oᵥ, oₕ)
sethue("black")
fontsize(120); fontface("Georgia-Bold")
text("GeoStats.jl", halign=:center, valign=:middle)

# Save and preview
finish()
preview()

logo

I am using the tiles to loop over the logo and put an ellipse only at a few locations. I couldn't figure out a way to rotate the ellipses locally, how can I achieve this with Luxor.jl? If you have a more elegant way to draw ellipses at random in space with random orientation, I'd love to learn.

Also, I don't know how complicated would it be to replace the capital S in GeoStats.jl by a Bezier mimicking a river channel, something like this meandering river:
meander

That would awesome, but I am happy just with the rotated ellipses 😊

Specifying Circle Sector Centerpoint

The Luxor.sector function draws sectors centered at the current origin:
sector(innerradius, outerradius, startangle, endangle, action=:none)

This feels inconsistent with the other Circles, Ellipses, and other Survey Things which take the center point as their first argument:
circle(pt, r, action)
circlepath(center::Point, radius, action=:none; reversepath=false, kappa = 0.5522847)

Is it possible to change sector to also take a centerpoint argument?
Or is there another method to draw circle sectors about points other than the origin?

Edit: arc function is working for thin arcs about cpt, but I think I'd also like sectors about cpt

Docs are broken

The move to JuliaGraphics org broke the documentation. :(

Install error `stars.png (Permission denied)`

Windows 7, Julia 0.4.5:

julia> Pkg.add("Luxor")
INFO: Cloning cache of Luxor from https://github.com/cormullion/Luxor.jl.git
INFO: Installing Luxor v0.2.0
error: unable to create file docs/figures/stars.png (Permission denied)

Other files seem to get copied into .julia\v0.4\Luxor\docs\figures directory OK.

Can luxor use `latex formulas` ?

Hello,

I have seen some amazing vector drawings in luxor that include text.
Nevertheless I have not seen in the docs any example involving formulas (or latex expresisons).
Is it possible to embbed latex formulas in luxor?

For example could we write $\pi r^2$ inside a circle?

Something like this:

@png begin
        fontsize(20)
        circle(O, 100, :stroke)
        text(" \pi r ^2", halign=:center, valign=:middle)
       
       # I would like to have something like this? 
       # latex("$ \pi r^2$", halign=:center, valign=:middle)
     end

I have seen that one of you videos uses some formulas video. Is the code for this animation available? I'm not sure if it uses fancy unicode letters like \theta or we can use more complication latex expressions such as \sum_{i \in X} \frac{\theta_i}{\pi^2} (which I just made up and does not mean anything).

It would be awesome if you could make public some of the code you used for some of your youtube animations. It would probably inspire people to try more your package.

Drawing in Memory Error

I get an error when trying to draw "in memory" in a Jupyter notebook.

E.g. the following code

Drawing(100, 100, :png)
origin()
circle(Point(0, 0), 10, :fill)
finish()
preview()

Gives this error message:

SystemError: opening file : No such file or directory

Stacktrace:
 [1] #systemerror#39(::Nothing, ::Function, ::String, ::Bool) at .\error.jl:106
 [2] systemerror at .\error.jl:106 [inlined]
 [3] #open#293(::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Function, ::String) at .\iostream.jl:283
 [4] open at .\iostream.jl:275 [inlined]
 [5] #open#294(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(Luxor, Symbol("##1#2")){MIME{Symbol("image/png")}}, ::String) at .\iostream.jl:367
 [6] open at .\iostream.jl:367 [inlined]
 [7] display_ijulia at C:\Users\michaelw\.julia\packages\Luxor\uf78H\src\drawings.jl:79 [inlined]
 [8] preview() at C:\Users\michaelw\.julia\packages\Luxor\uf78H\src\drawings.jl:275
 [9] top-level scope at In[91]:6

The plot appears as expected if I draw using a filename e.g.

Drawing(100, 100, "figures/dot.png")
origin()
circle(Point(0, 0), 10, :fill)
finish()
preview()

How to split the animation into two animation contexts (two separate canvases in same canvas)?

I am would like to know if it possible to; have a ball like simulation and a different 'context/pane/section' next to it, which the simulation does not move into, and then in the different area something such as statistics of the balls can then be displayed.

Would that use the 'tiles/partitions'? http://juliagraphics.github.io/Luxor.jl/stable/basics.html#Tiles-and-partitions-1

The partitions and tiles seem to provide the position context but does the algorithm utilizing them need to ensure the boundaries are respected? Can the background of the tiles be recalled to erase mistaken trespasses ?

Ellipse angle

Hello, it's the first time I'm using Luxor and even Julia. I managed to draw an ellipse for the minimal instance of the project I'm doing, but it seems like it has an angle which shouldn't be there. I don't know if I'm being understandable.

Here's the portion of the code that draws to a png file:

for ellipse in env.ellipses
    semiFocusDist = sqrt(ellipse.semiBigAxe^2 - ellipse.semiLittleAxe^2)
    f = Point(ellipse.center[1] - semiFocusDist, ellipse.center[2])
    f2 = Point(ellipse.center[1] + semiFocusDist, ellipse.center[2])
        
    @show f
    @show f2

    f = rotatePointAroundPoint(f, ellipse.center, ellipse.rotationAngle)
    f2 = rotatePointAroundPoint(f2, ellipse.center, ellipse.rotationAngle)
    
    @show f * scale
    @show f2 * scale
    
    sethue("yellow")
    Luxor.ellipse(f * scale, f2 * scale, 2 * ellipse.semiBigAxe * scale, :fill)

    sethue("black")
    Luxor.circle(f2 * scale, circleSize, :fill)
    Luxor.circle(f * scale, circleSize, :fill)
end

I also drawed the focus points of the ellipse for debugging purposes.

So, my ellipse type has a rotationAngle field, and for this ellipse, it's zero.

Here's the console output:

Loading instance:
Width : 1
Height : 1
Robot starting position : (0, 0)
Objective position : (1, 1)
Speed in water : 3.0
Speed in oil : 4.0
Ellipse n° 1 Center : (0.5, 0.5), Axes : 0.3 and 0.4, Angle : 0.0
f = Point(0.23542486889354086, 0.5)
f2 = Point(0.7645751311064591, 0.5)
f * scale = Point(235.42486889354086, 500.0)
f2 * scale = Point(764.5751311064591, 500.0)
Solution time: 5.121320343559643 units of time.
2.534168 seconds (5.75 M allocations: 285.122 MiB, 5.16% gc time)>

You can see that the two focus points have the same y, thus the ellipse should be horizontal, but here's the png file:

test

Thanks for looking into this.

Taxonomy

There is a taxon issue regarding the turtle emoji used in the documentation. The Turtle emoji is a Tortoise. This issue may need to be reported upstream. Also, I'm pretty sure that the Teenage Mutant Ninja Turtles were in fact Tortoises.

https://www.youtube.com/watch?v=EEMMShaYcNA

Please feel free to close this issue.

`preview()` .svg files on jupyter notebook

Previewing a svg file on IJulia results in opening the file by default program on my platform.
I read that:

"""
    preview()

If working in Jupyter (IJUlia), display a PNG file in the notebook.
On macOS, open the file, which probably uses the default, Preview.app.
On Unix, open the file with `xdg-open`.
On Windows, pass the filename to `explorer`.
"""
function preview()
    if isdefined(Main, :IJulia) && Main.IJulia.inited && currentdrawing.surfacetype == "png"
        display(load(currentdrawing.filename))
 ...

But why shouldn't it pass the file to jupyter? For me, open luxor-drawing.svg will open it with an outdated Adobe Illustrator, which is contrary to my expectations. Opening in on a web browser should even create a better experience.

Reproducing Sample Image

The basics.md file has an example for IJulia:

Drawing()
origin()
setopacity(0.5)
for θ in range(0, π/6, 12)
    randomhue()
    gsave()
    squircle(Point(200cos(θ), 200sin(θ)), 130, 130, :fillstroke, rt=2.5)
    grestore()
end
finish()
preview()

In order to match the output and not err out, I had to change the range call to:

for θ in range(0, stop=2π*11/12, length=12)

finish() isn't very smart

Although it's unlikely that you would call the function two times in a row, if you do:

julia> Drawing()                                           10:01:08  Void v6   tmp 
	width:    800.0 
	height:   800.0
	filename: luxor-drawing.png
	type:     png
	color:    (0.0, 0.0, 0.0, 1.0)

julia> finish()                                            10:01:20  Luxor.Drawing v6   tmp 
true

julia> finish()                                            10:01:25  Bool v6   tmp 

signal (11): Segmentation fault: 11
while loading no file, in expression starting on line 0
cairo_surface_write_to_png at /Users/me/.julia/v0.6/Homebrew/deps/usr/lib/libcairo.dylib (unknown line)
write_to_png at /Users/me/.julia/v0.6/Cairo/src/Cairo.jl:331
unknown function (ip: 0x31b6cd986)
jl_call_method_internal at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia_internal.h:248 [inlined]
jl_apply_generic at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:2212
finish at /Users/me/.julia/v0.6/Luxor/src/Luxor.jl:247
unknown function (ip: 0x31b6bfdff)
jl_call_method_internal at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia_internal.h:248 [inlined]
jl_apply_generic at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:2212
do_call at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:75
eval at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:230
jl_interpret_toplevel_expr at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:34
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:577
jl_toplevel_eval_in at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/builtins.c:484
eval at ./boot.jl:235
jlcall_eval_18101 at /Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_call_method_internal at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia_internal.h:248 [inlined]
jl_apply_generic at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:2212
eval_user_input at ./REPL.jl:66
unknown function (ip: 0x31b6311c6)
jl_call_method_internal at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia_internal.h:248 [inlined]
jl_apply_generic at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:2212
macro expansion at ./REPL.jl:97 [inlined]
#1 at ./event.jl:73
unknown function (ip: 0x31b60da0f)
jl_call_method_internal at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia_internal.h:248 [inlined]
jl_apply_generic at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:2212
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1410 [inlined]
start_task at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/task.c:261
Allocations: 18127732 (Pool: 18121695; Big: 6037); GC: 34...

Obviously it should do a bit more checking, just in case.

Make sure that pathname parameter of animate() is not a directory

If someone stupid like me doesn't read the documentation carefully enough and thinks that the pathnameparameter of the animate() method should point to a directory and therefore passes for example pathname="." to it, the animate method removes the whole directory before throwing a SystemError:

julia> using Luxor

julia> mkdir("test")
"test"

julia> cd("test")

julia> touch("testfile")
"testfile"

julia> isfile("testfile")
true

julia> demo = Movie(32,32,"test")
Movie(32.0, 32.0, "test", 1:250)

julia> scene = Scene(demo, (x,y)->nothing,1:250)
Scene(Movie(32.0, 32.0, "test", 1:250), getfield(Main, Symbol("##3#4"))(), 1:250, Luxor.lineartween, nothing)

julia> animate(demo, scene, pathname=".", creategif=true)
┌ Info: Frames for animation "test" are being stored in directory: 
└ 	 /tmp/tmpFUIdVK
┌ Info: ... 250 frames saved in directory:
└ 	 /tmp/tmpFUIdVK
ERROR: SystemError (with .): rmdir: Invalid argument
Stacktrace:
 [1] #systemerror#43(::String, ::Function, ::Symbol, ::Bool) at ./error.jl:134
 [2] #systemerror at ./none:0 [inlined]
 [3] #rm#9(::Bool, ::Bool, ::Function, ::String) at ./file.jl:271
 [4] #rm at ./none:0 [inlined]
 [5] #checkfor_mv_cp_cptree#10(::Bool, ::Function, ::String, ::String, ::String) at ./file.jl:291
 [6] #checkfor_mv_cp_cptree at ./none:0 [inlined]
 [7] #mv#13 at ./file.jl:377 [inlined]
 [8] #mv at ./none:0 [inlined]
 [9] #animate#129(::Bool, ::Int64, ::String, ::String, ::Bool, ::Function, ::Movie, ::Array{Scene,1}) at .julia/packages/Luxor/Sqw9K/src/animate.jl:200
 [10] #animate at ./none:0 [inlined]
 [11] #animate#130 at .julia/packages/Luxor/Sqw9K/src/animate.jl:214 [inlined]
 [12] (::getfield(Luxor, Symbol("#kw##animate")))(::NamedTuple{(:pathname, :creategif),Tuple{String,Bool}}, ::typeof(animate), ::Movie, ::Scene) at ./none:0
 [13] top-level scope at none:0

julia> isfile("testfile")
false

Maybe one could add a check with isdir to animate to prevent the user from shooting himself in the foot? :-)

Display output in Juno Plot pane

By loading this code:

using Juno, Hiccup

Media.media(Drawing, Media.Plot)

function Media.render(pane::Juno.PlotPane, img::Drawing)
    Media.render(pane, Hiccup.div(Hiccup.img(src=img.filename)))
end

it's sort of possible to display output in a Juno Plot pane:

screen shot 2017-05-15 at 11 08 34

However, this doesn't update when the file changes, so it's not yet working satisfactorily.

settext doesn't use fontsize()

I'm currently using Luxor for my CodePoster project. I wanted to try to set text with different colors for different parts of a text (syntax highlighting) by using settext. I realized that settext doesn't use the fontsize specified by fontsize. This is unexpected behavior for me. I think if not specified directly like <span font='26'>text</span> it should use the fontsize specified by the fontsize command.

Luxor not easily installable in jupyter/datascience-notebook

Attempting to install Luxor in a recent version of the jupyter/datascience-notebook docker image results in many libraries building from source, most notably Cairo -- which also requires glib and many other lower level libraries and is prone to not building/not working properly. Is it possible to bump the Cairo dependency in Luxor to v0.6.0 since it seems that version is available as a binary?

Step 29/36 : RUN $JULIA_PATH/bin/julia -E 'using Pkg; Pkg.instantiate()'
 ---> Running in db47b5748ac8
   Cloning default registries into /opt/julia/registries
   Cloning registry General from "https://github.com/JuliaRegistries/General.git"
   Cloning git-repo `https://github.com/probcomp/Gen`
 Installed Libz ────────────────── v1.0.0
 Installed OffsetArrays ────────── v0.11.1
 Installed Juno ────────────────── v0.7.1
 Installed OrderedCollections ──── v1.1.0
 Installed PaddedViews ─────────── v0.4.2
 Installed Arpack ──────────────── v0.3.1
 Installed ForwardDiff ─────────── v0.10.3
 Installed DSP ─────────────────── v0.5.2
 Installed ColorVectorSpace ────── v0.7.0
 Installed Compat ──────────────── v2.1.0
 Installed ImageMagick ─────────── v0.7.5
 Installed JuliaInterpreter ────── v0.6.1
 Installed ZMQ ─────────────────── v1.0.0
 Installed DataStructures ──────── v0.17.0
 Installed HTTPClient ──────────── v0.2.1
 Installed StatsFuns ───────────── v0.8.0
 Installed SpecialFunctions ────── v0.7.2
 Installed QuartzImageIO ───────── v0.6.0
 Installed AbstractFFTs ────────── v0.4.1
 Installed LibExpat ────────────── v0.5.0
 Installed FixedPointNumbers ───── v0.6.1
 Installed CodeTracking ────────── v0.5.7
 Installed FunctionWrappers ────── v1.0.0
 Installed Missings ────────────── v0.4.1
 Installed BufferedStreams ─────── v1.0.0
 Installed ColorTypes ──────────── v0.8.0
 Installed Media ───────────────── v0.5.0
 Installed Distributions ───────── v0.21.1
 Installed MbedTLS ─────────────── v0.6.8
 Installed Polynomials ─────────── v0.5.2
 Installed PDMats ──────────────── v0.9.7
 Installed FunctionalCollections ─ v0.5.0
 Installed FileIO ──────────────── v1.0.7
 Installed SortingAlgorithms ───── v0.3.1
 Installed WinRPM ──────────────── v0.4.2
 Installed Conda ───────────────── v1.3.0
 Installed Revise ──────────────── v2.1.6
 Installed PyCall ──────────────── v1.91.2
 Installed CommonSubexpressions ── v0.2.0
 Installed JSON ────────────────── v0.21.0
 Installed ReverseDiff ─────────── v0.3.1
 Installed StatsBase ───────────── v0.32.0
 Installed IJulia ──────────────── v1.19.0
 Installed PyPlot ──────────────── v2.8.1
 Installed QuadGK ──────────────── v2.0.3
 Installed Cairo ───────────────── v0.6.0
 Installed DataAPI ─────────────── v1.0.1
 Installed BinDeps ─────────────── v0.8.10
 Installed Parsers ─────────────── v0.3.6
 Installed CSTParser ───────────── v0.6.1
 Installed Parameters ──────────── v0.11.0
 Installed Reexport ────────────── v0.2.0
 Installed ImageCore ───────────── v0.8.4
 Installed Graphics ────────────── v0.4.0
 Installed URIParser ───────────── v0.4.0
 Installed StaticArrays ────────── v0.11.0
 Installed NaNMath ─────────────── v0.3.2
 Installed LoweredCodeUtils ────── v0.3.6
 Installed Rmath ───────────────── v0.5.0
 Installed SoftGlobalScope ─────── v1.0.10
 Installed DiffResults ─────────── v0.0.4
 Installed BinaryProvider ──────── v0.5.6
 Installed MappedArrays ────────── v0.2.1
 Installed Tokenize ────────────── v0.5.5
 Installed LaTeXStrings ────────── v1.0.3
 Installed DiffRules ───────────── v0.0.10
 Installed VersionParsing ──────── v1.1.3
 Installed LibCURL ─────────────── v0.5.2
 Installed MacroTools ──────────── v0.5.1
 Installed FFTW ────────────────── v0.3.0
 Installed Homebrew ────────────── v0.7.1
 Installed Colors ──────────────── v0.9.5
 Installed Luxor ───────────────── v1.5.0
  Building Arpack ──────────→ `/opt/julia/packages/Arpack/cu5By/deps/build.log`
  Building ZMQ ─────────────→ `/opt/julia/packages/ZMQ/ABGOx/deps/build.log`
  Building Conda ───────────→ `/opt/julia/packages/Conda/kLXeC/deps/build.log`
  Building FFTW ────────────→ `/opt/julia/packages/FFTW/2okGQ/deps/build.log`
  Building ImageMagick ─────→ `/opt/julia/packages/ImageMagick/vMfoS/deps/build.log`
  Building LibCURL ─────────→ `/opt/julia/packages/LibCURL/lWJxD/deps/build.log`
  Building WinRPM ──────────→ `/opt/julia/packages/WinRPM/Y9QdZ/deps/build.log`
  Building Homebrew ────────→ `/opt/julia/packages/Homebrew/s09IX/deps/build.log`
  Building Cairo ───────────→ `/opt/julia/packages/Cairo/p68X8/deps/build.log`

sector() with rounded corners shouldn't take shortcuts

Most of the arc-drawing functions are consistent and draw clockwise arcs even when the finish angle is less than the starting angle. However, sector() with rounded corners doesn't keep to the rule and instead takes shortcuts if the finish angle is less than the start angle.

luxor-drawing

It will have to be fixed to be consistent...

preview function on linux

ISSUE: preview function on linux is not working.

DIAGNOSIS:

  • The script depends on an external shell command "open" to display the current drawing. This command does something else on linux.

POTENTIAL SOLUTIONS:

  • use the command "xdg-open" for linux.
  • display the current drawing in a platform independent manner.

Switch to DefaultApplication

only for Luxor v1.0... and Julia Version 0.7/1.0, but could be back-ported to v0.6 one day

Probably no documentation required.

This change probably requires only editing Luxor.jl, where the following lines:

elseif Sys.isapple()
        run(`open $(currentdrawing.filename)`)
    elseif Sys.iswindows()
        run(ignorestatus(`explorer $(currentdrawing.filename)`))
    elseif Sys.isunix()
        run(`xdg-open $(currentdrawing.filename)`)
    end

would be replaced by a call to

(import DefaultApplication)
DefaultApplication.open("  ...

ERROR: UndefVarError: currentdrawing not defined

Every operation fails with this error on FreeBSD:

julia> rect(Point(20mm, 2cm), 5inch, (22/7)inch, :fill)
ERROR: UndefVarError: currentdrawing not defined
Stacktrace:
 [1] rect at /home/yuri/.julia/v0.6/Luxor/src/shapes.jl:12 [inlined]
 [2] rect(::Luxor.Point, ::Float64, ::Float64, ::Symbol) at /home/yuri/.julia/v0.6/Luxor/src/shapes.jl:24

Julia version requirement

Docs say Luxor currently runs on Julia version 0.5, using Cairo.jl and Colors.jl.
Does this mean that it requires 0.5 as a minimum version?
Or does it work with 0.4 and 0.5?

Seems to install on 0.4
REQUIRE has 0.4

Perhaps docs could be clarified.

Using function Base.display in preview()

Currently, if a user does not use Juypter or Juno, then preview() tries to display the drawing in an external program. This makes it impossible to use other IDE's and notebooks that provide image drawing capabilities.

There is a solution for that by using the functions displayable(mime) and display(mime, x), that verify if the environment allows drawing a certain mime type and then draw that.

If such a thing is welcome in Luxor, I could submit a PR for that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.