Ahhh… Palette Swaps.
I’m leaving some Java snippet below. It takes an image containing red pixels (e.g., Ermac’s sprite sheet) and adjusts the hues of these pixels to match the given one.
void colorear(BufferedImage image,int n_hue) {            int c,r,g,b;    int w = image.getWidth();    int h = image.getHeight();            float hue = n_hue / 360f;    float hsb[] = new float[3];            for(int j = 0; j < h; j++)        for(int i = 0; i < w; i++) {                            c = image.getRGB(i,j);                            b = c & 255;            g = (c » 8) & 255;            r = (c » 16) & 255;                            if(r > 0 && g == 0 && b == 0) {                                    Color.RGBtoHSB(r,g,b,hsb);                image.setRGB(i,j,Color.HSBtoRGB(hue,hsb[1],hsb[2]));            }        }}
To Part II ->

Ahhh… Palette Swaps.

I’m leaving some Java snippet below. It takes an image containing red pixels (e.g., Ermac’s sprite sheet) and adjusts the hues of these pixels to match the given one.

void colorear(BufferedImage image,int n_hue) {
        
    int c,r,g,b;

    int w = image.getWidth();
    int h = image.getHeight();
        
    float hue = n_hue / 360f;

    float hsb[] = new float[3];
        
    for(int j = 0; j < h; j++)
        for(int i = 0; i < w; i++) {
                
            c = image.getRGB(i,j);
                
            b = c & 255;
            g = (c » 8) & 255;
            r = (c » 16) & 255;
                
            if(r > 0 && g == 0 && b == 0) {
                    
                Color.RGBtoHSB(r,g,b,hsb);
                image.setRGB(i,j,Color.HSBtoRGB(hue,hsb[1],hsb[2]));
            }
        }
}

To Part II ->

  1. whatashithead reblogged this from unmanuel
  2. absolutd reblogged this from unmanuel
  3. davidhimaemissletoe reblogged this from unmanuel
  4. ah-sei-la reblogged this from unmanuel
  5. stockholmsyndrome47 reblogged this from unmanuel
  6. likasbanana reblogged this from theorange
  7. srtacherry reblogged this from marrimichelotti and added:
    scorpion and kitana \o/
  8. theorange reblogged this from unmanuel
  9. marrimichelotti reblogged this from unmanuel
  10. franqiitoh reblogged this from unmanuel
  11. shinlovee reblogged this from unmanuel
  12. theking84 reblogged this from unmanuel
  13. b0sst0pher reblogged this from unmanuel
  14. mbuchw reblogged this from unmanuel
  15. ialienhead reblogged this from unmanuel
  16. bigkev2real reblogged this from unmanuel and added:
    my favorite Childhood memories!!!!!
  17. thefjproject reblogged this from the-nomad
  18. gamemakers reblogged this from unmanuel
  19. the-nomad reblogged this from unmanuel
  20. advocat reblogged this from unmanuel
  21. samhallowell90 reblogged this from unmanuel
  22. xxcolorblindxx reblogged this from unmanuel
  23. This was featured in #Gaming
  24. unmanuel posted this