How to achieve alpha masking with antialias?

I wonder if there is a way to achieve alpha masking with antialias.

The effect I expect is like this
image

1 Like

It should be possible in dev-7.0 with the new masking system, but there is no documentation written yet, as it’s still a pre-release. :slightly_frowning_face:

I now know that alpha masking can be implemented with canvas (LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, LV_COLOR_TRANSP), but this has not been applied with anti-aliasing, so I wonder if there is a way to achieve anti-aliasing.

You don’t need to do it with a canvas; as I understand it 7.0 has the ability to punch holes in normal objects (antialiasing included).

That’s great, how can I achieve this, objmask, any examples?

@kisvegabor
@embeddedt

Hi, I have achieved this now, the primary code like this
lv_obj_t *objmask = lv_objmask_create(lv_scr_act(), NULL);
lv_draw_mask_radius_init(…);
lv_objmask_add_mask(…);
lv_obj_t *obj = lv_obj_create(objmask, NULL);

image

Best regards.

Exactly! :slight_smile:

You can make experiment with the other mask types too.

This mechanisms are working under the hood in new drawing system of dev-7.0 which quite new, so every feedback is highly appreciated!

Okay, very good.

If I want to achieve triangle or polygon alpha masking, then I can apply which mask type.

In trivial cases, you can create them from lines.
For more complicated cases you can draw to an LV_IMG_CF_ALPHA_8BIT canvas and create a map mask from it. Black colors will be masked out, white parts will be kept.

Do this such as lv_line_create(…) or lv_draw_mask_line_param_t…?

YES, I can now create more possibilities with this method.

I meant lv_draw_mask_line_param_t.

Okay.
It would be better if there is such an example.

We’re planning to write some documentation for the new features, but as v7.0 is still under development we haven’t started yet.

1 Like

Very good!