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. Alpha-channel in the bitmap

Alpha-channel in the bitmap

Scheduled Pinned Locked Moved C / C++ / MFC
graphicstutorialquestion
4 Posts 2 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.
  • E Offline
    E Offline
    Eugene Pustovoyt
    wrote on last edited by
    #1

    How to know whether a bitmap has an alpha-channel or not? Best regards, Eugene Pustovoyt

    C 1 Reply Last reply
    0
    • E Eugene Pustovoyt

      How to know whether a bitmap has an alpha-channel or not? Best regards, Eugene Pustovoyt

      C Offline
      C Offline
      Christopher Lloyd
      wrote on last edited by
      #2

      I'm assuming you have this bitmap in memory - if it's in a file then other methods apply. bool BitmapHasAlpha (HBITMAP hBitmap) { //Vars Bitmap BITMAP; //Get info about the bitmap GetObject (hBitmap, &Bitmap, sizeof(Bitmap)); //Bitmaps with alpha channel use 32 bits per pixel return Bitmap.bmBitsPixel == 32; } Of course, there's no guarantee that the alpha channel is actually being used!

      E 1 Reply Last reply
      0
      • C Christopher Lloyd

        I'm assuming you have this bitmap in memory - if it's in a file then other methods apply. bool BitmapHasAlpha (HBITMAP hBitmap) { //Vars Bitmap BITMAP; //Get info about the bitmap GetObject (hBitmap, &Bitmap, sizeof(Bitmap)); //Bitmaps with alpha channel use 32 bits per pixel return Bitmap.bmBitsPixel == 32; } Of course, there's no guarantee that the alpha channel is actually being used!

        E Offline
        E Offline
        Eugene Pustovoyt
        wrote on last edited by
        #3

        Yes of cause. This method don't guaranted a result. May be better searching a value more then zero in the fourth byte of COLORREF? Best regards, Eugene Pustovoyt


        ICQ UIN: 161325180

        C 1 Reply Last reply
        0
        • E Eugene Pustovoyt

          Yes of cause. This method don't guaranted a result. May be better searching a value more then zero in the fourth byte of COLORREF? Best regards, Eugene Pustovoyt


          ICQ UIN: 161325180

          C Offline
          C Offline
          Christopher Lloyd
          wrote on last edited by
          #4

          Where does the bitmap come from?

          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