Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. tough nut

tough nut

Scheduled Pinned Locked Moved C / C++ / MFC
graphicstutorialquestion
11 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Great ATuin
    wrote on last edited by
    #1

    hi folks, ok, i hope i can describe this in a way that will be understandable :) so here's what i plan to do: i want to display a splash screen with an alpha channel. neither the bitmaps rectangle nor the surrounding color of my graphic should visible. i.e. i need to set the surrounding color to be drawn 100% transparent. not difficult so far. but here's the tough part. namely, i want the splash screen to appear like it comes from nowhere. it should start with a opacity of 0% (i.e. 100% transparence) and within a few seconds it should become more and more visible until it has a final opacity of 100%. confused ? me too ;) i'm only able to display the graphic without the surrounding stuff (alpha value) when the graphics opacity is set to 100%. but when it comes to the piont where i need to set the opacity to a lower value and still want to make the surrounding color of my graphic completely invisible i'm starting to freak out. i don't know how to achieve this. i would be very glad about some hints ... any hints :wtf: thanks in advance.

    PJ ArendsP O 2 Replies Last reply
    0
    • G Great ATuin

      hi folks, ok, i hope i can describe this in a way that will be understandable :) so here's what i plan to do: i want to display a splash screen with an alpha channel. neither the bitmaps rectangle nor the surrounding color of my graphic should visible. i.e. i need to set the surrounding color to be drawn 100% transparent. not difficult so far. but here's the tough part. namely, i want the splash screen to appear like it comes from nowhere. it should start with a opacity of 0% (i.e. 100% transparence) and within a few seconds it should become more and more visible until it has a final opacity of 100%. confused ? me too ;) i'm only able to display the graphic without the surrounding stuff (alpha value) when the graphics opacity is set to 100%. but when it comes to the piont where i need to set the opacity to a lower value and still want to make the surrounding color of my graphic completely invisible i'm starting to freak out. i don't know how to achieve this. i would be very glad about some hints ... any hints :wtf: thanks in advance.

      PJ ArendsP Offline
      PJ ArendsP Offline
      PJ Arends
      wrote on last edited by
      #2

      Some ideas: 1: Do a screen grab of the area your splash screen will cover. In memory use the grabbed bitmap as the background, draw your splash screen on it. Blit that bitmap to the screen. Not true transparency, but it will appear that way to the user. 2: Use a window region (HRGN) that corresponds to the opaque part of your splash screen.


      "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

      Within you lies the power for good; Use it!

      G 1 Reply Last reply
      0
      • G Great ATuin

        hi folks, ok, i hope i can describe this in a way that will be understandable :) so here's what i plan to do: i want to display a splash screen with an alpha channel. neither the bitmaps rectangle nor the surrounding color of my graphic should visible. i.e. i need to set the surrounding color to be drawn 100% transparent. not difficult so far. but here's the tough part. namely, i want the splash screen to appear like it comes from nowhere. it should start with a opacity of 0% (i.e. 100% transparence) and within a few seconds it should become more and more visible until it has a final opacity of 100%. confused ? me too ;) i'm only able to display the graphic without the surrounding stuff (alpha value) when the graphics opacity is set to 100%. but when it comes to the piont where i need to set the opacity to a lower value and still want to make the surrounding color of my graphic completely invisible i'm starting to freak out. i don't know how to achieve this. i would be very glad about some hints ... any hints :wtf: thanks in advance.

        O Offline
        O Offline
        Owner drawn
        wrote on last edited by
        #3

        Did you try the AlphaBlend function... This will help you... http://www.codeproject.com/gdi/alphablend.asp[^]

        Jesus Loves:rose:

        --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

        G 1 Reply Last reply
        0
        • PJ ArendsP PJ Arends

          Some ideas: 1: Do a screen grab of the area your splash screen will cover. In memory use the grabbed bitmap as the background, draw your splash screen on it. Blit that bitmap to the screen. Not true transparency, but it will appear that way to the user. 2: Use a window region (HRGN) that corresponds to the opaque part of your splash screen.


          "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

          G Offline
          G Offline
          Great ATuin
          wrote on last edited by
          #4

          nice idea, actually. and i've already tried it. there is just one problem. the graphic i want to show is not rectangular (neither elliptic) it's a custom hand drawn one. so if i draw my splash on the background image and make it slightly transparent the whole graphic (including the surrounding alpha color) will be visible on it. you understand ? but the alpha color should be complete invisible during the entire appearance procedure.

          PJ ArendsP 1 Reply Last reply
          0
          • O Owner drawn

            Did you try the AlphaBlend function... This will help you... http://www.codeproject.com/gdi/alphablend.asp[^]

            Jesus Loves:rose:

            --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

            G Offline
            G Offline
            Great ATuin
            wrote on last edited by
            #5

            yeah. i use it already. AlphaBlend and SetLayeredWindowAttributes are the two main functions with those i'm trying to get this done. But they don't last out.

            O 1 Reply Last reply
            0
            • G Great ATuin

              yeah. i use it already. AlphaBlend and SetLayeredWindowAttributes are the two main functions with those i'm trying to get this done. But they don't last out.

              O Offline
              O Offline
              Owner drawn
              wrote on last edited by
              #6

              Take a look at the sample...

              Jesus Loves:rose:

              --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

              G 1 Reply Last reply
              0
              • O Owner drawn

                Take a look at the sample...

                Jesus Loves:rose:

                --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

                G Offline
                G Offline
                Great ATuin
                wrote on last edited by
                #7

                selecting rectangular bitmaps and AlphaBlending them is not my problem. i need to get it done with non-rectangular bitmaps.

                O 2 Replies Last reply
                0
                • G Great ATuin

                  nice idea, actually. and i've already tried it. there is just one problem. the graphic i want to show is not rectangular (neither elliptic) it's a custom hand drawn one. so if i draw my splash on the background image and make it slightly transparent the whole graphic (including the surrounding alpha color) will be visible on it. you understand ? but the alpha color should be complete invisible during the entire appearance procedure.

                  PJ ArendsP Offline
                  PJ ArendsP Offline
                  PJ Arends
                  wrote on last edited by
                  #8

                  Use an intermediate step. Use two memory bitmaps containing the background image. On one draw your splash screen with TransparentBlt() (Image is 100% opaque, alpha colour 100% transparent), then draw that image at the transparency you want onto the second bitmap. Because the "transparent" parts are the same colour the alpha blending will appear transparent. As for the window region idea, you should be able to adapt the code found at http://www.codeproject.com/buttonctrl/irregular_buttons.asp[^] to create the reguired window region for your splash screen.


                  "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

                  Within you lies the power for good; Use it!

                  1 Reply Last reply
                  0
                  • G Great ATuin

                    selecting rectangular bitmaps and AlphaBlending them is not my problem. i need to get it done with non-rectangular bitmaps.

                    O Offline
                    O Offline
                    Owner drawn
                    wrote on last edited by
                    #9

                    You've got to use SetWindowRegion and AlphaBlend together.

                    Jesus Loves:rose:

                    --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

                    1 Reply Last reply
                    0
                    • G Great ATuin

                      selecting rectangular bitmaps and AlphaBlending them is not my problem. i need to get it done with non-rectangular bitmaps.

                      O Offline
                      O Offline
                      Owner drawn
                      wrote on last edited by
                      #10

                      This one is all about Alpha Blending of non-rectangular bitmaps http://www.codeproject.com/miscctrl/csplashscreenex.asp[^]

                      Jesus Loves:rose:

                      --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

                      G 1 Reply Last reply
                      0
                      • O Owner drawn

                        This one is all about Alpha Blending of non-rectangular bitmaps http://www.codeproject.com/miscctrl/csplashscreenex.asp[^]

                        Jesus Loves:rose:

                        --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

                        G Offline
                        G Offline
                        Great ATuin
                        wrote on last edited by
                        #11

                        yesss that's it! thanks a lot!! ... AnimateWindow was completely new to me :doh:

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups