|
-
Apr 22nd, 2002, 08:50 PM
#1
Thread Starter
Frenzied Member
-
Apr 22nd, 2002, 09:30 PM
#2
Thread Starter
Frenzied Member
-
Apr 22nd, 2002, 09:44 PM
#3
Fanatic Member
LOL! nice animation....
the only way I would see to do this si to scan every little pixel one by one and store it's color in an array...
"A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
"First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
- Robert Matthews, Science Correspondent
-
Apr 22nd, 2002, 10:52 PM
#4
Thread Starter
Frenzied Member
yeah...but then?
and i dont know how to do arrays...
-
Apr 22nd, 2002, 10:58 PM
#5
Thread Starter
Frenzied Member
i've made a program that can open files like this drawn by hand...
-
Apr 22nd, 2002, 11:01 PM
#6
-
Apr 22nd, 2002, 11:02 PM
#7
Thread Starter
Frenzied Member
oh....forgit to mention:
the program is not ment to draw lines!
just store coordinates in a textbox or textfile...
-
Apr 22nd, 2002, 11:03 PM
#8
Thread Starter
Frenzied Member
it IS possible!
i've used another program that does the same thing...
i dont know how it works, but it works!
-
Apr 22nd, 2002, 11:06 PM
#9
Thread Starter
Frenzied Member
have you used the floodfill api?
how can that function know where to paint?
-
Apr 22nd, 2002, 11:11 PM
#10
Thread Starter
Frenzied Member
i know i can make a program that draws lines around those objects, but i can do one that does it in the right order...
-
Apr 22nd, 2002, 11:43 PM
#11
Thread Starter
Frenzied Member
when the user clicks on the background color the program knows where to look...
between that color and a color thats not equal to the BG color...
-
Apr 23rd, 2002, 01:08 AM
#12
PowerPoster
-
Apr 23rd, 2002, 01:43 AM
#13
Not NoteMe
If i understand you correctly, you want to detect everywhere where there is a change in colour, from the background to something else?? Am i correct?
If so, your logic would go something like this.
VB Code:
Option Explicit
Dim i As Integer, j As Integer
Dim BackGroundColour As Long
Private Type typPixel
x As Integer
y As Integer
End Type
Dim Edge() As typPixel
Private Sub FindEdges
Pic.ScaleMode = 3 'Pixel
For i = 2 To Pic.ScaleHeight
For j = 1 To Pic.ScaleWidth
If Pic.Point(j, i) = BackGroundColour And Pic.Point(j, i - 1) <> BackGroundColour Then
ReDim Preserve Edge(UBound(Edge) + 1)
Edge(UBound(Edge)).x = j
Edge(UBound(Edge)).y = i
End If
Next j
Next i
For i = 1 To Pic.ScaleHeight - 1
For j = 1 To Pic.ScaleWidth
If Pic.Point(j, i) = BackGroundColour And Pic.Point(j, i + 1) <> BackGroundColour Then
ReDim Preserve Edge(UBound(Edge) + 1)
Edge(UBound(Edge)).x = j
Edge(UBound(Edge)).y = i
End If
Next j
Next i
For i = 1 To Pic.ScaleHeight
For j = 2 To Pic.ScaleWidth
If Pic.Point(j, i) = BackGroundColour And Pic.Point(j - 1, i) <> BackGroundColour Then
ReDim Preserve Edge(UBound(Edge) + 1)
Edge(UBound(Edge)).x = j
Edge(UBound(Edge)).y = i
End If
Next j
Next i
For i = 1 To Pic.ScaleHeight
For j = 1 To Pic.ScaleWidth - 1
If Pic.Point(j, i) = BackGroundColour And Pic.Point(j + 1, i) <> BackGroundColour Then
ReDim Preserve Edge(UBound(Edge) + 1)
Edge(UBound(Edge)).x = j
Edge(UBound(Edge)).y = i
End If
Next j
Next i
End Sub
This will check every pixel, and against the ones next to it, for a change in colour. You may need to do diaganols, but that won't be too difficult.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 23rd, 2002, 02:37 AM
#14
Retired VBF Adm1nistrator
Yes I would suggest an approach as used by SLH.
That is the only sensible way to approach the problem.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Apr 23rd, 2002, 09:48 AM
#15
Thread Starter
Frenzied Member
yeah! SLH....you know what i want....but i also (if its possible) want the program to sort the coordinates as the .gif animation shows...
i get the
"Subscript out of range"
error on
"ReDim Preserve Edge(UBound(Edge) + 1)"
what wrong?
-
Apr 23rd, 2002, 10:51 AM
#16
Not NoteMe
Sorry, try this code:
VB Code:
Option Explicit
Dim i As Integer, j As Integer
Dim BackGroundColour As Long
Private Type typPixel
x As Integer
y As Integer
End Type
Dim Edge() As typPixel
Private Sub FindEdges
[B]ReDim Edge(0)[/B]
Pic.ScaleMode = 3 'Pixel
For i = 2 To Pic.ScaleHeight
For j = 1 To Pic.ScaleWidth
If Pic.Point(j, i) = BackGroundColour And Pic.Point(j, i - 1) <> BackGroundColour Then
ReDim Preserve Edge(UBound(Edge) + 1)
Edge(UBound(Edge)).x = j
Edge(UBound(Edge)).y = i
End If
Next j
Next i
For i = 1 To Pic.ScaleHeight - 1
For j = 1 To Pic.ScaleWidth
If Pic.Point(j, i) = BackGroundColour And Pic.Point(j, i + 1) <> BackGroundColour Then
ReDim Preserve Edge(UBound(Edge) + 1)
Edge(UBound(Edge)).x = j
Edge(UBound(Edge)).y = i
End If
Next j
Next i
For i = 1 To Pic.ScaleHeight
For j = 2 To Pic.ScaleWidth
If Pic.Point(j, i) = BackGroundColour And Pic.Point(j - 1, i) <> BackGroundColour Then
ReDim Preserve Edge(UBound(Edge) + 1)
Edge(UBound(Edge)).x = j
Edge(UBound(Edge)).y = i
End If
Next j
Next i
For i = 1 To Pic.ScaleHeight
For j = 1 To Pic.ScaleWidth - 1
If Pic.Point(j, i) = BackGroundColour And Pic.Point(j + 1, i) <> BackGroundColour Then
ReDim Preserve Edge(UBound(Edge) + 1)
Edge(UBound(Edge)).x = j
Edge(UBound(Edge)).y = i
End If
Next j
Next i
End Sub
NB: This code will take a couple of seconds on a large image (well, even a small one).
As for drawing lines, it would be easy to highlight the edges, but to make it join them up, would require A LOT of thinking....
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 23rd, 2002, 01:25 PM
#17
Thread Starter
Frenzied Member
yeah!
nice!
this code gets me the coordinates 
but do you know any way to sort them?
-
Apr 23rd, 2002, 01:28 PM
#18
Not NoteMe
What do you mean by 'sorted', do you want the program to calculate the best way to join then up (like in your pic)?? If so that would be very difficult.
P.S. Just out of interest, are you making a program that shows where a 'jig-saw' would need to cut (because that's what it looks like).
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 23rd, 2002, 01:47 PM
#19
Thread Starter
Frenzied Member
yes, i mean that the program should find the best way to draw the lines...
and no! im making a transparent region generator for winamp skins!
-
Apr 23rd, 2002, 01:57 PM
#20
Not NoteMe
How are you going to use the lines created to generate a transparency region, surely it'll end up being the same region as the bacoground??
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 23rd, 2002, 02:19 PM
#21
Thread Starter
Frenzied Member
winamp loads the transparecy regions in a strange way...
you have to do a file that looks like this fore example:
if there is a line with 6 different coordinates
(170,36)
(200,36)
(226,36)
etc...
it has to look like this:
[Normal]
NumPoints = 6
PointList = 170,36,200,36,226,36,239,36,255,36,34,63
this is the line where winamp is going to "cut" off the background
Last edited by cyborg; Apr 23rd, 2002 at 02:40 PM.
-
Apr 24th, 2002, 01:50 AM
#22
Not NoteMe
Ok, as i've said a couple of times in this post, i'll have a think
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|