001package org.jdesktop.swingx; 002 003/** 004 * An interface to describe an object that is capable of painting with an alpha value. 005 * 006 * @author kschaefer 007 */ 008interface AlphaPaintable { 009 /** 010 * Get the current alpha value. 011 * 012 * @return the alpha translucency level for this component. This will be a value between 0 and 013 * 1, inclusive. 014 */ 015 float getAlpha(); 016 017 /** 018 * Set the alpha transparency level for this component. This automatically causes a repaint of 019 * the component. 020 * 021 * @param alpha 022 * must be a value between 0 and 1 inclusive 023 * @throws IllegalArgumentException 024 * if the value is invalid 025 */ 026 void setAlpha(float alpha); 027 028 /** 029 * Returns the state of the panel with respect to inheriting alpha values. 030 * 031 * @return {@code true} if this panel inherits alpha values; {@code false} 032 * otherwise 033 * @see #setInheritAlpha(boolean) 034 */ 035 boolean isInheritAlpha(); 036 037 /** 038 * Determines if the effective alpha of this component should include the 039 * alpha of ancestors. 040 * 041 * @param inheritAlpha 042 * {@code true} to include ancestral alpha data; {@code false} 043 * otherwise 044 * @see #isInheritAlpha() 045 * @see #getEffectiveAlpha() 046 */ 047 void setInheritAlpha(boolean inheritAlpha); 048 049 /** 050 * Unlike other properties, alpha can be set on a component, or on one of 051 * its parents. If the alpha of a parent component is .4, and the alpha on 052 * this component is .5, effectively the alpha for this component is .4 053 * because the lowest alpha in the hierarchy "wins." 054 * 055 * @return the lowest alpha value in the hierarchy 056 */ 057 float getEffectiveAlpha(); 058}