Weird gtk_snapshot_push_opacity, is bug?

GtkSnapshot* child_snapshot = snapshot;  // gtk_snapshot_new();
gtk_snapshot_push_opacity( child_snapshot, 0.4 );
gtk_widget_snapshot_child( widget, child, child_snapshot )
gtk_snapshot_pop( child_snapshot );
GtkSnapshot* child_snapshot = gtk_snapshot_new();

gtk_snapshot_push_opacity( child_snapshot, 0.4 );
gtk_widget_snapshot_child( widget, child, child_snapshot )
gtk_snapshot_pop( child_snapshot );

gtk_snapshot_append_node( snapshot, gtk_snapshot_free_to_node( child_snapshot ) );

what should I do?

图片

I think the transparency has taken effect, but for some reason, the yellow one is not being lowered.

There is no problem with the above code, I found the problem. this confused me.

I just need to add the following code for the child control

gtk_snapshot_push_opacity( snapshot, 1.0 );
gtk_snapshot_append_color( snapshot, &color, &GRAPHENE_RECT_INIT( 0, 0, offset, height / 2 ) );
gtk_snapshot_pop(snapshot);

to get the transparency to work

a

a2

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.