Class DrawableHelper


  • public final class DrawableHelper
    extends java.lang.Object

    Drawable helper class. Used internally by WhiteboardRenderer.

    Client doesn't need to use/create object of this class.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static android.graphics.Bitmap createWhiteboard()
      Creates whiteboard bitmap.
      static android.graphics.Bitmap createWhiteboard​(int whiteboardWidth, int whiteboardHeight)
      Creates whiteboard bitmap.
      static void drawShape​(android.graphics.Canvas canvas, AbstractShape abstractShape, boolean isPicked)
      Draws abstract shape on canvas and if it's picked than its alpha channel will be 50%.
      static float getLongestLineWidth​(java.lang.String content, android.graphics.Paint paint)
      Calculates longest line width.
      static float getTextHeight​(java.lang.String content, android.graphics.Paint paint)
      Calculates text height.
      static boolean isTouchOnAbstractShape​(int x, int y, float clickRange, AbstractShape abstractShape)
      Calculates if x, y coordinates are on abstract shape.
      static boolean shapeWasMoved​(AbstractShape shape)
      Calculates if abstract shape was moved before
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_WHITEBOARD_WIDTH

        public static final int DEFAULT_WHITEBOARD_WIDTH
        See Also:
        Constant Field Values
      • DEFAULT_WHITEBOARD_HEIGHT

        public static final int DEFAULT_WHITEBOARD_HEIGHT
        See Also:
        Constant Field Values
    • Method Detail

      • createWhiteboard

        public static android.graphics.Bitmap createWhiteboard()
        Creates whiteboard bitmap.
        Returns:
        whiteboard bitmap.
      • createWhiteboard

        public static android.graphics.Bitmap createWhiteboard​(int whiteboardWidth,
                                                               int whiteboardHeight)
        Creates whiteboard bitmap.
        Parameters:
        whiteboardWidth - whiteboard width
        whiteboardHeight - whiteboard height
        Returns:
        whiteboard bitmap.
      • drawShape

        public static void drawShape​(android.graphics.Canvas canvas,
                                     AbstractShape abstractShape,
                                     boolean isPicked)
        Draws abstract shape on canvas and if it's picked than its alpha channel will be 50%.
        Parameters:
        canvas - canvas to draw on.
        abstractShape - abstractShape object.
        isPicked - is shape picked.
      • getTextHeight

        public static float getTextHeight​(java.lang.String content,
                                          android.graphics.Paint paint)
        Calculates text height.
        Parameters:
        content - text.
        paint - Paint object containing style and color information.
        Returns:
        text height.
      • getLongestLineWidth

        public static float getLongestLineWidth​(java.lang.String content,
                                                android.graphics.Paint paint)
        Calculates longest line width.
        Parameters:
        content - text.
        paint - Paint object containing style and color information.
        Returns:
        longest line width.
      • isTouchOnAbstractShape

        public static boolean isTouchOnAbstractShape​(int x,
                                                     int y,
                                                     float clickRange,
                                                     AbstractShape abstractShape)
        Calculates if x, y coordinates are on abstract shape.
        Parameters:
        x - x coordinate.
        y - y coordinate.
        clickRange - coordinate detection range.
        abstractShape - abstractShape object.
        Returns:
        true if if x, y coordinates are on abstract shape.
      • shapeWasMoved

        public static boolean shapeWasMoved​(AbstractShape shape)
        Calculates if abstract shape was moved before
        Parameters:
        shape - abstractShape object.
        Returns:
        true if abstract shape was moved before.