本文整理汇总了C++中Paint::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Paint::setColor方法的具体用法?C++ Paint::setColor怎么用?C++ Paint::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paint
的用法示例。
在下文中一共展示了Paint::setColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doFrame
void doFrame(int frameNr) override {
const char* text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::unique_ptr<Canvas> canvas(
Canvas::create_recording_canvas(container->stagingProperties().getWidth(),
container->stagingProperties().getHeight(),
container.get()));
Paint paint;
paint.setAntiAlias(true);
paint.setColor(Color::Black);
for (int i = 0; i < 5; i++) {
paint.setTextSize(10 + (frameNr % 20) + i * 20);
TestUtils::drawUtf8ToCanvas(canvas.get(), text, paint, 0, 100 * (i + 2));
}
container->setStagingDisplayList(canvas->finishRecording());
}
示例2: doFrame
void doFrame(int frameNr) override {
std::unique_ptr<uint16_t[]> text = TestUtils::asciiToUtf16(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
ssize_t textLength = 26 * 2;
TestCanvas canvas(
container->stagingProperties().getWidth(),
container->stagingProperties().getHeight());
Paint paint;
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
paint.setAntiAlias(true);
paint.setColor(Color::Black);
for (int i = 0; i < 5; i++) {
paint.setTextSize(10 + (frameNr % 20) + i * 20);
canvas.drawText(text.get(), 0, textLength, textLength,
0, 100 * (i + 2), kBidi_Force_LTR, paint, nullptr);
}
container->setStagingDisplayList(canvas.finishRecording(), nullptr);
}