• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Java paint question

 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to chnage white image background to transparent using Java 2D API? I know how to set composite to turn whole image transparent, but I am wondering if I can set selective color of the image as transparent?? Is that possible? How can I do this?

Any pointers, suggestions would be highly appreciated.

TIA,
- Manish
 
Rancher
Posts: 43009
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The BufferedImage class has provisions for 4-byte images, where in addition to the color channels R, G and B there is an alpha channel A that can be used to control transparency on a pixel-by-pixel basis. I've never used its alpha channel capabilities, so I'm not sure if they get displayed that way too, or if it's just for reading/writing files.
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look in this folder
sdk1.5/src/com/sun/java/swing/plaf/windows/XPStyle
in your sdk for the convertToTransparent method.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!