Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extraction of Picture box point / pixel colors.

Ken01

Programmer
Aug 8, 2014
55
0
6
GB
I am using the following code to examine the color of each point on a picture box and then changing it before
redisplaying as a different color on a 2nd picturebox. Although it works I was wondering if other colors outside the
RGB range could be utilised ? Also I have been unable to find any documention on the bTable command
(the original code was down-loaded from a shareware website).

-----------------------------------------------------------------------------------------------------------------------------------

vmin = 60: vmax = Picture3.ScaleHeight - 6: sx = 14
Picture1.Width = Picture1.Width - 130
Picture3.Left = Picture2.Left + 130: Picture3.Width = Picture3.Width + 240
For x1 = 7400 To 60 Step (sx * -1)
X2 = X2 + sx
For y1 = vmin To vmax Step sx
color = Picture1.Point(x1 - jx, y1 - jx)
color1 = Picture1.Point(X2, y1 - jx)

Rem Color = GetPixel(Picture1.hdc, x1, y1)
wx = wx + 1
R = ExtractR(color)
G = ExtractG(color)
B = ExtractB(color)
R = bTable(R)
G = bTable(G)
B = bTable(B)
R1 = ExtractR(color1)
G1 = ExtractG(color1)
B1 = ExtractB(color1)
R1 = bTable(R1): G1 = bTable(G1): B1 = bTable(B1)
G = G - 30: B = B - 30: R = R + 20
Picture3.PSet (Picture3.ScaleWidth - x1, y1), RGB(B, R, G)

rem End If
Rem SetPixelV Picture2.hdc, x1, y1, RGB(B, G, R)
List1.AddItem (color & " : " & x1 & " : " & y1 & " : " & " : " & R & " : " & G & " : " & B)
Next y1
Next x1
 
>colors outside the RGB range could be utilised

Perhaps you can clarify what you mean by this

>the bTable command

I suspect that bTable is an array; it certainly is not a native VB function
 

Part and Inventory Search

Sponsor

Back
Top