Exemplo n.º 1
0
    virtual void onDrawContent(SkCanvas* canvas) {
        canvas->drawBitmap(fBitmap, 0, 0);

        canvas->translate(SkIntToScalar(20), SkIntToScalar(120));

        SkPaint paint;
        SkRect  r;

        paint.setColor(SK_ColorGREEN);
        canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), paint);
        paint.setShader(fShader);
        canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), paint);

        canvas->translate(SkIntToScalar(110), 0);

        int w = fBitmap.width();
        int h = fBitmap.height();
        w = 120;
        h = 80;
        r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h));

        paint.setShader(NULL);
        canvas->drawRect(r, paint);
        paint.setShader(make_bitmapfade(fBitmap))->unref();
        canvas->drawRect(r, paint);

        paint.setShader(new SkTransparentShader)->unref();
        canvas->drawRect(r, paint);
    }
Exemplo n.º 2
0
    void onDrawContent(SkCanvas* canvas) override {
        canvas->drawBitmap(fBitmap, 0, 0);

        canvas->translate(20, 120);

        SkPaint paint;
        SkRect  r;

        paint.setColor(SK_ColorGREEN);
        canvas->drawRect(SkRect::MakeWH(100, 100), paint);
        paint.setShader(fShader);
        canvas->drawRect(SkRect::MakeWH(100, 100), paint);

        canvas->translate(SkIntToScalar(110), 0);

        int w = fBitmap.width();
        int h = fBitmap.height();
        w = 120;
        h = 80;
        r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h));

        paint.setShader(nullptr);
        canvas->drawRect(r, paint);
        paint.setShader(make_bitmapfade(fBitmap));
        canvas->drawRect(r, paint);
    }
Exemplo n.º 3
0
    virtual void onDraw(SkCanvas* canvas)
    {
        this->drawBG(canvas);
        
        canvas->drawBitmap(fBitmap, 0, 0);
        
        {
            SkIRect src;
            SkRect  dst;
            
            src.set(20, 50, 120, 70);
            dst.set(src);
            dst.offset(SkIntToScalar(300), 0);

            canvas->drawBitmapRect(fBitmap, &src, dst);
        }

        canvas->translate(SkIntToScalar(80), SkIntToScalar(80));
        
        SkPaint paint;
        SkRect  r;

        paint.setColor(SK_ColorGREEN);
        canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), paint);
        paint.setShader(fShader);
        canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), paint);

        canvas->translate(SkIntToScalar(110), 0);

        r.set(0, 0, SkIntToScalar(fBitmap.width()), SkIntToScalar(fBitmap.height()));

        paint.setShader(NULL);
        canvas->drawRect(r, paint);
        paint.setShader(make_bitmapfade(fBitmap))->unref();
        canvas->drawRect(r, paint);
        
        paint.setShader(new SkTransparentShader)->unref();
        canvas->drawRect(r, paint);
    }