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. Transparency in DirectDraw

Transparency in DirectDraw

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsgame-devquestionannouncement
2 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.
  • H Offline
    H Offline
    Hanan888
    wrote on last edited by
    #1

    I'm developing an animated game. For various reasons, we port the version to use DirectDraw interfaces. I'm having a hard time to draw bitmaps with transparent white parts. I'm doing this to every bitmap:

    // Set the color key for this bitmap.
    //
    // Whatever color is at entry 255 in the palette will be the
    // transparent color for blits. This color is black unless
    // you used the DDPCAPS_ALLOW256 flag when the palette was
    // created

    DDCOLORKEY ddck;
    ddck.dwColorSpaceLowValue = 0x00 /* 0xff */;
    ddck.dwColorSpaceHighValue = 0x00 /* 0xff */;

    // lpDDSSomeBitmapSurface is a DirectDraw surface with a
    // bitmap loaded into it. This needs to be done for each
    // surface containing a bitmap.
    lpDDSSomeBitmapSurface->SetColorKey( DDCKEY_SRCBLT, &ddck );

    But it doesn't make it. Is it something to do with palettes ?

    R 1 Reply Last reply
    0
    • H Hanan888

      I'm developing an animated game. For various reasons, we port the version to use DirectDraw interfaces. I'm having a hard time to draw bitmaps with transparent white parts. I'm doing this to every bitmap:

      // Set the color key for this bitmap.
      //
      // Whatever color is at entry 255 in the palette will be the
      // transparent color for blits. This color is black unless
      // you used the DDPCAPS_ALLOW256 flag when the palette was
      // created

      DDCOLORKEY ddck;
      ddck.dwColorSpaceLowValue = 0x00 /* 0xff */;
      ddck.dwColorSpaceHighValue = 0x00 /* 0xff */;

      // lpDDSSomeBitmapSurface is a DirectDraw surface with a
      // bitmap loaded into it. This needs to be done for each
      // surface containing a bitmap.
      lpDDSSomeBitmapSurface->SetColorKey( DDCKEY_SRCBLT, &ddck );

      But it doesn't make it. Is it something to do with palettes ?

      R Offline
      R Offline
      Rajkumar R
      wrote on last edited by
      #2

      Hanan888 wrote:

      ddck.dwColorSpaceLowValue = 0x00 /* 0xff */;ddck.dwColorSpaceHighValue = 0x00 /* 0xff */;

      Hanan888 wrote:

      But it doesn't make it.

      Means, it transparent blitting is not happening? possibly you are setting the palette index as 0x00 which may not contain the white color. why don't you use 0xff only and set the color white in the palette entry at 0xff when the palette is created.

      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