Package org.oscim.backend
Class CanvasAdapter
java.lang.Object
org.oscim.backend.CanvasAdapter
The Class CanvasAdapter.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static BitmapcreateBitmap(String relativePathPrefix, String src, XmlThemeResourceProvider resourceProvider, int width, int height, int percent) static BitmapdecodeBitmap(InputStream inputStream) static BitmapdecodeBitmap(InputStream inputStream, int width, int height, int percent) protected abstract BitmapdecodeBitmapImpl(InputStream inputStream) CreateBitmapfrom InputStream.protected abstract BitmapdecodeBitmapImpl(InputStream inputStream, int width, int height, int percent) CreateBitmapfrom InputStream.static BitmapdecodeSvgBitmap(InputStream inputStream, int width, int height, int percent) protected abstract BitmapdecodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) Create SVGBitmapfrom InputStream.static FilegetAbsoluteFile(String parentPath, String pathName) static BitmapgetBitmapAsset(String relativePathPrefix, String src) static BitmapgetBitmapAsset(String relativePathPrefix, String src, XmlThemeResourceProvider resourceProvider, int width, int height, int percent) static floatstatic floatgetScale()protected static voidinit(CanvasAdapter adapter) protected abstract BitmaploadBitmapAssetImpl(String relativePathPrefix, String src, XmlThemeResourceProvider resourceProvider, int width, int height, int percent) CreateBitmapfrom bundled assets.static BitmapnewBitmap(int width, int height, int format) protected abstract BitmapnewBitmapImpl(int width, int height, int format) CreateBitmapwith given dimensions.static Canvasprotected abstract CanvasCreate a Canvas.static PaintnewPaint()protected abstract PaintCreate Paint.
-
Field Details
-
PREFIX_FILE
- See Also:
-
DEFAULT_DPI
public static final float DEFAULT_DPIDefault dpi.- See Also:
-
dpi
public static float dpiThe dpi. -
platform
The used platform. -
lineScale
public static float lineScaleThe line scale. -
symbolScale
public static float symbolScaleThe symbol scale. -
textScale
public static float textScaleThe text scale. -
userScale
public static float userScaleThe user scale.
-
-
Constructor Details
-
CanvasAdapter
public CanvasAdapter()
-
-
Method Details
-
newCanvasImpl
Create a Canvas.- Returns:
- the canvas
-
newCanvas
-
newPaintImpl
Create Paint.- Returns:
- the paint
-
newPaint
-
newBitmapImpl
CreateBitmapwith given dimensions.- Parameters:
width- the widthheight- the heightformat- the format- Returns:
- the bitmap
-
newBitmap
-
decodeBitmapImpl
CreateBitmapfrom 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 CreateBitmapfrom InputStream.- Parameters:
inputStream- the input streamwidth- requested width (0: no change)height- requested height (0: no change)percent- requested scale percent (100: no change)- Returns:
- the bitmap
- Throws:
IOException
-
decodeBitmap
- 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 SVGBitmapfrom 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 CreateBitmapfrom bundled assets.- Parameters:
relativePathPrefix- the prefix for relative resource pathsrc- the resource- Returns:
- the bitmap
- Throws:
IOException
-
getBitmapAsset
- 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
-
getDeviceScale
public static float getDeviceScale() -
getScale
public static float getScale() -
init
-