Results 1 to 3 of 3

Thread: DirectX Transparency Query

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 1999
    Location
    Singapore
    Posts
    32

    Post

    Refering to DirectX development.
    Anyone figured out how to use the DDCOLORKEY type?? I need to make a certain colour (bright purple to be exact) transparent, but I don't know how to use the .high and .low values. Who's found out?

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134

    Lightbulb

    Use This:

    Code:
    Sub Whatever
    Dim CKey As DDCOLORKEY
    Dim Surface1 as DirectDrawSurface7
    dim DescS1 as DDSURFACEDESC2
    Dim Transparent as long 
       
       Transparent=rgb(255,0,255)
       ckey.low=transparent
       ckey.high=transparent
    
       DFlash.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
       DFlash.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
       DFlash.lWidth = 100
       DFlash.lHeight = 100
        
       Set Surface1 = DDraw.CreateSurfaceFromFile(App.Path & "\mybmp.bmp", DescS1)
    
       Surface1.SetColorKey DDCKEY_SRCBLT, CKey
    
    End Sub
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    That would only work if your project uses 24-bit color... (I'm unsure about that). Anyway, here's a function to convert RGB to DirectX-Color.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width