Renderer Plugins
SciChart ships with three swappable renderer plugins which perform the final draw for RenderableSeries and Axes on the renderSurface. These plugins are detailed below. To use them you can set renderSurface or extend SciChartSurface and overide getDefaultRenderSurface(Context context) to return alternaitive implementation:
// Assume a surface has been created and configured somewhere
surface.setRenderSurface(new RenderSurfaceGL(getContext()));
class CanvasSciChartSurface extends SciChartSurface {
public CanvasSciChartSurface(Context context) {
super(context);
}
public CanvasSciChartSurface(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CanvasSciChartSurface(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected IRenderSurface getDefaultRenderSurface(Context context) {
return new RenderSurface(context); // return Canvas based IRenderSurface
}
}
GLTextureView
Since v3.0 GLTextureView is a default IRenderSurface implementation which is used by SciChartSurface for drawing of its RenderableSeries and Axes. It uses OpenGL for rendering ( it's based on TextureView class provided by Android SDK) and creates a separate Thread for rendering which makes is suitable for the most cases. Unlike RenderSurfaceGL it doesn't have a problem with Z-order and transparency but is abit slower because it requires GPU to blitt its content onto the View layer. The GPU can do this quickly, but in case of RenderSurfaceGL which creates a separate layer for this it isn't required at all.
RenderSurfaceGL
The RenderSurfaceGL was default RenderSurface used by SciChart Android prior to v3.0. It uses OpenGL for rendering and based on GLSurfaceView class provided by Android SDK. This is the fastest implementation in terms of performance because its surface which is used for rendering gets passed directly to the surface compositor, so when you draw on it with OpenGL there's relatively little overhead. Also it uses separate Thread for rendering. This makes it fast, but it also makes it not play quite right with the View hierarchy, because the surface is rendered on one layer and the View-based UI is on a different layer. This means that if you use this type of surface you can get a problem with Z-order and problem with transparency ( you can't place Android View below surface )
RenderSurface
RenderSurface uses Canvas API isntead of OpenGL for rendering and doesn't use separate Thread for rendering which makes it slower than other OpenGL based IRenderSurface implementations, but because of this it doesn't introduce overhead on startup ( it doesn't require additional time to initialize OpenGL and start render Thread ) which may lead to seing a black screen on startup when surface isn't fully initialized. This makes it ideal for cases when you need to attach/detach SciChartSurface from View hierarchy many times (e.g. when you place chart into RecycleView which recycles its items)