Colour Swapping Solved

Screenshot_2014-01-07-21-35-23Screenshot_2014-01-07-21-35-28

I solved the colour swapping issue in Android last night, as seen above, and it is rapid as yer nana. Extremely pleased with another piece of the puzzle falling into place.

The method is as follows:

    private Drawable invertImage(Drawable inputDrawable){
        Bitmap bitmap = ((BitmapDrawable) inputDrawable).getBitmap();
        
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        
        int[] pixels = new int[width * height];
        bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
        
        int[] finalArray = new int[width * height];
        
        for(int i = 0; i < finalArray.length; i++) {
            int red = Color.red(pixels[i]);
            int green = Color.green(pixels[i]);
            int blue = Color.blue(pixels[i]);
            finalArray[i] = Color.rgb(blue, green, red);//invert sequence here.
        }
        bitmap = Bitmap.createBitmap(finalArray, width, height, Bitmap.Config.ARGB_8888);
        
        return new BitmapDrawable(getResources(),bitmap);
    }

I'm sorta cooling off on the idea of auto-generating players' profile images and whatnot. With the (hopefully) imminent commencing of shooting the move sequences, I will almost have a fully presentable working game to demonstrate – and this might allow me to get people interested in putting themselves forward as characters in the game.

Whether or not that would involve a Kickstarter project or not, I've yet to decide. I would definitely need something really presentable then. Must remember to take the iPhone to film any “behind the scenes” stuff during move sequence creation…

So anyway, I will probably jot down a mini-plan for tonight or tomorrow, and just continue chipping away at loose ends until the time is right to tackle one of the “big two” – move sequences and player profile images.

Adios.

 

TRP

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s