org.hermit.android.instruments
Class PowerGauge

java.lang.Object
  extended by org.hermit.android.instruments.Gauge
      extended by org.hermit.android.instruments.PowerGauge

public class PowerGauge
extends Gauge

A graphical display which displays the signal power in dB from an AudioAnalyser instrument. This class cannot be instantiated directly; get an instance by calling AudioAnalyser.getPowerGauge(SurfaceRunner).


Method Summary
protected  void drawBackgroundBody(Canvas canvas, Paint paint)
          Do the subclass-specific parts of drawing the background for this element.
protected  void drawBody(Canvas canvas, Paint paint, long now)
          Do the subclass-specific parts of drawing for this element.
 float getLabelSize()
          Get the size for the label text.
 void setBarWidth(int width)
          Set the overall thickness of the bar.
 void setGeometry(Rect bounds)
          This is called during layout when the size of this element has changed.
 void setLabelSize(float size)
          Set the size for the label text.
 
Methods inherited from class org.hermit.android.instruments.Gauge
cacheBackground, draw, drawBackground, drawFinish, drawStart, error, getBackgroundColor, getBaseTextSize, getBounds, getGridColor, getHeadTextSize, getHeight, getInnerGap, getInterPadding, getMiniTextSize, getPaint, getPlotColor, getPreferredHeight, getPreferredWidth, getSidebarWidth, getSurface, getTextScaleX, getTextTypeface, getTinyTextSize, getWidth, haveBounds, initializePaint, optionSet, setBackgroundColor, setBaseTextSize, setDataColors, setGridColor, setHeadTextSize, setInnerGap, setInterPadding, setMiniTextSize, setPlotColor, setSidebarWidth, setTextScaleX, setTextTypeface, setTinyTextSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setBarWidth

public void setBarWidth(int width)
Set the overall thickness of the bar.

Parameters:
width - Overall width in pixels of the bar.

setLabelSize

public void setLabelSize(float size)
Set the size for the label text.

Parameters:
size - Label text size for the gauge.

getLabelSize

public float getLabelSize()
Get the size for the label text.

Returns:
Label text size for the gauge.

setGeometry

public void setGeometry(Rect bounds)
This is called during layout when the size of this element has changed. This is where we first discover our size, so set our geometry to match.

Overrides:
setGeometry in class Gauge
Parameters:
bounds - The bounding rect of this element within its parent View.

drawBackgroundBody

protected void drawBackgroundBody(Canvas canvas,
                                  Paint paint)
Do the subclass-specific parts of drawing the background for this element. Subclasses should override this if they have significant background content which they would like to draw once only. Whatever is drawn here will be saved in a bitmap, which will be rendered to the screen before the dynamic content is drawn.

Obviously, if implementing this method, don't clear the screen when drawing the dynamic part.

Overrides:
drawBackgroundBody in class Gauge
Parameters:
canvas - Canvas to draw into.
paint - The Paint which was set up in initializePaint().

drawBody

protected final void drawBody(Canvas canvas,
                              Paint paint,
                              long now)
Do the subclass-specific parts of drawing for this element. This method is called on the thread of the containing SuraceView.

Subclasses should override this to do their drawing.

Overrides:
drawBody in class Gauge
Parameters:
canvas - Canvas to draw into.
paint - The Paint which was set up in initializePaint().
now - Nominal system time in ms. of this update.