Functions required for transparent forms

Source: Internet
Author: User

:

Baiyun district ..

 

1. dib32-bit, pre-multiplication alpha

proc AlphaPreMul uses ebx edi, pBitDst,pDstRect,dwDstWight    local   dwWight:DWORD,dwHight:DWORD    ;---------------------------------------    mov     edi,[pBitDst]    mov     edx,[pDstRect]      ;(p,q)        mov     eax,[edx+RECT.right]    test    eax,eax    jz      .exit    mov     [dwWight],eax    mov     eax,[edx+RECT.bottom]    test    eax,eax    jz      .exit    mov     [dwHight],eax        mov     eax,[dwDstWight]    ; shl     eax,2    mov     ecx,[edx+RECT.top]    imul    eax,ecx    mov     ecx,[edx+RECT.left]    lea     eax,[eax+ecx*4]    add     edi,eax             ;pDstData start    ;---------------------------------------.loopy:    mov     ebx,[dwWight]    push    edi.loopx:    mov     cl,[edi+3]  ;alpha        mov     al,[edi]    mul     cl          ;ax=al*cl    mov     [edi],ah        mov     al,[edi+1]    mul     cl          ;ax=al*cl    mov     [edi+1],ah        mov     al,[edi+2]    mul     cl          ;ax=al*cl    mov     [edi+2],ah            add     edi,4        sub     ebx,1    jnz     .loopx    pop     edi    add     edi,[dwDstWight]        sub     [dwHight],1    jnz     .loopy    .exit:    retendp

2. Alpha mixing for dib32 data

proc AlphaBlend32 uses ebx esi edi, pBitDst,pDstRect,dwDstWight,pBitSrc,pSrcPoint,dwSrcWight    local   dwWight:DWORD,dwHight:DWORD    mov     esi,[pBitSrc]    mov     edx,[pSrcPoint]      ;(p,q)    mov     eax,[dwSrcWight]    ; shl     eax,2    mov     ecx,[edx+POINT.y]    imul    eax,ecx    mov     ecx,[edx+POINT.x]    lea     eax,[eax+ecx*4]    add     esi,eax             ;pSrcData start    ;---------------------------------------    mov     edi,[pBitDst]    mov     edx,[pDstRect]      ;(p,q)        mov     eax,[edx+RECT.right]    test    eax,eax    jz      .exit    mov     [dwWight],eax    mov     eax,[edx+RECT.bottom]    test    eax,eax    jz      .exit    mov     [dwHight],eax        mov     eax,[dwDstWight]    ; shl     eax,2    mov     ecx,[edx+RECT.top]    imul    eax,ecx    mov     ecx,[edx+RECT.left]    lea     eax,[eax+ecx*4]    add     edi,eax             ;pDstData start    ;---------------------------------------.loopy:    mov     ebx,[dwWight]    push    edi    push    esi.loopx:    mov     cl,255    mov     dl,255    sub     cl,[esi+3]        mov     al,[edi]    mul     cl          ;ax=al*cl    ; add     ax,128    ; div     dl          ;al=ax/dl    add     ah,[esi]    mov     [edi],ah        mov     al,[edi+1]    mul     cl          ;ax=al*cl    ; add     ax,128    ; div     dl          ;al=ax/dl    add     ah,[esi+1]    mov     [edi+1],ah        mov     al,[edi+2]    mul     cl          ;ax=al*cl    ; add     ax,128    ; div     dl          ;al=ax/dl    add     ah,[esi+2]    mov     [edi+2],ah        mov     al,[edi+3]    mul     cl          ;ax=al*cl    ; add     ax,128    ; div     dl          ;al=ax/dl    add     ah,[esi+3]    mov     [edi+3],ah    add     esi,4    add     edi,4        sub     ebx,1    jnz     .loopx    pop     esi    pop     edi    add     esi,[dwSrcWight]    add     edi,[dwDstWight]        sub     [dwHight],1    jnz     .loopy    .exit:    retendp

3. Partial copy of dib32 data

proc Dib32Copy uses esi edi, pBitDst,pDstRect,dwDstWight,pBitSrc,pSrcPoint,dwSrcWight    local   dwWight:DWORD,dwHight:DWORD    mov     esi,[pBitSrc]    mov     edx,[pSrcPoint]      ;(p,q)    mov     eax,[dwSrcWight]    ; shl     eax,2    mov     ecx,[edx+POINT.y]    imul    eax,ecx    mov     ecx,[edx+POINT.x]    lea     eax,[eax+ecx*4]    add     esi,eax             ;pSrcData start    ;---------------------------------------    mov     edi,[pBitDst]    mov     edx,[pDstRect]      ;(p,q)        mov     eax,[edx+RECT.right]    test    eax,eax    jz      .exit    shl     eax,2    mov     [dwWight],eax    mov     eax,[edx+RECT.bottom]    test    eax,eax    jz      .exit    mov     [dwHight],eax        mov     eax,[dwDstWight]    ; shl     eax,2    mov     ecx,[edx+RECT.top]    imul    eax,ecx    mov     ecx,[edx+RECT.left]    lea     eax,[eax+ecx*4]    add     edi,eax             ;pDstData start    ;---------------------------------------.loopy:    invoke  RtlMoveMemory,edi,esi,[dwWight]        add     esi,[dwSrcWight]    add     edi,[dwDstWight]        sub     [dwHight],1    jnz     .loopy    .exit:    retendp

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.