processing 0.5.30 → 0.5.31

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: ca6d65b8e9bd003c16fabbf550a70f20f0adf70ea623d1abe01ec1b967b88fa0
4
- data.tar.gz: e4f689b826f7854a4da0bf9b52c6368c27ef02179ae98e15e0995b452eafc096
3
+ metadata.gz: f74daae97a7e307834facbc6eb147a08dbdc731afdb738674161db47eccd04ef
4
+ data.tar.gz: 41324b1b967f4e3e5c11392ecf1a36beb82f9bbd4a2bb97dbc6d297b572bbe16
5
5
  SHA512:
6
- metadata.gz: f74584e4c313f4c95ce326ccadd8fa20e59dba80a2b4598f083c7dd5f2041950b8f3d69f0ca34c7fc3021d5b704f26170879587d19d375bb499e244577d529e3
7
- data.tar.gz: a38786a6783135f58ffd9a81edf929f5ba8d020dbd12fc06faa85cc6d36dc95c682249cccea600a823faee81e03b86eb3ffff2ca766704a520f867294cf51ae8
6
+ metadata.gz: dace99fcdae4a94a38942d40327fe0e27251e4ea0cb5ba1c1b19683c45a92690124449b61fd47980389730350e8ccda180076e29cf99678a03a2a8408d0be03e
7
+ data.tar.gz: a60cd201501e210f71ef6c163e0493877e6aed90ecae82c344d6f3e62238fa6091e3d1a17755098a3b7722b56f812fa6aa4ca1aa78de02560264f2fa30c41003
@@ -4,7 +4,6 @@ on:
4
4
  push:
5
5
  branches: [master]
6
6
  pull_request:
7
- branches: [master]
8
7
 
9
8
  jobs:
10
9
  test:
@@ -4,7 +4,6 @@ on:
4
4
  push:
5
5
  branches: [master]
6
6
  pull_request:
7
- branches: [master]
8
7
 
9
8
  jobs:
10
9
  test:
data/ChangeLog.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # processing ChangeLog
2
2
 
3
3
 
4
+ ## [v0.5.31] - 2023-12-09
5
+
6
+ - Add Shape class
7
+ - Add createShape(), shape(), shapeMode()
8
+ - Add beginShape(), endShape(), and vertex(x, y)
9
+ - Test with p5.rb
10
+ - GraphicsContext#rotate() can take z parameter
11
+ - Set default miter_limit to 10
12
+ - Trigger github actions on all pull_request
13
+
14
+
4
15
  ## [v0.5.30] - 2023-11-09
5
16
 
6
17
  - Test drawing methods with p5.rb
data/Rakefile CHANGED
@@ -14,12 +14,16 @@ require 'reflex/extension'
14
14
  require 'processing/extension'
15
15
 
16
16
 
17
- EXTENSIONS = [Xot, Rucy, Rays, Reflex, Processing]
18
- DRAW_TESTS = Dir.glob('test/draw/test_*.rb')
19
- TESTS_EXCLUDE = DRAW_TESTS
17
+ def test_with_p5()
18
+ ENV['TEST_WITH_P5'] = '1'
19
+ end
20
+
21
+ EXTENSIONS = [Xot, Rucy, Rays, Reflex, Processing]
20
22
 
21
23
  ENV['RDOC'] = 'yardoc --no-private'
22
24
 
25
+ #test_with_p5 if ci?
26
+
23
27
  default_tasks
24
28
  use_bundler
25
29
  test_ruby_extension
@@ -30,10 +34,14 @@ task :clean => 'test:clean'
30
34
 
31
35
  namespace :test do
32
36
  task :clean do
