33 auto canvas = surf->getCanvas();
38 SkPoint pt = { wScalar / 2, hScalar / 2 };
61 for (
int i = 0;
i < 4; ++
i) {
69 rect.inset(wScalar / 8, hScalar / 8);
76 paint.setShader(
nullptr);
78 constexpr char kTxt[] =
"Skia";
79 SkPoint texPos = { wScalar / 17, hScalar / 2 +
font.getSize() / 2.5f };
87 return surf->makeImageSnapshot();
114 auto emplace_back = [](std::vector<Clip>& clips) ->
Clip& {
115 clips.emplace_back();
128 for (
int i = 0;
i < 6; ++
i) {
132 point = center + point;
139 emplace_back(fClips).setPath(hexagon.
snapshot());
165 constexpr char kTxt[] =
"Clip Me!";
173 for (
int doLayer = 0; doLayer <= testLayers; ++doLayer) {
176 for (
int aa = 0; aa < 2; ++aa) {
192 for (
int aa = 0; aa < 2; ++aa) {
196 clipOutlinePaint.
setColor(0x50505050);
211 canvas->
drawPath(closedClipPath, clipOutlinePaint);
213 canvas->
scale(1.f, 1.8f);
215 0, 1.5f *
font.getSize(),
font, txtPaint);
237 Clip () : fClipType(kNone_ClipType) {}
242 canvas->
clipPath(fPathBuilder.snapshot(), op, aa);
253 SkPath asClosedPath()
const {
267 fClipType = kPath_ClipType;
272 fClipType = kRect_ClipType;
274 fPathBuilder.
reset();
277 ClipType getType()
const {
return fClipType; }
282 *
bounds = fPathBuilder.computeBounds();
299 std::vector<Clip> fClips;
302 using INHERITED =
GM;
305DEF_GM(
return new ConvexPolyClip;)
@ kOpaque_SkAlphaType
pixel is opaque
#define SkDEBUGFAIL(message)
constexpr SkColor SK_ColorLTGRAY
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorWHITE
constexpr SkColor SK_ColorDKGRAY
@ kUTF8
uses bytes to represent UTF-8 or ASCII
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define SkScalarSin(radians)
#define SkScalarCeilToInt(x)
#define SkScalarCos(radians)
static constexpr bool SkToBool(const T &x)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
virtual SkISize getBaseLayerSize() const
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void drawPath(const SkPath &path, const SkPaint &paint)
void scale(SkScalar sx, SkScalar sy)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
SkMatrix & postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
static const SkMatrix & I()
SkMatrix & preTranslate(SkScalar dx, SkScalar dy)
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
void setStrokeWidth(SkScalar width)
SkPathBuilder & lineTo(SkPoint pt)
SkPathBuilder & moveTo(SkPoint pt)
static SkPath Rect(const SkRect &, SkPathDirection=SkPathDirection::kCW, unsigned startIndex=0)
const SkRect & getBounds() const
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
SkPath makeTransform(const SkMatrix &m, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
void reset(T *ptr=nullptr)
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
SkString getName() const override
void onOnceBeforeDraw() override
bool runAsBench() const override
GM(SkColor backgroundColor=SK_ColorWHITE)
static sk_sp< SkImage > make_img(int w, int h)
static float max(float r, float g, float b)
Optional< SkRect > bounds
sk_sp< SkBlender > blender SkRect rect
PODArray< SkColor > colors
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
font
Font Metadata and Metrics.
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
void scale(float scale, SkPoint *dst) const
static SkRect MakeIWH(int w, int h)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)