This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Qt Widget Overlay on Video - Alpha (ARGB)? or Color Key?

Other Parts Discussed in Thread: DM3730, OMAP3530

We have successfully been able to semi-transparently overlay Qt widgets on top of video using the below script.

  • We use the global_alpha value to obtain the semi-transparent overlay of the widget over the video.
  • We use color keying of green (green = 0xff, red and blue both 0)

#!/bin/sh
KEY=255
GREEN_KEY=$((KEY * 256))
echo 1 > /sys/devices/platform/omapdss/manager0/alpha_blending_enabled
echo 200 > /sys/devices/platform/omapdss/overlay0/global_alpha
echo 1 > /sys/devices/platform/omapdss/manager0/trans_key_enabled
echo $GREEN_KEY > /sys/devices/platform/omapdss/manager0/trans_key_value
/opt/qt/demos/mydemo/mydemo -qws

We can clearly see the color-keyed video passed through.  However, what we really wanted to do was use the ARGB's alpha value for transparency instead of color keying.  We have tried several things, but have been unsuccessful.  Does anyone have a simple Qt demo that does that?  Any suggestions for what to configure in Qt to allow that to work properly?   It seems to work on the Windows desktop using the following code, but not on the OMAP 3530:

#include <QtGui/QApplication>

#include "mainwindow.h"

int main(int argc, char *argv[])

{

    QApplication a(argc, argv);

    MainWindow w;

    w.setWindowFlags(Qt::FramelessWindowHint);

    w.setAttribute(Qt::WA_TranslucentBackground, true);

    w.show();

    return a.exec();

}

  • Here are steps to enable pixel alpha in Qt:

    1. Config framebuffer to ARGB32 format;

    2. Draw the Qt widgets to be translucent in ARGB color with the alpha value you want;

    3. Enable DSS pixel alpha blending in video overlay;

    4. Run the app with "-bg transparent" cmdline option.

  • Hi  Liu ,

    please do you have any ready to use example or tutorial on how to do in SW   your seqeunce ?

    in particular  how to set the Framebuffer  to argb32   ,  and how to compile  the app  to have the -bg transparent option

     

    thank you

     

    bye

     

    Carlo

  • If you have downloaded dvsdk4.0 for DM3730, please look at the dvsdk_demos source.

    step 1 - Config framebuffer to ARGB32 is done in OSDManager::setupOsd() in dvsdk-demos_4_00_00_18/qtInterface/osdmanager.cpp.

    step 3 - Enable DSS pixel alpha blending in video overlay is done in enableAlphaBlending() in dvsdk-demos_4_00_00_18/omap3530/decode/display.c. If you use gstreamer, you might have to make sure it has been done in the gstreamer plugin, maybe in the videosink plugin? I am not familiar with gstreamer plugins.

    step 4 - Run the app with "-bg transparent" cmdline option: The dvsdk demo does not use this option, it is set as QWSServer::setBackground(QBrush(QColor(0, 0, 0, 0))) in dvsdk-demos_4_00_00_18/qtInterface/main.cpp line 209. They have the same effect basically.

  • hi,

    i had tired with your suggestion and after a small modifications to fit my LCD 800x480, i run the app as ./qtInterface -y 8 -O 6  -bg transparent -qws

    -y 8 is add to support the custom LCD.And i think "-bg transparent" is useless here. so i change the source code with

    #ifdef Platform_omap3530
        QWSServer::setBackground(QBrush(QColor(0, 0, 0, 0)));
    #endif
     //mike add to test transparence
     QWSServer::setBackground(QBrush(QColor(0, 0, 0, 0)));

    cus we are using dm365 custom borad.

    and then we get the picture you can see above. i think the transparent is already done, but..

    after the pen skiing on  the left part of LCD, the left pad shows with some kinds of "patterned"...see here:

     

    i dont konw why.

    i thought the background is already black and if  it(fb0=osd0) is transparent, the part without any widget there must be filled with the video lay (vid0=fb1) which i had tryed to use dd command to write some yuv files into

    dd if=/linux.yuv of=/dev/fb1

     and.. i had tryed to use

    blend 15

    form dvsdk\psp\linux-driver-examples-psp03.01.01.38\fbdev\blend

    any ideas ???

     

    regards, Mike

     

  • by the way, why there is not such a file there in our custom borad ? ?

    /sys/devices/platform/omapdss/manager0/alpha_blending_enabled

  • Hi Bin Liu,

    Can you tell me if it's possible to achieve this with a DM365 using DVSDK 2_10_00_17?

    Thanks!


    Marlon