本文整理汇总了C++中SkMatrix::setRSXform方法的典型用法代码示例。如果您正苦于以下问题:C++ SkMatrix::setRSXform方法的具体用法?C++ SkMatrix::setRSXform怎么用?C++ SkMatrix::setRSXform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkMatrix
的用法示例。
在下文中一共展示了SkMatrix::setRSXform方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawAtlas
void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkRSXform xform[],
const SkRect tex[], const SkColor colors[], int count,
SkXfermode::Mode mode, const SkPaint& paint) {
SkPath path;
path.setIsVolatile(true);
for (int i = 0; i < count; ++i) {
SkPoint quad[4];
xform[i].toQuad(tex[i].width(), tex[i].height(), quad);
SkMatrix localM;
localM.setRSXform(xform[i]);
localM.preTranslate(-tex[i].left(), -tex[i].top());
SkPaint pnt(paint);
sk_sp<SkShader> shader = atlas->makeShader(SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode,
&localM);
if (!shader) {
break;
}
pnt.setShader(std::move(shader));
if (colors) {
pnt.setColorFilter(SkColorFilter::MakeModeFilter(colors[i], mode));
}
path.rewind();
path.addPoly(quad, 4, true);
path.setConvexity(SkPath::kConvex_Convexity);
this->drawPath(draw, path, pnt, nullptr, true);
}
}
示例2: onDrawTextRSXform
void SkOverdrawCanvas::onDrawTextRSXform(const void* text, size_t byteLength,
const SkRSXform xform[], const SkRect*,
const SkPaint& paint) {
CountTextProc proc = nullptr;
switch (paint.getTextEncoding()) {
case SkPaint::kUTF8_TextEncoding:
proc = SkUTF8_CountUTF8Bytes;
break;
case SkPaint::kUTF16_TextEncoding:
proc = count_utf16;
break;
case SkPaint::kUTF32_TextEncoding:
proc = return_4;
break;
case SkPaint::kGlyphID_TextEncoding:
proc = return_2;
break;
}
SkASSERT(proc);
SkMatrix matrix;
const void* stopText = (const char*)text + byteLength;
while ((const char*)text < (const char*)stopText) {
matrix.setRSXform(*xform++);
matrix.setConcat(this->getTotalMatrix(), matrix);
int subLen = proc((const char*)text);
this->save();
this->concat(matrix);
this->drawText(text, subLen, 0, 0, paint);
this->restore();
text = (const char*)text + subLen;
}
}
示例3: drawAtlas
void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkRSXform xform[],
const SkRect tex[], const SkColor colors[], int count,
SkXfermode::Mode mode, const SkPaint& paint) {
SkPath path;
path.setIsVolatile(true);
for (int i = 0; i < count; ++i) {
SkPoint quad[4];
xform[i].toQuad(tex[i].width(), tex[i].height(), quad);
SkMatrix localM;
localM.setRSXform(xform[i]);
localM.preTranslate(-tex[i].left(), -tex[i].top());
SkPaint pnt(paint);
pnt.setShader(atlas->newShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode,
&localM))->unref();
if (colors && colors[i] != SK_ColorWHITE) {
SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(colors[i], mode));
pnt.setColorFilter(cf);
}
path.rewind();
path.addPoly(quad, 4, true);
path.setConvexity(SkPath::kConvex_Convexity);
this->drawPath(draw, path, pnt, NULL, true);
}
}
示例4: draw
void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setColor(SK_ColorGRAY);
paint.setAntiAlias(true);
SkRect rect = {20, 20, 100, 100};
canvas->drawRect(rect, paint);
paint.setColor(SK_ColorRED);
SkMatrix matrix;
matrix.setRSXform(SkRSXform::Make(.85f, .25f, rect.centerX(), rect.centerY()));
canvas->concat(matrix);
canvas->translate(-rect.centerX(), -rect.centerY());
canvas->drawRect(rect, paint);
}
示例5: draw_atlas_sim
static void draw_atlas_sim(SkCanvas* canvas, SkImage* atlas, const SkRSXform xform[],
const SkRect tex[], const SkColor colors[], int count, const SkRect* cull,
const SkPaint* paint) {
for (int i = 0; i < count; ++i) {
SkMatrix matrix;
matrix.setRSXform(xform[i]);
canvas->save();
canvas->concat(matrix);
canvas->drawImageRect(atlas, tex[i], tex[i].makeOffset(-tex[i].x(), -tex[i].y()), paint,
SkCanvas::kFast_SrcRectConstraint);
canvas->restore();
}
}