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


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

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


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

示例1: CreateComposeFilter

static SkColorFilter* make_cf1() {
    SkColorMatrix cm;
    cm.setSaturation(0.75f);
    SkAutoTUnref<SkColorFilter> a(SkColorMatrixFilter::Create(cm));
    // CreateComposedFilter will try to concat these two matrices, resulting in a single
    // filter (which is good for speed). For this test, we want to force a real compose of
    // these two, so our inner filter has a scale-up, which disables the optimization of
    // combining the two matrices.
    cm.setScale(1.1f, 0.9f, 1);
    SkAutoTUnref<SkColorFilter> b(SkColorMatrixFilter::Create(cm));
    return SkColorFilter::CreateComposeFilter(a, b);
}
开发者ID:eitanlevy97,项目名称:skia,代码行数:12,代码来源:color4f.cpp

示例2: 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

示例3: 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

示例4: Create

static SkColorFilter* make_cf0() {
    SkColorMatrix cm;
    cm.setSaturation(0.75f);
    return SkColorMatrixFilter::Create(cm);
}
开发者ID:eitanlevy97,项目名称:skia,代码行数:5,代码来源:color4f.cpp

示例5:

static sk_sp<SkColorFilter> make_cf0() {
    SkColorMatrix cm;
    cm.setSaturation(0.75f);
    return SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat);
}
开发者ID:03050903,项目名称:skia,代码行数:5,代码来源:color4f.cpp


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