Results 1 to 2 of 2
  1. #1
    samson is offline Member
    Join Date
    Mar 2007
    Posts
    16
    Rep Power
    0

    Default How can I get a transparent pixel from an image

    I have an image I just need to check the transparent image , How can I do that ?

  2. #2
    goldhouse is offline Senior Member
    Join Date
    Mar 2007
    Posts
    134
    Rep Power
    0

    Default

    Please try this
    Java Code:
     if ( (mouseX >= imageX) && (mouseX < imageX+image.getWidth(this)) && (mouseY >= imageY) && (mouseY < imageY+image.getHeight(this)) )
             {
                int alpha = (image.getRGB(mouseX-imageX, mouseY-imageY) >> 24) & 0xff; 					
                if (alpha == 0) { result = false; } 
                else {result = true; }
             }

Similar Threads

  1. Image denoising
    By sharonpriya in forum Advanced Java
    Replies: 2
    Last Post: 02-14-2011, 06:01 AM
  2. Replies: 0
    Last Post: 01-08-2008, 05:29 PM
  3. how to set an image size
    By valery in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 08:27 PM
  4. 2D Array to image
    By fred in forum Java 2D
    Replies: 1
    Last Post: 07-24-2007, 01:52 AM
  5. Transparent JTextPane
    By Ada in forum AWT / Swing
    Replies: 1
    Last Post: 05-31-2007, 09:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •