MSFN Forum: [VB] Alpha Blend - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[VB] Alpha Blend Windows 98 or later only Rate Topic: -----

#1 User is offline   ABEO 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 304
  • Joined: 02-June 03

Posted 08 June 2003 - 05:11 PM

This is my first time posting code so be nice:

Put this code in the Declerations(at the top):
Option Explicit
 '*************************************
 'Copyright © 2001 by Alexander Anikin
 '& DREAM Interactive - QQQ
 'e-mail: aka@i.com.ua
 'For more my code samples visit:
 'http://hotmix.narod.ru
 '*************************************
Private Declare Function AlphaBlend Lib "msimg32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal widthSrc As Long, ByVal heightSrc As Long, ByVal dreamAKA As Long) As Long                          'only Windows 98 or Later
Dim Num As Byte, nN%, nBlend&


This is the simple stuff :):
Private Sub Form_Activate()
 Call Run_Blending
End Sub

Private Sub Form_Unload(Cancel As Integer)
 End
End Sub


Now for the effects :D

You need to add a picture box and name it 'picSrc'.
Then find the two pictures you wish to blend and set one as the background of the form, and the other as the picture in picSrc.

Then add this code:
Private Sub Run_Blending()
Num = 255
nN = 5
Do
 DoEvents
 '***********************************************
  nBlend = vbBlue - CLng(Num) * (vbYellow + 1)
 'It's Magic Formula is
 'Alchemical Mixture of Elements of Gold & Sky
 'It's obtained by an almost mystical way
 '***********************************************
 Num = Num - nN
 If Num = 0 Then
   nN = -5
 ElseIf Num = 255 Then
   nN = 5
 End If
 Me.Cls
 AlphaBlend Me.hDC, 0, 0, picSrc.ScaleWidth, picSrc.ScaleHeight, picSrc.hDC, 0, 0, picSrc.ScaleWidth, picSrc.ScaleHeight, nBlend
Loop
End Sub


Change the value of 'nN' to increase/decrease speed of the blend, all comments by the original author have been left in the code(I just wanted to show you something cool that you may not have seen :rolleyes:

Have fun with this :D


#2 User is offline   aka 

  • Group: Members
  • Posts: 1
  • Joined: 09-September 03

  Posted 09 September 2003 - 10:47 PM

:rolleyes: It's my code! Wow! :D
Thank You for advertising :D
Regards

Alexander Anikin [aka]
______________________
http://hotmix.narod.ru

*** :)

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy