ruby-gr 0.0.5 → 0.0.6

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
2
  SHA256:
3
- metadata.gz: 51cba5fbff46f2beca8d4343580d583390daa5ae65308af59bc5353385c181ae
4
- data.tar.gz: b7a9fed2d87f74dde366032c2589a71aeabafa142d1499cdaacf7b3ba0b150b0
3
+ metadata.gz: f31069eac6089014b6cbea3453d5c7e42996e02b1b243e0b8d3aa116fb1b3c3f
4
+ data.tar.gz: 697465b25729e4f7a8b9b8c6252b3ceec4e6614f5760994cb91a2a8ad31d34df
5
5
  SHA512:
6
- metadata.gz: 1a31d16e878229021a6f02403766b1d7be0d0c161261e92d5f1d2a19b5c4146bade5f17ef4f03784b6212845d0af089a21c41dc258fee194dedf1943fd649303
7
- data.tar.gz: 741bb5fbfafd7a0422d5d0b528545112a9e84b2c20baa396d2ef51e6a0692083a0124db0e70cd82763e725e1169f18ce5a2dcc6ec1cec9deadecdff3042f023b
6
+ metadata.gz: 74496ad16167dfba8725c67f65b20125f00d1969a0c311e1e9312be465e740c303df9482671c61d04c2de77773208ac8cfb6e33c301f33173ce27fe21540d9f0
7
+ data.tar.gz: 0c5ee85a6944438ea3f0b0ecfc61ef1f188a4c779205d84eb2bce63b83746fe36ee57c94d402235bb020189d526f03e6d9f1828253da181bd95307fcaf8e0b5e
data/LICENSE.txt CHANGED
@@ -1,6 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
3
  Copyright (c) 2019 kojix2
4
+ Copyright (c) 2019 Red Data Tools
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # GR module for Ruby
2
2
 
