Class GraphicOverlay.Graphic

  • Direct Known Subclasses:
    ActionGraphic
    Enclosing class:
    GraphicOverlay

    public abstract static class GraphicOverlay.Graphic
    extends Object
    Base class for a custom graphics object to be rendered within the graphic overlay. Subclass this and implement the draw(Canvas) method to define the graphics element. Add instances to the overlay using GraphicOverlay.add(Graphic).
    • Method Detail

      • draw

        public abstract void draw​(Canvas canvas)
        Draw the graphic on the supplied canvas. Drawing should use the following methods to convert to view coordinates for the graphics that are drawn:
        1. scaleX(float) and scaleY(float) adjust the size of the supplied value from the preview scale to the view scale.
        2. translateX(float) and translateY(float) adjust the coordinate from the preview's coordinate system to the view coordinate system.
        Parameters:
        canvas - drawing canvas
      • previewWidth

        public int previewWidth()
      • previewHeight

        public int previewHeight()
      • getWidthScaleFactor

        public float getWidthScaleFactor()
      • getHeightScaleFactor

        public float getHeightScaleFactor()
      • scaleX

        public float scaleX​(float horizontal)
        Adjusts a horizontal value of the supplied value from the preview scale to the view scale.
      • scaleY

        public float scaleY​(float vertical)
        Adjusts a vertical value of the supplied value from the preview scale to the view scale.
      • getApplicationContext

        public Context getApplicationContext()
        Returns the application context of the app.
      • translateX

        public float translateX​(float x)
        Adjusts the x coordinate from the preview's coordinate system to the view coordinate system.
      • translateX2

        public float translateX2​(float y)
        Adjusts the x coordinate from the preview's coordinate system to the view coordinate system.
      • translateX3

        public float translateX3​(float y)
      • translateY

        public float translateY​(float y)
        Adjusts the y coordinate from the preview's coordinate system to the view coordinate system.
      • translateY2

        public float translateY2​(float x)
        Adjusts the y coordinate from the preview's coordinate system to the view coordinate system.
      • translateY3

        public float translateY3​(float x)
      • postInvalidate

        public void postInvalidate()