Per-pixel alpha blitting question

Hi all,

Apologies if something like this has been asked, before but I haven’t
been able to figure it out based on the documentation.

I have two images: a background image with no transparency, and a “fuzzy
blob” png with per-pixel alpha. I’d like to create a surface with the
some solid TTF text blitted on top of the fuzzy blob png, and be able to
blit this surface onto the background image such that the alpha channel
of the blob is retained. I’ve thought of two ways to do this, and
neither really works.

If I draw the TTF text onto the blob png surface directly, it is
transparent with the blob alpha rather than being solid. If I create a
separate, blank surface and blit the blob png onto it, and then draw the
text, the result looks good except that the background is black when I
blit it on to the background image, i.e. the alpha isn’t being kept.

I’ve played around with various combinations of setAlpha() and I can’t
get either way to work. Am I doing something wrong? The blob+text
combination will be rotated, scaled, and moved around the display very
rapidly, so I’d like to have it on its own surface.

(And ultimately I’d like to place another png with per-pixel alpha on
top of the blob, so I need a generic solution rather than something
TTF-specific…)

Thanks for any advice,–
William <@William_Morgan>