33
- sh %( rm -rf test/draw/p5rb )
37
+ sh %( rm -rf test/.png/*.png )
38
+ end
39
+
40
+ task :with_p5 do
41
+ test_with_p5
34
42
  end
35
43
 
36
- task :draw do
37
- sh %( ruby #{DRAW_TESTS.join ' '} )
44
+ ::Rake::TestTask.new :draw do |t|
45
+ t.test_files = FileList['test/test_*.rb']
38
46
  end
39
47
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.30
1
+ 0.5.31
@@ -14,6 +14,7 @@ require 'processing/vector'
14
14
  require 'processing/image'
15
15
  require 'processing/font'
16
16
  require 'processing/touch'
17
+ require 'processing/shape'
17
18
  require 'processing/shader'
18
19
  require 'processing/capture'
19
20
  require 'processing/graphics_context'
@@ -45,15 +45,16 @@ module Processing
45
45
  #
46
46
  DEGREES = :degrees
47
47
 
48
- # Mode for rectMode(), ellipseMode() and imageMode().
48
+ # Mode for rectMode(), ellipseMode(), imageMode(), and shapeMode().
49
49
  #
50
50
  CORNER = :corner
51
51
 
52
- # Mode for rectMode(), ellipseMode() and imageMode().
52
+ # Mode for rectMode(), ellipseMode(), imageMode(), and shapeMode().
53
53
  #
54
54
  CORNERS = :corners
55
55
 
56
- # Mode for rectMode(), ellipseMode(), imageMode() and textAlign().
56
+ # Mode for rectMode(), ellipseMode(), imageMode(), shapeMode(),
57
+ # and textAlign().
57
58
  #
58
59
  CENTER = :center
59
60
 
@@ -140,6 +141,57 @@ module Processing
140
141
  # Filter type for filter()
141
142
  BLUR = :blur
142
143
 
144
+ # Shape mode for createShape()
145
+ LINE = :line
146
+
147
+ # Shape mode for createShape()
148
+ RECT = :rect
149
+
150
+ # Shape mode for createShape()
151
+ ELLIPSE = :ellipse
152
+
153
+ # Shape mode for createShape()
154
+ ARC = :arc
155
+
156
+ # Shape mode for createShape()
157
+ TRIANGLE = :triangle
158
+
159
+ # Shape mode for createShape()
160
+ QUAD = :quad
161
+
162
+ # Shape mode for createShape()
163
+ GROUP = :group
164
+
165
+ # Shape mode for beginShape()
166
+ POINTS = :points
167
+
168
+ # Shape mode for beginShape()
169
+ LINES = :lines
170
+
171
+ # Shape mode for beginShape()
172
+ TRIANGLES = :triangles
173
+
174
+ # Shape mode for beginShape()
175
+ TRIANGLE_FAN = :triangle_fan
176
+
177
+ # Shape mode for beginShape()
178
+ TRIANGLE_STRIP = :triangle_strip
179
+
180
+ # Shape mode for beginShape()
181
+ QUADS = :quads
182
+
183
+ # Shape mode for beginShape()
184
+ QUAD_STRIP = :quad_strip
185
+
186
+ # Shape mode for beginShape()
187
+ TESS = :tess
188
+
189
+ # OPEN flag for endShape()
190
+ OPEN = :open
191
+
192
+ # CLOSE flag for endShape()
193
+ CLOSE = :close
194
+
143
195
  # Key codes.
144
196
  ENTER = :enter
145
197
  SPACE = :space
@@ -206,6 +258,7 @@ module Processing
206
258
  @rectMode__ = nil
207
259
  @ellipseMode__ = nil
208
260
  @imageMode__ = nil
261
+ @shapeMode__ = nil
209
262
  @blendMode__ = nil
210
263
  @textAlignH__ = nil
211
264
  @textAlignV__ = nil
@@ -222,6 +275,7 @@ module Processing
222
275
  rectMode CORNER
223
276
  ellipseMode CENTER
224
277
  imageMode CORNER
278
+ shapeMode CORNER
225
279
  blendMode BLEND
226
280
  strokeCap ROUND
227
281
  strokeJoin MITER
@@ -235,7 +289,9 @@ module Processing
235
289
 
236
290
  # @private
237
291
  def updateCanvas__(image, painter)
238
- @image__, @painter__ = image, painter
292
+ @image__, @painter__ = image, painter
293
+ @painter__.miter_limit = 10
294
+ @painter__.stroke_outset = 0.5
239
295
  end
240
296
 
241
297
  # @private
@@ -434,7 +490,7 @@ module Processing
434
490
  end
435
491
 
436
492
  # @private
437
- def toAngle__(angle)
493
+ def toDegrees__(angle)
438
494
  angle * @angleScale__
439
495
  end
440
496
 
@@ -460,8 +516,8 @@ module Processing
460
516
  #
461
517
  # CORNER -> rect(left, top, width, height)
462
518
  # CORNERS -> rect(left, top, right, bottom)
463
- # CENTER -> rect(center_x, center_y, width, height)
464
- # RADIUS -> rect(center_x, center_y, radius_h, radius_v)
519
+ # CENTER -> rect(centerX, centerY, width, height)
520
+ # RADIUS -> rect(centerX, centerY, radiusH, radiusV)
465
521
  #
466
522
  # @param mode [CORNER, CORNERS, CENTER, RADIUS]
467
523
  #
@@ -475,8 +531,8 @@ module Processing
475
531
  #
476
532
  # CORNER -> ellipse(left, top, width, height)
477
533
  # CORNERS -> ellipse(left, top, right, bottom)
478
- # CENTER -> ellipse(center_x, center_y, width, height)
479
- # RADIUS -> ellipse(center_x, center_y, radius_h, radius_v)
534
+ # CENTER -> ellipse(centerX, centerY, width, height)
535
+ # RADIUS -> ellipse(centerX, centerY, radiusH, radiusV)
480
536
  #
481
537
  # @param mode [CORNER, CORNERS, CENTER, RADIUS]
482
538
  #
@@ -490,7 +546,7 @@ module Processing
490
546
  #
491
547
  # CORNER -> image(img, left, top, width, height)
492
548
  # CORNERS -> image(img, left, top, right, bottom)
493
- # CENTER -> image(img, center_x, center_y, width, height)
549
+ # CENTER -> image(img, centerX, centerY, width, height)
494
550
  #
495
551
  # @param mode [CORNER, CORNERS, CENTER]
496
552
  #
@@ -500,6 +556,20 @@ module Processing
500
556
  @imageMode__ = mode
501
557
  end
502
558
 
559
+ # Sets shape mode. Default is CORNER.
560
+ #
561
+ # CORNER -> shape(shp, left, top, width, height)
562
+ # CORNERS -> shape(shp, left, top, right, bottom)
563
+ # CENTER -> shape(shp, centerX, centerY, width, height)
564
+ #
565
+ # @param mode [CORNER, CORNERS, CENTER]
566
+ #
567
+ # @return [nil] nil
568
+ #
569
+ def shapeMode(mode)
570
+ @shapeMode__ = mode
571
+ end
572
+
503
573
  # @private
504
574
  private def toXYWH__(mode, a, b, c, d)
505
575
  case mode
@@ -924,9 +994,8 @@ module Processing
924
994
  def arc(a, b, c, d, start, stop)
925
995
  assertDrawing__
926
996
  x, y, w, h = toXYWH__ @ellipseMode__, a, b, c, d
927
- start = toAngle__(-start)
928
- stop = toAngle__(-stop)
929
- @painter__.ellipse x, y, w, h, from: start, to: stop
997
+ from, to = toDegrees__(-start), toDegrees__(-stop)
998
+ @painter__.ellipse x, y, w, h, from: from, to: to
930
999
  nil
931
1000
  end
932
1001
 
@@ -1094,6 +1163,98 @@ module Processing
1094
1163
 
1095
1164
  alias drawImage image
1096
1165
 
1166
+ # Draws a shape.
1167
+ #
1168
+ # The parameters a, b, c, and d are determined by shapeMode().
1169
+ #
1170
+ # @overload shape(img, a, b)
1171
+ # @overload shape(img, a, b, c, d)
1172
+ #
1173
+ # @param shp [Shape] shape to draw
1174
+ # @param a [Numeric] horizontal position of the shape, by default
1175
+ # @param b [Numeric] vertical position of the shape, by default
1176
+ # @param c [Numeric] width of the shape, by default
1177
+ # @param d [Numeric] height of the shape, by default
1178
+ #
1179
+ # @return [nil] nil
1180
+ #
1181
+ def shape(shp, a = 0, b = 0, c = nil, d = nil)
1182
+ assertDrawing__
1183
+ return nil unless shp.isVisible
1184
+
1185
+ if c || d || @shapeMode__ != CORNER
1186
+ x, y, w, h = toXYWH__ @shapeMode__, a, b, c || shp.width, d || shp.height
1187
+ shp.draw__ @painter__, x, y, w, h
1188
+ else
1189
+ shp.draw__ @painter__, a, b
1190
+ end
1191
+ nil
1192
+ end
1193
+
1194
+ alias drawShape shape
1195
+
1196
+ # Begins drawing complex shapes.
1197
+ #
1198
+ # @param mode [POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP, TESS]
1199
+ #
1200
+ # @return [nil] nil
1201
+ #
1202
+ # @example
1203
+ # # Draws polygon
1204
+ # beginShape
1205
+ # vertex 10, 10
1206
+ # vertex 10, 50
1207
+ # vertex 50, 50
1208
+ # vertex 90, 10
1209
+ # endShape CLOSE
1210
+ #
1211
+ # # Draws triangles
1212
+ # beginShape TRIANGLES
1213
+ # vertex 10, 10
1214
+ # vertex 10, 50
1215
+ # vertex 50, 50
1216
+ # endShape
1217
+ #
1218
+ # @see https://processing.org/reference/beginShape_.html
1219
+ #
1220
+ def beginShape(mode = nil)
1221
+ @shapeMode__, @shapePoints__ = mode, []
1222
+ nil
1223
+ end
1224
+
1225
+ # Ends drawing complex shapes.
1226
+ #
1227
+ # @overload endShape()
1228
+ # @overload endShape(CLOSE)
1229
+ #
1230
+ # @param mode [CLOSE] Use CLOSE to create looped polygon
1231
+ #
1232
+ # @return [nil] nil
1233
+ #
1234
+ # @see https://processing.org/reference/endShape_.html
1235
+ #
1236
+ def endShape(mode = nil)
1237
+ raise "endShape() must be called after beginShape()" unless @shapePoints__
1238
+ polygon = Shape.createPolygon__ @shapeMode__, @shapePoints__, mode == CLOSE
1239
+ @painter__.polygon polygon if polygon
1240
+ @shapeMode__ = @shapePoints__ = nil
1241
+ nil
1242
+ end
1243
+
1244
+ # Append vertex for shape polygon.
1245
+ #
1246
+ # @param x [Numeric] x position of vertex
1247
+ # @param y [Numeric] y position of vertex
1248
+ #
1249
+ # @return [nil] nil
1250
+ #
1251
+ # @see https://processing.org/reference/vertex_.html
1252
+ #
1253
+ def vertex(x, y)
1254
+ raise "vertex() must be called after beginShape()" unless @shapePoints__
1255
+ @shapePoints__ << x << y
1256
+ end
1257
+
1097
1258
  # Copies image.
1098
1259
  #
1099
1260
  # @overload copy(sx, sy, sw, sh, dx, dy, dw, dh)
@@ -1181,9 +1342,9 @@ module Processing
1181
1342
  #
1182
1343
  # @return [nil] nil
1183
1344
  #
1184
- def scale(x, y)
1345
+ def scale(x, y = nil, z = 1)
1185
1346
  assertDrawing__
1186
- @painter__.scale x, y
1347
+ @painter__.scale x, (y || x), z
1187
1348
  nil
1188
1349
  end
1189
1350
 
@@ -1195,7 +1356,7 @@ module Processing
1195
1356
  #
1196
1357
  def rotate(angle)
1197
1358
  assertDrawing__
1198
- @painter__.rotate toAngle__ angle
1359
+ @painter__.rotate toDegrees__ angle
1199
1360
  nil
1200
1361
  end
1201
1362
 
@@ -1254,6 +1415,7 @@ module Processing
1254
1415
  @rectMode__,
1255
1416
  @ellipseMode__,
1256
1417
  @imageMode__,
1418
+ @shapeMode__,
1257
1419
  @textAlignH__,
1258
1420
  @textAlignV__,
1259
1421
  @tint__,
@@ -1285,6 +1447,7 @@ module Processing
1285
1447
  @rectMode__,
1286
1448
  @ellipseMode__,
1287
1449
  @imageMode__,
1450
+ @shapeMode__,
1288
1451
  @textAlignH__,
1289
1452
  @textAlignV__,
1290
1453
  @tint__ = @styleStack__.pop
@@ -1732,6 +1895,67 @@ module Processing
1732
1895
  Image.new Rays::Image.new(w, h, colorspace).paint {background 0, 0}
1733
1896
  end
1734
1897
 
1898
+ # Creates a new shape.
1899
+ #
1900
+ # @overload createShape()
1901
+ # @overload createShape(LINE, x1, y1, x2, y2)
1902
+ # @overload createShape(RECT, a, b, c, d)
1903
+ # @overload createShape(ELLIPSE, a, b, c, d)
1904
+ # @overload createShape(ARC, a, b, c, d, start, stop)
1905
+ # @overload createShape(TRIANGLE, x1, y1, x2, y2, x3, y3)
1906
+ # @overload createShape(QUAD, x1, y1, x2, y2, x3, y3, x4, y4)
1907
+ # @overload createShape(GROUP)
1908
+ #
1909
+ # @param kind [LINE, RECT, ELLIPSE, ARC, TRIANGLE, QUAD, GROUP]
1910
+ #
1911
+ def createShape(kind = nil, *args)
1912
+ case kind
1913
+ when LINE then createLineShape__( *args)
1914
+ when RECT then createRectShape__( *args)
1915
+ when ELLIPSE then createEllipseShape__( *args)
1916
+ when ARC then createArcShape__( *args)
1917
+ when TRIANGLE then createTriangleShape__(*args)
1918
+ when QUAD then createQuadShape__( *args)
1919
+ when GROUP then Shape.new nil, [], context: self
1920
+ when nil then Shape.new context: self
1921
+ else raise ArgumentError, "Unknown shape kind '#{kind}'"
1922
+ end
1923
+ end
1924
+
1925
+ # @private
1926
+ private def createLineShape__(x1, y1, x2, y2)
1927
+ Shape.new Rays::Polygon.lines(x1, y1, x2, y2), context: self
1928
+ end
1929
+
1930
+ # @private
1931
+ private def createRectShape__(a, b, c, d)
1932
+ x, y, w, h = toXYWH__ @rectMode__, a, b, c, d
1933
+ Shape.new Rays::Polygon.rect(x, y, w, h), context: self
1934
+ end
1935
+
1936
+ # @private
1937
+ private def createEllipseShape__(a, b, c, d)
1938
+ x, y, w, h = toXYWH__ @ellipseMode__, a, b, c, d
1939
+ Shape.new Rays::Polygon.ellipse(x, y, w, h), context: self
1940
+ end
1941
+
1942
+ # @private
1943
+ private def createArcShape__(a, b, c, d, start, stop)
1944
+ x, y, w, h = toXYWH__ @ellipseMode__, a, b, c, d
1945
+ from, to = toDegrees__(-start), toDegrees__(-stop)
1946
+ Shape.new Rays::Polygon.ellipse(x, y, w, h, from: from, to: to), context: self
1947
+ end
1948
+
1949
+ # @private
1950
+ private def createTriangleShape__(x1, y1, x2, y2, x3, y3)
1951
+ Shape.new Rays::Polygon.new(x1, y1, x2, y2, x3, y3, loop: true), context: self
1952
+ end
1953
+
1954
+ # @private
1955
+ private def createQuadShape__(x1, y1, x2, y2, x3, y3, x4, y4)
1956
+ Shape.new Rays::Polygon.quads(x1, y1, x2, y2, x3, y3, x4, y4), context: self
1957
+ end
1958
+
1735
1959
  # Creates a new off-screen graphics context object.
1736
1960
  #
1737
1961
  # @param width [Numeric] width of graphics image
@@ -0,0 +1,183 @@
1
+ module Processing
2
+
3
+
4
+ # Shape object.
5
+ #
6
+ class Shape
7
+
8
+ # @private
9
+ def initialize(polygon = nil, children = nil, context: nil)
10
+ @polygon, @children = polygon, children
11
+ @context = context || Context.context__
12
+ @visible, @matrix = true, nil
13
+ @mode = @points = @closed = nil
14
+ end
15
+
16
+ # Gets width of shape.
17
+ #
18
+ # @return [Numeric] width of shape
19
+ #
20
+ def width()
21
+ polygon = getInternal__ or return 0
22
+ (@bounds ||= polygon.bounds).width
23
+ end
24
+
25
+ # Gets height of shape.
26
+ #
27
+ # @return [Numeric] height of shape
28
+ #
29
+ def height()
30
+ polygon = getInternal__ or return 0
31
+ (@bounds ||= polygon.bounds).height
32
+ end
33
+
34
+ alias w width
35
+ alias h height
36
+
37
+ # Returns whether the shape is visible or not.
38
+ #
39
+ # @return [Boolean] visible or not
40
+ #
41
+ def isVisible()
42
+ @visible
43
+ end
44
+
45
+ alias visible? isVisible
46
+
47
+ # Sets whether to display the shape or not.
48
+ #
49
+ # @return [nil] nil
50
+ #
51
+ def setVisible(visible)
52
+ @visible = !!visible
53
+ nil
54
+ end
55
+
56
+ def beginShape(mode = nil)
57
+ @mode = mode
58
+ @points ||= []
59
+ @polygon = nil# clear cache
60
+ nil
61
+ end
62
+
63
+ def endShape(close = nil)
64
+ raise "endShape() must be called after beginShape()" unless @points
65
+ @closed = close == GraphicsContext::CLOSE
66
+ nil
67
+ end
68
+
69
+ def vertex(x, y)
70
+ raise "vertex() must be called after beginShape()" unless @points
71
+ @points << x << y
72
+ end
73
+
74
+ def setVertex(index, point)
75
+ return nil unless @points && @points[index * 2, 2]&.size == 2
76
+ @points[index * 2, 2] = [point.x, point.y]
77
+ end
78
+
79
+ def getVertex(index)
80
+ return nil unless @points
81
+ point = @points[index * 2, 2]
82
+ return nil unless point&.size == 2
83
+ @context.createVector(*point)
84
+ end
85
+
86
+ def getVertexCount()
87
+ return 0 unless @points
88
+ @points.size / 2
89
+ end
90
+
91
+ def addChild(child)
92
+ return unless @children
93
+ @children.push child
94
+ nil
95
+ end
96
+
97
+ def getChild(index)
98
+ @children&.[](index)
99
+ end
100
+
101
+ def getChildCount()
102
+ @children&.size || 0
103
+ end
104
+
105
+ def translate(x, y, z = 0)
106
+ matrix__.translate x, y, z
107
+ nil
108
+ end
109
+
110
+ def rotate(angle)
111
+ matrix__.rotate @context.toDegrees__(angle)
112
+ nil
113
+ end
114
+
115
+ def scale(x, y, z = 1)
116
+ matrix__.scale x, y, z
117
+ nil
118
+ end
119
+
120
+ def resetMatrix()
121
+ @matrix = nil
122
+ end
123
+
124
+ def rotateX = nil
125
+ def rotateY = nil
126
+ def rotateZ = nil
127
+
128
+ # @private
129
+ def matrix__()
130
+ @matrix ||= Rays::Matrix.new
131
+ end
132
+
133
+ # @private
134
+ def getInternal__()
135
+ unless @polygon
136
+ return nil unless @points && @closed != nil
137
+ @polygon = self.class.createPolygon__ @mode, @points, @closed
138
+ end
139
+ @polygon
140
+ end
141
+
142
+ # @private
143
+ def draw__(painter, x, y, w = nil, h = nil)
144
+ poly = getInternal__
145
+
146
+ backup = nil
147
+ if @matrix && (poly || @children)
148
+ backup = painter.matrix
149
+ painter.matrix = backup * @matrix
150
+ end
151
+
152
+ if poly
153
+ if w || h
154
+ painter.polygon poly, x, y, w,h
155
+ else
156
+ painter.polygon poly, x, y
157
+ end
158
+ end
159
+ @children&.each {|o| o.draw__ painter, x, y, w, h}
160
+
161
+ painter.matrix = backup if backup
162
+ end
163
+
164
+ # @private
165
+ def self.createPolygon__(mode, points, close = false)
166
+ g = GraphicsContext
167
+ case mode
168
+ when g::POINTS then Rays::Polygon.points( *points)
169
+ when g::LINES then Rays::Polygon.lines( *points)
170
+ when g::TRIANGLES then Rays::Polygon.triangles( *points)
171
+ when g::TRIANGLE_FAN then Rays::Polygon.triangle_fan( *points)
172
+ when g::TRIANGLE_STRIP then Rays::Polygon.triangle_strip(*points)
173
+ when g::QUADS then Rays::Polygon.quads( *points)
174
+ when g::QUAD_STRIP then Rays::Polygon.quad_strip( *points)
175
+ when g::TESS, nil then Rays::Polygon.new(*points, loop: close)
176
+ else raise ArgumentError, "invalid polygon mode '#{mode}'"
177
+ end
178
+ end
179
+
180
+ end# Shape
181
+
182
+
183
+ end# Processing
@@ -463,9 +463,9 @@ module Processing
463
463
  # @return [Vector] rotated this object
464
464
  #
465
465
  def rotate(angle)
466
- angle = @context ?
467
- @context.toAngle__(angle) : angle * GraphicsContext::RAD2DEG__
468
- @point.rotate! angle
466
+ deg = @context ?
467
+ @context.toDegrees__(angle) : angle * GraphicsContext::RAD2DEG__
468
+ @point.rotate! deg
469
469
  self
470
470
  end
471
471
 
data/processing.gemspec CHANGED
@@ -25,10 +25,10 @@ Gem::Specification.new do |s|
25
25
  s.platform = Gem::Platform::RUBY
26
26
  s.required_ruby_version = '>= 3.0.0'
27
27
 
28
- s.add_runtime_dependency 'xot', '~> 0.1.40'
29
- s.add_runtime_dependency 'rucy', '~> 0.1.41'
30
- s.add_runtime_dependency 'rays', '~> 0.1.46'
31
- s.add_runtime_dependency 'reflexion', '~> 0.1.54'
28
+ s.add_runtime_dependency 'xot', '~> 0.1.41'
29
+ s.add_runtime_dependency 'rucy', '~> 0.1.42'
30
+ s.add_runtime_dependency 'rays', '~> 0.1.47'
31
+ s.add_runtime_dependency 'reflexion', '~> 0.1.55'
32
32
 
33
33
  s.files = `git ls-files`.split $/
34
34
  s.test_files = s.files.grep %r{^(test|spec|features)/}