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#
  4. Alpha Channel in DirectX

Alpha Channel in DirectX

Scheduled Pinned Locked Moved C#
questiongame-devgraphicstutorial
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.
  • R Offline
    R Offline
    Rob Tomson
    wrote on last edited by
    #1

    i'm making a 2d sprite game with directx but i can't figure out how to use the alpha channel so that parts of my images are transparent. what is the best type of image to use, .png, .bmp? and how do i apply an alpha channel to them. thanks, Rob Tomson -- There are 10 kinds of people. Those who understand binary and those who don't.

    H 1 Reply Last reply
    0
    • R Rob Tomson

      i'm making a 2d sprite game with directx but i can't figure out how to use the alpha channel so that parts of my images are transparent. what is the best type of image to use, .png, .bmp? and how do i apply an alpha channel to them. thanks, Rob Tomson -- There are 10 kinds of people. Those who understand binary and those who don't.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      .bmp does not support alpha channels, nor does .jpg, .gif, or .tiff. .gif only supports an indexed color to serve as a transparency, which is the same as what is done for 24-bit and lower .ico files. .png does support alpha channels. You can find lots of information about image formats by searching the web, but this forum is not the appropriate place for questions not related to using C#. You can also use Image.IsAlphaPixelFormat on each member of the PixelFormat enumeration to see which ones that GDI+ (which .NET uses for the graphics classes) supports support alpha channels. If you're question is about how to use such images in C# then see the Image class in the .NET Framework SDK. Managed DirectX can also make use of these, as well as native code. Use Bitmap.GetHbitmap to get an IntPtr that represents the HBITMAP (native handle to a bitmap data structure, which describes about any image format) for calls to native APIs that require an HBITMAP. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

      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