0

Can anyone tell me how to change opacity on the drawImage() function from the regular Graphics object, not the Graphics2D object? Most threads on here suggest using Graphics2D, but in my game, rendering is done through regular Graphics objects, so it would be messy to convert all instances where it's called.

Help is much appreciated!

Thanks.

iPsych0
  • 19
  • 3
  • 2
    The Graphics object in Java is a Graphics2D object. You just cast the Graphics to a Graphic2D. – camickr May 13 '17 at 23:23
  • 1
    I'd start by having a look at [2D Graphics](https://docs.oracle.com/javase/tutorial/2d/TOC.html) and [Compositing Graphics](https://docs.oracle.com/javase/tutorial/2d/advanced/compositing.html) in particular – MadProgrammer May 13 '17 at 23:30
  • 1
    [As an example](http://stackoverflow.com/questions/15996314/alphacomposite-transparency-with-repaint-overlaps-into-black/15996385#15996385) – MadProgrammer May 13 '17 at 23:31
  • @camickr, Thanks, that cast did the job. Also thanks MadProgrammer for the response, I used that snippet of code, but the lack of a cast was rejecting my standard Graphics object. – iPsych0 May 13 '17 at 23:34

0 Answers0