processing 0.5.32 → 0.5.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +49 -1
- data/VERSION +1 -1
- data/lib/processing/all.rb +3 -1
- data/lib/processing/context.rb +232 -16
- data/lib/processing/events.rb +22 -0
- data/lib/processing/font.rb +5 -0
- data/lib/processing/graphics.rb +11 -2
- data/lib/processing/graphics_context.rb +968 -74
- data/lib/processing/image.rb +92 -1
- data/lib/processing/shader.rb +29 -16
- data/lib/processing/shape.rb +268 -12
- data/lib/processing/vector.rb +126 -0
- data/lib/processing/window.rb +98 -58
- data/processing.gemspec +4 -4
- data/test/helper.rb +5 -2
- data/test/p5.rb +1 -1
- data/test/test_font.rb +1 -1
- data/test/test_graphics_context.rb +442 -8
- data/test/test_utility.rb +0 -19
- metadata +12 -11
data/lib/processing/font.rb
CHANGED
@@ -3,6 +3,9 @@ module Processing
|
|
3
3
|
|
4
4
|
# Font object.
|
5
5
|
#
|
6
|
+
# @see https://processing.org/reference/PFont.html
|
7
|
+
# @see https://p5js.org/reference/#/p5.Font
|
8
|
+
#
|
6
9
|
class Font
|
7
10
|
|
8
11
|
# @private
|
@@ -24,6 +27,8 @@ module Processing
|
|
24
27
|
#
|
25
28
|
# @return [TextBounds] bounding box for text
|
26
29
|
#
|
30
|
+
# @see https://p5js.org/reference/#/p5.Font/textBounds
|
31
|
+
#
|
27
32
|
def textBounds(str, x = 0, y = 0, fontSize = nil)
|
28
33
|
font = getInternal__ fontSize
|
29
34
|
TextBounds.new x, y, x + font.width(str), y + font.height
|
data/lib/processing/graphics.rb
CHANGED
@@ -3,6 +3,9 @@ module Processing
|
|
3
3
|
|
4
4
|
# Draws graphics into an offscreen buffer
|
5
5
|
#
|
6
|
+
# @see https://processing.org/reference/PGraphics.html
|
7
|
+
# @see https://p5js.org/reference/#/p5.Graphics
|
8
|
+
#
|
6
9
|
class Graphics
|
7
10
|
|
8
11
|
include Xot::Inspectable
|
@@ -10,6 +13,8 @@ module Processing
|
|
10
13
|
|
11
14
|
# Initialize graphics object.
|
12
15
|
#
|
16
|
+
# @see https://p5js.org/reference/#/p5.Graphics
|
17
|
+
#
|
13
18
|
def initialize(width, height, pixelDensity = 1)
|
14
19
|
image = Rays::Image.new width, height, Rays::RGBA, pixelDensity
|
15
20
|
init__ image, image.painter
|
@@ -17,9 +22,11 @@ module Processing
|
|
17
22
|
|
18
23
|
# Start drawing.
|
19
24
|
#
|
25
|
+
# @see https://processing.org/reference/PGraphics_beginDraw_.html
|
26
|
+
#
|
20
27
|
def beginDraw(&block)
|
21
|
-
beginDraw__
|
22
28
|
@painter__.__send__ :begin_paint
|
29
|
+
beginDraw__
|
23
30
|
push
|
24
31
|
if block
|
25
32
|
begin
|
@@ -32,10 +39,12 @@ module Processing
|
|
32
39
|
|
33
40
|
# End drawing.
|
34
41
|
#
|
42
|
+
# @see https://processing.org/reference/PGraphics_endDraw_.html
|
43
|
+
#
|
35
44
|
def endDraw()
|
36
45
|
pop
|
37
|
-
@painter__.__send__ :end_paint
|
38
46
|
endDraw__
|
47
|
+
@painter__.__send__ :end_paint
|
39
48
|
end
|
40
49
|
|
41
50
|
end# Graphics
|