Users browsing this thread: 1 Guest(s)
The Spriter's Toolkit
#11
I think I see what you mean. Take the images and lay them out onto neat rows with a label. Yeah, I think I could do that.

As to the above question of how Palomine locates the closest color, I've come to realize that no matter how you slice it up, creating a one-dimensional array of colors just isn't gonna cut it. Color is three-dimensional, and I have to treat it as such, so I'm changing the color distance to actually use 3D distance.

Also, a lil snippet of Tigestion's code. I'm gonna make it open-source anyway, but if anyone using SDL needs a way to ensure two images match, here ya go:
Code:
bool imageMatch(img* A, img* B){
    //Check that they're the same size
    int w = A->w, h = A->h;
    if(A->w != B->w || A->h != B->h) return 0;

    //Check each pixel
    bool isDiff = 0;
    for(int i = 0; i < w; i++){
        for(int j = 0; j < h; j++){
            if(getPixel(A, i, j) != getPixel(B, i, j)) isDiff = 1;
            if(isDiff) break;
        };
        if(isDiff) break;
    };

    //Return the test result
    return !isDiff;
};
This checks that two images are of the same size, then if that check works, it checks that all pixels are the same color. Because Tigestion needs to check every new tile against every saved tile, it may seem slower as it goes through the list, but this is normal behaviour, and shouldn't be worried about. Though, if you end up with the same exact image, just skewed in a funny way, chances are you used a JPEG or something.
Reply
Thanked by:


Messages In This Thread
The Spriter's Toolkit - by Kelvin - 04-12-2015, 10:23 PM
RE: The Spriter's Toolkit - by SmithyGCN - 04-12-2015, 10:44 PM
RE: The Spriter's Toolkit - by Kelvin - 04-13-2015, 07:32 AM
RE: The Spriter's Toolkit - by daemoth - 04-13-2015, 01:45 PM
RE: The Spriter's Toolkit - by puggsoy - 04-13-2015, 08:39 PM
RE: The Spriter's Toolkit - by Sketchasaurus - 04-14-2015, 05:04 AM
RE: The Spriter's Toolkit - by Kelvin - 04-14-2015, 09:14 PM
RE: The Spriter's Toolkit - by daemoth - 04-14-2015, 09:40 PM
RE: The Spriter's Toolkit - by TheShyGuy - 04-14-2015, 09:41 PM
RE: The Spriter's Toolkit - by Sketchasaurus - 04-14-2015, 10:01 PM
RE: The Spriter's Toolkit - by Kelvin - 04-17-2015, 03:24 PM
RE: The Spriter's Toolkit - by puggsoy - 04-18-2015, 04:34 AM
RE: The Spriter's Toolkit - by Kelvin - 04-19-2015, 03:56 PM
RE: The Spriter's Toolkit - by puggsoy - 04-20-2015, 03:56 AM
RE: The Spriter's Toolkit - by TheShyGuy - 04-20-2015, 09:35 AM
RE: The Spriter's Toolkit - by Kelvin - 04-20-2015, 01:49 PM
RE: The Spriter's Toolkit - by puggsoy - 04-21-2015, 02:06 AM
RE: The Spriter's Toolkit - by Kelvin - 05-04-2015, 08:48 AM
RE: The Spriter's Toolkit - by puggsoy - 05-08-2015, 09:05 AM
RE: The Spriter's Toolkit - by Kelvin - 05-10-2015, 07:04 AM
RE: The Spriter's Toolkit - by puggsoy - 05-11-2015, 03:56 AM
RE: The Spriter's Toolkit - by Kelvin - 05-11-2015, 07:35 AM

Forum Jump: