本文整理汇总了C++中SkColorMatrix::setYUV2RGB方法的典型用法代码示例。如果您正苦于以下问题:C++ SkColorMatrix::setYUV2RGB方法的具体用法?C++ SkColorMatrix::setYUV2RGB怎么用?C++ SkColorMatrix::setYUV2RGB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkColorMatrix
的用法示例。
在下文中一共展示了SkColorMatrix::setYUV2RGB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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);
}
}