:
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