本文整理汇总了C++中SkBitmap::getAddr1方法的典型用法代码示例。如果您正苦于以下问题:C++ SkBitmap::getAddr1方法的具体用法?C++ SkBitmap::getAddr1怎么用?C++ SkBitmap::getAddr1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkBitmap
的用法示例。
在下文中一共展示了SkBitmap::getAddr1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: comparePathsTiny
// doesn't work yet
void comparePathsTiny(const SkPath& one, const SkPath& two) {
const SkRect& bounds1 = one.getBounds();
const SkRect& bounds2 = two.getBounds();
SkRect larger = bounds1;
larger.join(bounds2);
SkBitmap bits;
int bitWidth = SkScalarCeil(larger.width()) + 2;
int bitHeight = SkScalarCeil(larger.height()) + 2;
bits.setConfig(SkBitmap::kA1_Config, bitWidth * 2, bitHeight);
bits.allocPixels();
SkCanvas canvas(bits);
canvas.drawColor(SK_ColorWHITE);
SkPaint paint;
canvas.save();
canvas.translate(-bounds1.fLeft + 1, -bounds1.fTop + 1);
canvas.drawPath(one, paint);
canvas.restore();
canvas.save();
canvas.translate(-bounds2.fLeft + 1, -bounds2.fTop + 1);
canvas.drawPath(two, paint);
canvas.restore();
for (int y = 0; y < bitHeight; ++y) {
uint8_t* addr1 = bits.getAddr1(0, y);
uint8_t* addr2 = bits.getAddr1(bitWidth, y);
for (int x = 0; x < bits.rowBytes(); ++x) {
SkASSERT(addr1[x] == addr2[x]);
}
}
}