0

Now I am working on a simple game. But I came across a problem: I want to make halos of different shapes from lamps. These halos should be bright colour in the center and fade out on the sides.

The question is does Java AWT supports drawing images of PNG format with alpha channel(transparency, alpha transparency - value between 0 and 255)?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Kuznetsov S.A.
  • 169
  • 2
  • 11
  • Your question lacks details, but assuming you’re using a Graphics2D to draw images, you can simply call the [setComposite](https://docs.oracle.com/javase/9/docs/api/java/awt/Graphics2D.html#setComposite-java.awt.Composite-) method before drawing. The argument passed to it would be something like `AlphaComposite.SrcOver.derive(0.5f)`. – VGR Apr 29 '18 at 21:45
  • 1
    1) *"does Java AWT supports drawing images of PNG format with alpha channel(transparency, alpha transparency - value between 0 and 255)?"* What happened when you tried it? 2) Why use AWT? See [this answer](http://stackoverflow.com/questions/6255106/java-gui-listeners-without-awt/6255978#6255978) for many good reasons to abandon AWT components in favor of Swing. – Andrew Thompson Apr 30 '18 at 10:20

0 Answers0