by Walter Eigner (15 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 2nd December 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Merges an area with a new color. Good for translucent menus.
Dim LONG1 As Long
Dim LONG2 As Long
Dim R1 As Long
Dim G1 As Long
Dim B1 As Long
Dim R2 As Long
Dim G2 As Long
Dim B2 As Long
Dim r As Long
Dim G As Long
Dim B As Long
LONG1 = frm.Point(pointX, pointY)
LONG2 = translucentColor
B1 = LONG1 \ 65536
G1 = (LONG1 - B1 * 65536) \ 256
R1 = LONG1 - B1 * 65536 - G1 * 256
B2 = LONG2 \ 65536
G2 = (LONG2 - B2 * 65536) \ 256
R2 = LONG2 - B2 * 65536 - G2 * 256
r = (R1 + R2) / 2
G = (G1 + G2) / 2
B = (B1 + B2) / 2
frm.PSet (pointX, pointY), RGB(r, G, B)
End Sub
Sub drawTranslucent(frm As Form, x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer, translucentColor As Long)
Dim x As Integer
Dim i As Integer
For x = x1 To x2
For i = y1 To y2
drawTranslucentPx frm, x, i, translucentColor
Next
Next
End Sub