public abstract class DVBGraphics extends Graphics
DVBGraphics
class is a adapter class to support alpha compositing in an MHP device. Most methods directly delegate to java.awt.Graphics other methods could delegate to the appropriate methods in java.awt.Graphics2D where available or could be implemented in native code. In implementations where the class java.awt.Graphics2D is visible to MHP applications, org.dvb.ui.DVBGraphics inherits from java.awt.Graphics2D. Otherwise, org.dvb.ui.DVBGraphics inherits from java.awt.Graphics. In MHP devices all Graphics Objects are DVBGraphics objects. Thus one can get a DVBGraphics by casting a given Graphics object. The normal compositing rule used is DVBAlphaComposite.SRC_OVER. Note that the default rule of SRC_OVER may not give the highest performance. Under many circumstances, applications will find that the SRC rule will give higher performance. The intersection between setDVBCompsite in this class and the setPaintMode
and setXORMode
methods inherited from java.awt.Graphics shall be as follows. setPaintMode
on an instance of this class shall be equivalent to calling setDVBComposite(DVBAlphaComposite.SrcOver)
. setXORMode
on an instance of this class shall be equivalent to calling setDVBComposite
with a special and implementation dependent DVBAlphaComposite object which implements the semantics specified for this method in the parent class. getDVBComposite
when setXORMode
is the last DVBComposite set shall return this implementation dependent object. Conformant MHP applications shall not do anything with or to this object including calling any methods on it. setXORMode
beyond what is specified for the parent class. Note: Implementations of XOR mode may change colours with alpha to without and vice versa (reversibly).
Graphics
Modifier | Constructor and Description |
---|---|
protected |
DVBGraphics()
Constructs a new
DVBGraphics object. |
Modifier and Type | Method and Description |
---|---|
abstract int[] |
getAvailableCompositeRules()
Returns all available Porter-Duff Rules for this specific Graphics context.
|
DVBColor |
getBestColorMatch(Color c)
Returns the best match for the specified Color as a DVBColor, in a
device-dependent manner, as constrained by the MHP graphics reference model.
|
abstract Color |
getColor()
Gets this graphics context's current color.
|
abstract DVBAlphaComposite |
getDVBComposite()
Returns the current
DVBAlphaComposite in the
DVBGraphics context. |
int |
getType()
Returns the Sample Model (DVBBufferedImage.TYPE_BASE, DVBBufferedImage.TYPE_ADVANCED)
which is used in the on/off screen buffer this graphics object draws into.
|
abstract void |
setColor(Color c)
Sets this graphics context's current color to the specified
color.
|
abstract void |
setDVBComposite(DVBAlphaComposite comp)
Sets the
DVBAlphaComposite for the DVBGraphics context. |
String |
toString()
Returns a
String object representing this
DVBGraphics object's value. |
clearRect, clipRect, copyArea, create, create, dispose, draw3DRect, drawArc, drawBytes, drawChars, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, drawString, fill3DRect, fillArc, fillOval, fillPolygon, fillPolygon, fillRect, fillRoundRect, finalize, getClip, getClipBounds, getClipBounds, getFont, getFontMetrics, getFontMetrics, hitClip, setClip, setClip, setFont, setPaintMode, setXORMode, translate
protected DVBGraphics()
DVBGraphics
object.
This constructor is the default constructor for a graphics
context.
Since DVBGraphics
is an abstract class, applications
cannot call this constructor directly. DVBGraphics contexts are
obtained from other DVBGraphics contexts or are created by casting java.awt.Graphics to DVBGraphics.
Graphics.create()
,
Component.getGraphics()
public abstract int[] getAvailableCompositeRules()
public DVBColor getBestColorMatch(Color c)
c
- the specified Color.public abstract Color getColor()
getColor
in class Graphics
DVBColor
,
Color
,
setColor(java.awt.Color)
public abstract DVBAlphaComposite getDVBComposite()
DVBAlphaComposite
in the
DVBGraphics
context.
This method could delegate to a java.awt.Graphics2D object where availableDVBGraphics
DVBAlphaComposite
,
which defines a compositing style.setDVBComposite(org.dvb.ui.DVBAlphaComposite)
public int getType()
DVBBufferedImage
public abstract void setColor(Color c)
setColor
in class Graphics
c
- the new rendering color.Color
,
DVBColor
,
getColor()
public abstract void setDVBComposite(DVBAlphaComposite comp) throws UnsupportedDrawingOperationException
DVBAlphaComposite
for the DVBGraphics
context.
The DVBAlphaComposite
is used in all drawing methods such as
drawImage
, drawString
, draw
,
and fill
. It specifies how new pixels are to be combined
with the existing pixels on the graphics device during the rendering
process.
This method could delegate to a Graphics2D object or to an native implementation
comp
- the DVBAlphaComposite
object to be used for renderingUnsupportedDrawingOperationException
- when the requested Porter-Duff rule is not supported by this graphics contextGraphics.setXORMode(java.awt.Color)
,
Graphics.setPaintMode()
,
DVBAlphaComposite
Copyright © 2012 CableLabs. All Rights Reserved.