Don't need an even full color spectrum. Even is best, though.
Let's go to the definition of blurring, shall we? Now, I'll define it as this:
Take four pixels that are adjacent to each other and make their colors more alike in RGB. That's your basic blur, I think. Now you can make variations, like using 16 pixels, or subsequently blurring 4 pixels in certain overlapping patterns...
The RGB will be produced, in above scheme, by looking at the average of all the RGBs in the 4-pixel area and the current pixel, and then taking the average (or you could set it to a certain percentage [sp??]) of that.
When you're blurring you want to find the closest match to a certain RGB color. There are at leasttwo ways to do that.
The easiest (but very slow, potentially) way is just going through each pixel in your palette each time, and finding the difference from the color you want. You want to use the square difference, like so:
Code:
'c = the color you want to match to.
smallestdiff& = (R(1) - R(1))^2 + (G(1) - G(1))^2 + (B(1) - B(1))^2
FOR i = 2 TO bla
diff& = (R(i) - R(c))^2 + (G(i) - G(c))^2 + (B(i) - B(c))^2
IF diff& > smallestdiff& THEN smallestdiff& = diff&: j = i
NEXT i
PRINT "closest match>"; j
Now, the second way to do this is to precompute all the possible color matchings and then use an array to match them up. You can do the same formula as above, changing the color "c" each time.
PS: Toonski, your code was indented so much I couldn't even realize you were saying almost the same thing until now. The only difference is you're not squaring. You really should square .. 8)