Why does the Android command use the demo version for delegates of the SmoothCanvas class?

In Android MapsDemo, available in Eclipse for the Google APIs, they create an inner class SmoothCanvasin MapViewCompassDemo.java. Within this class, reimplement each seemingly apparent method and redirect it to the delegate instance Canvas.

static final class SmoothCanvas extends Canvas {
    Canvas delegate;

    private final Paint mSmooth = new Paint(Paint.FILTER_BITMAP_FLAG);

    public void setBitmap(Bitmap bitmap) {
        delegate.setBitmap(bitmap);
    }

    public void setViewport(int width, int height) {
        delegate.setViewport(width, height);
    }
    ...

What is the point of the delegate in this case?

+3
source share
2 answers

delegate dispatchDraw. SmoothCanvas delegate. , Canvas, dispatchDraw, . Canvas.

+1

:

private final Paint mSmooth = new Paint(Paint.FILTER_BITMAP_FLAG);

FILTER_BITMAP_FLAG. . , . xfermodes.

, . , mSmoth drawBitmap.

0

Source: https://habr.com/ru/post/1756357/


All Articles