Skip to content

Commit b333894

Browse files
committed
to reduce deprecation warnings: some whitespace and Libc for strftime
1 parent 8d340a7 commit b333894

20 files changed

+256
-256
lines changed

samples/sample_arc.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ stroke(cr);
3535

3636
## mark picture with current date
3737
move_to(cr,0.0,12.0);
38-
set_source_rgb (cr, 0,0,0);
39-
show_text(cr,strftime(time()));
38+
set_source_rgb(cr, 0,0,0);
39+
show_text(cr,Libc.strftime(time()));
4040
write_to_png(c,"sample_arc.png");

samples/sample_arc_negative.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ stroke(cr);
3535

3636
## mark picture with current date
3737
move_to(cr,0.0,12.0);
38-
set_source_rgb (cr, 0,0,0);
39-
show_text(cr,strftime(time()));
38+
set_source_rgb(cr, 0,0,0);
39+
show_text(cr,Libc.strftime(time()));
4040
write_to_png(c,"sample_arc_negative.png");

samples/sample_clip.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ stroke(cr);
2929
## mark picture with current date
3030
restore(cr);
3131
move_to(cr,0.0,12.0);
32-
set_source_rgb (cr, 0,0,0);
33-
show_text(cr,strftime(time()));
32+
set_source_rgb(cr, 0,0,0);
33+
show_text(cr,Libc.strftime(time()));
3434
write_to_png(c,"sample_clip.png");

samples/sample_clip_image.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ save(cr);
1313

1414
## original example, following here
1515

16-
arc (cr, 128.0, 128.0, 76.8, 0, 2*pi);
17-
clip (cr);
18-
new_path (cr); # path not consumed by clip
16+
arc(cr, 128.0, 128.0, 76.8, 0, 2*pi);
17+
clip(cr);
18+
new_path(cr); # path not consumed by clip
1919

20-
image = read_from_png ("data/mulberry.png"); # should be create_from_png
20+
image = read_from_png("data/mulberry.png"); # should be create_from_png
2121
w = image.width;
2222
h = image.height;
2323

2424
scale(cr, 256.0/w, 256.0/h);
2525

26-
set_source_surface (cr, image, 0, 0);
27-
paint (cr);
26+
set_source_surface(cr, image, 0, 0);
27+
paint(cr);
2828

2929
#cairo_surface_destroy not used here
3030

3131
## mark picture with current date
3232
restore(cr);
3333
move_to(cr,0.0,12.0);
34-
set_source_rgb (cr, 0,0,0);
35-
show_text(cr,strftime(time()));
34+
set_source_rgb(cr, 0,0,0);
35+
show_text(cr,Libc.strftime(time()));
3636
write_to_png(c,"sample_clip_image.png");

samples/sample_copy_path.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ end
1818
function write_out_picture(filename::AbstractString,c::CairoSurface)
1919
## mark picture with current date
2020
move_to(cr,0.0,12.0);
21-
set_source_rgb (cr, 0,0,0);
22-
show_text(cr,strftime(time()));
21+
set_source_rgb(cr, 0,0,0);
22+
show_text(cr,Libc.strftime(time()));
2323
##
2424
write_to_png(c,filename);
2525
nothing
@@ -29,11 +29,11 @@ function example_copy_path(cr)
2929

3030
save(cr);
3131
# single (large) character set with text_path+stroke
32-
select_font_face (cr, "Sans", Cairo.FONT_SLANT_NORMAL,
32+
select_font_face(cr, "Sans", Cairo.FONT_SLANT_NORMAL,
3333
Cairo.FONT_WEIGHT_BOLD);
34-
set_font_size (cr, 100.0);
34+
set_font_size(cr, 100.0);
3535
translate(cr, 10.0, 100.0);
36-
text_path (cr, "J");
36+
text_path(cr, "J");
3737
stroke_preserve(cr);
3838

3939
# copied and converted

samples/sample_curve_rectangle.jl

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,47 +27,47 @@ function shape_curve_rectangle(cr::CairoContext,x0::Real,y0::Real,
2727
end
2828
if (rect_width/2 < radius)
2929
if (rect_height/2 < radius)
30-
move_to (cr, x0, (y0 + y1)/2);
31-
curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0);
32-
curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2);
33-
curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1);
34-
curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2);
30+
move_to(cr, x0, (y0 + y1)/2);
31+
curve_to(cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0);
32+
curve_to(cr, x1, y0, x1, y0, x1, (y0 + y1)/2);
33+
curve_to(cr, x1, y1, x1, y1, (x1 + x0)/2, y1);
34+
curve_to(cr, x0, y1, x0, y1, x0, (y0 + y1)/2);
3535
else
36-
move_to (cr, x0, y0 + radius);
37-
curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0);
38-
curve_to (cr, x1, y0, x1, y0, x1, y0 + radius);
39-
line_to (cr, x1 , y1 - radius);
40-
curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1);
41-
curve_to (cr, x0, y1, x0, y1, x0, y1- radius);
36+
move_to(cr, x0, y0 + radius);
37+
curve_to(cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0);
38+
curve_to(cr, x1, y0, x1, y0, x1, y0 + radius);
39+
line_to(cr, x1 , y1 - radius);
40+
curve_to(cr, x1, y1, x1, y1, (x1 + x0)/2, y1);
41+
curve_to(cr, x0, y1, x0, y1, x0, y1- radius);
4242
end
4343

