本文整理汇总了C++中SkMatrix::setScaleTranslate方法的典型用法代码示例。如果您正苦于以下问题:C++ SkMatrix::setScaleTranslate方法的具体用法?C++ SkMatrix::setScaleTranslate怎么用?C++ SkMatrix::setScaleTranslate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkMatrix
的用法示例。
在下文中一共展示了SkMatrix::setScaleTranslate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkCanvas
SkCanvas*
SkSurface_Compute::onNewCanvas()
{
uint32_t w = 0,h = 0;
// skc_interop_size_get(compute->interop,&w,&h); TODO skc.h
SkDevice_Compute * const device_compute = new SkDevice_Compute(compute,w,h);;
SkCanvas * const canvas = new SkCanvas(device_compute,SkCanvas::kConservativeRasterClip_InitFlag);
//
// destroy device upon surface destruction
//
device = sk_sp<SkBaseDevice>(device_compute);
//
// move origin from upper left to lower left
//
SkMatrix matrix;
matrix.setScaleTranslate(1.0f,-1.0f,0.0f,(SkScalar)h);
canvas->setMatrix(matrix);
return canvas;
}
示例2: onDraw
void onDraw(SkCanvas* canvas) override {
static const SkFilterQuality kFilterQuality = SkFilterQuality::kHigh_SkFilterQuality;
static const bool kDoAA = true;
{
SkRect r1 = SkRect::MakeXYWH(50.0f, 0.0f, 50.0f, 50.0f);
SkPaint p1;
p1.setAntiAlias(kDoAA);
p1.setFilterQuality(kFilterQuality);
SkMatrix localMat;
localMat.setScaleTranslate(2.0f, 2.0f, 50.0f, 0.0f);
p1.setShader(SkImageShader::Make(fTop,
SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode,
&localMat));
canvas->drawRect(r1, p1);
}
{
SkRect r2 = SkRect::MakeXYWH(50.0f, 50.0f, 50.0f, 36.0f);
SkPaint p2;
p2.setColor(SK_ColorWHITE);
p2.setAntiAlias(kDoAA);
p2.setFilterQuality(kFilterQuality);
canvas->drawRect(r2, p2);
}
{
SkRect r3 = SkRect::MakeXYWH(50.0f, 86.0f, 50.0f, 50.0f);
SkPaint p3;
p3.setAntiAlias(kDoAA);
p3.setFilterQuality(kFilterQuality);
SkMatrix localMat;
localMat.setScaleTranslate(2.0f, 2.0f, 50.0f, 86.0f);
p3.setShader(SkImageShader::Make(fBot,
SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode,
&localMat));
canvas->drawRect(r3, p3);
}
}