MAKE TRANSPARENT IMAGE BLINKING

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • MAKE TRANSPARENT IMAGE BLINKING

      Hello
      i have an IMAGE widget containing a PNG file. I want to have this image with transparency and make it blink (sometimes we see the balckground trough this image, and sometime we only see the baclground)



      1) I created the image in the frame with :
      { IMAGE_CreateIndirect, "DLC_not_active", ID_IMAGE_DLC_NO_ACTIVE_3, 13, 9, 241, 174, WM_CF_SHOW, IMAGE_CF_MEMDEV | IMAGE_CF_ALPHA, 0 },

      2) i set png file to this widget :
      case WM_INIT_DIALOG:

      hItem = WM_GetDialogItem(hWin, ID_IMAGE_DLC_NO_ACTIVE_3);
      WM_SetCallback(hItem, _cbDLC_not_active2);
      IMAGE_SetPNG(hItem, &_acImage_DLC_not_active_transparent, sizeof(_acImage_DLC_not_active_transparent));

      3) in the call back i call GUI_PNG_Draw :
      case WM_PAINT:
      GUI_EnableAlpha(1);
      if (DLG_Load_menu_hide_show == 1)
      GUI_PNG_Draw(&_acImage_DLC_not_active_transparent, sizeof(_acImage_DLC_not_active_transparent), 0, 0);
      GUI_EnableAlpha(0);

      4) on timer event i call WM_HideWindow/WM_ShowWin
      if (DLG_Load_menu_hide_show == 0)
      {
      WM_HideWindow(hItem);
      DLG_Load_menu_hide_show = 1;

      }
      else
      {
      WM_ShowWin(hItem);
      DLG_Load_menu_hide_show = 0;
      }


      The problem is that i can't make the image blinking (make it disapear)
      It seems that with a bitmap i don't have this problem (i don't need the call back and the blinking is OK)

      A) How can i make the image disapear ?

      B)It seems that the PNG image has contains transparency information to display it with transparency : can we diplay a non transparent PNG image in a IMAGE WIDGET with transparency ?


      Thanks
      best regards
    • Hi,

      Attached is an example which shows three different ways of letting an image blink.

      The first way is to create a dialog with an IMAGE widget and just hide/show the IMAGE widget each time a timer expires.

      The second is more or less the same but without a dialog. The IMAGE widget gets created as child of the desktop window.

      The third way is creating a simple window and manage drawing of the PNG in the callback.

      A) How can i make the image disapear ?
      See above. I guess the easiest way is to hide/show the IMAGE widget. No need to overwrite a callback.

      B)It seems that the PNG image has contains transparency information to
      display it with transparency : can we diplay a non transparent PNG image
      in a IMAGE WIDGET with transparency ?
      Of course, there is no difference in how the PNG gets displayed.

      There is no need to use GUI_EnableAlpha(). You should try to avoid this because it can have a big impact on the performance.

      Regards,
      Sven