1

The image without transparency is just not visible in other laptops.

Also when I make a new Eclipse project:

  • When I copy paste code in separate class files, it works fine on my machine, but not on others, with same code and project settings.
  • The images in bin are not copied, I have to copy the images separately.

Here is code used for transparency.

public static class Transparency 
    {
          public static Image makeColorTransparent(Image im, final Color color) 
          {
            ImageFilter filter = new RGBImageFilter() 
            {
                  public int markerRGB = color.getRGB() | 0xFF000000;

                  public final int filterRGB(int x, int y, int rgb) 
                  {
                    if ( ( rgb | 0xFF000000 ) == markerRGB ) 
                    {
                      // Mark the alpha bits as zero - transparent
                      return 0x00FFFFFF & rgb;
                    }
                    else 
                    {
                      // nothing to do
                      return rgb;
                    }
                 }
            }; 

        ImageProducer ip = new FilteredImageSource(im.getSource(), filter);
        return Toolkit.getDefaultToolkit().createImage(ip);
        }
    }

I want to make multiplayer game. So its vital that it should run on other laptops...

riya das
  • 31
  • 1
  • 5
  • Does the image that you pass as the first parameter in makeColorTransparent() method come from a file? What image format used for the image file? It may not contain transparency byte at all due to a non-transparent color model. Make sure you verify this with the same image file on each test system. – ecle Mar 31 '12 at 13:54
  • For better help sooner, post an [SSCCE](http://sscce.org/). Hot-link to a (small in bytes) sample image. – Andrew Thompson Mar 31 '12 at 13:56
  • 1
    Please deal with one matter per ..question. Speaking of which, do you *have* a question? – Andrew Thompson Mar 31 '12 at 13:58
  • I used gif file format, and copied the same images on other systems too. And my question is why the same code with same images not working on other systems ? – riya das Apr 01 '12 at 03:24

1 Answers1

0

solved the problem by making the image bmp/png file format, works on both comps, used ImageIO.read to get the bmp imagw

riya das
  • 31
  • 1
  • 5