gir_ffi-cairo 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bdfee0ee121e41438b7d0dabfcabae03362a42b9
4
- data.tar.gz: 4f0553d509425734c116294a3f199c34e5cd12f2
2
+ SHA256:
3
+ metadata.gz: 15b274d8e00c739bf2ac1fc4a160ce2d535ee94c7b0dfcdff9a6e162c7991393
4
+ data.tar.gz: 78b673223b0653a824aea70f58386cc1a7bc5f522b0b758c24f319efd286747e
5
5
  SHA512:
6
- metadata.gz: c63df99ed7f65a180a8acb285fbce7bbbb3b214019e1763a6c90ba62cc65f3ee74b098dac8d8c0560e3dab0b45f74abc4154c62603f336369487e6de2ba09393
7
- data.tar.gz: b2efb29f129d6e5086ab6296e56f030b79e55ff3eef05d53a85c2cb588d6e63a3441aa6bb9e942c4d78916f17edcb8ce5e891f4c218457a8675f584648f8341d
6
+ metadata.gz: 0dd29d627b52e35329bf8dee8177c6e39281f3c609fd3bf09bc11536b51f7434692cdb3e4da44c1798dcc069034b21574de7791b4a5142ad546d0b330e19530f
7
+ data.tar.gz: 3132145bd971d040484c55315ef29899330db73d31eb22757e3ec521e21f4cc606578379d5beef5b834664126768f1ac6f226beb177c9cec88d073e859fa46d6
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_helper'
2
4
  require 'rake/testtask'
3
5
 
@@ -16,9 +18,9 @@ namespace :test do
16
18
  t.warning = true
17
19
  end
18
20
 
19
- task :all => [:unit, :integration]
21
+ task all: [:unit, :integration]
20
22
  end
21
23
 
22
- task :test => 'test:all'
24
+ task test: 'test:all'
23
25
 
24
- task :default => 'test'
26
+ task default: 'test'
@@ -1,10 +1,13 @@
1
- module Cairo
2
- load_class :Context
1
+ # frozen_string_literal: true
2
+
3
+ Cairo.load_class :Context
3
4
 
5
+ module Cairo
6
+ # Overrides for CairoContext (cairo_t)
4
7
  class Context
5
- def self.create target
8
+ def self.create(target)
6
9
  ptr = Lib.cairo_create target
7
- self.wrap ptr
10
+ wrap ptr
8
11
  end
9
12
 
10
13
  def move_to(x, y)
@@ -23,7 +26,7 @@ module Cairo
23
26
  Lib.cairo_rectangle self, x, y, width, height
24
27
  end
25
28
 
26
- def arc xc, yc, radius, angle1, angle2
29
+ def arc(xc, yc, radius, angle1, angle2)
27
30
  Lib.cairo_arc self, xc, yc, radius, angle1, angle2
28
31
  end
29
32
 
@@ -40,7 +43,7 @@ module Cairo
40
43
  Surface.wrap ptr
41
44
  end
42
45
 
43
- def set_source_rgba red, green, blue, alpha
46
+ def set_source_rgba(red, green, blue, alpha)
44
47
  Lib.cairo_set_source_rgba self, red, green, blue, alpha
45
48
  end
46
49
 
@@ -56,26 +59,26 @@ module Cairo
56
59
  Lib.cairo_show_page self
57
60
  end
58
61
  end
62
+ end
59
63
 
60
- module Lib
61
- attach_function :cairo_create, [:pointer], :pointer
62
- attach_function :cairo_get_target, [:pointer], :pointer
64
+ Cairo::Lib.module_eval do
65
+ attach_function :cairo_create, [:pointer], :pointer
66
+ attach_function :cairo_get_target, [:pointer], :pointer
63
67
 
64
- attach_function :cairo_move_to, [:pointer, :double, :double], :void
65
- attach_function :cairo_line_to, [:pointer, :double, :double], :void
66
- attach_function :cairo_arc,
67
- [:pointer, :double, :double, :double, :double, :double], :void
68
- attach_function :cairo_close_path, [:pointer], :void
69
- attach_function :cairo_rectangle, [:pointer, :double, :double, :double, :double], :void
68
+ attach_function :cairo_move_to, [:pointer, :double, :double], :void
69
+ attach_function :cairo_line_to, [:pointer, :double, :double], :void
70
+ attach_function :cairo_arc,
71
+ [:pointer, :double, :double, :double, :double, :double], :void
72
+ attach_function :cairo_close_path, [:pointer], :void
73
+ attach_function :cairo_rectangle, [:pointer, :double, :double, :double, :double], :void
70
74
 
71
- attach_function :cairo_fill, [:pointer], :void
72
- attach_function :cairo_stroke, [:pointer], :void
75
+ attach_function :cairo_fill, [:pointer], :void
76
+ attach_function :cairo_stroke, [:pointer], :void
73
77
 
