Results 1 to 3 of 3

Thread: DirectDraw Transperancy

  1. #1

    Thread Starter
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666

    Angry

    When using the DirectDraw Funciton SetColorKey how do i convert the RGB Value for the color i want into the DDCOLORKEY Structure. I have bright green as my key. I tried:
    Code:
    Key.high = RGB(0,255,0)
    Key.low = RGB(0,255,0)
    That didn't work, the only thing i know is black is
    Code:
    key.high = 0
    key.low = 0
    Can't do that because black is in my pict

    Any help would be great

    Grant
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Just something i got from Fox page:
    Code:
    Function ConvertColor(R As Byte, G As Byte, B As Byte, Surface As DirectDrawSurface7) As Long
    Dim Temp As DDPIXELFORMAT
    
    Dim Red As Single
    Dim Green As Single
    Dim Blue As Single
    Dim Alpha As Single
    
    'Shift colors
    Red = R / 255
    Green = G / 255
    Blue = B / 255
    Alpha = 1
    
    'Get the pixel format
    Surface.GetPixelFormat Temp
    
    'Return the scaled color
    ConvertColor = (Temp.lRGBAlphaBitMask * Alpha And Temp.lRGBAlphaBitMask) + (Temp.lRBitMask * Red And Temp.lRBitMask) + (Temp.lGBitMask * Green And Temp.lGBitMask) + (Temp.lBBitMask * Blue And Temp.lBBitMask)
    End Function
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    It worked, Yeah!!!!
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

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