Skip to content

Commit 1a548ec

Browse files
committed
test draw_circle
seems to work!
1 parent 865b440 commit 1a548ec

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes to `:vips` will be documented in this file.
77
- Image::set and Image::get methods, handy for properties whose names do not
88
confirm to PHP conventions
99
- type annotations [Kleis Auke Wolthuizen]
10+
- libvips draw calls now work
1011

1112
### Deprecated
1213
- now require php >= 7.0.11, fixes #10

Diff for: README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@ to add 1 to the first band, 2 to the second and 3 to the third. Or:
8686
$image = $image->add($image2);
8787
```
8888

89-
to add two images.
89+
to add two images. Or:
90+
91+
```
92+
$image = $image->add([[1, 2, 3], [4, 5, 6]]);
93+
```
94+
95+
To make a 2 x 3 image from the array, then add that image to the original.
9096

9197
Almost all methods can take an optional final argument, an array of options.
9298
For example:

Diff for: tests/call.php

+12
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,16 @@ public function testVipsCall2D()
3434
$this->assertEquals($image->getpoint(0, 0), [1]);
3535
}
3636

37+
public function testVipsDraw()
38+
{
39+
$image = Vips\Image::black(100, 100);
40+
$image = $image->draw_circle(255, 50, 50, 20, ["fill" => true]);
41+
42+
$this->assertEquals($image->width, 100);
43+
$this->assertEquals($image->height, 100);
44+
$this->assertEquals($image->bands, 1);
45+
$this->assertEquals($image->getpoint(0, 0), [0]);
46+
$this->assertEquals($image->getpoint(50, 50), [255]);
47+
}
48+
3749
}

0 commit comments

Comments
 (0)