Skip to content

Commit 4d1a585

Browse files
committed
Updated tests and bindings to latest mapnik
1 parent 0d07890 commit 4d1a585

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+18
-34
lines changed

src/mapnik_image.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,9 @@ void set_color_to_alpha(image_any & im, mapnik::color const& c)
282282
mapnik::set_color_to_alpha(im, c);
283283
}
284284

285-
void set_alpha(image_any & im, float opacity)
285+
void apply_opacity(image_any & im, float opacity)
286286
{
287-
mapnik::set_alpha(im, opacity);
288-
}
289-
290-
void multiply_alpha(image_any & im, float opacity)
291-
{
292-
mapnik::multiply_alpha(im, opacity);
287+
mapnik::apply_opacity(im, opacity);
293288
}
294289

295290
bool premultiplied(image_any &im)
@@ -410,8 +405,7 @@ void export_image()
410405
.def("set_grayscale_to_alpha",&set_grayscale_to_alpha, "Set the grayscale values to the alpha channel of the Image")
411406
.def("set_grayscale_to_alpha",&set_grayscale_to_alpha_c, "Set the grayscale values to the alpha channel of the Image")
412407
.def("set_color_to_alpha",&set_color_to_alpha, "Set a given color to the alpha channel of the Image")
413-
.def("set_alpha",&set_alpha, "Set the overall alpha channel of the Image")
414-
.def("multiply_alpha",&multiply_alpha, "Multiply the alpha channel of the Image")
408+
.def("apply_opacity",&apply_opacity, "Set the opacity of the Image relative to the current alpha of each pixel.")
415409
.def("composite",&composite,
416410
( arg("self"),
417411
arg("image"),

test/data

test/data-visual

Submodule data-visual updated 159 files

test/python_tests/compositing_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def test_rounding_and_color_expectations():
208208
# should have no effect
209209
im_file.premultiply()
210210
eq_(get_unique_colors(im_file),['rgba(0,0,0,0)', 'rgba(74,74,74,255)'])
211-
im_file.multiply_alpha(.5)
211+
im_file.apply_opacity(.5)
212212
# should have effect now that image has transparency
213213
im_file.premultiply()
214214
eq_(get_unique_colors(im_file),['rgba(0,0,0,0)', 'rgba(37,37,37,127)'])

test/python_tests/feature_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_add_geom_wkb():
3939
# POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))
4040
wkb = '010300000001000000050000000000000000003e4000000000000024400000000000002440000000000000344000000000000034400000000000004440000000000000444000000000000044400000000000003e400000000000002440'
4141
geometry = mapnik.Geometry.from_wkb(unhexlify(wkb))
42-
eq_(geometry.is_valid(), False) # False because winding order is wrong according to OGC or because end point != first point
42+
eq_(geometry.is_valid(), True)
4343
eq_(geometry.is_simple(), True)
4444
eq_(geometry.envelope(), mapnik.Box2d(10.0,10.0,40.0,40.0))
4545
geometry.correct()

test/python_tests/image_test.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,10 @@ def test_image_premultiply_values():
4949
eq_(c.b,255)
5050
eq_(c.a,128)
5151

52-
def test_set_alpha():
52+
def test_apply_opacity():
5353
im = mapnik.Image(4,4)
5454
im.fill(mapnik.Color(128,128,128,128))
55-
im.set_alpha(0.75);
56-
c = im.get_pixel(0,0,True)
57-
eq_(c.r,128)
58-
eq_(c.g,128)
59-
eq_(c.b,128)
60-
eq_(c.a,191)
61-
62-
def test_multiply_alpha():
63-
im = mapnik.Image(4,4)
64-
im.fill(mapnik.Color(128,128,128,128))
65-
im.multiply_alpha(0.75);
55+
im.apply_opacity(0.75);
6656
c = im.get_pixel(0,0,True)
6757
eq_(c.r,128)
6858
eq_(c.g,128)
-46 Bytes
-35 Bytes

0 commit comments

Comments
 (0)