Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Julia 0.7 #216

Merged
merged 10 commits into from
Feb 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
matrix:
include:
- language: julia
julia: 0.5
julia: 0.6
os: linux
dist: trusty
sudo: false
sudo: false
- language: julia
julia: 0.6
julia: nightly
os: linux
dist: trusty
sudo: false
sudo: false
- language: julia
julia: 0.5
julia: 0.6
os: linux
- language: julia
julia: 0.5
julia: nightly
os: linux

- language: julia
julia: 0.6
os: osx
- language: julia
julia: 0.6
julia: nightly
os: osx
notifications:
email: false
Expand Down
4 changes: 2 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
julia 0.5
Compat 0.39.0
julia 0.6
Compat 0.50.0
Colors
BinDeps 0.3.21
Graphics 0.1
Expand Down
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ environment:
# - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
# - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
# - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
# - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
# - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

branches:
only:
Expand Down
27 changes: 15 additions & 12 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using BinDeps

@BinDeps.setup

using Compat
import Compat.Libdl
import Compat.Sys
import Compat.Pkg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't exist

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i cannot follow, as it does (here locally in 0.51.0).

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.3677 (2018-02-01 16:36 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit ecb8b56* (2 days old master)
|__/                   |  x86_64-linux-gnu

julia> using Compat

help?>  Compat.Libdl
  Interface to libdl. Provides dynamic linking support.


julia> import Compat.Libdl

julia> 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Tony is referring to Compat.Pkg. That was introduced in Compat v0.52.0, which postdates this PR (tagged today).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange, still 0.51.0 here and

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.3677 (2018-02-01 16:36 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit ecb8b56* (2 days old master)
|__/                   |  x86_64-linux-gnu

julia> using Compat

julia> import Compat.Pkg
WARNING: importing deprecated binding Base.Pkg into Compat.

julia> 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same warning in 0.50.0


# check for cairo version
@BinDeps.setup

# check for cairo version
function validate_cairo_version(name,handle)
f = Libdl.dlsym_e(handle, "cairo_version")
f == C_NULL && return false
v = ccall(f, Int32,())
v = ccall(f, Int32,())
return v > 10800
end

Expand All @@ -28,7 +31,7 @@ deps = [
zlib = library_dependency("zlib", aliases = ["libzlib","zlib1"], os = :Windows, group = group)
]

if is_windows()
if Sys.iswindows()
using WinRPM
provides(WinRPM.RPM,"libpango-1_0-0",[pango,pangocairo],os = :Windows)
provides(WinRPM.RPM,["glib2", "libgobject-2_0-0"],gobject,os = :Windows)
Expand Down Expand Up @@ -59,7 +62,7 @@ end

# System Package Managers
provides(AptGet,
@compat Dict(
Dict(
"libcairo2" => cairo,
"libfontconfig1" => fontconfig,
"libpango1.0-0" => [pango,pangocairo],
Expand All @@ -71,17 +74,17 @@ provides(AptGet,

# TODO: check whether these are accurate
provides(Yum,
@compat Dict(
Dict(
"cairo" => cairo,
"fontconfig" => fontconfig,
"pango" => [pango,pangocairo],
"glib2" => gobject,
"libpng" => libpng,
"gettext-libs" => gettext
))

provides(Zypper,
@compat Dict(
Dict(
"libcairo" => cairo,
"libfontconfig" => fontconfig,
"libpango-1.0" => [pango,pangocairo],
Expand All @@ -94,7 +97,7 @@ provides(Zypper,
const png_version = "1.5.14"

provides(Sources,
@compat Dict(
Dict(
URI("http://www.cairographics.org/releases/pixman-0.28.2.tar.gz") => pixman,
URI("http://www.cairographics.org/releases/cairo-1.12.16.tar.xz") => cairo,
URI("http://download.savannah.gnu.org/releases/freetype/freetype-2.4.11.tar.gz") => freetype,
Expand All @@ -107,10 +110,10 @@ provides(Sources,
URI("http://zlib.net/zlib-1.2.7.tar.gz") => zlib
))

xx(t...) = (is_windows() ? t[1] : (is_linux() || length(t) == 2) ? t[2] : t[3])
xx(t...) = (Sys.iswindows() ? t[1] : (is_linux() || length(t) == 2) ? t[2] : t[3])

provides(BuildProcess,
@compat Dict(
Dict(
Autotools(libtarget = "pixman/libpixman-1.la", installed_libname = xx("libpixman-1-0.","libpixman-1.","libpixman-1.0.")*Libdl.dlext) => pixman,
Autotools(libtarget = xx("objs/.libs/libfreetype.la","libfreetype.la")) => freetype,
Autotools(libtarget = "src/libfontconfig.la") => fontconfig,
Expand Down
37 changes: 19 additions & 18 deletions samples/sample_alpha_paint.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
## header to provide surface and context
using Cairo
using Colors
using Compat

c = CairoRGBSurface(256,256);
cr = CairoContext(c);
c = CairoRGBSurface(256,256)
cr = CairoContext(c)

save(cr);
save(cr)

z = Array{RGB24}(2,2)
z = Array{RGB24}(uninitialized, 2, 2)
c1 = convert(RGB24,colorant"grey20")
c2 = convert(RGB24,colorant"grey80")
z[1,1] = c1
Expand All @@ -16,18 +17,18 @@ z[2,1] = c2
z[2,2] = c1

img = CairoImageSurface(z)
pattern = CairoPattern(img);
pattern_set_extend(pattern, Cairo.EXTEND_REPEAT);
pattern_set_filter(pattern, Cairo.FILTER_BILINEAR);
pattern = CairoPattern(img)
pattern_set_extend(pattern, Cairo.EXTEND_REPEAT)
pattern_set_filter(pattern, Cairo.FILTER_BILINEAR)

m = CairoMatrix(1/8.0,0,0,1/8.0,0,0);
m = CairoMatrix(1/8.0,0,0,1/8.0,0,0)

set_matrix(pattern, m);
set_source(cr, pattern);
paint(cr);
restore(cr);
set_matrix(pattern, m)
set_source(cr, pattern)
paint(cr)
restore(cr)

save(cr);
save(cr)

# 5 uses of set_source

Expand Down Expand Up @@ -75,8 +76,8 @@ restore(cr)


## mark picture with current date
restore(cr);
move_to(cr,0.0,12.0);
set_source_rgb(cr, 0,0,0);
show_text(cr,Libc.strftime(time()));
write_to_png(c,"sample_alpha_paint.png");
restore(cr)
move_to(cr,0.0,12.0)
set_source_rgb(cr, 0,0,0)
show_text(cr,Libc.strftime(time()))
write_to_png(c,"sample_alpha_paint.png")
7 changes: 4 additions & 3 deletions samples/sample_arc.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## header to provide surface and context
using Cairo

c = CairoRGBSurface(256,256);
cr = CairoContext(c);

Expand All @@ -13,14 +14,14 @@ restore(cr);
xc = 128.0;
yc = 128.0;
radius = 100.0;
angle1 = 45.0 * (pi/180.0); # angles are specified
angle2 = 180.0 * (pi/180.0); # in radians
angle1 = 45.0 * (pi/180.0); # angles are specified
angle2 = 180.0 * (pi/180.0); # in radians

set_line_width(cr, 10.0);
arc(cr, xc, yc, radius, angle1, angle2);
stroke(cr);

# draw helping lines
# draw helping lines
set_source_rgba(cr, 1, 0.2, 0.2, 0.6);
set_line_width(cr, 6.0);

Expand Down
6 changes: 3 additions & 3 deletions samples/sample_arc_negative.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ restore(cr);
xc = 128.0;
yc = 128.0;
radius = 100.0;
angle1 = 45.0 * (pi/180.0); # angles are specified
angle2 = 180.0 * (pi/180.0); # in radians
angle1 = 45.0 * (pi/180.0); # angles are specified
angle2 = 180.0 * (pi/180.0); # in radians

set_line_width(cr, 10.0);
arc_negative(cr, xc, yc, radius, angle1, angle2);
stroke(cr);

# draw helping lines
# draw helping lines
set_source_rgba(cr, 1, 0.2, 0.2, 0.6);
set_line_width(cr, 6.0);

Expand Down
2 changes: 1 addition & 1 deletion samples/sample_copy_path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function example_copy_path(cr)
s1 = repr(x.points)
move_to(cr,100.0,14.0*l)
l += 1
show_text(cr,s0*s1); #
show_text(cr,s0*s1)
end
nothing
end
Expand Down
49 changes: 25 additions & 24 deletions samples/sample_copy_path_flat.jl
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
## header to provide surface and context
using Cairo
c = CairoRGBSurface(256,256);
cr = CairoContext(c);

save(cr);
set_source_rgb(cr,0.8,0.8,0.8); # light gray
rectangle(cr,0.0,0.0,256.0,256.0); # background
fill(cr);
restore(cr);
c = CairoRGBSurface(256,256)
cr = CairoContext(c)

save(cr);
save(cr)
set_source_rgb(cr,0.8,0.8,0.8) # light gray
rectangle(cr,0.0,0.0,256.0,256.0) # background
fill(cr)
restore(cr)

save(cr)

## original example, following here
move_to(cr, 16.0, 32.0);
curve_to(cr, 16.0, 16.0, 16.0, 16.0, 32.0, 16.0);
move_to(cr, 16.0, 32.0)
curve_to(cr, 16.0, 16.0, 16.0, 16.0, 32.0, 16.0)

opath = Cairo.convert_cairo_path_data(Cairo.copy_path(cr));
dx,dy,ex,ey = path_extents(cr);
opath = Cairo.convert_cairo_path_data(Cairo.copy_path(cr))
dx,dy,ex,ey = path_extents(cr)

fpath = Cairo.convert_cairo_path_data(Cairo.copy_path_flat(cr));
fpath = Cairo.convert_cairo_path_data(Cairo.copy_path_flat(cr))

stroke(cr);
stroke(cr)

restore(cr);
restore(cr)

l = 2 # something like a line counter

Expand All @@ -39,8 +40,8 @@ for x in opath
end
s1 = repr(x.points)
move_to(cr,10.0,16.0+(14.0*l))
l += 1
show_text(cr,s0*s1); #
global l += 1
show_text(cr,s0*s1)
end

l = 2 # something like a line counter
Expand All @@ -58,16 +59,16 @@ for x in fpath
end
s1 = repr(x.points)
move_to(cr,10.0,50.0+(14.0*l))
l += 1
show_text(cr,s0*s1); #
global l += 1
show_text(cr,s0*s1)
end


## mark picture with current date
restore(cr);
restore(cr)

move_to(cr,0.0,12.0);
set_source_rgb(cr, 0,0,0);
show_text(cr,Libc.strftime(time()));
move_to(cr,0.0,12.0)
set_source_rgb(cr, 0,0,0)
show_text(cr,Libc.strftime(time()))

write_to_png(c,"sample_copy_path_flat.png");
write_to_png(c,"sample_copy_path_flat.png")
4 changes: 3 additions & 1 deletion samples/sample_pango_text.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## header to provide surface and context
using Cairo
using Compat.Printf

c = CairoRGBSurface(256,256);
cr = CairoContext(c);

Expand All @@ -19,7 +21,7 @@ text(cr,16.0,104.0,"Text<b>Bold</b><i>Italic</i><sup>super-2</sup>",markup=true)

text(cr,40.0,224.0,"Es geht <span foreground=\"white\" background=\"blue\">aufwärts</span> !",markup=true,angle=30.0)

#using textwidth and height
#using textwidth and height

set_font_face(cr, "Sans 12")

Expand Down
2 changes: 1 addition & 1 deletion samples/sample_script0.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ t1 = 24.0
for x in r1
move_to(cr,0.0,t1)
show_text(cr,x)
t1 += 12.0
global t1 += 12.0
end


Expand Down
Loading