本文整理汇总了C++中Paint::paint方法的典型用法代码示例。如果您正苦于以下问题:C++ Paint::paint方法的具体用法?C++ Paint::paint怎么用?C++ Paint::paint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paint
的用法示例。
在下文中一共展示了Paint::paint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawAtlas
void Canvas::drawAtlas(CanvasImage* atlas,
const Vector<RSTransform>& transforms, const Vector<Rect>& rects,
const Vector<SkColor>& colors, TransferMode mode,
const Rect& cullRect, const Paint& paint)
{
if (!m_canvas)
return;
RefPtr<SkImage> skImage = atlas->image();
Vector<SkRSXform> skXForms;
skXForms.reserveInitialCapacity(transforms.size());
for (const RSTransform& transform : transforms)
skXForms.append(transform.sk_xform);
Vector<SkRect> skRects;
skRects.reserveInitialCapacity(rects.size());
for (const Rect& rect : rects)
skRects.append(rect.sk_rect);
m_canvas->drawAtlas(
skImage.get(),
skXForms.data(),
skRects.data(),
colors.isEmpty() ? nullptr : colors.data(),
skXForms.size(),
mode,
cullRect.is_null ? nullptr : &cullRect.sk_rect,
paint.paint()
);
}
示例2: saveLayer
void Canvas::saveLayer(const Rect& bounds, const Paint& paint)
{
if (!m_canvas)
return;
m_canvas->saveLayer(!bounds.is_null ? &bounds.sk_rect : nullptr,
paint.paint());
}
示例3: drawImageNine
void Canvas::drawImageNine(const CanvasImage* image, Rect& center, Rect& dst, const Paint& paint) {
if (!m_canvas)
return;
ASSERT(image);
SkIRect icenter;
center.sk_rect.round(&icenter);
m_canvas->drawImageNine(image->image(), icenter, dst.sk_rect, paint.paint());
}
示例4: drawVertices
void Canvas::drawVertices(SkCanvas::VertexMode vertexMode,
const Vector<Point>& vertices,
const Vector<Point>& textureCoordinates,
const Vector<SkColor>& colors,
SkXfermode::Mode transferMode,
const Vector<int>& indices,
const Paint& paint,
ExceptionState& es)
{
if (!m_canvas)
return;
size_t vertexCount = vertices.size();
if (textureCoordinates.size() && textureCoordinates.size() != vertexCount)
return es.ThrowRangeError("vertices and textureCoordinates lengths must match");
if (colors.size() && colors.size() != vertexCount)
return es.ThrowRangeError("vertices and colors lengths must match");
Vector<SkPoint> skVertices;
for (size_t x = 0; x < vertices.size(); x++) {
const Point& point = vertices[x];
if (point.is_null)
return es.ThrowRangeError("vertices contained a null");
skVertices.append(point.sk_point);
}
Vector<SkPoint> skTextureCoordinates;
for (size_t x = 0; x < textureCoordinates.size(); x++) {
const Point& point = textureCoordinates[x];
if (point.is_null)
return es.ThrowRangeError("textureCoordinates contained a null");
skTextureCoordinates.append(point.sk_point);
}
Vector<uint16_t> skIndices;
for (size_t x = 0; x < indices.size(); x++) {
uint16_t i = indices[x];
skIndices.append(i);
}
RefPtr<SkXfermode> transferModePtr = adoptRef(SkXfermode::Create(transferMode));
m_canvas->drawVertices(
vertexMode,
skVertices.size(),
skVertices.data(),
skTextureCoordinates.isEmpty() ? nullptr : skTextureCoordinates.data(),
colors.isEmpty() ? nullptr : colors.data(),
transferModePtr.get(),
skIndices.isEmpty() ? nullptr : skIndices.data(),
skIndices.size(),
*paint.paint()
);
}
示例5: saveLayer
void Canvas::saveLayer(double left,
double top,
double right,
double bottom,
const Paint& paint)
{
if (!m_canvas)
return;
SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
m_canvas->saveLayer(&bounds, paint.paint());
}
示例6: drawVertices
void Canvas::drawVertices(SkCanvas::VertexMode vertexMode,
const std::vector<Point>& vertices,
const std::vector<Point>& textureCoordinates,
const std::vector<CanvasColor>& colors,
TransferMode transferMode,
const std::vector<int>& indices,
const Paint& paint)
{
if (!m_canvas)
return;
std::vector<SkPoint> skVertices;
skVertices.reserve(vertices.size());
for (const Point& point : vertices)
skVertices.push_back(point.sk_point);
std::vector<SkPoint> skTextureCoordinates;
skVertices.reserve(textureCoordinates.size());
for (const Point& point : textureCoordinates)
skTextureCoordinates.push_back(point.sk_point);
std::vector<SkColor> skColors;
skColors.reserve(colors.size());
for (const CanvasColor& color : colors)
skColors.push_back(color);
std::vector<uint16_t> skIndices;
skIndices.reserve(indices.size());
for (uint16_t i : indices)
skIndices.push_back(i);
RefPtr<SkXfermode> transferModePtr = adoptRef(SkXfermode::Create(transferMode));
m_canvas->drawVertices(
vertexMode,
skVertices.size(),
skVertices.data(),
skTextureCoordinates.empty() ? nullptr : skTextureCoordinates.data(),
skColors.empty() ? nullptr : skColors.data(),
transferModePtr.get(),
skIndices.empty() ? nullptr : skIndices.data(),
skIndices.size(),
*paint.paint()
);
}
示例7: drawImageRect
void Canvas::drawImageRect(const CanvasImage* image,
double srcLeft,
double srcTop,
double srcRight,
double srcBottom,
double dstLeft,
double dstTop,
double dstRight,
double dstBottom,
const Paint& paint) {
if (!m_canvas)
return;
ASSERT(image);
m_canvas->drawImageRect(image->image(),
SkRect::MakeLTRB(srcLeft, srcTop, srcRight, srcBottom),
SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom),
paint.paint(),
SkCanvas::kFast_SrcRectConstraint);
}
示例8: drawImageNine
void Canvas::drawImageNine(const CanvasImage* image,
double centerLeft,
double centerTop,
double centerRight,
double centerBottom,
double dstLeft,
double dstTop,
double dstRight,
double dstBottom,
const Paint& paint) {
if (!m_canvas)
return;
ASSERT(image);
SkRect center = SkRect::MakeLTRB(centerLeft, centerTop, centerRight, centerBottom);
SkIRect icenter;
center.round(&icenter);
m_canvas->drawImageNine(image->image(),
icenter,
SkRect::MakeLTRB(dstLeft, dstTop, dstRight, dstBottom),
paint.paint());
}
示例9: drawAtlas
void Canvas::drawAtlas(CanvasImage* atlas,
const Vector<RSTransform>& transforms, const Vector<Rect>& rects,
const Vector<SkColor>& colors, SkXfermode::Mode mode,
const Rect& cullRect, const Paint& paint, ExceptionState& es)
{
if (!m_canvas)
return;
RefPtr<SkImage> skImage = atlas->image();
if (transforms.size() != rects.size())
return es.ThrowRangeError("transforms and rects lengths must match");
if (colors.size() && colors.size() != rects.size())
return es.ThrowRangeError("if supplied, colors length must match that of transforms and rects");
Vector<SkRSXform> skXForms;
for (size_t x = 0; x < transforms.size(); x++) {
const RSTransform& transform = transforms[x];
if (transform.is_null)
return es.ThrowRangeError("transforms contained a null");
skXForms.append(transform.sk_xform);
}
Vector<SkRect> skRects;
for (size_t x = 0; x < rects.size(); x++) {
const Rect& rect = rects[x];
if (rect.is_null)
return es.ThrowRangeError("rects contained a null");
skRects.append(rect.sk_rect);
}
m_canvas->drawAtlas(
skImage.get(),
skXForms.data(),
skRects.data(),
colors.isEmpty() ? nullptr : colors.data(),
skXForms.size(),
mode,
cullRect.is_null ? nullptr : &cullRect.sk_rect,
paint.paint()
);
}
示例10: drawVertices
void Canvas::drawVertices(SkCanvas::VertexMode vertexMode,
const Vector<Point>& vertices,
const Vector<Point>& textureCoordinates,
const Vector<SkColor>& colors,
TransferMode transferMode,
const Vector<int>& indices,
const Paint& paint)
{
if (!m_canvas)
return;
Vector<SkPoint> skVertices;
skVertices.reserveInitialCapacity(vertices.size());
for (const Point& point : vertices)
skVertices.append(point.sk_point);
Vector<SkPoint> skTextureCoordinates;
skVertices.reserveInitialCapacity(textureCoordinates.size());
for (const Point& point : textureCoordinates)
skTextureCoordinates.append(point.sk_point);
Vector<uint16_t> skIndices;
skIndices.reserveInitialCapacity(indices.size());
for (uint16_t i : indices)
skIndices.append(i);
RefPtr<SkXfermode> transferModePtr = adoptRef(SkXfermode::Create(transferMode));
m_canvas->drawVertices(
vertexMode,
skVertices.size(),
skVertices.data(),
skTextureCoordinates.isEmpty() ? nullptr : skTextureCoordinates.data(),
colors.isEmpty() ? nullptr : colors.data(),
transferModePtr.get(),
skIndices.isEmpty() ? nullptr : skIndices.data(),
skIndices.size(),
*paint.paint()
);
}
示例11: drawAtlas
void Canvas::drawAtlas(CanvasImage* atlas,
const std::vector<RSTransform>& transforms, const std::vector<Rect>& rects,
const std::vector<CanvasColor>& colors, TransferMode mode,
const Rect& cullRect, const Paint& paint)
{
if (!m_canvas)
return;
RefPtr<SkImage> skImage = atlas->image();
std::vector<SkRSXform> skXForms;
skXForms.reserve(transforms.size());
for (const RSTransform& transform : transforms)
skXForms.push_back(transform.sk_xform);
std::vector<SkRect> skRects;
skRects.reserve(rects.size());
for (const Rect& rect : rects)
skRects.push_back(rect.sk_rect);
std::vector<SkColor> skColors;
skColors.reserve(colors.size());
for (const CanvasColor& color : colors)
skColors.push_back(color);
m_canvas->drawAtlas(
skImage.get(),
skXForms.data(),
skRects.data(),
skColors.empty() ? nullptr : skColors.data(),
skXForms.size(),
mode,
cullRect.is_null ? nullptr : &cullRect.sk_rect,
paint.paint()
);
}
示例12: drawImageRect
void Canvas::drawImageRect(const CanvasImage* image, Rect& src, Rect& dst, const Paint& paint) {
if (!m_canvas)
return;
ASSERT(image);
m_canvas->drawImageRect(image->image(), src.sk_rect, dst.sk_rect, paint.paint(), SkCanvas::kFast_SrcRectConstraint);
}
示例13: drawImage
void Canvas::drawImage(const CanvasImage* image, const Point& p, const Paint& paint) {
if (!m_canvas)
return;
ASSERT(image);
m_canvas->drawImage(image->image(), p.sk_point.x(), p.sk_point.y(), paint.paint());
}
示例14: saveLayerWithoutBounds
void Canvas::saveLayerWithoutBounds(const Paint& paint) {
if (!m_canvas)
return;
m_canvas->saveLayer(nullptr, paint.paint());
}
示例15: drawImage
void Canvas::drawImage(const CanvasImage* image, double x, double y, const Paint& paint) {
if (!m_canvas)
return;
ASSERT(image);
m_canvas->drawImage(image->image(), x, y, paint.paint());
}