Merge pull request #5434 from radarhere/text_alpha

This commit is contained in:
Hugo van Kemenade 2021-05-09 22:17:58 +03:00 committed by GitHub
commit 649eaae360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

View File

@ -236,7 +236,7 @@ class TestImagingPaste:
[ [
(127, 191, 254, 191), (127, 191, 254, 191),
(111, 207, 206, 110), (111, 207, 206, 110),
(255, 255, 255, 0) if mode == "RGBA" else (127, 254, 127, 0), (127, 254, 127, 0),
(207, 207, 239, 239), (207, 207, 239, 239),
(191, 191, 190, 191), (191, 191, 190, 191),
(207, 206, 111, 112), (207, 206, 111, 112),

View File

@ -131,6 +131,9 @@ class TestImageFont:
target = "Tests/images/transparent_background_text.png" target = "Tests/images/transparent_background_text.png"
assert_image_similar_tofile(im, target, 4.09) assert_image_similar_tofile(im, target, 4.09)
target = "Tests/images/transparent_background_text_L.png"
assert_image_similar_tofile(im.convert("L"), target, 0.01)
def test_textsize_equal(self): def test_textsize_equal(self):
im = Image.new(mode="RGB", size=(300, 100)) im = Image.new(mode="RGB", size=(300, 100))
draw = ImageDraw.Draw(im) draw = ImageDraw.Draw(im)

View File

@ -436,7 +436,7 @@ fill_mask_L(
strcmp(imOut->mode, "La") == 0 || strcmp(imOut->mode, "La") == 0 ||
strcmp(imOut->mode, "LA") == 0 || strcmp(imOut->mode, "LA") == 0 ||
strcmp(imOut->mode, "PA") == 0) && strcmp(imOut->mode, "PA") == 0) &&
i != 3) { i != 3 && channel_mask != 0) {
channel_mask = channel_mask =
255 - (255 - channel_mask) * (1 - (255 - out[3]) / 255); 255 - (255 - channel_mask) * (1 - (255 - out[3]) / 255);
} }