74
- attach_function :cairo_set_source_rgba,
75
- [:pointer, :double, :double, :double, :double], :void
78
+ attach_function :cairo_set_source_rgba,
79
+ [:pointer, :double, :double, :double, :double], :void
76
80
 
77
- attach_function :cairo_save, [:pointer], :void
78
- attach_function :cairo_restore, [:pointer], :void
79
- attach_function :cairo_show_page, [:pointer], :void
80
- end
81
+ attach_function :cairo_save, [:pointer], :void
82
+ attach_function :cairo_restore, [:pointer], :void
83
+ attach_function :cairo_show_page, [:pointer], :void
81
84
  end
@@ -1,15 +1,13 @@
1
- module Cairo
2
- module Lib
3
- enum :Format, [
4
- :invalid, -1,
5
- :argb32, 0,
6
- :rgb24,
7
- :a8,
8
- :a1,
9
- :rgb16_565,
10
- :rgb30
11
- ]
12
- end
1
+ # frozen_string_literal: true
13
2
 
14
- Format = Lib.enum_type :Format
3
+ module Cairo
4
+ Format = Lib.enum :Format, [
5
+ :invalid, -1,
6
+ :argb32, 0,
7
+ :rgb24,
8
+ :a8,
9
+ :a1,
10
+ :rgb16_565,
11
+ :rgb30
12
+ ]
15
13
  end
@@ -1,13 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Cairo
4
+ # Surface subclass for (bitmap) images.
2
5
  class ImageSurface < Surface
3
- def self.create format, width, height
6
+ def self.create(format, width, height)
4
7
  ptr = Lib.cairo_image_surface_create format, width, height
5
- self.wrap ptr
8
+ wrap ptr
6
9
  end
7
10
  end
8
-
9
- module Lib
10
- attach_function :cairo_image_surface_create, [Cairo::Format, :int, :int], :pointer
11
- end
12
11
  end
13
12
 
13
+ Cairo::Lib.attach_function(:cairo_image_surface_create,
14
+ [Cairo::Format, :int, :int], :pointer)
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Cairo
4
+ # Surface subclass for PDFs.
2
5
  class PDFSurface < Surface
3
- def self.create filename, width, height
6
+ def self.create(filename, width, height)
4
7
  ptr = Lib.cairo_pdf_surface_create filename, width, height
5
- surface = self.wrap ptr
8
+ surface = wrap ptr
6
9
 
7
10
  if block_given?
8
11
  yield surface
@@ -16,9 +19,9 @@ module Cairo
16
19
  Lib.cairo_pdf_surface_set_size(self, width, height)
17
20
  end
18
21
  end
22
+ end
19
23
 
20
- module Lib
21
- attach_function :cairo_pdf_surface_create, [:string, :double, :double], :pointer
22
- attach_function :cairo_pdf_surface_set_size, [:pointer, :double, :double], :void
23
- end
24
+ Cairo::Lib.module_eval do
25
+ attach_function :cairo_pdf_surface_create, [:string, :double, :double], :pointer
26
+ attach_function :cairo_pdf_surface_set_size, [:pointer, :double, :double], :void
24
27
  end
@@ -1,19 +1,21 @@
1
- module Cairo
2
- load_class :Surface
1
+ # frozen_string_literal: true
2
+
3
+ Cairo.load_class :Surface
3
4
 
5
+ module Cairo
6
+ # Overrides for CairoSurface (cairo_surface_t)
4
7
  class Surface
5
- # TODO: Add overrides
6
8
  def flush
7
9
  Lib.cairo_surface_flush(self)
8
10
  end
11
+
9
12
  def finish
10
13
  Lib.cairo_surface_finish(self)
11
14
  end
12
15
  end
16
+ end
13
17
 
14
- module Lib
15
- # TODO: Attach functions
16
- attach_function :cairo_surface_flush, [:pointer], :void
17
- attach_function :cairo_surface_finish, [:pointer], :void
18
- end
18
+ Cairo::Lib.module_eval do
19
+ attach_function :cairo_surface_flush, [:pointer], :void
20
+ attach_function :cairo_surface_finish, [:pointer], :void
19
21
  end
data/lib/gir_ffi-cairo.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gir_ffi'
2
4
 
3
5
  GirFFI.setup :cairo
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
2
4
 
3
5
  describe Cairo::Context do
4
- describe ".create" do
5
- it "creates a new Cairo::Context" do
6
+ describe '.create' do
7
+ it 'creates a new Cairo::Context' do
6
8
  obj = Cairo::Context.create(nil)
7
9
  obj.must_be_instance_of Cairo::Context
8
10
  end
