[MPlayer-dev-eng] draw_alpha

Kim Minh Kaplan kmkaplan at selfoffice.com
Wed Dec 5 18:04:01 CET 2001


David Holm writes:

> Could someone please explain the arguments sent to draw_alpha for me?
> Iive on #MPlayerDEV tried two times but I still didn't get it. For one
> thing, if src is an 8bpp grayscale then why would you need a srcstride?
> Etc, need to know so I can start using spuenc...

Here is what I understood from it.

    void draw_alpha(int x0,int y0, int w,int h,
                    unsigned char* src, unsigned char *srca,
                    int stride)

The first four arguments are quite clear: they define the video output
area that will be drawn into.  The fifth (src) is the color plane
(always 1 byte per pixel?) to use for drawing.  The sixth (srca) is
the corresponding alpha value plane¹.  The seventh (stride) argument
is the amount of bytes you have to skip in the color and alpha planes
to get to the next line (that is first line of data is at src, second
line is at src+stride, Nth line is at (src+stride*(N-1)) etc...)

I am not sure why it needs a stride argument, but I think it is meant
for OSD fonts where fonts are just small rectangular are in a bigger
image, in which you need the extra information (the width if the
bigger picture) to know how to get to the next line.

BTW I wrote most of spudec (is that what you meant when you wrote
spuenc?) so if you need more info about it just go ahead.

While on the subject of spudec, I just came across a DVD (Fargo) that
uses 0x7 control code...  Does anybody know how to interpret them?  I
can't view subtitles on it :-(

Kim-Minh.

¹ A few weird rules about alpha values:
    - The sum of color+alpha has to be less than 256.
    - If alpha is 0 then nothing is drawn.  Otherwise the smaller the
      value the more opaque the point.



More information about the MPlayer-dev-eng mailing list