3
- [![The MIT License](https://img.shields.io/badge/license-MIT-orange.svg)](LICENSE.md)
4
- [![Build Status](https://travis-ci.com/kojix2/GR.rb.svg?&branch=master)](https://travis-ci.org/kojix2/GR.rb)
3
+ [![The MIT License](https://img.shields.io/badge/license-MIT-orange.svg)](LICENSE.txt)
4
+ [![Build Status](https://travis-ci.org/red-data-tools/GR.rb.svg?branch=master)](https://travis-ci.org/red-data-tools/GR.rb)
5
5
  [![Gem Version](https://badge.fury.io/rb/ruby-gr.svg)](https://badge.fury.io/rb/ruby-gr)
6
- [![Gitter chat](https://badges.gitter.im/kojix2/GR.rb.svg)](https://gitter.im/kojix2/GR.rb)
6
+ [![Gitter Chat](https://badges.gitter.im/red-data-tools/en.svg)](https://gitter.im/red-data-tools/en)
7
+ [![Docs Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://rubydoc.info/gems/ruby-gr)
7
8
 
8
9
  [GR framework](https://github.com/sciapp/gr) - the graphics library for visualisation - for Ruby
9
10
 
@@ -25,20 +26,21 @@ gem 'ruby-gr'
25
26
 
26
27
  ## Quick Start
27
28
 
29
+ <p align="center">
30
+ <img src="https://user-images.githubusercontent.com/5798442/69689128-74cb1480-110b-11ea-9097-29e878a19e8f.png">
31
+ </p>
32
+
28
33
  ```ruby
29
- require 'gr'
34
+ require 'gr/plot'
30
35
 
31
36
  x = [0, 0.2, 0.4, 0.6, 0.8, 1.0]
32
37
  y = [0.3, 0.5, 0.4, 0.2, 0.6, 0.7]
33
38
 
34
- GR.polyline(x, y)
35
- tick = GR.tick(0, 1)
36
- GR.axes(tick, tick, 0, 0, 1, 1, -0.001)
37
- GR.updatews
39
+ GR.lineplot(x, y)
38
40
  ```
39
41
 
40
42
  ## Examples
41
- Have a look in the [`examples`](https://github.com/kojix2/GR.rb/tree/master/examples) directory for some simple examples.
43
+ Have a look in the [`examples`](https://github.com/red-data-tools/GR.rb/tree/master/examples) directory for some simple examples.
42
44
 
43
45
  griddata.rb
44
46
 
@@ -115,4 +117,4 @@ GR.updatews
115
117
 
116
118
  ## Contributing
117
119
 
118
- Bug reports and pull requests are welcome on GitHub at https://github.com/kojix2/GR.rb.
120
+ Bug reports and pull requests are welcome on GitHub at https://github.com/red-data-tools/GR.rb.
data/lib/gr.rb CHANGED
@@ -2,38 +2,43 @@
2
2
 
3
3
  # OverView of GR.rb
4
4
  #
5
- # +--------------------+
6
- # +-------------------+ | GR3 module |
7
- # | GR module | | +----------------+ |
8
- # | +---------------+ | | | GR3::FFI | |
9
- # | | GR::FFI | | | | + libGR3.so | |
10
- # | | + libGR.so | | | +----------------+ |
11
- # | +---------------+ | | | define_method |
12
- # | | define_method | | +----------------+ |
13
- # | +---------------+ | | | | GR3::GR3Base | |
14
- # | | | GR::GRBase | | | | v (Private) | |
15
- # | | v (Private) | | | +++--------------+ |
16
- # | +++-------------+ | | | Extend |
17
- # | | Extend | | v +------+ |
18
- # | v | | |Check | |
19
- # | | | <--+Error | |
20
- # +-------+-----------+ | +------+ |
21
- # ^ +---------+----------+
22
- # | +------------------+ ^
23
- # Extend | | GRCommons module | | Extend
24
- # | | +--------------+ | |
25
- # +----+ CommonUtils +----+
26
- # | | +--------------+ | |
27
- # | | +--------------+ | |
28
- # +----+ Version +----+
29
- # | | +--------------+ |
30
- # | | +--------------+ |
31
- # +----+JupyterSupport| |
32
- # | +--------------+ |
33
- # +------------------+
34
-
35
- require 'ffi'
5
+ # +--------------------+
6
+ # +-------------------+ | GR3 module |
7
+ # | GR module | | +----------------+ |
8
+ # | +---------------+ | | | GR3::FFI | |
9
+ # | | GR::FFI | | | | + libGR3.so | |
10
+ # | | + libGR.so | | | +----------------+ |
11
+ # | +---------------+ | | | define_method |
12
+ # | | define_method | | +----------------+ |
13
+ # | +---------------+ | | | | GR3::GR3Base | |
14
+ # | | | GR::GRBase | | | | v (Private) | |
15
+ # | | v (Private) | | | +++--------------+ |
16
+ # | +++-------------+ | | | Extend |
17
+ # | | Extend | | v +------+ |
18
+ # | v | | |Check | |
19
+ # | | | <--+Error | |
20
+ # +-------+-----------+ | +------+ |
21
+ # ^ +---------+----------+
22
+ # | +------------------+ ^
23
+ # Extend | | GRCommons module | | Extend
24
+ # | | +--------------+ | |
25
+ # | | | Fiddley | | |
26
+ # | | +--------------+ | |
27
+ # | | +--------------+ | |
28
+ # +----+ CommonUtils +----+
29
+ # | | +--------------+ | |
30
+ # | | +--------------+ | |
31
+ # +----+ Version +----+
32
+ # | | +--------------+ |
33
+ # | | +--------------+ |
34
+ # +----+JupyterSupport| |
35
+ # | +--------------+ |
36
+ # +------------------+
37
+ #
38
+ # The GR module works without Numo::Narrray.
36
39
 
40
+ # This is a procedural interface to the GR plotting library,
41
+ # https://github.com/sciapp/gr
37
42
  module GR
38
43
  class Error < StandardError; end
39
44
 
@@ -48,13 +53,12 @@ module GR
48
53
  raise Error, 'Please set env variable GRDIR' unless ENV['GRDIR']
49
54
 
50
55
  ENV['GKS_FONTPATH'] ||= ENV['GRDIR']
51
- @ffi_lib = case RbConfig::CONFIG['host_os']
52
- when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
53
- File.expand_path('bin/libgr.dll', ENV['GRDIR'])
54
- .gsub('/', '\\') # windows backslash
55
- else
56
- File.expand_path('lib/libGR.so', ENV['GRDIR'])
57
- end
56
+ if Object.const_defined?(:RubyInstaller)
57
+ @ffi_lib = File.expand_path('bin/libgr.dll', ENV['GRDIR'])
58
+ RubyInstaller::Runtime.add_dll_directory(File.dirname(@ffi_lib))
59
+ else
60
+ @ffi_lib = File.expand_path('lib/libGR.so', ENV['GRDIR'])
61
+ end
58
62
 
59
63
  require_relative 'gr_commons'
60
64
  require_relative 'gr/version'
@@ -68,6 +72,9 @@ module GR
68
72
  # a FFI::MemoryPointer in the GRBase class.
69
73
  extend GRBase
70
74
 
75
+ # Now you can see a lot of methods just calling super here.
76
+ # Why? Do they really need?
77
+ # Yes. They are written to help the yard generate the documentation.
71
78
  class << self
72
79
  def initgr(*)
73
80
  super
@@ -272,9 +279,9 @@ module GR
272
279
  # The values for `x` and `y` are in world coordinates. The attributes that
273
280
  # control the appearance of a spline-fit are linetype, linewidth and color
274
281
  # index.
275
- def spline(px, py, m, method)
276
- n = equal_length(px, py)
277
- super(n, px, py, m, method)
282
+ def spline(x, y, m, method)
283
+ n = equal_length(x, y)
284
+ super(n, x, y, m, method)
278
285
  end
279
286
 
280
287
  def gridit(xd, yd, zd, nx, ny)
@@ -640,39 +647,6 @@ module GR
640
647
  super
641
648
  end
642
649
 
643
- # `setscale` sets the type of transformation to be used for subsequent GR output
644
- # primitives.
645
- # @param options [Integer] Scale specification
646
- # * 1 : OPTION_X_LOG
647
- # * Logarithmic X-axis
648
- # * 2 : OPTION_Y_LOG
649
- # * Logarithmic Y-axis
650
- # * 4 : OPTION_Z_LOG
651
- # * Logarithmic Z-axis
652
- # * 8 : OPTION_FLIP_X
653
- # * Flip X-axis
654
- # * 16 : OPTION_FLIP_Y
655
- # * Flip Y-axis
656
- # * 32 : OPTION_FLIP_Z
657
- # * Flip Z-axis
658
- # @return [Integer]
659
- # `setscale` defines the current transformation according to the given scale
660
- # specification which may be or'ed together using any of the above options. GR uses
661
- # these options for all subsequent output primitives until another value is provided.
662
- # The scale options are used to transform points from an abstract logarithmic or
663
- # semi-logarithmic coordinate system, which may be flipped along each axis, into the
664
- # world coordinate system.
665
- # Note: When applying a logarithmic transformation to a specific axis, the system
666
- # assumes that the axes limits are greater than zero.
667
- def setscale(*)
668
- super
669
- end
670
-
671
- # inqscale
672
- def inqscale
673
- inquiry_int { |pt| super(pt) }
674
- end
675
-
676
650
  # `setwindow` establishes a window, or rectangular subspace, of world coordinates to be
677
651
  # plotted. If you desire log scaling or mirror-imaging of axes, use the SETSCALE function.
678
652
  # @param xmin [Numeric] The left horizontal coordinate of the window (`xmin` < `xmax`).
@@ -819,6 +793,39 @@ module GR
819
793
  end
820
794
  end
821
795
 
796
+ # `setscale` sets the type of transformation to be used for subsequent GR output
797
+ # primitives.
798
+ # @param options [Integer] Scale specification
799
+ # * 1 : OPTION_X_LOG
800
+ # * Logarithmic X-axis
801
+ # * 2 : OPTION_Y_LOG
802
+ # * Logarithmic Y-axis
803
+ # * 4 : OPTION_Z_LOG
804
+ # * Logarithmic Z-axis
805
+ # * 8 : OPTION_FLIP_X
806
+ # * Flip X-axis
807
+ # * 16 : OPTION_FLIP_Y
808
+ # * Flip Y-axis
809
+ # * 32 : OPTION_FLIP_Z
810
+ # * Flip Z-axis
811
+ # @return [Integer]
812
+ # `setscale` defines the current transformation according to the given scale
813
+ # specification which may be or'ed together using any of the above options. GR uses
814
+ # these options for all subsequent output primitives until another value is provided.
815
+ # The scale options are used to transform points from an abstract logarithmic or
816
+ # semi-logarithmic coordinate system, which may be flipped along each axis, into the
817
+ # world coordinate system.
818
+ # Note: When applying a logarithmic transformation to a specific axis, the system
819
+ # assumes that the axes limits are greater than zero.
820
+ def setscale(*)
821
+ super
822
+ end
823
+
824
+ # inqscale
825
+ def inqscale
826
+ inquiry_int { |pt| super(pt) }
827
+ end
828
+
822
829
  # Draw a text at position `x`, `y` using the current text attributes. Strings can be
823
830
  # defined to create basic mathematical expressions and Greek letters.
824
831
  # @param x [Numeric] The X coordinate of starting position of the text string
@@ -906,6 +913,10 @@ module GR
906
913
 
907
914
  alias axes2d axes
908
915
 
916
+ def axeslbl(*)
917
+ super
918
+ end
919
+
909
920
  # Draw a linear and/or logarithmic grid.
910
921
  # @param x_tick [Numeric] The length in world coordinates of the interval between minor grid lines.
911
922
  # @param y_tick [Numeric] The length in world coordinates of the interval between minor grid lines.
@@ -954,9 +965,9 @@ module GR
954
965
  # @param y [Array, NArray] A list of length N containing the Y coordinates
955
966
  # @param e1 [Array, NArray] The absolute values of the lower error bar data
956
967
  # @param e2 [Array, NArray] The absolute values of the lower error bar data
957
- def verrorbars(px, py, e1, e2)
958
- n = equal_length(px, py, e1, e2)
959
- super(n, px, py, e1, e2)
968
+ def verrorbars(x, y, e1, e2)
969
+ n = equal_length(x, y, e1, e2)
970
+ super(n, x, y, e1, e2)
960
971
  end
961
972
 
962
973
  # Draw a standard horizontal error bar graph.
@@ -964,9 +975,9 @@ module GR
964
975
  # @param y [Array, NArray] A list of length N containing the Y coordinates
965
976
  # @param e1 [Array, NArray] The absolute values of the lower error bar data
966
977
  # @param e2 [Array, NArray] The absolute values of the lower error bar data
967
- def herrorbars(px, py, e1, e2)
968
- n = equal_length(px, py, e1, e2)
969
- super(n, px, py, e1, e2)
978
+ def herrorbars(x, y, e1, e2)
979
+ n = equal_length(x, y, e1, e2)
980
+ super(n, x, y, e1, e2)
970
981
  end
971
982
 
972
983
  # Draw a 3D curve using the current line attributes,
@@ -977,9 +988,9 @@ module GR
977
988
  # The values for `x`, `y` and `z` are in world coordinates. The attributes that
978
989
  # control the appearance of a polyline are linetype, linewidth and color
979
990
  # index.
980
- def polyline3d(px, py, pz)
981
- n = equal_length(px, py, pz)
982
- super(n, px, py, pz)
991
+ def polyline3d(x, y, z)
992
+ n = equal_length(x, y, z)
993
+ super(n, x, y, z)
983
994
  end
984
995
 
985
996
  # Draw marker symbols centered at the given 3D data points.
@@ -989,9 +1000,9 @@ module GR
989
1000
  # The values for `x`, `y` and `z` are in world coordinates. The attributes
990
1001
  # that control the appearance of a polymarker are marker type, marker size
991
1002
  # scale factor and color index.
992
- def polymarker3d(px, py, pz)
993
- n = equal_length(px, py, pz)
994
- super(n, px, py, pz)
1003
+ def polymarker3d(x, y, z)
1004
+ n = equal_length(x, y, z)
1005
+ super(n, x, y, z)
995
1006
  end
996
1007
 
997
1008
  # Draw X, Y and Z coordinate axes with linearly and/or logarithmically
@@ -1061,11 +1072,11 @@ module GR
1061
1072
  # `x` and `y` define a grid. `z` is a singly dimensioned array containing at least
1062
1073
  # `nx` * `ny` data points. Z describes the surface height at each point on the grid.
1063
1074
  # Data is ordered as shown in the table:
1064
- def surface(px, py, pz, option)
1075
+ def surface(x, y, z, option)
1065
1076
  # TODO: check: Arrays have incorrect length or dimension.
1066
- nx = px.length
1067
- ny = py.length
1068
- super(nx, ny, px, py, pz, option)
1077
+ nx = x.length
1078
+ ny = y.length
1079
+ super(nx, ny, x, y, z, option)
1069
1080
  end
1070
1081
 
1071
1082
  # Draw contours of a three-dimensional data set
@@ -1083,12 +1094,12 @@ module GR
1083
1094
  # every third line. A value of 1 will label every line. A value of 0
1084
1095
  # produces no labels. To produce colored contour lines, add an offset
1085
1096
  # of 1000 to `major_h`.
1086
- def contour(px, py, h, pz, major_h)
1097
+ def contour(x, y, h, z, major_h)
1087
1098
  # TODO: check: Arrays have incorrect length or dimension.
1088
- nx = px.length
1089
- ny = py.length
1099
+ nx = x.length
1100
+ ny = y.length
1090
1101
  nh = h.length
1091
- super(nx, ny, nh, px, py, h, pz, major_h)
1102
+ super(nx, ny, nh, x, y, h, z, major_h)
1092
1103
  end
1093
1104
 
1094
1105
  # Draw filled contours of a three-dimensional data set
@@ -1102,12 +1113,12 @@ module GR
1102
1113
  # @param z [Array, NArray]
1103
1114
  # A list of length `len(x)` * `len(y)` or an appropriately dimensioned
1104
1115
  # array containing the Z coordinates
1105
- def contourf(px, py, h, pz, major_h)
1116
+ def contourf(x, y, h, z, major_h)
1106
1117
  # TODO: check: Arrays have incorrect length or dimension.
1107
- nx = px.length
1108
- ny = py.length
1118
+ nx = x.length
1119
+ ny = y.length
1109
1120
  nh = h.length
1110
- super(nx, ny, nh, px, py, h, pz, major_h)
1121
+ super(nx, ny, nh, x, y, h, z, major_h)
1111
1122
  end
1112
1123
 
1113
1124
  # Draw a contour plot for the given triangle mesh.
@@ -1136,9 +1147,9 @@ module GR
1136
1147
  def setcolormapfromrgb(r, g, b, positions: nil)
1137
1148
  n = equal_length(r, g, b)
1138
1149
  if positions.nil?
1139
- positions = ::FFI::Pointer::NULL
1140
- else
1141
- raise if positions.length != n
1150
+ positions = Fiddle::NULL
1151
+ elsif positions.length != n
1152
+ raise
1142
1153
  end
1143
1154
  super(n, r, g, b, positions)
1144
1155
  end
@@ -1386,11 +1397,13 @@ module GR
1386
1397
 
1387
1398
  # @return [Integer]
1388
1399
  def readimage(path)
1389
- w, h, d = inquiry [:int, :int, :pointer] do |width, height, data|
1400
+ data = Fiddle::Pointer.malloc(Fiddle::SIZEOF_INTPTR_T)
1401
+ w, h = inquiry [:int, :int] do |width, height|
1390
1402
  # data is a pointer of a pointer
1391
- super(path, width, height, data)
1403
+ super(path, width, height, data.ref)
1392
1404
  end
1393
- [w, h, d.read_array_of_uint(w * h)]
1405
+ d = data.to_str(w * h * 8).unpack('L*') # UINT8
1406
+ [w, h, d]
1394
1407
  end
1395
1408
 
1396
1409
  # Draw an image into a given rectangular area.
@@ -1464,7 +1477,7 @@ module GR
1464
1477
 
1465
1478
  # @return [String]
1466
1479
  def getgraphics(*)
1467
- super
1480
+ super.to_s
1468
1481
  end
1469
1482
 
1470
1483
  # @return [Integer]
@@ -1558,9 +1571,9 @@ module GR
1558
1571
  # @param x [Array, NArray] A list containing the X coordinates
1559
1572
  # @param y [Array, NArray] A list containing the Y coordinates
1560
1573
  # @param z [Array, NArray] A list containing the Z coordinates
1561
- def trisurface(px, py, pz)
1562
- n = [px, py, pz].map(&:length).min
1563
- super(n, px, py, pz)
1574
+ def trisurface(x, y, z)
1575
+ n = [x, y, z].map(&:length).min
1576
+ super(n, x, y, z)
1564
1577
  end
1565
1578
 
1566
1579
  # @deprecated
@@ -1625,7 +1638,11 @@ module GR
1625
1638
  # Returns the combined version strings of the GR runtime.
1626
1639
  # @return [String]
1627
1640
  def version
1628
- super.read_string
1641
+ super.to_s
1642
+ end
1643
+
1644
+ def shade(*)
1645
+ super
1629
1646
  end
1630
1647
 
1631
1648
  # Display a point set as a aggregated and rasterized image.
@@ -1740,206 +1757,236 @@ module GR
1740
1757
  super(resample_method)
1741
1758
  end
1742
1759
  end
1760
+
1761
+ # Draw paths using given vertices and path codes.
1762
+ # @param x [Array, NArray] A list containing the X coordinates
1763
+ # @param y [Array, NArray] A list containing the Y coordinates
1764
+ # @param codes [String] Path codes
1765
+ # The following path codes are recognized:
1766
+ # * M, m
1767
+ # * moveto x, y
1768
+ # * L, l
1769
+ # * lineto x, y
1770
+ # * Q, q
1771
+ # * quadratic Bézier x1, y1 x2, y2
1772
+ # * C, c
1773
+ # * cubic Bézier x1, y1 x2, y2 x3, y3
1774
+ # * R, r
1775
+ # * rectangle w, h
1776
+ # * A, a
1777
+ # * arc w, h a1, a2
1778
+ # * Z
1779
+ # * closepath -
1780
+ # * s
1781
+ # * stroke -
1782
+ # * f
1783
+ # * fill -
1784
+ # The values for `x` and `y` are in normalized device coordinates.
1785
+ # The `codes` describe several patch primitives that can be used to create compound paths.
1786
+ def path(x, y, codes)
1787
+ n = equal_length(x, y)
1788
+ super(n, x, y, codes)
1789
+ end
1743
1790
  end
1744
1791
 
1745
- ASF_BUNDLED = 0
1792
+ ASF_BUNDLED = 0
1746
1793
  ASF_INDIVIDUAL = 1
1747
1794
 
1748
1795
  NOCLIP = 0
1749
- CLIP = 1
1796
+ CLIP = 1
1750
1797
 
1751
- COORDINATES_WC = 0
1798
+ COORDINATES_WC = 0
1752
1799
  COORDINATES_NDC = 1
1753
1800
 
1754
- INTSTYLE_HOLLOW = 0
1755
- INTSTYLE_SOLID = 1
1801
+ INTSTYLE_HOLLOW = 0
1802
+ INTSTYLE_SOLID = 1
1756
1803
  INTSTYLE_PATTERN = 2
1757
- INTSTYLE_HATCH = 3
1804
+ INTSTYLE_HATCH = 3
1758
1805
 
1759
1806
  TEXT_HALIGN_NORMAL = 0
1760
- TEXT_HALIGN_LEFT = 1
1807
+ TEXT_HALIGN_LEFT = 1
1761
1808
  TEXT_HALIGN_CENTER = 2
1762
- TEXT_HALIGN_RIGHT = 3
1809
+ TEXT_HALIGN_RIGHT = 3
1763
1810
  TEXT_VALIGN_NORMAL = 0
1764
- TEXT_VALIGN_TOP = 1
1765
- TEXT_VALIGN_CAP = 2
1766
- TEXT_VALIGN_HALF = 3
1767
- TEXT_VALIGN_BASE = 4
1811
+ TEXT_VALIGN_TOP = 1
1812
+ TEXT_VALIGN_CAP = 2
1813
+ TEXT_VALIGN_HALF = 3
1814
+ TEXT_VALIGN_BASE = 4
1768
1815
  TEXT_VALIGN_BOTTOM = 5
1769
1816
 
1770
1817
  TEXT_PATH_RIGHT = 0
1771
- TEXT_PATH_LEFT = 1
1772
- TEXT_PATH_UP = 2
1773
- TEXT_PATH_DOWN = 3
1818
+ TEXT_PATH_LEFT = 1
1819
+ TEXT_PATH_UP = 2
1820
+ TEXT_PATH_DOWN = 3
1774
1821
 
1775
1822
  TEXT_PRECISION_STRING = 0
1776
- TEXT_PRECISION_CHAR = 1
1823
+ TEXT_PRECISION_CHAR = 1
1777
1824
  TEXT_PRECISION_STROKE = 2
1778
1825
 
1779
- LINETYPE_SOLID = 1
1780
- LINETYPE_DASHED = 2
1781
- LINETYPE_DOTTED = 3
1782
- LINETYPE_DASHED_DOTTED = 4
1783
- LINETYPE_DASH_2_DOT = -1
1784
- LINETYPE_DASH_3_DOT = -2
1785
- LINETYPE_LONG_DASH = -3
1826
+ LINETYPE_SOLID = 1
1827
+ LINETYPE_DASHED = 2
1828
+ LINETYPE_DOTTED = 3
1829
+ LINETYPE_DASHED_DOTTED = 4
1830
+ LINETYPE_DASH_2_DOT = -1
1831
+ LINETYPE_DASH_3_DOT = -2
1832
+ LINETYPE_LONG_DASH = -3
1786
1833
  LINETYPE_LONG_SHORT_DASH = -4
1787
- LINETYPE_SPACED_DASH = -5
1788
- LINETYPE_SPACED_DOT = -6
1789
- LINETYPE_DOUBLE_DOT = -7
1790
- LINETYPE_TRIPLE_DOT = -8
1791
-
1792
- MARKERTYPE_DOT = 1
1793
- MARKERTYPE_PLUS = 2
1794
- MARKERTYPE_ASTERISK = 3
1795
- MARKERTYPE_CIRCLE = 4
1796
- MARKERTYPE_DIAGONAL_CROSS = 5
1797
- MARKERTYPE_SOLID_CIRCLE = -1
1798
- MARKERTYPE_TRIANGLE_UP = -2
1799
- MARKERTYPE_SOLID_TRI_UP = -3
1800
- MARKERTYPE_TRIANGLE_DOWN = -4
1801
- MARKERTYPE_SOLID_TRI_DOWN = -5
1802
- MARKERTYPE_SQUARE = -6
1803
- MARKERTYPE_SOLID_SQUARE = -7
1804
- MARKERTYPE_BOWTIE = -8
1805
- MARKERTYPE_SOLID_BOWTIE = -9
1806
- MARKERTYPE_HOURGLASS = -10
1807
- MARKERTYPE_SOLID_HGLASS = -11
1808
- MARKERTYPE_DIAMOND = -12
1809
- MARKERTYPE_SOLID_DIAMOND = -13
1810
- MARKERTYPE_STAR = -14
1811
- MARKERTYPE_SOLID_STAR = -15
1812
- MARKERTYPE_TRI_UP_DOWN = -16
1834
+ LINETYPE_SPACED_DASH = -5
1835
+ LINETYPE_SPACED_DOT = -6
1836
+ LINETYPE_DOUBLE_DOT = -7
1837
+ LINETYPE_TRIPLE_DOT = -8
1838
+
1839
+ MARKERTYPE_DOT = 1
1840
+ MARKERTYPE_PLUS = 2
1841
+ MARKERTYPE_ASTERISK = 3
1842
+ MARKERTYPE_CIRCLE = 4
1843
+ MARKERTYPE_DIAGONAL_CROSS = 5
1844
+ MARKERTYPE_SOLID_CIRCLE = -1
1845
+ MARKERTYPE_TRIANGLE_UP = -2
1846
+ MARKERTYPE_SOLID_TRI_UP = -3
1847
+ MARKERTYPE_TRIANGLE_DOWN = -4
1848
+ MARKERTYPE_SOLID_TRI_DOWN = -5
1849
+ MARKERTYPE_SQUARE = -6
1850
+ MARKERTYPE_SOLID_SQUARE = -7
1851
+ MARKERTYPE_BOWTIE = -8
1852
+ MARKERTYPE_SOLID_BOWTIE = -9
1853
+ MARKERTYPE_HOURGLASS = -10
1854
+ MARKERTYPE_SOLID_HGLASS = -11
1855
+ MARKERTYPE_DIAMOND = -12
1856
+ MARKERTYPE_SOLID_DIAMOND = -13
1857
+ MARKERTYPE_STAR = -14
1858
+ MARKERTYPE_SOLID_STAR = -15
1859
+ MARKERTYPE_TRI_UP_DOWN = -16
1813
1860
  MARKERTYPE_SOLID_TRI_RIGHT = -17
1814
- MARKERTYPE_SOLID_TRI_LEFT = -18
1815
- MARKERTYPE_HOLLOW_PLUS = -19
1816
- MARKERTYPE_SOLID_PLUS = -20
1817
- MARKERTYPE_PENTAGON = -21
1818
- MARKERTYPE_HEXAGON = -22
1819
- MARKERTYPE_HEPTAGON = -23
1820
- MARKERTYPE_OCTAGON = -24
1821
- MARKERTYPE_STAR_4 = -25
1822
- MARKERTYPE_STAR_5 = -26
1823
- MARKERTYPE_STAR_6 = -27
1824
- MARKERTYPE_STAR_7 = -28
1825
- MARKERTYPE_STAR_8 = -29
1826
- MARKERTYPE_VLINE = -30
1827
- MARKERTYPE_HLINE = -31
1828
- MARKERTYPE_OMARK = -32
1829
-
1830
- OPTION_X_LOG = 1
1831
- OPTION_Y_LOG = 2
1832
- OPTION_Z_LOG = 4
1833
- OPTION_FLIP_X = 8
1861
+ MARKERTYPE_SOLID_TRI_LEFT = -18
1862
+ MARKERTYPE_HOLLOW_PLUS = -19
1863
+ MARKERTYPE_SOLID_PLUS = -20
1864
+ MARKERTYPE_PENTAGON = -21
1865
+ MARKERTYPE_HEXAGON = -22
1866
+ MARKERTYPE_HEPTAGON = -23
1867
+ MARKERTYPE_OCTAGON = -24
1868
+ MARKERTYPE_STAR_4 = -25
1869
+ MARKERTYPE_STAR_5 = -26
1870
+ MARKERTYPE_STAR_6 = -27
1871
+ MARKERTYPE_STAR_7 = -28
1872
+ MARKERTYPE_STAR_8 = -29
1873
+ MARKERTYPE_VLINE = -30
1874
+ MARKERTYPE_HLINE = -31
1875
+ MARKERTYPE_OMARK = -32
1876
+
1877
+ OPTION_X_LOG = 1
1878
+ OPTION_Y_LOG = 2
1879
+ OPTION_Z_LOG = 4
1880
+ OPTION_FLIP_X = 8
1834
1881
  OPTION_FLIP_Y = 16
1835
1882
  OPTION_FLIP_Z = 32
1836
1883
 
1837
- OPTION_LINES = 0
1838
- OPTION_MESH = 1
1839
- OPTION_FILLED_MESH = 2
1884
+ OPTION_LINES = 0
1885
+ OPTION_MESH = 1
1886
+ OPTION_FILLED_MESH = 2
1840
1887
  OPTION_Z_SHADED_MESH = 3
1841
- OPTION_COLORED_MESH = 4
1842
- OPTION_CELL_ARRAY = 5
1843
- OPTION_SHADED_MESH = 6
1888
+ OPTION_COLORED_MESH = 4
1889
+ OPTION_CELL_ARRAY = 5
1890
+ OPTION_SHADED_MESH = 6
1844
1891
 
1845
1892
  MODEL_RGB = 0
1846
1893
  MODEL_HSV = 1
1847
1894
 
1848
- COLORMAP_UNIFORM = 0
1849
- COLORMAP_TEMPERATURE = 1
1850
- COLORMAP_GRAYSCALE = 2
1851
- COLORMAP_GLOWING = 3
1852
- COLORMAP_RAINBOWLIKE = 4
1853
- COLORMAP_GEOLOGIC = 5
1854
- COLORMAP_GREENSCALE = 6
1855
- COLORMAP_CYANSCALE = 7
1856
- COLORMAP_BLUESCALE = 8
1857
- COLORMAP_MAGENTASCALE = 9
1858
- COLORMAP_REDSCALE = 10
1859
- COLORMAP_FLAME = 11
1860
- COLORMAP_BROWNSCALE = 12
1861
- COLORMAP_PILATUS = 13
1862
- COLORMAP_AUTUMN = 14
1863
- COLORMAP_BONE = 15
1864
- COLORMAP_COOL = 16
1865
- COLORMAP_COPPER = 17
1866
- COLORMAP_GRAY = 18
1867
- COLORMAP_HOT = 19
1868
- COLORMAP_HSV = 20
1869
- COLORMAP_JET = 21
1870
- COLORMAP_PINK = 22
1871
- COLORMAP_SPECTRAL = 23
1872
- COLORMAP_SPRING = 24
1873
- COLORMAP_SUMMER = 25
1874
- COLORMAP_WINTER = 26
1875
- COLORMAP_GIST_EARTH = 27
1876
- COLORMAP_GIST_HEAT = 28
1877
- COLORMAP_GIST_NCAR = 29
1895
+ COLORMAP_UNIFORM = 0
1896
+ COLORMAP_TEMPERATURE = 1
1897
+ COLORMAP_GRAYSCALE = 2
1898
+ COLORMAP_GLOWING = 3
1899
+ COLORMAP_RAINBOWLIKE = 4
1900
+ COLORMAP_GEOLOGIC = 5
1901
+ COLORMAP_GREENSCALE = 6
1902
+ COLORMAP_CYANSCALE = 7
1903
+ COLORMAP_BLUESCALE = 8
1904
+ COLORMAP_MAGENTASCALE = 9
1905
+ COLORMAP_REDSCALE = 10
1906
+ COLORMAP_FLAME = 11
1907
+ COLORMAP_BROWNSCALE = 12
1908
+ COLORMAP_PILATUS = 13
1909
+ COLORMAP_AUTUMN = 14
1910
+ COLORMAP_BONE = 15
1911
+ COLORMAP_COOL = 16
1912
+ COLORMAP_COPPER = 17
1913
+ COLORMAP_GRAY = 18
1914
+ COLORMAP_HOT = 19
1915
+ COLORMAP_HSV = 20
1916
+ COLORMAP_JET = 21
1917
+ COLORMAP_PINK = 22
1918
+ COLORMAP_SPECTRAL = 23
1919
+ COLORMAP_SPRING = 24
1920
+ COLORMAP_SUMMER = 25
1921
+ COLORMAP_WINTER = 26
1922
+ COLORMAP_GIST_EARTH = 27
1923
+ COLORMAP_GIST_HEAT = 28
1924
+ COLORMAP_GIST_NCAR = 29
1878
1925
  COLORMAP_GIST_RAINBOW = 30
1879
- COLORMAP_GIST_STERN = 31
1880
- COLORMAP_AFMHOT = 32
1881
- COLORMAP_BRG = 33
1882
- COLORMAP_BWR = 34
1883
- COLORMAP_COOLWARM = 35
1884
- COLORMAP_CMRMAP = 36
1885
- COLORMAP_CUBEHELIX = 37
1886
- COLORMAP_GNUPLOT = 38
1887
- COLORMAP_GNUPLOT2 = 39
1888
- COLORMAP_OCEAN = 40
1889
- COLORMAP_RAINBOW = 41
1890
- COLORMAP_SEISMIC = 42
1891
- COLORMAP_TERRAIN = 43
1892
- COLORMAP_VIRIDIS = 44
1893
- COLORMAP_INFERNO = 45
1894
- COLORMAP_PLASMA = 46
1895
- COLORMAP_MAGMA = 47
1896
-
1897
- FONT_TIMES_ROMAN = 101
1898
- FONT_TIMES_ITALIC = 102
1899
- FONT_TIMES_BOLD = 103
1900
- FONT_TIMES_BOLDITALIC = 104
1901
- FONT_HELVETICA = 105
1902
- FONT_HELVETICA_OBLIQUE = 106
1903
- FONT_HELVETICA_BOLD = 107
1904
- FONT_HELVETICA_BOLDOBLIQUE = 108
1905
- FONT_COURIER = 109
1906
- FONT_COURIER_OBLIQUE = 110
1907
- FONT_COURIER_BOLD = 111
1908
- FONT_COURIER_BOLDOBLIQUE = 112
1909
- FONT_SYMBOL = 113
1910
- FONT_BOOKMAN_LIGHT = 114
1911
- FONT_BOOKMAN_LIGHTITALIC = 115
1912
- FONT_BOOKMAN_DEMI = 116
1913
- FONT_BOOKMAN_DEMIITALIC = 117
1914
- FONT_NEWCENTURYSCHLBK_ROMAN = 118
1915
- FONT_NEWCENTURYSCHLBK_ITALIC = 119
1916
- FONT_NEWCENTURYSCHLBK_BOLD = 120
1926
+ COLORMAP_GIST_STERN = 31
1927
+ COLORMAP_AFMHOT = 32
1928
+ COLORMAP_BRG = 33
1929
+ COLORMAP_BWR = 34
1930
+ COLORMAP_COOLWARM = 35
1931
+ COLORMAP_CMRMAP = 36
1932
+ COLORMAP_CUBEHELIX = 37
1933
+ COLORMAP_GNUPLOT = 38
1934
+ COLORMAP_GNUPLOT2 = 39
1935
+ COLORMAP_OCEAN = 40
1936
+ COLORMAP_RAINBOW = 41
1937
+ COLORMAP_SEISMIC = 42
1938
+ COLORMAP_TERRAIN = 43
1939
+ COLORMAP_VIRIDIS = 44
1940
+ COLORMAP_INFERNO = 45
1941
+ COLORMAP_PLASMA = 46
1942
+ COLORMAP_MAGMA = 47
1943
+
1944
+ FONT_TIMES_ROMAN = 101
1945
+ FONT_TIMES_ITALIC = 102
1946
+ FONT_TIMES_BOLD = 103
1947
+ FONT_TIMES_BOLDITALIC = 104
1948
+ FONT_HELVETICA = 105
1949
+ FONT_HELVETICA_OBLIQUE = 106
1950
+ FONT_HELVETICA_BOLD = 107
1951
+ FONT_HELVETICA_BOLDOBLIQUE = 108
1952
+ FONT_COURIER = 109
1953
+ FONT_COURIER_OBLIQUE = 110
1954
+ FONT_COURIER_BOLD = 111
1955
+ FONT_COURIER_BOLDOBLIQUE = 112
1956
+ FONT_SYMBOL = 113
1957
+ FONT_BOOKMAN_LIGHT = 114
1958
+ FONT_BOOKMAN_LIGHTITALIC = 115
1959
+ FONT_BOOKMAN_DEMI = 116
1960
+ FONT_BOOKMAN_DEMIITALIC = 117
1961
+ FONT_NEWCENTURYSCHLBK_ROMAN = 118
1962
+ FONT_NEWCENTURYSCHLBK_ITALIC = 119
1963
+ FONT_NEWCENTURYSCHLBK_BOLD = 120
1917
1964
  FONT_NEWCENTURYSCHLBK_BOLDITALIC = 121
1918
- FONT_AVANTGARDE_BOOK = 122
1919
- FONT_AVANTGARDE_BOOKOBLIQUE = 123
1920
- FONT_AVANTGARDE_DEMI = 124
1921
- FONT_AVANTGARDE_DEMIOBLIQUE = 125
1922
- FONT_PALATINO_ROMAN = 126
1923
- FONT_PALATINO_ITALIC = 127
1924
- FONT_PALATINO_BOLD = 128
1925
- FONT_PALATINO_BOLDITALIC = 129
1926
- FONT_ZAPFCHANCERY_MEDIUMITALIC = 130
1927
- FONT_ZAPFDINGBATS = 131
1965
+ FONT_AVANTGARDE_BOOK = 122
1966
+ FONT_AVANTGARDE_BOOKOBLIQUE = 123
1967
+ FONT_AVANTGARDE_DEMI = 124
1968
+ FONT_AVANTGARDE_DEMIOBLIQUE = 125
1969
+ FONT_PALATINO_ROMAN = 126
1970
+ FONT_PALATINO_ITALIC = 127
1971
+ FONT_PALATINO_BOLD = 128
1972
+ FONT_PALATINO_BOLDITALIC = 129
1973
+ FONT_ZAPFCHANCERY_MEDIUMITALIC = 130
1974
+ FONT_ZAPFDINGBATS = 131
1928
1975
 
1929
1976
  # GR.beginprint types
1930
- PRINT_PS = 'ps'
1931
- PRINT_EPS = 'eps'
1932
- PRINT_PDF = 'pdf'
1933
- PRINT_PGF = 'pgf'
1934
- PRINT_BMP = 'bmp'
1977
+ PRINT_PS = 'ps'
1978
+ PRINT_EPS = 'eps'
1979
+ PRINT_PDF = 'pdf'
1980
+ PRINT_PGF = 'pgf'
1981
+ PRINT_BMP = 'bmp'
1935
1982
  PRINT_JPEG = 'jpeg'
1936
- PRINT_JPG = 'jpg'
1937
- PRINT_PNG = 'png'
1983
+ PRINT_JPG = 'jpg'
1984
+ PRINT_PNG = 'png'
1938
1985
  PRINT_TIFF = 'tiff'
1939
- PRINT_TIF = 'tif'
1940
- PRINT_FIG = 'fig'
1941
- PRINT_SVG = 'svg'
1942
- PRINT_WMF = 'wmf'
1986
+ PRINT_TIF = 'tif'
1987
+ PRINT_FIG = 'fig'
1988
+ PRINT_SVG = 'svg'
1989
+ PRINT_WMF = 'wmf'
1943
1990
 
1944
1991
  PATH_STOP = 0x00
1945
1992
  PATH_MOVETO = 0x01
@@ -1948,30 +1995,30 @@ module GR
1948
1995
  PATH_CURVE4 = 0x04
1949
1996
  PATH_CLOSEPOLY = 0x4f
1950
1997
 
1951
- MPL_SUPPRESS_CLEAR = 1
1998
+ MPL_SUPPRESS_CLEAR = 1
1952
1999
  MPL_POSTPONE_UPDATE = 2
1953
2000
 
1954
- XFORM_BOOLEAN = 0
1955
- XFORM_LINEAR = 1
1956
- XFORM_LOG = 2
1957
- XFORM_LOGLOG = 3
1958
- XFORM_CUBIC = 4
2001
+ XFORM_BOOLEAN = 0
2002
+ XFORM_LINEAR = 1
2003
+ XFORM_LOG = 2
2004
+ XFORM_LOGLOG = 3
2005
+ XFORM_CUBIC = 4
1959
2006
  XFORM_EQUALIZED = 5
1960
2007
 
1961
- UPSAMPLE_VERTICAL_DEFAULT = 0x00000000
1962
- UPSAMPLE_HORIZONTAL_DEFAULT = 0x00000000
1963
- DOWNSAMPLE_VERTICAL_DEFAULT = 0x00000000
2008
+ UPSAMPLE_VERTICAL_DEFAULT = 0x00000000
2009
+ UPSAMPLE_HORIZONTAL_DEFAULT = 0x00000000
2010
+ DOWNSAMPLE_VERTICAL_DEFAULT = 0x00000000
1964
2011
  DOWNSAMPLE_HORIZONTAL_DEFAULT = 0x00000000
1965
- UPSAMPLE_VERTICAL_NEAREST = 0x00000001
1966
- UPSAMPLE_HORIZONTAL_NEAREST = 0x00000100
1967
- DOWNSAMPLE_VERTICAL_NEAREST = 0x00010000
2012
+ UPSAMPLE_VERTICAL_NEAREST = 0x00000001
2013
+ UPSAMPLE_HORIZONTAL_NEAREST = 0x00000100
2014
+ DOWNSAMPLE_VERTICAL_NEAREST = 0x00010000
1968
2015
  DOWNSAMPLE_HORIZONTAL_NEAREST = 0x01000000
1969
- UPSAMPLE_VERTICAL_LINEAR = 0x00000002
1970
- UPSAMPLE_HORIZONTAL_LINEAR = 0x00000200
1971
- DOWNSAMPLE_VERTICAL_LINEAR = 0x00020000
1972
- DOWNSAMPLE_HORIZONTAL_LINEAR = 0x02000000
1973
- UPSAMPLE_VERTICAL_LANCZOS = 0x00000003
1974
- UPSAMPLE_HORIZONTAL_LANCZOS = 0x00000300
1975
- DOWNSAMPLE_VERTICAL_LANCZOS = 0x00030000
2016
+ UPSAMPLE_VERTICAL_LINEAR = 0x00000002
2017
+ UPSAMPLE_HORIZONTAL_LINEAR = 0x00000200
2018
+ DOWNSAMPLE_VERTICAL_LINEAR = 0x00020000
2019
+ DOWNSAMPLE_HORIZONTAL_LINEAR = 0x02000000
2020
+ UPSAMPLE_VERTICAL_LANCZOS = 0x00000003
2021
+ UPSAMPLE_HORIZONTAL_LANCZOS = 0x00000300
2022
+ DOWNSAMPLE_VERTICAL_LANCZOS = 0x00030000
1976
2023
  DOWNSAMPLE_HORIZONTAL_LANCZOS = 0x03000000
1977
2024
  end