Results 1 to 1 of 1
  1. #1
    qweasd_24
    qweasd_24 is offline
    Guest
    Join Date
    2013 Nov
    Posts
    2
    Thanks Thanks Given 
    1
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0

    Thumbs up [VB6] - Alpha Blending

    On form u need HScrollBar
    That is a simple code of Alpha blending

    Code:
    Private Const GWL_EXSTYLE As Long = (-20)
    Private Const WS_EX_RIGHT As Long = &H1000
    Private Const WS_EX_LEFTSCROLLBAR As Long = &H4000
    Private Const WS_EX_LAYERED As Long = &H80000
    Private Const WS_EX_TRANSPARENT = &H20&
    Private Const LWA_COLORKEY As Long = &H1
    Private Const LWA_ALPHA As Long = &H2
    
    Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Declare Function SetLayeredWindowAttributes Lib "User32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Long, ByVal dwFlags As Long) As Long
    
    Private Sub Form_Load()
       Dim style As Long
       HScroll1.Min = 10
       HScroll1.Max = 255
       HScroll1.Value = 127
       style = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
       If Not (style And WS_EX_LAYERED = WS_EX_LAYERED) Then
        style = style Or WS_EX_LAYERED
        SetWindowLong Me.hwnd, GWL_EXSTYLE, style
        SetLayeredWindowAttributes Me.hwnd, 0&, HScroll1.Value, LWA_ALPHA
       End If
    End Sub
    
    Private Sub HScroll1_Change()
       HScroll1_Scroll
    End Sub
    
    Private Sub HScroll1_Scroll()
       SetLayeredWindowAttributes Me.hwnd, 0&, HScroll1.Value, LWA_ALPHA
    End Sub
    in Attachments professional code of Alpha Blending

    [...]

    Introduction to DiBits
    The gdi32.dll is the dynamic library handling all window’s application graphics processing, with the exception of Direct-X.
    One of its functions is called GetDIBits which loads all the data of a bitmap in to an array, really quickly.

    The Purpose of such a function is to help programmers, process image data really quickly, since this function writes instructions directly into the video memory.

    Revision:
    The GetDIBits function retrieves the bits of the specified bitmap and copies them into a buffer using the specified format.

    How To Use GetDIBits
    Firstly we need to create a context to process our graphic into.

    Usage:
    CreateCompatibleDC(hdc)
    hdc refers to the device context to be compatible with.
    If zero is put, the context will be compatible with the application’s current screen.
    Code:
    Type BITMAPINFOHEADER
      biSize        As Long 
      '4 Bytes to hold a fixed value
      biWidth       As Long 
      '4 Bytes to hold the bitmap’s width
      biHeight      As Long
      '4 Bytes to hold the bitmap’s height
      biPlanes      As Integer
      '2 Bytes to hold the bitmap’s Plane
      biBitCount    As Integer
      '2 Bytes to hold the bits per pixel
      '16 Colors, 16 Color gray = 4
      'Gray, 256 Color = 8
      'True Color = 24
      'True Color & Transparency = 32
      biCompression As Long
      '4 Bytes to hold thecompression type (if any)
      biSizeImage   As Long
      biXPelsPerMeter As Long
      biYPelsPerMeter As Long
      biClrUsed       As Long
      'My guess use a byte to show the next line
      biClrImportant  As Long
      'Is this importand?
    End Type
    i'm pretty like that code, because is awesome...

    don't forget on main form put
    Code:
    Const Rad As Currency = 1.74532925199433E-02
    This is only a foretaste of this code, lots and lots of lines but... with comments

    virustotal.com/pl/file/eb1713638114026d0c1e61dea2e8cd88c167dd0dd5dd0d60ef de907a49ea81d3/analysis/1386621905/

    Please register or login to download attachments.


Similar Threads

  1. DiE (Detect it Easy) v0.70 Alpha 12
    By Kingstaa in forum Files & Tools
    Replies: 0
    Last Post: 2013-02-27, 06:44 AM
  2. [Release] BF2 Alpha v1.1
    By khuletz09 in forum Battlefield
    Replies: 3
    Last Post: 2012-01-29, 05:52 PM
  3. Blending Tutorial
    By annnnndre in forum Graphics Tutorials
    Replies: 0
    Last Post: 2011-12-21, 03:39 AM
  4. Lime Odyssey The Chronicles of Orta Alpha Test
    By Grooguz in forum Games Lounge
    Replies: 0
    Last Post: 2011-12-07, 06:15 AM

Posting Permissions

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