Skip to content

Commit af116ec

Browse files
committed
adding GR backend
1 parent 71b99fa commit af116ec

File tree

7 files changed

+426
-415
lines changed

7 files changed

+426
-415
lines changed

ext/grruby/grruby.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,8 +1031,9 @@ static VALUE version(VALUE self){
10311031

10321032
void Init_grruby()
10331033
{
1034-
VALUE mGRruby = rb_define_module("GR");
1035-
VALUE mGR3ruby = rb_define_module("GR3");
1034+
VALUE mRubyplot = rb_define_module("Rubyplot");
1035+
VALUE mGRruby = rb_define_module_under("GR", mRubyplot);
1036+
VALUE mGR3ruby = rb_define_module_under("GR3", mRubyplot);
10361037

10371038
rb_define_singleton_method(mGRruby,"opengks",opengks,0);
10381039
rb_define_singleton_method(mGRruby,"closegks",closegks,0);

lib/rubyplot.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,18 @@
1313
require 'rubyplot/spi'
1414

1515
module Rubyplot
16-
@@backend = Rubyplot::Backend::MagickWrapper.new
1716
class << self
1817
def backend
19-
@@backend
18+
@backend
2019
end
2120

22-
def set_backend_magick
23-
@@backed = Rubyplot::Backend::MagickWrapper.new
21+
def set_backend b
22+
case b
23+
when :magick
24+
@backend = Rubyplot::Backend::MagickWrapper.new
25+
when :gr
26+
@backend = Rubyplot::Backend::GRWrapper.new
27+
end
2428
end
2529
end
2630
end # module Rubyplot

lib/rubyplot/artist/polygon.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module Rubyplot
22
module Artist
33
class Polygon < Base
44
def initialize(owner, coords:, fill_opacity: 0.0, color: :default, stroke: 'transparent')
5-
@backend = owner.backend
65
@coords = coords
76
@fill_opacity = fill_opacity
87
@color = color

lib/rubyplot/backend.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
require_relative 'backend/magick_wrapper'
2+
require_relative 'backend/gr_wrapper'

lib/rubyplot/backend/gr_wrapper.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Rubyplot
2+
module Backend
3+
class GRWrapper
4+
5+
end # class GRWrapper
6+
end # module Backend
7+
end # module Rubyplot

0 commit comments

Comments
 (0)