本文整理汇总了C++中SkDraw类的典型用法代码示例。如果您正苦于以下问题:C++ SkDraw类的具体用法?C++ SkDraw怎么用?C++ SkDraw使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SkDraw类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkASSERT
bool SkLayerRasterizer::onRasterize(const SkPath& path, const SkMatrix& matrix,
const SkIRect* clipBounds,
SkMask* mask, SkMask::CreateMode mode) const {
SkASSERT(fLayers);
if (fLayers->empty()) {
return false;
}
if (SkMask::kJustRenderImage_CreateMode != mode) {
if (!compute_bounds(*fLayers, path, matrix, clipBounds, &mask->fBounds))
return false;
}
if (SkMask::kComputeBoundsAndRenderImage_CreateMode == mode) {
mask->fFormat = SkMask::kA8_Format;
mask->fRowBytes = mask->fBounds.width();
size_t size = mask->computeImageSize();
if (0 == size) {
return false; // too big to allocate, abort
}
mask->fImage = SkMask::AllocImage(size);
memset(mask->fImage, 0, size);
}
if (SkMask::kJustComputeBounds_CreateMode != mode) {
SkBitmap device;
SkRasterClip rectClip;
SkDraw draw;
SkMatrix translatedMatrix; // this translates us to our local pixels
SkMatrix drawMatrix; // this translates the path by each layer's offset
rectClip.setRect(SkIRect::MakeWH(mask->fBounds.width(), mask->fBounds.height()));
translatedMatrix = matrix;
translatedMatrix.postTranslate(-SkIntToScalar(mask->fBounds.fLeft),
-SkIntToScalar(mask->fBounds.fTop));
device.installMaskPixels(*mask);
draw.fBitmap = &device;
draw.fMatrix = &drawMatrix;
draw.fRC = &rectClip;
draw.fClip = &rectClip.bwRgn();
// we set the matrixproc in the loop, as the matrix changes each time (potentially)
SkDeque::F2BIter iter(*fLayers);
SkLayerRasterizer_Rec* rec;
while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) {
drawMatrix = translatedMatrix;
drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY);
draw.drawPath(path, rec->fPaint);
}
}
return true;
}
示例2: SkToU16
bool SkLayerRasterizer::onRasterize(const SkPath& path, const SkMatrix& matrix,
const SkIRect* clipBounds,
SkMask* mask, SkMask::CreateMode mode)
{
if (fLayers.empty())
return false;
if (SkMask::kJustRenderImage_CreateMode != mode)
{
if (!compute_bounds(fLayers, path, matrix, clipBounds, &mask->fBounds))
return false;
}
if (SkMask::kComputeBoundsAndRenderImage_CreateMode == mode)
{
mask->fFormat = SkMask::kA8_Format;
mask->fRowBytes = SkToU16(mask->fBounds.width());
mask->fImage = SkMask::AllocImage(mask->computeImageSize());
memset(mask->fImage, 0, mask->computeImageSize());
}
if (SkMask::kJustComputeBounds_CreateMode != mode)
{
SkBitmap device;
SkDraw draw;
SkMatrix translatedMatrix; // this translates us to our local pixels
SkMatrix drawMatrix; // this translates the path by each layer's offset
SkRegion rectClip;
rectClip.setRect(0, 0, mask->fBounds.width(), mask->fBounds.height());
translatedMatrix = matrix;
translatedMatrix.postTranslate(-SkIntToScalar(mask->fBounds.fLeft),
-SkIntToScalar(mask->fBounds.fTop));
device.setConfig(SkBitmap::kA8_Config, mask->fBounds.width(), mask->fBounds.height(), mask->fRowBytes);
device.setPixels(mask->fImage);
draw.fBitmap = &device;
draw.fMatrix = &drawMatrix;
draw.fClip = &rectClip;
// we set the matrixproc in the loop, as the matrix changes each time (potentially)
draw.fBounder = NULL;
SkDeque::Iter iter(fLayers);
SkLayerRasterizer_Rec* rec;
while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) {
drawMatrix = translatedMatrix;
drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY);
draw.drawPath(path, rec->fPaint);
}
}
return true;
}
示例3: drawVertices
void SkBitmapDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
int vertexCount,
const SkPoint verts[], const SkPoint textures[],
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
const SkPaint& paint) {
draw.drawVertices(vmode, vertexCount, verts, textures, colors, xmode,
indices, indexCount, paint);
}
示例4: drawTextOnPath
void SkPDFDeviceFlattener::drawTextOnPath(const SkDraw& d, const void* text, size_t len,
const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint) {
if (mustPathText(d, paint) || (matrix && matrix->hasPerspective())) {
d.drawTextOnPath((const char*)text, len, path, matrix, paint);
return;
}
INHERITED::drawTextOnPath(d, text, len, path, matrix, paint);
}
示例5: drawPosText
void SkPDFDeviceFlattener::drawPosText(const SkDraw& d, const void* text, size_t len,
const SkScalar pos[], SkScalar constY,
int scalarsPerPos, const SkPaint& paint) {
if (mustPathText(d, paint)) {
d.drawPosText_asPaths((const char*)text, len, pos, constY, scalarsPerPos, paint);
return;
}
INHERITED::drawPosText(d, text, len, pos, constY,scalarsPerPos, paint);
}
示例6: drawText
void SkPDFDeviceFlattener::drawText(const SkDraw& d, const void* text, size_t len,
SkScalar x, SkScalar y, const SkPaint& paint) {
if (mustPathText(d, paint)) {
d.drawText_asPaths((const char*)text, len, x, y, paint);
return;
}
INHERITED::drawText(d, text, len, x, y, paint);
}
示例7: drawRRect
void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
#ifdef SK_IGNORE_BLURRED_RRECT_OPT
SkPath path;
path.addRRect(rrect);
// call the VIRTUAL version, so any subclasses who do handle drawPath aren't
// required to override drawRRect.
this->drawPath(draw, path, paint, nullptr, true);
#else
draw.drawRRect(rrect, paint);
#endif
}
示例8: drawBitmap
void SkDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
const SkIRect* srcRect,
const SkMatrix& matrix, const SkPaint& paint) {
SkBitmap tmp; // storage if we need a subset of bitmap
const SkBitmap* bitmapPtr = &bitmap;
if (srcRect) {
if (!bitmap.extractSubset(&tmp, *srcRect)) {
return; // extraction failed
}
bitmapPtr = &tmp;
}
draw.drawBitmap(*bitmapPtr, matrix, paint);
}
示例9: drawVertices
void SkBitmapDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
int vertexCount,
const SkPoint verts[], const SkPoint textures[],
const SkColor colors[], SK_XFERMODE_PARAM xmode,
const uint16_t indices[], int indexCount,
const SkPaint& paint) {
SkBlendMode bmode;
#ifdef SK_SUPPORT_LEGACY_XFERMODE_PARAM
bmode = xmode ? xmode->blend() : SkBlendMode::kModulate;
#else
bmode = xmode;
#endif
draw.drawVertices(vmode, vertexCount, verts, textures, colors, bmode,
indices, indexCount, paint);
}
示例10: drawSprite
void SkBitmapDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
int x, int y, const SkPaint& paint) {
draw.drawSprite(bitmap, x, y, paint);
}
示例11: drawText
void SkBitmapDevice::drawText(const SkDraw& draw, const void* text, size_t len,
SkScalar x, SkScalar y, const SkPaint& paint) {
draw.drawText((const char*)text, len, x, y, paint);
}
示例12: drawPath
void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path,
const SkPaint& paint, const SkMatrix* prePathMatrix,
bool pathIsMutable) {
CHECK_FOR_ANNOTATION(paint);
draw.drawPath(path, paint, prePathMatrix, pathIsMutable);
}
示例13: drawBitmap
void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
const SkMatrix& matrix, const SkPaint& paint) {
draw.drawBitmap(bitmap, matrix, paint);
}
示例14: drawRect
void SkDevice::drawRect(const SkDraw& draw, const SkRect& r,
const SkPaint& paint) {
draw.drawRect(r, paint);
}
示例15: drawRect
void SkBitmapDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) {
CHECK_FOR_ANNOTATION(paint);
draw.drawRect(r, paint);
}