|
-
Nov 5th, 2001, 04:48 PM
#1
Thread Starter
Addicted Member
Range Color Remover
I have a getright skin making aplication and there is one major flaw in it. When the skins are compilled in 24Bit there are disgressions in the color, probally left from the paint program. How could i go from 1 sample color and remove all colors like it? I allready have a fast system for changing the color i really need is a was to check a color from a long for all the diffrent shades.
-
Nov 8th, 2001, 09:22 PM
#2
Frenzied Member
Well I believe what you want is somethat that will remove similar colors??
Define a threshold, say 15. Then loop through all pixels, if Red component of color is within "threshold" of the color you want to get rid of, and so are Green and Blue, then change.
Ex:
Color to change RGB = 100, 100, 200
Threshold = 10
Color found RGB = 110, 95, 206
All values are within "threshold" of the color to change, so change it
OR
Color found RGB = 100, 100, 0
Values aren't all within "threshold" of the color to change, leave it alone
Did that make sense?
-
Nov 9th, 2001, 04:57 PM
#3
Thread Starter
Addicted Member
I know that, but how could i use the colors from getPixelV that returns a long.
-
Nov 10th, 2001, 01:22 PM
#4
Frenzied Member
Ah...ok what you have to do split the long into several bytes. I don't exactly remember how this works, but MSDN should be able to help. There may also be an API that does this for you, so check around carefully.
-
Nov 10th, 2001, 10:30 PM
#5
Thread Starter
Addicted Member
I found a hard way to find the RGB value of a pixel by brute force. I couldn't find a simpler way.
-
Nov 11th, 2001, 04:43 PM
#6
Addicted Member
Here are two ways of getting the RGB values from LONG.
Most-used way:
Code:
Private Sub Form_Load()
Dim lColor As Long
Dim iRed As Integer, iGreen As Integer, iBlue As Integer
lColor = RGB(255, 128, 64)
'Get the R G B values
iRed = lColor Mod 256
iGreen = (lColor \ 256) Mod 256
iBlue = ((lColor \ 256) \ 256) Mod 256
MsgBox "R, G, B values: " & iRed & ", " & iGreen & ", " & iBlue
End Sub
Using the CopyMemory API:
Code:
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Sub Form_Load()
Dim lColor As Long, c(3) As Byte
lColor = RGB(255, 128, 64)
CopyMemory c(0), lColor, 4
MsgBox "R, G, B values: " & c(0) & ", " & c(1) & ", " & c(2)
End Sub
Hope this helps.
-
Nov 11th, 2001, 06:41 PM
#7
Thread Starter
Addicted Member
yeah now i can do searches with a hugh tollerance
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
|