python - Clutter actor content does not blend like it should -
as cluttertexture marked deprecated, followed recommendation , replaced clutteractor has it's content set pixbuf.
from gi.repository import clutter, gdkpixbuf, cogl clutter.init([]) stage = clutter.stage() stage.set_size(600, 300) # old style texture_actor = clutter.texture(filename='icon_big_a.png') texture_actor.set_opacity(127) stage.add_child(texture_actor) # replacement because cluttertexture deprecated pixbuf = gdkpixbuf.pixbuf.new_from_file('icon_big_b.png') pixel_format = cogl.pixelformat.rgba_8888 if pixbuf.get_has_alpha() \ else cogl.pixelformat.rgb_888 image = clutter.image() image.set_data( pixbuf.get_pixels(), pixel_format, pixbuf.get_width(), pixbuf.get_height(), pixbuf.get_rowstride(), ) image_actor = clutter.actor() image_actor.set_content_scaling_filters( clutter.scalingfilter.trilinear, clutter.scalingfilter.linear ) image_actor.set_content(image) image_actor.set_size(pixbuf.get_width(), pixbuf.get_height()) image_actor.set_opacity(127) image_actor.move_by(300, 0) stage.add_child(image_actor) stage.show() clutter.main()
everything works when change actors opacity 127, darkens background it's white.
here git repo code , screenshot of problem
when set opacity 255 looks should, white white.
you need update version of clutter version greater than, or equal to, 1.16.2 (the latest 1.16 release 1.16.4). there bug in clutterimage
caused blend color premultiplied unnecessarily:
Comments
Post a Comment