Harris6310 Posted April 4, 2012 Author Share Posted April 4, 2012 I was wondering how I could set the transparency mask colour to just plain white instead of the top left pixel. I found the right sub-routine, how would I change it?```' This sub gets the mask color from the surface loaded from a bitmap imagePublic Sub SetMaskColorFromPixel(ByRef TheSurface As DirectDrawSurface7, ByVal x As Long, ByVal y As Long)Dim TmpR As RECTDim TmpDDSD As DDSURFACEDESC2Dim TmpColorKey As DDCOLORKEY ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler With TmpR .Left = x .top = y .Right = x .Bottom = y End With TheSurface.Lock TmpR, TmpDDSD, DDLOCK_WAIT Or DDLOCK_READONLY, 0 With TmpColorKey .Low = TheSurface.GetLockedPixel(x, y) .High = .Low End With TheSurface.SetColorKey DDCKEY_SRCBLT, TmpColorKey TheSurface.Unlock TmpR ' Error handler Exit Suberrorhandler: HandleError "SetMaskColorFromPixel", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub``` Link to comment Share on other sites More sharing options...
Harris6310 Posted April 4, 2012 Author Share Posted April 4, 2012 Bump. Link to comment Share on other sites More sharing options...
sirsk8aton Posted April 4, 2012 Share Posted April 4, 2012 Change```With TmpColorKey .Low = TheSurface.GetLockedPixel(x, y) .High = .Low End With```To```With TmpColorKey .Low = RGB(255, 255, 255) .High = .Low End With``` Link to comment Share on other sites More sharing options...
Harris6310 Posted April 4, 2012 Author Share Posted April 4, 2012 @Noth:> Change> ```> With TmpColorKey> .Low = TheSurface.GetLockedPixel(x, y)> .High = .Low> End With> > ```> To> ```> With TmpColorKey> .Low = RGB(255, 255, 255)> .High = .Low> End With> > ```That simple, eh? Thanks for your help. Link to comment Share on other sites More sharing options...
sirsk8aton Posted April 4, 2012 Share Posted April 4, 2012 Yep :P Np man Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now