当前位置: 首页>>代码示例>>C++>>正文


C++ SkColorMatrix::setRotate方法代码示例

本文整理汇总了C++中SkColorMatrix::setRotate方法的典型用法代码示例。如果您正苦于以下问题:C++ SkColorMatrix::setRotate方法的具体用法?C++ SkColorMatrix::setRotate怎么用?C++ SkColorMatrix::setRotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SkColorMatrix的用法示例。


在下文中一共展示了SkColorMatrix::setRotate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EffectsView

    EffectsView() {
        size_t i;
        const float pts[] = {
            0, 0,
            10, 0,
            10, 5,
            20, -5,
            10, -15,
            10, -10,
            0, -10
        };
        fPath.moveTo(pts[0], pts[1]);
        for (i = 2; i < SK_ARRAY_COUNT(pts); i += 2) {
            fPath.lineTo(pts[i], pts[i+1]);
        }

        for (i = 0; i < SK_ARRAY_COUNT(gPaintProcs); i++) {
            fPaint[i].setAntiAlias(true);
            fPaint[i].setColor(COLOR);
            gPaintProcs[i](&fPaint[i]);
        }

        SkColorMatrix cm;
        cm.setRotate(SkColorMatrix::kG_Axis, 180);
        cm.setIdentity();

        this->setBGColor(0xFFDDDDDD);
    }
开发者ID:molikto,项目名称:Skia,代码行数:28,代码来源:SampleEffects.cpp

示例2: postRotate

void SkColorMatrix::postRotate(Axis axis, SkScalar degrees)
{
    SkColorMatrix tmp;
    tmp.setRotate(axis, degrees);
    this->postConcat(tmp);
}
开发者ID:AOSP-JF-MM,项目名称:platform_external_skia,代码行数:6,代码来源:SkColorMatrix.cpp

示例3: onDraw

    virtual void onDraw(SkCanvas* canvas) {
        this->init();

        SkPaint paint;
        SkColorMatrix matrix;
        SkColorMatrixFilter* filter = new SkColorMatrixFilter();
        paint.setColorFilter(filter)->unref();

        matrix.setIdentity();
        filter->setMatrix(matrix);
        canvas->drawBitmap(fBitmap, 0, 0, &paint);

        matrix.setRotate(SkColorMatrix::kR_Axis, 90);
        filter->setMatrix(matrix);
        canvas->drawBitmap(fBitmap, 80, 0, &paint);

        matrix.setRotate(SkColorMatrix::kG_Axis, 90);
        filter->setMatrix(matrix);
        canvas->drawBitmap(fBitmap, 160, 0, &paint);

        matrix.setRotate(SkColorMatrix::kB_Axis, 90);
        filter->setMatrix(matrix);
        canvas->drawBitmap(fBitmap, 240, 0, &paint);

        matrix.setSaturation(SkFloatToScalar(0.0f));
        filter->setMatrix(matrix);
        canvas->drawBitmap(fBitmap, 0, 80, &paint);

        matrix.setSaturation(SkFloatToScalar(0.5f));
        filter->setMatrix(matrix);
        canvas->drawBitmap(fBitmap, 80, 80, &paint);

        matrix.setSaturation(SkFloatToScalar(1.0f));
        filter->setMatrix(matrix);
        canvas->drawBitmap(fBitmap, 160, 80, &paint);

        matrix.setSaturation(SkFloatToScalar(2.0f));
        filter->setMatrix(matrix);
        canvas->drawBitmap(fBitmap, 240, 80, &paint);

        matrix.setRGB2YUV();
        filter->setMatrix(matrix);
        canvas->drawBitmap(fBitmap, 0, 160, &paint);

        matrix.setYUV2RGB();
        filter->setMatrix(matrix);
        canvas->drawBitmap(fBitmap, 80, 160, &paint);

        SkScalar s1 = SK_Scalar1;
        SkScalar s255 = SkIntToScalar(255);
        // Move red into alpha, set color to white
        SkScalar data[20] = {
            0,  0, 0, 0, s255,
            0,  0, 0, 0, s255,
            0,  0, 0, 0, s255,
            s1, 0, 0, 0, 0,
        };

        filter->setArray(data);
        canvas->drawBitmap(fBitmap, 160, 160, &paint);
    }
开发者ID:ghub,项目名称:NVprSDK,代码行数:61,代码来源:colormatrix.cpp

示例4: onDraw

    virtual void onDraw(SkCanvas* canvas) {
        this->init();

        SkPaint paint;
        SkColorMatrix matrix;

        paint.setXfermodeMode(SkXfermode::kSrc_Mode);
        const SkBitmap bmps[] = { fSolidBitmap, fTransparentBitmap };

        for (size_t i = 0; i < SK_ARRAY_COUNT(bmps); ++i) {
            matrix.setIdentity();
            setColorMatrix(&paint, matrix);
            canvas->drawBitmap(bmps[i], 0, 0, &paint);

            matrix.setRotate(SkColorMatrix::kR_Axis, 90);
            setColorMatrix(&paint, matrix);
            canvas->drawBitmap(bmps[i], 80, 0, &paint);

            matrix.setRotate(SkColorMatrix::kG_Axis, 90);
            setColorMatrix(&paint, matrix);
            canvas->drawBitmap(bmps[i], 160, 0, &paint);

            matrix.setRotate(SkColorMatrix::kB_Axis, 90);
            setColorMatrix(&paint, matrix);
            canvas->drawBitmap(bmps[i], 240, 0, &paint);

            matrix.setSaturation(0.0f);
            setColorMatrix(&paint, matrix);
            canvas->drawBitmap(bmps[i], 0, 80, &paint);

            matrix.setSaturation(0.5f);
            setColorMatrix(&paint, matrix);
            canvas->drawBitmap(bmps[i], 80, 80, &paint);

            matrix.setSaturation(1.0f);
            setColorMatrix(&paint, matrix);
            canvas->drawBitmap(bmps[i], 160, 80, &paint);

            matrix.setSaturation(2.0f);
            setColorMatrix(&paint, matrix);
            canvas->drawBitmap(bmps[i], 240, 80, &paint);

            matrix.setRGB2YUV();
            setColorMatrix(&paint, matrix);
            canvas->drawBitmap(bmps[i], 0, 160, &paint);

            matrix.setYUV2RGB();
            setColorMatrix(&paint, matrix);
            canvas->drawBitmap(bmps[i], 80, 160, &paint);

            SkScalar s1 = SK_Scalar1;
            SkScalar s255 = SkIntToScalar(255);
            // Move red into alpha, set color to white
            SkScalar data[20] = {
                0,  0, 0, 0, s255,
                0,  0, 0, 0, s255,
                0,  0, 0, 0, s255,
                s1, 0, 0, 0, 0,
            };

            setArray(&paint, data);
            canvas->drawBitmap(bmps[i], 160, 160, &paint);

            canvas->translate(0, 240);
        }
    }
开发者ID:Arternis,项目名称:skia,代码行数:66,代码来源:colormatrix.cpp


注:本文中的SkColorMatrix::setRotate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。