当前位置: 首页>>代码示例>>C++>>正文


C++ SkDraw类代码示例

本文整理汇总了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;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:56,代码来源:SkLayerRasterizer.cpp

示例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;
}
开发者ID:Dieken,项目名称:SurfaceFlinger,代码行数:55,代码来源:SkLayerRasterizer.cpp

示例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);
}
开发者ID:hgl888,项目名称:RuntimeCanvas,代码行数:9,代码来源:SkBitmapDevice.cpp

示例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);
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例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);
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例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);
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例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
}
开发者ID:AHPlankton,项目名称:skia,代码行数:12,代码来源:SkBitmapDevice.cpp

示例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);
}
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:14,代码来源:SkDevice.cpp

示例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);
}
开发者ID:aseprite,项目名称:skia,代码行数:15,代码来源:SkBitmapDevice.cpp

示例10: drawSprite

void SkBitmapDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
                                int x, int y, const SkPaint& paint) {
    draw.drawSprite(bitmap, x, y, paint);
}
开发者ID:hgl888,项目名称:RuntimeCanvas,代码行数:4,代码来源:SkBitmapDevice.cpp

示例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);
}
开发者ID:hgl888,项目名称:RuntimeCanvas,代码行数:4,代码来源:SkBitmapDevice.cpp

示例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);
}
开发者ID:hgl888,项目名称:RuntimeCanvas,代码行数:6,代码来源:SkBitmapDevice.cpp

示例13: drawBitmap

void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
                                const SkMatrix& matrix, const SkPaint& paint) {
    draw.drawBitmap(bitmap, matrix, paint);
}
开发者ID:hgl888,项目名称:RuntimeCanvas,代码行数:4,代码来源:SkBitmapDevice.cpp

示例14: drawRect

void SkDevice::drawRect(const SkDraw& draw, const SkRect& r,
                            const SkPaint& paint) {
    draw.drawRect(r, paint);
}
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:4,代码来源:SkDevice.cpp

示例15: drawRect

void SkBitmapDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) {
    CHECK_FOR_ANNOTATION(paint);
    draw.drawRect(r, paint);
}
开发者ID:hgl888,项目名称:RuntimeCanvas,代码行数:4,代码来源:SkBitmapDevice.cpp


注:本文中的SkDraw类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。