Package 

Class NonAcceleratedOverlay

  • All Implemented Interfaces:
    org.osmdroid.views.util.constants.OverlayConstants

    
    public abstract class NonAcceleratedOverlay
    extends Overlay
                        

    This will allow an Overlay that is not HW acceleration compatible to work in a HW accelerated MapView. It will create a screen-sized backing Bitmap for the Overlay to draw to and then will draw the Bitmap to the HW accelerated canvas. Due to the extra work, it does not draw the shadow layer. If the Canvas passed into the Overlay is not HW accelerated or if isUsingBackingBitmap returns false then it draws normally (including the shadow layer) without the backing Bitmap. TODO:

    • Implement a flag to determine if the drawing has actually changed. If not, then reuse the last frame's backing bitmap. This will prevent having to re-upload the bitmap texture to GPU.
    • Method Summary

      Modifier and Type Method Description
      boolean isUsingBackingBitmap() Allow forcing this overlay to skip drawing using backing Bitmap by returning false.
      void onDetach(MapView mapView) Override to perform clean up of resources before shutdown.
      final void draw(Canvas c, MapView osmv, boolean shadow) Draw the overlay over the map.
      • Methods inherited from class org.osmdroid.views.overlay.Overlay

        draw, draw, getBounds, isEnabled, onDetach, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onLongPress, onPause, onResume, onScroll, onShowPress, onSingleTapConfirmed, onSingleTapUp, onTouchEvent, onTrackballEvent, setEnabled
      • Methods inherited from class java.lang.Object

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

      • NonAcceleratedOverlay

        NonAcceleratedOverlay()
    • Method Detail

      • isUsingBackingBitmap

         boolean isUsingBackingBitmap()

        Allow forcing this overlay to skip drawing using backing Bitmap by returning false.

      • onDetach

         void onDetach(MapView mapView)

        Override to perform clean up of resources before shutdown. By default does nothing.

      • draw

         final void draw(Canvas c, MapView osmv, boolean shadow)

        Draw the overlay over the map. This will be called on all active overlays with shadow=true,to lay down the shadow layer, and then again on all overlays with shadow=false. Callersshould check isEnabled() before calling draw(). By default, draws nothing.

        changed for 5.6 to be public see https://github.com/osmdroid/osmdroid/issues/466If possible, use draw instead (cf. MapSnapshot