Skip to content

Commit b3fc5ff

Browse files
committed
patch to fix issue matplotlib#2473.
The change to the agg propagate to how `imsave` works so one test had to be changed to account for the fact that pixels with alpha=0 are now set to (1, 1, 1, 0) instead of (0, 0, 0, 0).
1 parent 498e249 commit b3fc5ff

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

lib/matplotlib/tests/test_image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ def test_imsave_color_alpha():
147147
# Wherever alpha values were rounded down to 0, the rgb values all get set
148148
# to 0 during imsave (this is reasonable behaviour).
149149
# Recreate that here:
150-
data[data[:, :, 3] == 0] = 0
150+
for j in range(3):
151+
data[data[:, :, 3] == 0, j] = 1
151152

152153
assert_array_equal(data, arr_buf)
153154

src/_backend_agg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ RendererAgg::RendererAgg(unsigned int width, unsigned int height, double dpi,
430430
renderingBuffer.attach(pixBuffer, width, height, stride);
431431
pixFmt.attach(renderingBuffer);
432432
rendererBase.attach(pixFmt);
433-
rendererBase.clear(agg::rgba(0, 0, 0, 0));
433+
rendererBase.clear(agg::rgba(1, 1, 1, 0));
434434
rendererAA.attach(rendererBase);
435435
rendererBin.attach(rendererBase);
436436
hatchRenderingBuffer.attach(hatchBuffer, HATCH_SIZE, HATCH_SIZE,

0 commit comments

Comments
 (0)