Package 

Class GraphicOverlay.Graphic


  • 
    public abstract class GraphicOverlay.Graphic
    
                        

    Base class for a custom graphics object to be rendered within the graphic overlay. Subclassthis and implement the draw method to define the graphics element. Addinstances to the overlay using add.

    • Method Summary

      Modifier and Type Method Description
      abstract void draw(Canvas canvas) Draw the graphic on the supplied canvas.
      int previewWidth()
      int previewHeight()
      float getWidthScaleFactor()
      float getHeightScaleFactor()
      float scaleX(float horizontal) Adjusts a horizontal value of the supplied value from the preview scale to the view scale.
      float scaleY(float vertical) Adjusts a vertical value of the supplied value from the preview scale to the view scale.
      Context getApplicationContext() Returns the application context of the app.
      float translateX(float x) Adjusts the x coordinate from the preview's coordinate system to the view coordinate system.
      float translateX2(float y) Adjusts the x coordinate from the preview's coordinate system to the view coordinate system.
      float translateX3(float y)
      float translateY(float y) Adjusts the y coordinate from the preview's coordinate system to the view coordinate system.
      float translateY2(float x) Adjusts the y coordinate from the preview's coordinate system to the view coordinate system.
      float translateY3(float x)
      void postInvalidate()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GraphicOverlay.Graphic

        GraphicOverlay.Graphic(GraphicOverlay overlay)
    • Method Detail

      • draw

         abstract void draw(Canvas canvas)

        Draw the graphic on the supplied canvas. Drawing should use the following methods to convertto view coordinates for the graphics that are drawn:

        • scaleX and scaleY adjust the size of thesupplied value from the preview scale to the view scale.
        • translateX and translateY adjust thecoordinate from the preview's coordinate system to the view coordinate system.
        Parameters:
        canvas - drawing canvas
      • scaleX

         float scaleX(float horizontal)

        Adjusts a horizontal value of the supplied value from the preview scale to the view scale.

      • scaleY

         float scaleY(float vertical)

        Adjusts a vertical value of the supplied value from the preview scale to the view scale.

      • translateX

         float translateX(float x)

        Adjusts the x coordinate from the preview's coordinate system to the view coordinate system.

      • translateX2

         float translateX2(float y)

        Adjusts the x coordinate from the preview's coordinate system to the view coordinate system.

      • translateY

         float translateY(float y)

        Adjusts the y coordinate from the preview's coordinate system to the view coordinate system.

      • translateY2

         float translateY2(float x)

        Adjusts the y coordinate from the preview's coordinate system to the view coordinate system.