Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java.awt.Color & transparency  RSS feed

David Mace
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've researched this topic for the past week and have not come upon anything close to a solution. I'm trying to build an overlay on top of a background image.

Environment: Java 1.1

I can do this without any difficulty at all using J2 classes, but I have not found a way to achieve this in 1.1. The Color constructor taking an alpha value as it's 4th argument does not exist and there is not .setAlpha() method to the class so I'm really at a loss for the overlay.

Using transparent images does not seem to help the situation because it seems as though in 1.1, if a pixel's transparency is set <50% then it does not get painted and it if is >=50% then it gets painted at 100%. At least this is my observation.

My LAST resort is to extend Component or Container and implement a .paint() method that adds pixel values together to get the overlay effect....although I can't say that I know about adding pixel values so if I have to go that route, I'll have to research that as well.

Does anybody out there have any ideas? I'm getting a little desperate regarding this matter...but I've learned a lot about .paint() in the process....that's for sure. And probably more than I ever wanted to know.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!