[Scummvm-devel] Transparent overlay

Marcus Comstedt marcus at mc.pp.se
Sun Apr 3 12:54:25 CEST 2005


Earlier today I posted a message to the list about wanting to have
real alpha for the overlay, in order to not have to do ugly stuff in
the clearOverlay function.  While it looks like this message hasn't
been disributed by the mailing list yet, I have already implemented
and commited this, as it was actually quite simple to do.  :-)

There are now two new functions ARGBToColor and colortoARGB in the
OSystem interface which work like their RGB counterparts but with
alpha.  There are default implementations which discard the alpha /
set it to 0xff, so ports not having real alpha don't need to do
anything.  There is also a new advistory function hasAlpha() which can
be used to test whether real alpha is available (default
implementation returns false).

The only code that did any actual blending as far as I could find was
NewGui::blendRect, so I fixed that one to use real alpha blending when
available.

Then I changed the Dreamcast port to use ARGB4444 for the overlay, and
clearOverlay() to do just that; clear the overlay to alpha=0.  Works
like a charm.

Something which I assume remains to be done is to add support for
gBitFormat == 4444 to animation.cpp.  Optionally it could be added to
the software scaler as well, but it's not needed for the Dreamcast
port (which currently is the only one using 4444) as it doesn't use
the software scaler.

(And I'd still like to know for sure about the expected resolution,
 size and position of the overlay given various screen sizes and scale
 factors...)


  // Marcus






More information about the Scummvm-devel mailing list