Results 1 to 4 of 4
  1. #1
    totalspelnerd is offline Member
    Join Date
    Mar 2012
    Location
    Sweden
    Posts
    83
    Rep Power
    0

    Default Transparent Image flickers to none transparent image

    I've been playing around with graphics for some time now but since last week I've been getting some weird things happening to transparent images.

    When the processor is at hard work (or if I use a bad one) the transparent image flickers to a none transparent image every now and then. I'm using normal images from java.util.Image to render them onto a Graphics class (by extending my class to a JPanel and overriding the paintComponent method and using g.drawImage). I've tried converting the Graphics into a Graphics2D but it didn't help (no idea why it would but I tried). But just rendering a single transparent image doesn't make it flicker but when a lot of process gets into the program it starts. But I can't seem to recreate it in a smaller project in one single class.

    If you know the answer or have seen it before, please reply to this thread.

    Thanks in advance!

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    2,947
    Rep Power
    4

    Default Re: Transparent Image flickers to none transparent image

    Can you provide an SSCCE that demonstrates the problem (even if it is processor dependent). You may also want to investigate modifying rendering hints and/or using clip regions to help minimize the amount of repainting.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    totalspelnerd is offline Member
    Join Date
    Mar 2012
    Location
    Sweden
    Posts
    83
    Rep Power
    0

    Default Re: Transparent Image flickers to none transparent image

    Okay, I've found a solution. I did something wrong with my own library that renders images on layers. Apparently it is saving the transparent images or rendering them twice sometimes. Probably something to do with painting Threads. I've found a way to come around this problem now. I'm feeling kinda stupid for asking for help right now. Sorry for wasting your time on nothing.

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,096
    Rep Power
    4

    Default Re: Transparent Image flickers to none transparent image

    Lesson learned: don't call stuff weird. It will never ever help you to label things as strange or weird; that's just misdirection for admitting that you don't understand it (yet). If you label it truthfully ("I DON'T UNDERSTAND IT YET!") the next step is simple: attempt to understand it first!
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. transparent
    By chathura992 in forum NetBeans
    Replies: 2
    Last Post: 12-30-2010, 04:03 PM
  2. transparent jframe?
    By majkel in forum AWT / Swing
    Replies: 12
    Last Post: 10-09-2010, 05:06 PM
  3. SWT Transparent button
    By ynnorj in forum SWT / JFace
    Replies: 2
    Last Post: 03-04-2009, 06:33 AM
  4. Making an Image transparent?
    By audinue in forum Java 2D
    Replies: 3
    Last Post: 01-03-2009, 07:32 PM
  5. Replies: 1
    Last Post: 07-17-2007, 04:10 AM

Posting Permissions

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