4444
else
4545
if (rect_height/2 < radius)
46-
move_to (cr, x0, (y0 + y1)/2);
47-
curve_to (cr, x0 , y0, x0 , y0, x0 + radius, y0);
48-
line_to (cr, x1 - radius, y0);
49-
curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2);
50-
curve_to (cr, x1, y1, x1, y1, x1 - radius, y1);
51-
line_to (cr, x0 + radius, y1);
52-
curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2);
46+
move_to(cr, x0, (y0 + y1)/2);
47+
curve_to(cr, x0 , y0, x0 , y0, x0 + radius, y0);
48+
line_to(cr, x1 - radius, y0);
49+
curve_to(cr, x1, y0, x1, y0, x1, (y0 + y1)/2);
50+
curve_to(cr, x1, y1, x1, y1, x1 - radius, y1);
51+
line_to(cr, x0 + radius, y1);
52+
curve_to(cr, x0, y1, x0, y1, x0, (y0 + y1)/2);
5353
else
54-
move_to (cr, x0, y0 + radius);
55-
curve_to (cr, x0 , y0, x0 , y0, x0 + radius, y0);
56-
line_to (cr, x1 - radius, y0);
57-
curve_to (cr, x1, y0, x1, y0, x1, y0 + radius);
58-
line_to (cr, x1 , y1 - radius);
59-
curve_to (cr, x1, y1, x1, y1, x1 - radius, y1);
60-
line_to (cr, x0 + radius, y1);
61-
curve_to (cr, x0, y1, x0, y1, x0, y1- radius);
54+
move_to(cr, x0, y0 + radius);
55+
curve_to(cr, x0 , y0, x0 , y0, x0 + radius, y0);
56+
line_to(cr, x1 - radius, y0);
57+
curve_to(cr, x1, y0, x1, y0, x1, y0 + radius);
58+
line_to(cr, x1 , y1 - radius);
59+
curve_to(cr, x1, y1, x1, y1, x1 - radius, y1);
60+
line_to(cr, x0 + radius, y1);
61+
curve_to(cr, x0, y1, x0, y1, x0, y1- radius);
6262
end
6363
end
64-
close_path (cr);
64+
close_path(cr);
6565

66-
set_source_rgb (cr, 0.5, 0.5, 1);
67-
fill_preserve (cr);
68-
set_source_rgba (cr, 0.5, 0, 0, 0.5);
69-
set_line_width (cr, 10.0);
70-
stroke (cr);
66+
set_source_rgb(cr, 0.5, 0.5, 1);
67+
fill_preserve(cr);
68+
set_source_rgba(cr, 0.5, 0, 0, 0.5);
69+
set_line_width(cr, 10.0);
70+
stroke(cr);
7171
restore(cr);
7272
return;
7373
end
@@ -77,6 +77,6 @@ shape_curve_rectangle(cr,25.6,25.6,204.8,204.8,102.4);
7777
## mark picture with current date
7878
restore(cr);
7979
move_to(cr,0.0,12.0);
80-
set_source_rgb (cr, 0,0,0);
81-
show_text(cr,strftime(time()));
80+
set_source_rgb(cr, 0,0,0);
81+
show_text(cr,Libc.strftime(time()));
8282
write_to_png(c,"sample_curve_rectangle.png");

samples/sample_curve_to.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ x1=102.4; y1=230.4;
1818
x2=153.6; y2=25.6;
1919
x3=230.4; y3=128.0;
2020

21-
move_to (cr, x, y);
22-
curve_to (cr, x1, y1, x2, y2, x3, y3);
21+
move_to(cr, x, y);
22+
curve_to(cr, x1, y1, x2, y2, x3, y3);
2323

24-
set_line_width (cr, 10.0);
25-
stroke (cr);
24+
set_line_width(cr, 10.0);
25+
stroke(cr);
2626

27-
set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
28-
set_line_width (cr, 6.0);
29-
move_to (cr,x,y); line_to (cr,x1,y1);
30-
move_to (cr,x2,y2); line_to (cr,x3,y3);
31-
stroke (cr);
27+
set_source_rgba(cr, 1, 0.2, 0.2, 0.6);
28+
set_line_width(cr, 6.0);
29+
move_to(cr,x,y); line_to(cr,x1,y1);
30+
move_to(cr,x2,y2); line_to(cr,x3,y3);
31+
stroke(cr);
3232

3333
## mark picture with current date
3434
restore(cr);
3535
move_to(cr,0.0,12.0);
36-
set_source_rgb (cr, 0,0,0);
37-
show_text(cr,strftime(time()));
36+
set_source_rgb(cr, 0,0,0);
37+
show_text(cr,Libc.strftime(time()));
3838
write_to_png(c,"sample_curve_to.png");

samples/sample_dash.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ dashes = [50.0, # ink
2020
#ndash = length(dashes); not implemented as ndash on set_dash
2121
offset = -50.0;
2222

23-
set_dash (cr, dashes, offset);
24-
set_line_width (cr, 10.0);
23+
set_dash(cr, dashes, offset);
24+
set_line_width(cr, 10.0);
2525

26-
move_to (cr, 128.0, 25.6);
27-
line_to (cr, 230.4, 230.4);
28-
rel_line_to (cr, -102.4, 0.0);
29-
curve_to (cr, 51.2, 230.4, 51.2, 128.0, 128.0, 128.0);
26+
move_to(cr, 128.0, 25.6);
27+
line_to(cr, 230.4, 230.4);
28+
rel_line_to(cr, -102.4, 0.0);
29+
curve_to(cr, 51.2, 230.4, 51.2, 128.0, 128.0, 128.0);
3030

31-
stroke (cr);
31+
stroke(cr);
3232

3333

3434
## mark picture with current date
3535
restore(cr);
3636
move_to(cr,0.0,12.0);
37-
set_source_rgb (cr, 0,0,0);
38-
show_text(cr,strftime(time()));
37+
set_source_rgb(cr, 0,0,0);
38+
show_text(cr,Libc.strftime(time()));
3939
write_to_png(c,"sample_dash.png");

samples/sample_fill_and_stroke2.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ restore(cr);
1111

1212
save(cr);
1313
## original example, following here
14-
move_to (cr, 128.0, 25.6);
15-
line_to (cr, 230.4, 230.4);
16-
rel_line_to (cr, -102.4, 0.0);
17-
curve_to (cr, 51.2, 230.4, 51.2, 128.0, 128.0, 128.0);
18-
close_path (cr);
14+
move_to(cr, 128.0, 25.6);
15+
line_to(cr, 230.4, 230.4);
16+
rel_line_to(cr, -102.4, 0.0);
17+
curve_to(cr, 51.2, 230.4, 51.2, 128.0, 128.0, 128.0);
18+
close_path(cr);
1919

20-
move_to (cr, 64.0, 25.6);
21-
rel_line_to (cr, 51.2, 51.2);
22-
rel_line_to (cr, -51.2, 51.2);
23-
rel_line_to (cr, -51.2, -51.2);
24-
close_path (cr);
20+
move_to(cr, 64.0, 25.6);
21+
rel_line_to(cr, 51.2, 51.2);
22+
rel_line_to(cr, -51.2, 51.2);
23+
rel_line_to(cr, -51.2, -51.2);
24+
close_path(cr);
2525

26-
set_line_width (cr, 10.0);
27-
set_source_rgb (cr, 0, 0, 1);
28-
fill_preserve (cr);
29-
set_source_rgb (cr, 0, 0, 0);
30-
stroke (cr);
26+
set_line_width(cr, 10.0);
27+
set_source_rgb(cr, 0, 0, 1);
28+
fill_preserve(cr);
29+
set_source_rgb(cr, 0, 0, 0);
30+
stroke(cr);
3131

3232
## mark picture with current date
3333
restore(cr);
3434
move_to(cr,0.0,12.0);
35-
set_source_rgb (cr, 0,0,0);
36-
show_text(cr,strftime(time()));
35+
set_source_rgb(cr, 0,0,0);
36+
show_text(cr,Libc.strftime(time()));
3737
write_to_png(c,"sample_fill_and_stroke2.png");

samples/sample_fill_style.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ restore(cr);
1111

1212
save(cr);
1313
## original example, following here
14-
set_line_width (cr, 6);
14+
set_line_width(cr, 6);
1515

16-
rectangle (cr, 12, 12, 232, 70);
17-
new_sub_path (cr); arc (cr, 64, 64, 40, 0, 2*pi);
18-
new_sub_path (cr); arc_negative (cr, 192, 64, 40, 0, -2*pi);
16+
rectangle(cr, 12, 12, 232, 70);
17+
new_sub_path(cr); arc(cr, 64, 64, 40, 0, 2*pi);
18+
new_sub_path(cr); arc_negative(cr, 192, 64, 40, 0, -2*pi);
1919

20-
set_fill_type (cr, Cairo.CAIRO_FILL_RULE_EVEN_ODD); # should be set_fill_rule
21-
set_source_rgb (cr, 0, 0.7, 0); fill_preserve (cr);
22-
set_source_rgb (cr, 0, 0, 0); stroke (cr);
20+
set_fill_type(cr, Cairo.CAIRO_FILL_RULE_EVEN_ODD); # should be set_fill_rule
21+
set_source_rgb(cr, 0, 0.7, 0); fill_preserve(cr);
22+
set_source_rgb(cr, 0, 0, 0); stroke(cr);
2323

24-
translate (cr, 0, 128);
25-
rectangle (cr, 12, 12, 232, 70);
26-
new_sub_path (cr); arc (cr, 64, 64, 40, 0, 2*pi);
27-
new_sub_path (cr); arc_negative (cr, 192, 64, 40, 0, -2*pi);
24+
translate(cr, 0, 128);
25+
rectangle(cr, 12, 12, 232, 70);
26+
new_sub_path(cr); arc(cr, 64, 64, 40, 0, 2*pi);
27+
new_sub_path(cr); arc_negative(cr, 192, 64, 40, 0, -2*pi);
2828

29-
set_fill_type (cr, Cairo.CAIRO_FILL_RULE_WINDING);
30-
set_source_rgb (cr, 0, 0, 0.9); fill_preserve (cr);
31-
set_source_rgb (cr, 0, 0, 0); stroke (cr);
29+
set_fill_type(cr, Cairo.CAIRO_FILL_RULE_WINDING);
30+
set_source_rgb(cr, 0, 0, 0.9); fill_preserve(cr);
31+
set_source_rgb(cr, 0, 0, 0); stroke(cr);
3232

3333
## mark picture with current date
3434
restore(cr);
3535
move_to(cr,0.0,12.0);
36-
set_source_rgb (cr, 0,0,0);
37-
show_text(cr,strftime(time()));
36+
set_source_rgb(cr, 0,0,0);
37+
show_text(cr,Libc.strftime(time()));
3838
write_to_png(c,"sample_fill_style.png");

samples/sample_gradient.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@ save(cr);
1313

1414
## original example, following here
1515

16-
pat = pattern_create_linear (0.0, 0.0, 0.0, 256.0);
17-
pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1);
18-
pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 1);
19-
rectangle (cr, 0, 0, 256, 256);
20-
set_source (cr, pat);
21-
fill (cr);
22-
destroy (pat);
16+
pat = pattern_create_linear(0.0, 0.0, 0.0, 256.0);
17+
pattern_add_color_stop_rgba(pat, 1, 0, 0, 0, 1);
18+
pattern_add_color_stop_rgba(pat, 0, 1, 1, 1, 1);
19+
rectangle(cr, 0, 0, 256, 256);
20+
set_source(cr, pat);
21+
fill(cr);
22+
destroy(pat);
2323

24-
pat = pattern_create_radial (115.2, 102.4, 25.6,
25-
102.4, 102.4, 128.0);
26-
pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 1);
27-
pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1);
28-
set_source (cr, pat);
29-
arc (cr, 128.0, 128.0, 76.8, 0, 2 * pi);
30-
fill (cr);
31-
destroy (pat);
24+
pat = pattern_create_radial(115.2, 102.4, 25.6,
25+
102.4, 102.4, 128.0);
26+
pattern_add_color_stop_rgba(pat, 0, 1, 1, 1, 1);
27+
pattern_add_color_stop_rgba(pat, 1, 0, 0, 0, 1);
28+
set_source(cr, pat);
29+
arc(cr, 128.0, 128.0, 76.8, 0, 2 * pi);
30+
fill(cr);
31+
destroy(pat);
3232

3333
## mark picture with current date
3434
restore(cr);
3535
move_to(cr,0.0,12.0);
36-
set_source_rgb (cr, 0,0,0);
37-
show_text(cr,strftime(time()));
36+
set_source_rgb(cr, 0,0,0);
37+
show_text(cr,Libc.strftime(time()));
3838
write_to_png(c,"sample_gradient.png");

0 commit comments

Comments
 (0)