The following new methods on AlphaComposite would simplify a fair amount of code: public AlphaComposite derive(float alpha); public AlphaComposite derive(int rule); The first one in particular would simplify the creation of new objects from: AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f); to: AlphaComposite ac = AlphaComposite.SrcOver.derive(0.5); this would also simplify a fade operation where a new AlphaComposite needs to be created with a different alpha parameter for each iteration of the fade: ac = ac.derive(newfadeamount); The latter method that derives a new instance with a new rule is probably less useful, but is included for completeness.
|