FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Transparent window
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Transparent window
Posted: Thu Sep 15, 2022 08:30 AM

Hi,

Is it possible to make a transparent window with animated .gif ? The higher the transparency of the window (oDlg:nOpacity), the paler the gif image becomes :cry:

Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Transparent window
Posted: Thu Sep 15, 2022 11:18 AM
hi,

how does animated GIF work under FiveWin :-)

---

using DMW i can get "Glass Effect" when use {1,1,1} as Backgroud Color
so if Backgound of GIF is {1,1,1} you might get a "transparent" animated GIF

have a look here https://forums.fivetechsupport.com/viewtopic.php?f=3&t=42116
greeting,

Jimmy
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Transparent window
Posted: Thu Sep 15, 2022 01:00 PM

Thanks Jimmy ! I looked at DWM but didn't understand how I can use it :(

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Transparent window
Posted: Thu Sep 15, 2022 06:18 PM
Natter wrote:Hi,

Is it possible to make a transparent window with animated .gif ? The higher the transparency of the window (oDlg:nOpacity), the paler the gif image becomes :-)


Instead of nOpacity, please use nSeeThroClr.

This is a sample:
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "gif.ch"

function Main()

   local oWnd, oGif

   DEFINE WINDOW oWnd STYLE WS_POPUP

   @ 0,140 GIF oGif SIZE 240,260 FILE "..\gifs\forgif.gif" OF oWnd ;
      ADJUST ACTION oWnd:End()

   oWnd:nSeeThroClr  := CLR_WHITE

   ACTIVATE WINDOW oWnd CENTERED

return nil


Regards



G. N. Rao.

Hyderabad, India
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Transparent window
Posted: Thu Sep 15, 2022 06:53 PM

spectacular master nages.

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Transparent window
Posted: Fri Sep 16, 2022 08:19 AM

Rao, excuse me, but I didn't understand how using the nSeeThroClr option would help to get a transparent window. I put together your example and got an animated Gif on a white window

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Transparent window
Posted: Fri Sep 16, 2022 10:18 AM

Did you build and run the same sample without any changes atleast once?

Regards



G. N. Rao.

Hyderabad, India
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Transparent window
Posted: Fri Sep 16, 2022 11:09 AM

Everything works with the "Window", but "Dialog" cannot be made transparent

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Transparent window
Posted: Fri Sep 16, 2022 11:42 AM
Please try this:
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "gif.ch"

function Main()

   local oDlg, oGif

   DEFINE DIALOG oDlg SIZE 400, 300 PIXEL ;
      STYLE WS_POPUP COLOR CLR_BLACK,CLR_WHITE

   oDlg:nSeeThroClr := CLR_WHITE

   oDlg:bInit := <||
      @ 0,140 GIF oGif SIZE 240,260 FILE "..\gifs\forgif.gif" OF oDlg ;
         ADJUST ACTION oDlg:End()
      return nil
      >

   ACTIVATE DIALOG oDlg CENTERED ;

return nil


Please try another sample
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "gif.ch"

function Main()

   local oDlg, oGif

   DEFINE DIALOG oDlg SIZE 400, 300 PIXEL ;
      STYLE WS_POPUP COLOR CLR_BLACK,RGB(255,254,254)

   oDlg:nSeeThroClr := RGB(255,254,254)

   oDlg:bInit := <||
      @ 0,140 GIF oGif SIZE 240,260 FILE "..\gifs\halo.gif" OF oDlg ;
         ADJUST ACTION oDlg:End()
      return nil
      >

   ACTIVATE DIALOG oDlg CENTERED ;

return nil


Regards



G. N. Rao.

Hyderabad, India
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Transparent window
Posted: Fri Sep 16, 2022 12:26 PM

Everything is fine. Thank you very much.

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Transparent window
Posted: Fri Sep 16, 2022 12:34 PM

IMPORTANT:
Now, some explanation about the DATA nSeeThroClr.

When you assign any color value to oWnd/oDlg:nSeeThroClr, that color will be treated as transparent while the window/dialog is displayed.

When you choose a GIF, you should also know its background color. Also choose a gif, whoose background color is perfectly uniform.

While creating the dialog or window, set its colors to:
DEFINE oWnd/oDlg ...... COLOR <anyclr>, <background color of the gif)

Now, set the same background color to oDlg:nSeeThroClr

Regards



G. N. Rao.

Hyderabad, India
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Transparent window
Posted: Fri Sep 16, 2022 12:56 PM

Yes, you are right, it was in the difference of the background color of the window color :nSeeThroClr that my mistake was :oops:

Continue the discussion