@@ -10,7 +12,7 @@ describe Cairo::Context do
10
12
 
11
13
  let(:instance) { Cairo::Context.create(nil) }
12
14
 
13
- describe "#get_target" do
15
+ describe '#get_target' do
14
16
  it "returns the context's target" do
15
17
  instance.get_target.must_be_instance_of Cairo::Surface
16
18
  end
@@ -1,15 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
2
4
 
3
5
  describe Cairo::ImageSurface do
4
- it "is a subclass of Cairo::Surface" do
6
+ it 'is a subclass of Cairo::Surface' do
5
7
  Cairo::ImageSurface.superclass.must_equal Cairo::Surface
6
8
  end
7
9
 
8
- describe ".create" do
9
- it "creates a new Cairo::ImageSurface" do
10
+ describe '.create' do
11
+ it 'creates a new Cairo::ImageSurface' do
10
12
  obj = Cairo::ImageSurface.create(:argb32, 300, 200)
11
13
  obj.must_be_instance_of Cairo::ImageSurface
12
14
  end
13
15
  end
14
16
  end
15
-
@@ -1,29 +1,29 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
2
4
 
3
5
  describe Cairo::PDFSurface do
4
- it "is a subclass of Cairo::Surface" do
6
+ it 'is a subclass of Cairo::Surface' do
5
7
  Cairo::PDFSurface.superclass.must_equal Cairo::Surface
6
8
  end
7
9
 
8
- describe ".create" do
10
+ describe '.create' do
9
11
  before { @path = 'test.pdf' }
10
12
  after { File.delete(@path) if File.exist? @path }
11
13
 
12
- it "creates a new Cairo::PDFSurface" do
14
+ it 'creates a new Cairo::PDFSurface' do
13
15
  obj = Cairo::PDFSurface.create(@path, 300, 200)
14
16
  obj.must_be_instance_of Cairo::PDFSurface
15
17
  end
16
18
 
17
- it "creates a new Cairo::PDFSurface with block" do
19
+ it 'creates a new Cairo::PDFSurface with block' do
18
20
  called = nil
19
- Cairo::PDFSurface.create(@path, 300, 200) {|surface|
21
+ Cairo::PDFSurface.create(@path, 300, 200) do |surface|
20
22
  surface.must_be_instance_of Cairo::PDFSurface
21
23
  called = true
22
- }
24
+ end
23
25
  refute_nil called
24
26
  assert File.exist?(@path)
25
27
  end
26
-
27
28
  end
28
29
  end
29
-
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
2
4
 
3
5
  describe Cairo::Context do
4
- it "can retrieve the surface it was created for" do
6
+ it 'can retrieve the surface it was created for' do
5
7
  dst = Cairo::ImageSurface.create(:argb32, 400, 300)
6
8
  ctx = Cairo::Context.create(dst)
7
9
  ctx.get_target.to_ptr.must_equal dst.to_ptr
8
10
  pass
9
11
  end
10
12
 
11
- it "can create and fill a path" do
13
+ it 'can create and fill a path' do
12
14
  dst = Cairo::ImageSurface.create(:argb32, 400, 300)
13
15
  ctx = Cairo::Context.create(dst)
14
16
  ctx.arc(300, 200, 100, 0, 2 * Math::PI)
@@ -21,14 +23,14 @@ describe Cairo::Context do
21
23
  before { @path = 'integration-test.pdf' }
22
24
  after { File.delete(@path) if File.exist? @path }
23
25
 
24
- it "can create pdf" do
25
- Cairo::PDFSurface.create(@path, 400, 300) {|surface|
26
+ it 'can create pdf' do
27
+ Cairo::PDFSurface.create(@path, 400, 300) do |surface|
26
28
  ctx = Cairo::Context.create(surface)
27
29
  ctx.arc(300, 200, 100, 0, 2 * Math::PI)
28
30
  ctx.set_source_rgba(1, 1, 0, 0.5)
29
31
  ctx.fill
30
32
  ctx.show_page
31
- }
33
+ end
32
34
  pass
33
35
  end
34
36
  end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'minitest/autorun'
2
4
 
3
5
  require 'gir_ffi-cairo'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gir_ffi-cairo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-16 00:00:00.000000000 Z
11
+ date: 2018-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gir_ffi
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.11.0
19
+ version: 0.12.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.11.0
26
+ version: 0.12.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '11.1'
47
+ version: '12.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '11.1'
54
+ version: '12.0'
55
55
  description: Bindings for Cairo generated by GirFFI, with overrides.
56
56
  email:
57
57
  - matijs@matijs.net
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
- version: '0'
88
+ version: 2.3.0
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - ">="
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.5.1
96
+ rubygems_version: 2.7.6
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: GirFFI-based bindings for Cairo