Class CanvasAdapter

java.lang.Object
org.oscim.backend.CanvasAdapter

public abstract class CanvasAdapter extends Object
The Class CanvasAdapter.
  • Field Details

    • PREFIX_FILE

      public static final String PREFIX_FILE
      See Also:
    • DEFAULT_DPI

      public static final float DEFAULT_DPI
      Default dpi.
      See Also:
    • dpi

      public static float dpi
      The dpi.
    • platform

      public static Platform platform
      The used platform.
    • lineScale

      public static float lineScale
      The line scale.
    • symbolScale

      public static float symbolScale
      The symbol scale.
    • textScale

      public static float textScale
      The text scale.
    • userScale

      public static float userScale
      The user scale.
  • Constructor Details

    • CanvasAdapter

      public CanvasAdapter()
  • Method Details

    • newCanvasImpl

      protected abstract Canvas newCanvasImpl()
      Create a Canvas.
      Returns:
      the canvas
    • newCanvas

      public static Canvas newCanvas()
    • newPaintImpl

      protected abstract Paint newPaintImpl()
      Create Paint.
      Returns:
      the paint
    • newPaint

      public static Paint newPaint()
    • newBitmapImpl

      protected abstract Bitmap newBitmapImpl(int width, int height, int format)
      Create Bitmap with given dimensions.
      Parameters:
      width - the width
      height - the height
      format - the format
      Returns:
      the bitmap
    • newBitmap

      public static Bitmap newBitmap(int width, int height, int format)
    • decodeBitmapImpl

      protected abstract Bitmap decodeBitmapImpl(InputStream inputStream) throws IOException
      Create Bitmap from InputStream.
      Parameters:
      inputStream - the input stream
      Returns:
      the bitmap
      Throws:
      IOException
    • decodeBitmapImpl

      protected abstract Bitmap decodeBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException
      Create Bitmap from InputStream.
      Parameters:
      inputStream - the input stream
      width - requested width (0: no change)
      height - requested height (0: no change)
      percent - requested scale percent (100: no change)
      Returns:
      the bitmap
      Throws:
      IOException
    • decodeBitmap

      public static Bitmap decodeBitmap(InputStream inputStream) throws IOException
      Throws:
      IOException
    • decodeBitmap

      public static Bitmap decodeBitmap(InputStream inputStream, int width, int height, int percent) throws IOException
      Throws:
      IOException
    • decodeSvgBitmapImpl

      protected abstract Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException
      Create SVG Bitmap from InputStream.
      Parameters:
      inputStream - the input stream
      Returns:
      the SVG bitmap
      Throws:
      IOException
    • decodeSvgBitmap

      public static Bitmap decodeSvgBitmap(InputStream inputStream, int width, int height, int percent) throws IOException
      Throws:
      IOException
    • loadBitmapAssetImpl

      protected abstract Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, XmlThemeResourceProvider resourceProvider, int width, int height, int percent) throws IOException
      Create Bitmap from bundled assets.
      Parameters:
      relativePathPrefix - the prefix for relative resource path
      src - the resource
      Returns:
      the bitmap
      Throws:
      IOException
    • getBitmapAsset

      public static Bitmap getBitmapAsset(String relativePathPrefix, String src) throws IOException
      Throws:
      IOException
    • getBitmapAsset

      public static Bitmap getBitmapAsset(String relativePathPrefix, String src, XmlThemeResourceProvider resourceProvider, int width, int height, int percent) throws IOException
      Throws:
      IOException
    • createBitmap

      protected static Bitmap createBitmap(String relativePathPrefix, String src, XmlThemeResourceProvider resourceProvider, int width, int height, int percent) throws IOException
      Throws:
      IOException
    • getAbsoluteFile

      public static File getAbsoluteFile(String parentPath, String pathName)
    • getDeviceScale

      public static float getDeviceScale()
    • getScale

      public static float getScale()
    • init

      protected static void init(CanvasAdapter adapter)