• Log in or sign up for an account here: https://www.sythe.org/login

[source]FindColorSpiral

slashshot007

Active Member
Joined
May 6, 2006
Sythe Gold
0
Messages
164
[source]FindColorSpiral
credits to to cruel, i just converted it to vb.net, this also uses a picture, instead of the traditional getPixel thing, so u may be able to customize this for findBitmap. I may do that later on, and i will post the source if i get it to work.
Code:
    Function FindColorSpiral(ByVal color As Color, ByVal StartPoint As Point, ByVal Area As Rectangle) As Point
        Dim AreaSize As Size = Area.Size
        Dim TempBitmap As New Bitmap(AreaSize.Width, AreaSize.Height)
        Graphics.FromImage(TempBitmap).CopyFromScreen(Area.Location, New Point(), AreaSize)
        Dim x As Integer = StartPoint.X - Area.X
        Dim y As Integer = StartPoint.Y - Area.Y
        Dim direction, length, i As Integer
        direction = 0 : length = 1
        If color = TempBitmap.GetPixel(x, y) Then Return New Point(Area.X + x, Area.Y + y)
        Do Until (x < 2) Or (y < 2) Or (x > Area.Width - 2) Or (y > Area.Height - 2)
            For i = 1 To length
                Select Case direction
                    Case 0 : y = y - 1
                    Case 1 : x = x + 1
                    Case 2 : y = y + 1
                    Case 3 : x = x - 1
                End Select
                If color = TempBitmap.GetPixel(x, y) Then Return New Point(Area.X + x, Area.Y + y)
            Next i
            direction = (direction + 1) Mod 4
            If (direction Mod 2) = 0 Then length = length + 1
        Loop
        Return New Point(-1, -1)
    End Function
 
[source]FindColorSpiral
gets me always a pixel 1 could you explain me or says how to make coler picker and specifie the color
but i made a image box with back grond black an it couldnt find the image box.

waht i do wrong:
Code:
 varco = Color.Black
        Label2.Text = FindColorSpiral(varco, New Point(15, 70), New Rectangle(15, 70, 800, 540)).ToString [CODE]
 
[source]FindColorSpiral
gets me always a pixel 1 could you explain me or says how to make coler picker and specifie the color
but i made a image box with back grond black an it couldnt find the image box.

waht i do wrong:
Code:
 varco = Color.Black
        Label2.Text = FindColorSpiral(varco, New Point(15, 70), New Rectangle(15, 70, 800, 540)).ToString [CODE][/QUOTE]

it wont find Color.black, u need to enter the RGB integer value.
i'll tell you how to find that when i get home
 
[source]FindColorSpiral
made something like a color finder using part of your script.
BUT , u know how check if left mouse is pressed?:P
 
[source]FindColorSpiral
Code:
Private Sub btnGetColor_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnGetColor.MouseDown
		tmrGetColor.Start()
	End Sub


	Private Sub tmrGetColor_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrGetColor.Tick
		Dim TempBitmap As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
		Graphics.FromImage(TempBitmap).CopyFromScreen(Screen.PrimaryScreen.Bounds.Location, New Point(), Screen.PrimaryScreen.Bounds.Size)
		PictureBoxColor.BackColor = TempBitmap.GetPixel(System.Windows.Forms.Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y)
	End Sub

	Private Sub btnGetColor_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnGetColor.MouseUp
		tmrGetColor.Stop()
	End Sub

that should help u figure it out.

edit: its not even that fast. flaming idiots has a really fast good findcolorspiral. i reccomend u ask him, i may post it but that requires me to find it.
 
Runescape Gamblingrunescape gambling
Back
Top