本文整理汇总了C++中SkColorMatrix类的典型用法代码示例。如果您正苦于以下问题:C++ SkColorMatrix类的具体用法?C++ SkColorMatrix怎么用?C++ SkColorMatrix使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SkColorMatrix类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: byte_to_scale
SkColorFilter* SkColorFilter::CreateLightingFilter(SkColor mul, SkColor add) {
SkColorMatrix matrix;
matrix.setScale(byte_to_scale(SkColorGetR(mul)),
byte_to_scale(SkColorGetG(mul)),
byte_to_scale(SkColorGetB(mul)),
1);
matrix.postTranslate(SkIntToScalar(SkColorGetR(add)),
SkIntToScalar(SkColorGetG(add)),
SkIntToScalar(SkColorGetB(add)),
0);
return SkColorMatrixFilter::Create(matrix);
}
示例3: make_cf1
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);
}
示例4: postRotate
void SkColorMatrix::postRotate(Axis axis, SkScalar degrees)
{
SkColorMatrix tmp;
tmp.setRotate(axis, degrees);
this->postConcat(tmp);
}
示例5: 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);
}
示例6: 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);
}
}
示例7: make_cf0
static SkColorFilter* make_cf0() {
SkColorMatrix cm;
cm.setSaturation(0.75f);
return SkColorMatrixFilter::Create(cm);
}
示例8: make_cf0
static sk_sp<SkColorFilter> make_cf0() {
SkColorMatrix cm;
cm.setSaturation(0.75f);
return SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat);
}