processing 0.5.5 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog.md +19 -0
- data/VERSION +1 -1
- data/examples/shake.rb +24 -0
- data/lib/processing/all.rb +1 -0
- data/lib/processing/capture.rb +2 -0
- data/lib/processing/context.rb +19 -14
- data/lib/processing/font.rb +16 -0
- data/lib/processing/graphics.rb +1 -0
- data/lib/processing/graphics_context.rb +78 -21
- data/lib/processing/image.rb +2 -0
- data/lib/processing/shader.rb +2 -0
- data/lib/processing/touch.rb +8 -0
- data/lib/processing/vector.rb +8 -4
- data/lib/processing/window.rb +2 -0
- data/processing.gemspec +4 -4
- data/test/helper.rb +0 -3
- data/test/test_capture.rb +16 -0
- data/test/test_font.rb +16 -0
- data/test/test_graphics.rb +4 -3
- data/test/test_graphics_context.rb +43 -0
- data/test/test_image.rb +16 -0
- data/test/test_shader.rb +4 -3
- data/test/test_text_bounds.rb +16 -0
- data/test/test_touch.rb +16 -0
- data/test/test_utility.rb +0 -3
- data/test/test_vector.rb +23 -3
- metadata +23 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ed81c4d96658275007c873b5f32fc445982fe79b80a2bc082bedff56e6008de4
|
|
4
|
+
data.tar.gz: 51c826f5baa2d107a8020e4aa7631ce4a5f636c43f90dd52a7a0227afc3b3ed8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ad89a983085617ddf327ee16949165e93c8b7262bc7ca00d1353b855fa96f9603045933ab6dc9de36f86dade87e03c204ebd02cd25d1f855bdc360b7f86b113
|
|
7
|
+
data.tar.gz: 962c4288dba17ce1296d5a6b3bc36bf43854fb5091367f4cb3dd379a69f2a8201fe18e0cbb267942599dde7c5582e9c12740348e91cfddacfddbc2ddd7430a22
|
data/ChangeLog.md
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
# processing ChangeLog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## [v0.5.8] - 2023-05-13
|
|
5
|
+
|
|
6
|
+
- Update dependencies
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [v0.5.7] - 2023-05-11
|
|
10
|
+
|
|
11
|
+
- Add examples/shake.rb
|
|
12
|
+
- Fix Vector.random2D() not working correctly when angleMode is set to DEGREES
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [v0.5.6] - 2023-05-08
|
|
16
|
+
|
|
17
|
+
- Add inspect() to classes
|
|
18
|
+
- Alias draw methods
|
|
19
|
+
- colorMode(), angleMode(), and blendMode() returns current mode value
|
|
20
|
+
- fix that mouseButton returns 0 on mouseReleased
|
|
21
|
+
|
|
22
|
+
|
|
4
23
|
## [v0.5.5] - 2023-04-30
|
|
5
24
|
|
|
6
25
|
- Update documents
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.5.
|
|
1
|
+
0.5.8
|
data/examples/shake.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
%w[xot rays reflex processing]
|
|
2
|
+
.map {|s| File.expand_path "../../#{s}/lib", __dir__}
|
|
3
|
+
.each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}
|
|
4
|
+
|
|
5
|
+
require 'processing'
|
|
6
|
+
using Processing
|
|
7
|
+
|
|
8
|
+
shake = 0
|
|
9
|
+
|
|
10
|
+
draw do
|
|
11
|
+
background 100
|
|
12
|
+
|
|
13
|
+
v = Vector.random2D * shake
|
|
14
|
+
translate v.x, v.y
|
|
15
|
+
shake *= 0.8
|
|
16
|
+
|
|
17
|
+
textSize 50
|
|
18
|
+
text 'hello, world!', 30, 50
|
|
19
|
+
rect 100, 100, 200, 100
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
mouseClicked do
|
|
23
|
+
shake = 10
|
|
24
|
+
end
|
data/lib/processing/all.rb
CHANGED
data/lib/processing/capture.rb
CHANGED
data/lib/processing/context.rb
CHANGED
|
@@ -5,6 +5,7 @@ module Processing
|
|
|
5
5
|
#
|
|
6
6
|
class Context
|
|
7
7
|
|
|
8
|
+
include Xot::Inspectable
|
|
8
9
|
include GraphicsContext
|
|
9
10
|
|
|
10
11
|
Capture = Processing::Capture
|
|
@@ -35,17 +36,18 @@ module Processing
|
|
|
35
36
|
@window__.canvas_image,
|
|
36
37
|
@window__.canvas_painter.paint {background 0.8})
|
|
37
38
|
|
|
38
|
-
@loop__
|
|
39
|
-
@redraw__
|
|
40
|
-
@frameCount__
|
|
41
|
-
@key__
|
|
42
|
-
@keyCode__
|
|
43
|
-
@keysPressed__
|
|
44
|
-
@pointerPos__
|
|
45
|
-
@pointerPrevPos__
|
|
46
|
-
@pointersPressed__
|
|
47
|
-
@
|
|
48
|
-
@
|
|
39
|
+
@loop__ = true
|
|
40
|
+
@redraw__ = false
|
|
41
|
+
@frameCount__ = 0
|
|
42
|
+
@key__ = nil
|
|
43
|
+
@keyCode__ = nil
|
|
44
|
+
@keysPressed__ = Set.new
|
|
45
|
+
@pointerPos__ =
|
|
46
|
+
@pointerPrevPos__ = Rays::Point.new 0
|
|
47
|
+
@pointersPressed__ = []
|
|
48
|
+
@pointersReleased__ = []
|
|
49
|
+
@touches__ = []
|
|
50
|
+
@motionGravity__ = createVector 0, 0
|
|
49
51
|
|
|
50
52
|
@window__.before_draw = proc {beginDraw__}
|
|
51
53
|
@window__.after_draw = proc {endDraw__}
|
|
@@ -95,11 +97,13 @@ module Processing
|
|
|
95
97
|
@pointerPos__ = event.pos.dup
|
|
96
98
|
@touches__ = event.pointers.map {|p| Touch.new(p.id, *p.pos.to_a)}
|
|
97
99
|
if pressed != nil
|
|
98
|
-
array = @pointersPressed__
|
|
99
100
|
event.types
|
|
100
101
|
.tap {|types| types.delete :mouse}
|
|
101
102
|
.map {|type| mouseButtonMap[type] || type}
|
|
102
|
-
.each
|
|
103
|
+
.each do |type|
|
|
104
|
+
(pressed ? @pointersPressed__ : @pointersReleased__).push type
|
|
105
|
+
@pointersPressed__.delete type unless pressed
|
|
106
|
+
end
|
|
103
107
|
end
|
|
104
108
|
}
|
|
105
109
|
|
|
@@ -127,6 +131,7 @@ module Processing
|
|
|
127
131
|
@mouseClickedBlock__&.call if (@pointerPos__ - startPos).length < 3
|
|
128
132
|
@pointerDownStartPos__ = nil
|
|
129
133
|
end
|
|
134
|
+
@pointersReleased__.clear
|
|
130
135
|
end
|
|
131
136
|
|
|
132
137
|
@window__.pointer_move = proc do |e|
|
|
@@ -440,7 +445,7 @@ module Processing
|
|
|
440
445
|
# @return [Numeric] LEFT, RIGHT, CENTER or 0
|
|
441
446
|
#
|
|
442
447
|
def mouseButton()
|
|
443
|
-
(@pointersPressed__ & [LEFT, RIGHT, CENTER]).last
|
|
448
|
+
((@pointersPressed__ + @pointersReleased__) & [LEFT, RIGHT, CENTER]).last
|
|
444
449
|
end
|
|
445
450
|
|
|
446
451
|
# Returns array of touches
|
data/lib/processing/font.rb
CHANGED
|
@@ -28,6 +28,14 @@ module Processing
|
|
|
28
28
|
TextBounds.new x, y, x + f.width(str), y + f.height
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
# Returns a string containing a human-readable representation of object.
|
|
32
|
+
#
|
|
33
|
+
# @return [String] inspected text
|
|
34
|
+
#
|
|
35
|
+
def inspect()
|
|
36
|
+
"#<Processing::Font: name:'#{@font.name}' size:#{@font.size}>"
|
|
37
|
+
end
|
|
38
|
+
|
|
31
39
|
end# Font
|
|
32
40
|
|
|
33
41
|
|
|
@@ -56,6 +64,14 @@ module Processing
|
|
|
56
64
|
@x, @y, @w, @h = x, y, w, h
|
|
57
65
|
end
|
|
58
66
|
|
|
67
|
+
# Returns a string containing a human-readable representation of object.
|
|
68
|
+
#
|
|
69
|
+
# @return [String] inspected text
|
|
70
|
+
#
|
|
71
|
+
def inspect()
|
|
72
|
+
"#<Processing::TextBounds: x:#{x} y:#{y} w:#{w} h:#{h}>"
|
|
73
|
+
end
|
|
74
|
+
|
|
59
75
|
end# TextBounds
|
|
60
76
|
|
|
61
77
|
|
data/lib/processing/graphics.rb
CHANGED
|
@@ -198,12 +198,15 @@ module Processing
|
|
|
198
198
|
# @private
|
|
199
199
|
def init__(image, painter)
|
|
200
200
|
@drawing__ = false
|
|
201
|
+
@colorMode__ = nil
|
|
201
202
|
@hsbColor__ = false
|
|
202
203
|
@colorMaxes__ = [1.0] * 4
|
|
204
|
+
@angleMode__ = nil
|
|
203
205
|
@angleScale__ = 1.0
|
|
204
206
|
@rectMode__ = nil
|
|
205
207
|
@ellipseMode__ = nil
|
|
206
208
|
@imageMode__ = nil
|
|
209
|
+
@blendMode__ = nil
|
|
207
210
|
@textAlignH__ = nil
|
|
208
211
|
@textAlignV__ = nil
|
|
209
212
|
@tint__ = nil
|
|
@@ -271,19 +274,22 @@ module Processing
|
|
|
271
274
|
# @param max3 [Numeric] max value for blue or brightness
|
|
272
275
|
# @param maxA [Numeric] max value for alpha
|
|
273
276
|
#
|
|
274
|
-
# @return [
|
|
277
|
+
# @return [RGB, HSB] current mode
|
|
275
278
|
#
|
|
276
|
-
def colorMode(mode, *maxes)
|
|
277
|
-
mode
|
|
278
|
-
|
|
279
|
-
|
|
279
|
+
def colorMode(mode = nil, *maxes)
|
|
280
|
+
if mode != nil
|
|
281
|
+
mode = mode.downcase.to_sym
|
|
282
|
+
raise ArgumentError, "invalid color mode: #{mode}" unless [RGB, HSB].include?(mode)
|
|
283
|
+
raise ArgumentError unless [0, 1, 3, 4].include?(maxes.size)
|
|
280
284
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
+
@colorMode__ = mode
|
|
286
|
+
@hsbColor__ = mode == HSB
|
|
287
|
+
case maxes.size
|
|
288
|
+
when 1 then @colorMaxes__ = [maxes.first.to_f] * 4
|
|
289
|
+
when 3, 4 then @colorMaxes__[0...maxes.size] = maxes.map &:to_f
|
|
290
|
+
end
|
|
285
291
|
end
|
|
286
|
-
|
|
292
|
+
@colorMode__
|
|
287
293
|
end
|
|
288
294
|
|
|
289
295
|
# @private
|
|
@@ -319,15 +325,19 @@ module Processing
|
|
|
319
325
|
#
|
|
320
326
|
# @param mode [RADIANS, DEGREES] RADIANS or DEGREES
|
|
321
327
|
#
|
|
322
|
-
# @return [
|
|
328
|
+
# @return [RADIANS, DEGREES] current mode
|
|
323
329
|
#
|
|
324
|
-
def angleMode(mode)
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
330
|
+
def angleMode(mode = nil)
|
|
331
|
+
if mode != nil
|
|
332
|
+
@angleMode__ = mode
|
|
333
|
+
@angleScale__ =
|
|
334
|
+
case mode.downcase.to_sym
|
|
335
|
+
when RADIANS then RAD2DEG__
|
|
336
|
+
when DEGREES then 1.0
|
|
337
|
+
else raise ArgumentError, "invalid angle mode: #{mode}"
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
@angleMode__
|
|
331
341
|
end
|
|
332
342
|
|
|
333
343
|
# @private
|
|
@@ -335,6 +345,24 @@ module Processing
|
|
|
335
345
|
angle * @angleScale__
|
|
336
346
|
end
|
|
337
347
|
|
|
348
|
+
# @private
|
|
349
|
+
def fromRadians__(radians)
|
|
350
|
+
case @angleMode__
|
|
351
|
+
when RADIANS then radians
|
|
352
|
+
when DEGREES then radians * RAD2DEG__
|
|
353
|
+
else raise "invalid angle mode: #{mode}"
|
|
354
|
+
end
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
# @private
|
|
358
|
+
def fromDegrees__(degrees)
|
|
359
|
+
case @angleMode__
|
|
360
|
+
when RADIANS then degrees * DEG2RAD__
|
|
361
|
+
when DEGREES then degrees
|
|
362
|
+
else raise "invalid angle mode: #{mode}"
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
|
|
338
366
|
# Sets rect mode. Default is CORNER.
|
|
339
367
|
#
|
|
340
368
|
# CORNER -> rect(left, top, width, height)
|
|
@@ -396,9 +424,12 @@ module Processing
|
|
|
396
424
|
#
|
|
397
425
|
# @return [nil] nil
|
|
398
426
|
#
|
|
399
|
-
def blendMode(mode)
|
|
400
|
-
|
|
401
|
-
|
|
427
|
+
def blendMode(mode = nil)
|
|
428
|
+
if mode != nil
|
|
429
|
+
@blendMode__ = mode
|
|
430
|
+
@painter__.blend_mode = mode
|
|
431
|
+
end
|
|
432
|
+
@blendMode__
|
|
402
433
|
end
|
|
403
434
|
|
|
404
435
|
# Sets fill color.
|
|
@@ -691,6 +722,8 @@ module Processing
|
|
|
691
722
|
nil
|
|
692
723
|
end
|
|
693
724
|
|
|
725
|
+
alias drawPoint point
|
|
726
|
+
|
|
694
727
|
# Draws a line.
|
|
695
728
|
#
|
|
696
729
|
# @param x1 [Numeric] horizontal position of first point
|
|
@@ -706,6 +739,8 @@ module Processing
|
|
|
706
739
|
nil
|
|
707
740
|
end
|
|
708
741
|
|
|
742
|
+
alias drawLine line
|
|
743
|
+
|
|
709
744
|
# Draws a rectangle.
|
|
710
745
|
#
|
|
711
746
|
# The parameters a, b, c, and d are determined by rectMode().
|
|
@@ -738,6 +773,8 @@ module Processing
|
|
|
738
773
|
nil
|
|
739
774
|
end
|
|
740
775
|
|
|
776
|
+
alias drawRect rect
|
|
777
|
+
|
|
741
778
|
# Draws an ellipse.
|
|
742
779
|
#
|
|
743
780
|
# The parameters a, b, c, and d are determined by ellipseMode().
|
|
@@ -756,6 +793,8 @@ module Processing
|
|
|
756
793
|
nil
|
|
757
794
|
end
|
|
758
795
|
|
|
796
|
+
alias drawEllipse ellipse
|
|
797
|
+
|
|
759
798
|
# Draws a circle.
|
|
760
799
|
#
|
|
761
800
|
# @param x [Numeric] horizontal position of the shape
|
|
@@ -768,6 +807,8 @@ module Processing
|
|
|
768
807
|
ellipse x, y, extent, extent
|
|
769
808
|
end
|
|
770
809
|
|
|
810
|
+
alias drawCircle circle
|
|
811
|
+
|
|
771
812
|
# Draws an arc.
|
|
772
813
|
#
|
|
773
814
|
# The parameters a, b, c, and d are determined by ellipseMode().
|
|
@@ -790,6 +831,8 @@ module Processing
|
|
|
790
831
|
nil
|
|
791
832
|
end
|
|
792
833
|
|
|
834
|
+
alias drawArc arc
|
|
835
|
+
|
|
793
836
|
# Draws a square.
|
|
794
837
|
#
|
|
795
838
|
# @param x [Numeric] horizontal position of the shape
|
|
@@ -802,6 +845,8 @@ module Processing
|
|
|
802
845
|
rect x, y, extent, extent
|
|
803
846
|
end
|
|
804
847
|
|
|
848
|
+
alias drawSquare square
|
|
849
|
+
|
|
805
850
|
# Draws a triangle.
|
|
806
851
|
#
|
|
807
852
|
# @param x1 [Numeric] horizontal position of first point
|
|
@@ -819,6 +864,8 @@ module Processing
|
|
|
819
864
|
nil
|
|
820
865
|
end
|
|
821
866
|
|
|
867
|
+
alias drawTriangle triangle
|
|
868
|
+
|
|
822
869
|
# Draws a quad.
|
|
823
870
|
#
|
|
824
871
|
# @param x1 [Numeric] horizontal position of first point
|
|
@@ -838,6 +885,8 @@ module Processing
|
|
|
838
885
|
nil
|
|
839
886
|
end
|
|
840
887
|
|
|
888
|
+
alias drawQuad quad
|
|
889
|
+
|
|
841
890
|
# Draws a Catmull-Rom spline curve.
|
|
842
891
|
#
|
|
843
892
|
# @param cx1 [Numeric] horizontal position of beginning control point
|
|
@@ -857,6 +906,8 @@ module Processing
|
|
|
857
906
|
nil
|
|
858
907
|
end
|
|
859
908
|
|
|
909
|
+
alias drawCurve curve
|
|
910
|
+
|
|
860
911
|
# Draws a Bezier spline curve.
|
|
861
912
|
#
|
|
862
913
|
# @param x1 [Numeric] horizontal position of first point
|
|
@@ -876,6 +927,8 @@ module Processing
|
|
|
876
927
|
nil
|
|
877
928
|
end
|
|
878
929
|
|
|
930
|
+
alias drawBezier bezier
|
|
931
|
+
|
|
879
932
|
# Draws a text.
|
|
880
933
|
#
|
|
881
934
|
# The parameters a, b, c, and d are determined by rectMode().
|
|
@@ -915,6 +968,8 @@ module Processing
|
|
|
915
968
|
nil
|
|
916
969
|
end
|
|
917
970
|
|
|
971
|
+
alias drawText text
|
|
972
|
+
|
|
918
973
|
# Draws an image.
|
|
919
974
|
#
|
|
920
975
|
# The parameters a, b, c, and d are determined by imageMode().
|
|
@@ -938,6 +993,8 @@ module Processing
|
|
|
938
993
|
nil
|
|
939
994
|
end
|
|
940
995
|
|
|
996
|
+
alias drawImage image
|
|
997
|
+
|
|
941
998
|
# Copies image.
|
|
942
999
|
#
|
|
943
1000
|
# @overload copy(sx, sy, sw, sh, dx, dy, dw, dh)
|
data/lib/processing/image.rb
CHANGED
data/lib/processing/shader.rb
CHANGED
data/lib/processing/touch.rb
CHANGED
|
@@ -26,6 +26,14 @@ module Processing
|
|
|
26
26
|
@id, @x, @y = id, x, y
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
# Returns a string containing a human-readable representation of object.
|
|
30
|
+
#
|
|
31
|
+
# @return [String] inspected text
|
|
32
|
+
#
|
|
33
|
+
def inspect()
|
|
34
|
+
"#<Processing::Touch: id:#{id} x:#{x} y:#{y}>"
|
|
35
|
+
end
|
|
36
|
+
|
|
29
37
|
end# Touch
|
|
30
38
|
|
|
31
39
|
|
data/lib/processing/vector.rb
CHANGED
|
@@ -513,7 +513,8 @@ module Processing
|
|
|
513
513
|
# @return [Vector] a random vector
|
|
514
514
|
#
|
|
515
515
|
def self.random2D(target = nil)
|
|
516
|
-
v = self.
|
|
516
|
+
v = self.new(1, 0, 0)
|
|
517
|
+
v.getInternal__.rotate! rand 0.0...360.0
|
|
517
518
|
target.set v if target
|
|
518
519
|
v
|
|
519
520
|
end
|
|
@@ -535,14 +536,17 @@ module Processing
|
|
|
535
536
|
v
|
|
536
537
|
end
|
|
537
538
|
|
|
538
|
-
#
|
|
539
|
+
# Returns a string containing a human-readable representation of object.
|
|
540
|
+
#
|
|
541
|
+
# @return [String] inspected text
|
|
542
|
+
#
|
|
539
543
|
def inspect()
|
|
540
|
-
"
|
|
544
|
+
"#<#{self.class.name}: #{x}, #{y}, #{z}>"
|
|
541
545
|
end
|
|
542
546
|
|
|
543
547
|
# @private
|
|
544
548
|
def <=>(o)
|
|
545
|
-
@point <=> o
|
|
549
|
+
@point <=> o&.getInternal__
|
|
546
550
|
end
|
|
547
551
|
|
|
548
552
|
# @private
|
data/lib/processing/window.rb
CHANGED
data/processing.gemspec
CHANGED
|
@@ -28,10 +28,10 @@ Gem::Specification.new do |s|
|
|
|
28
28
|
s.platform = Gem::Platform::RUBY
|
|
29
29
|
s.required_ruby_version = '>= 2.7.0'
|
|
30
30
|
|
|
31
|
-
s.add_runtime_dependency 'xot', '~> 0.1.
|
|
32
|
-
s.add_runtime_dependency 'rucy', '~> 0.1.
|
|
33
|
-
s.add_runtime_dependency 'rays', '~> 0.1.
|
|
34
|
-
s.add_runtime_dependency 'reflexion', '~> 0.1.
|
|
31
|
+
s.add_runtime_dependency 'xot', '~> 0.1.35'
|
|
32
|
+
s.add_runtime_dependency 'rucy', '~> 0.1.35'
|
|
33
|
+
s.add_runtime_dependency 'rays', '~> 0.1.36'
|
|
34
|
+
s.add_runtime_dependency 'reflexion', '~> 0.1.38'
|
|
35
35
|
|
|
36
36
|
s.add_development_dependency 'rake'
|
|
37
37
|
s.add_development_dependency 'test-unit'
|
data/test/helper.rb
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require_relative 'helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TestCapture < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
P = Processing
|
|
7
|
+
|
|
8
|
+
def capture(*args, **kwargs)
|
|
9
|
+
P::Capture.new(*args, **kwargs)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_inspect()
|
|
13
|
+
assert_match %r|#<Processing::Capture:0x\w{16}>|, capture.inspect
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end# TestCapture
|
data/test/test_font.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require_relative 'helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TestFont < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
P = Processing
|
|
7
|
+
|
|
8
|
+
def font()
|
|
9
|
+
P::Font.new Rays::Font.new(nil, 10)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_inspect()
|
|
13
|
+
assert_match %r|#<Processing::Font: name:'[\w\s]+' size:[\d\.]+>|, font.inspect
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end# TestFont
|
data/test/test_graphics.rb
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
require_relative 'helper'
|
|
5
2
|
|
|
6
3
|
|
|
@@ -18,4 +15,8 @@ class TestGraphics < Test::Unit::TestCase
|
|
|
18
15
|
assert_raise {g.beginDraw}
|
|
19
16
|
end
|
|
20
17
|
|
|
18
|
+
def test_inspect()
|
|
19
|
+
assert_match %r|#<Processing::Graphics:0x\w{16}>|, graphics.inspect
|
|
20
|
+
end
|
|
21
|
+
|
|
21
22
|
end# TestGraphics
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require_relative 'helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TestGraphicsContext < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
P = Processing
|
|
7
|
+
G = P::Graphics
|
|
8
|
+
|
|
9
|
+
def graphics(w = 10, h = 10)
|
|
10
|
+
G.new w, h
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_colorMode()
|
|
14
|
+
g = graphics
|
|
15
|
+
assert_equal G::RGB, g.colorMode
|
|
16
|
+
|
|
17
|
+
g.colorMode G::HSB, 1
|
|
18
|
+
assert_equal G::HSB, g.colorMode
|
|
19
|
+
|
|
20
|
+
assert_raise {g.colorMode LEFT}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_angleMode()
|
|
24
|
+
g = graphics
|
|
25
|
+
assert_equal G::RADIANS, g.angleMode
|
|
26
|
+
|
|
27
|
+
g.angleMode G::DEGREES
|
|
28
|
+
assert_equal G::DEGREES, g.angleMode
|
|
29
|
+
|
|
30
|
+
assert_raise {g.angleMode LEFT}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_blendMode()
|
|
34
|
+
g = graphics
|
|
35
|
+
assert_equal G::BLEND, g.blendMode
|
|
36
|
+
|
|
37
|
+
g.blendMode G::ADD
|
|
38
|
+
assert_equal G::ADD, g.blendMode
|
|
39
|
+
|
|
40
|
+
assert_raise {g.blendMode LEFT}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end# TestGraphics
|
data/test/test_image.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require_relative 'helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TestImage < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
P = Processing
|
|
7
|
+
|
|
8
|
+
def image(w = 10, h = 10)
|
|
9
|
+
P::Image.new(Rays::Image.new w, h)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_inspect()
|
|
13
|
+
assert_match %r|#<Processing::Image:0x\w{16}>|, image.inspect
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end# TestImage
|
data/test/test_shader.rb
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
require_relative 'helper'
|
|
5
2
|
|
|
6
3
|
|
|
@@ -44,4 +41,8 @@ class TestShader < Test::Unit::TestCase
|
|
|
44
41
|
end
|
|
45
42
|
end
|
|
46
43
|
|
|
44
|
+
def test_inspect()
|
|
45
|
+
assert_match %r|#<Processing::Shader:0x\w{16}>|, shader.inspect
|
|
46
|
+
end
|
|
47
|
+
|
|
47
48
|
end# TestShader
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require_relative 'helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TestTextBounds < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
P = Processing
|
|
7
|
+
|
|
8
|
+
def bounds(*args)
|
|
9
|
+
P::TextBounds.new(*args)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_inspect()
|
|
13
|
+
assert_equal "#<Processing::TextBounds: x:1 y:2 w:3 h:4>", bounds(1, 2, 3, 4).inspect
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end# TestTextBounds
|
data/test/test_touch.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require_relative 'helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TestTouch < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
P = Processing
|
|
7
|
+
|
|
8
|
+
def touch(id, x, y)
|
|
9
|
+
P::Touch.new id, x, y
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_inspect()
|
|
13
|
+
assert_equal "#<Processing::Touch: id:1 x:2 y:3>", touch(1, 2, 3).inspect
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end# TestTouch
|
data/test/test_utility.rb
CHANGED
data/test/test_vector.rb
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
require_relative 'helper'
|
|
5
2
|
|
|
6
3
|
|
|
@@ -341,6 +338,25 @@ class TestVector < Test::Unit::TestCase
|
|
|
341
338
|
assert_equal_vector vec(M.cos(angle * 2), M.sin(angle * 2), 0), v.rotate(angle)
|
|
342
339
|
end
|
|
343
340
|
|
|
341
|
+
def test_compare()
|
|
342
|
+
v = vec 1, 2, 3
|
|
343
|
+
assert v == vec(1, 2, 3)
|
|
344
|
+
assert_not v != vec(1, 2, 3)
|
|
345
|
+
|
|
346
|
+
assert v < vec(2, 2, 3)
|
|
347
|
+
assert v < vec(1, 3, 3)
|
|
348
|
+
assert v < vec(1, 2, 4)
|
|
349
|
+
|
|
350
|
+
assert v > vec(0, 2, 3)
|
|
351
|
+
assert v > vec(1, 1, 3)
|
|
352
|
+
assert v > vec(1, 2, 2)
|
|
353
|
+
|
|
354
|
+
assert_not v == nil
|
|
355
|
+
assert v != nil
|
|
356
|
+
assert_raise {v < nil}
|
|
357
|
+
assert_raise {v > nil}
|
|
358
|
+
end
|
|
359
|
+
|
|
344
360
|
def test_fromAngle()
|
|
345
361
|
angle = PI * 2 * 0.1
|
|
346
362
|
result = vec
|
|
@@ -395,4 +411,8 @@ class TestVector < Test::Unit::TestCase
|
|
|
395
411
|
assert_in_delta 1, v2.mag, 0.000001
|
|
396
412
|
end
|
|
397
413
|
|
|
414
|
+
def test_inspect()
|
|
415
|
+
assert_equal '#<Processing::Vector: 1.0, 2.0, 3.0>', vec(1, 2, 3).inspect
|
|
416
|
+
end
|
|
417
|
+
|
|
398
418
|
end# TestVector
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: processing
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- xordog
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-05-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: xot
|
|
@@ -16,56 +16,56 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.1.
|
|
19
|
+
version: 0.1.35
|
|
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.1.
|
|
26
|
+
version: 0.1.35
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rucy
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.1.
|
|
33
|
+
version: 0.1.35
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.1.
|
|
40
|
+
version: 0.1.35
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rays
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.1.
|
|
47
|
+
version: 0.1.36
|
|
48
48
|
type: :runtime
|
|
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: 0.1.
|
|
54
|
+
version: 0.1.36
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: reflexion
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0.1.
|
|
61
|
+
version: 0.1.38
|
|
62
62
|
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0.1.
|
|
68
|
+
version: 0.1.38
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: rake
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -132,6 +132,7 @@ files:
|
|
|
132
132
|
- examples/delay_camera.rb
|
|
133
133
|
- examples/hello.rb
|
|
134
134
|
- examples/image.rb
|
|
135
|
+
- examples/shake.rb
|
|
135
136
|
- examples/shapes.rb
|
|
136
137
|
- lib/processing.rb
|
|
137
138
|
- lib/processing/all.rb
|
|
@@ -149,8 +150,14 @@ files:
|
|
|
149
150
|
- lib/processing/window.rb
|
|
150
151
|
- processing.gemspec
|
|
151
152
|
- test/helper.rb
|
|
153
|
+
- test/test_capture.rb
|
|
154
|
+
- test/test_font.rb
|
|
152
155
|
- test/test_graphics.rb
|
|
156
|
+
- test/test_graphics_context.rb
|
|
157
|
+
- test/test_image.rb
|
|
153
158
|
- test/test_shader.rb
|
|
159
|
+
- test/test_text_bounds.rb
|
|
160
|
+
- test/test_touch.rb
|
|
154
161
|
- test/test_utility.rb
|
|
155
162
|
- test/test_vector.rb
|
|
156
163
|
homepage: https://github.com/xord/processing
|
|
@@ -177,7 +184,13 @@ specification_version: 4
|
|
|
177
184
|
summary: Processing compatible Creative Coding Framework.
|
|
178
185
|
test_files:
|
|
179
186
|
- test/helper.rb
|
|
187
|
+
- test/test_capture.rb
|
|
188
|
+
- test/test_font.rb
|
|
180
189
|
- test/test_graphics.rb
|
|
190
|
+
- test/test_graphics_context.rb
|
|
191
|
+
- test/test_image.rb
|
|
181
192
|
- test/test_shader.rb
|
|
193
|
+
- test/test_text_bounds.rb
|
|
194
|
+
- test/test_touch.rb
|
|
182
195
|
- test/test_utility.rb
|
|
183
196
|
- test/test_vector.rb
|