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


C++ SkRect::makeOffset方法代码示例

本文整理汇总了C++中SkRect::makeOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ SkRect::makeOffset方法的具体用法?C++ SkRect::makeOffset怎么用?C++ SkRect::makeOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SkRect的用法示例。


在下文中一共展示了SkRect::makeOffset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onDraw

    void onDraw(SkCanvas* canvas) override {
        if (NULL == fBitmap.pixelRef()) {
            fImage.reset(make_image(canvas, &fCenter));
            image_to_bitmap(fImage, &fBitmap);
        }

        // amount of bm that should not be stretched (unless we have to)
        const SkScalar fixed = SkIntToScalar(fBitmap.width() - fCenter.width());

        const SkTSize<SkScalar> size[] = {
            { fixed * 4 / 5, fixed * 4 / 5 },   // shrink in both axes
            { fixed * 4 / 5, fixed * 4 },       // shrink in X
            { fixed * 4,     fixed * 4 / 5 },   // shrink in Y
            { fixed * 4,     fixed * 4 }
        };

        canvas->drawBitmap(fBitmap, 10, 10, NULL);

        SkScalar x = SkIntToScalar(100);
        SkScalar y = SkIntToScalar(100);

        SkPaint paint;
        paint.setFilterQuality(kLow_SkFilterQuality);

        for (int iy = 0; iy < 2; ++iy) {
            for (int ix = 0; ix < 2; ++ix) {
                int i = ix * 2 + iy;
                SkRect r = SkRect::MakeXYWH(x + ix * fixed, y + iy * fixed,
                                            size[i].width(), size[i].height());
                canvas->drawBitmapNine(fBitmap, fCenter, r, &paint);
                canvas->drawImageNine(fImage, fCenter, r.makeOffset(360, 0), &paint);

            }
        }
    }
开发者ID:mariospr,项目名称:chromium-browser,代码行数:35,代码来源:ninepatchstretch.cpp

示例2: quickContains

bool GrClipStackClip::quickContains(const SkRect& rect) const {
    if (!fStack) {
        return true;
    }
    return fStack->quickContains(rect.makeOffset(SkIntToScalar(fOrigin.x()),
                                                 SkIntToScalar(fOrigin.y())));
}
开发者ID:03050903,项目名称:skia,代码行数:7,代码来源:GrClip.cpp

示例3: onDraw

 void onDraw(int loops, SkCanvas* canvas) override {
     SkRect rect = SkRect::MakeWH(fDstRectSize, fDstRectSize);
     SkPaint paint;
     paint.setAlpha(0x40);
     paint.setFilterQuality(kLow_SkFilterQuality);
     paint.setAntiAlias(fAA);
     for (int i = 0; i < loops; i++) {
         for (int j = 0; j < kNumImages; ++j) {
             SkVector translate = this->translation(i * kNumImages + j);
             canvas->drawImageRect(fImages[j].get(), rect.makeOffset(translate.fX, translate.fY),
                                   &paint);
         }
         // Prevent any batching except without multitexturing since we're trying to measure
         // drawing distinct images and just repeating images here to increase the workload for
         // timing reasons.
         canvas->flush();
     }
 }
开发者ID:android,项目名称:platform_external_skia,代码行数:18,代码来源:MultitextureImageBench.cpp

示例4: onDrawContent

    void onDrawContent(SkCanvas* canvas) override {
        const SkRect oval = fOval.makeOffset(fCenter.fX - fOval.centerX(),
                                             fCenter.fY - fOval.centerY());

        SkPaint p;
        p.setAntiAlias(true);

        p.setStyle(SkPaint::kStroke_Style);
        canvas->drawOval(oval, p);

        const SkRect r = SkRect::MakeLTRB(200, 200, 300, 300);
        canvas->clipRect(r);

        p.setStyle(SkPaint::kFill_Style);
        p.setColor(SK_ColorRED);
        canvas->drawRect(r, p);

        p.setColor(0x800000FF);
        canvas->drawOval(oval, p);
    }
开发者ID:03050903,项目名称:skia,代码行数:20,代码来源:SamplePathClip.cpp


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