Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function alpha22( ByVal source_pixel As ulong, ByVal destination_pixel As ulong, ByVal parameter As Any Ptr ) As ulong
- dim as ulong rgba1,rgba2,rgba3
- dim as ulong r1,g1,b1,a1
- dim as ulong r2,g2,b2,a2
- dim as ulong r3,g3,b3,a3
- /'
- Dim threshold As ulong = &HFF
- select case parameter
- case 0
- case else
- threshold = *CPtr(ULong Ptr, parameter)
- end select
- '/
- rgba1=source_pixel
- rgba2=destination_pixel
- a1=(rgba1 shr 24) and &HFF
- a2=(rgba2 shr 24) and &HFF
- r1=(rgba1 shr 16) and &HFF
- r2=(rgba2 shr 16) and &HFF
- g1=(rgba1 shr 8) and &HFF
- g2=(rgba2 shr 8) and &HFF
- b1=rgba1 and &HFF
- b2=rgba2 and &HFF
- r3=(r1 * a1 + r2 * a2) / &HFF / 2
- g3=(g1 * a1 + g2 * a2) / &HFF / 2
- b3=(b1 * a1 + b2 * a2) / &HFF / 2
- a3=(a1 + a2) / 2
- rgba3=rgba(r3,g3,b3,a3)
- function = rgba3
- exit function
- end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement