32 for (
int i = 0;
i < 200; ++
i) {
42 paint.setAntiAlias(doAA);
44 for (
int i = 0;
i < 50; ++
i) {
67 paint.setAntiAlias(doAA);
71 for (
int i = 0;
i < n; ++
i) {
123 for (
int aa = 0; aa <= 1; ++aa) {
147 return fA *
x + fB *
y + fC;
165 pts[0] = { 0, -c /
b };
166 pts[1] = {
b, pts[0].
fY -
a};
168 pts[0] = { -c /
a, 0 };
169 pts[1] = { pts[0].
fX +
b, -
a };
237 Rec* rec = (Rec*)ctx;
239 bool addLineTo =
false;
244 rec->fResult.moveTo(pts[0]);
249 if (addLineTo || pts[0] != rec->fPrev) {
250 rec->fResult.lineTo(pts[0]);
255 rec->fResult.lineTo(pts[1]);
259 rec->fResult.quadTo(pts[1], pts[2]);
263 rec->fResult.cubicTo(pts[1], pts[2], pts[3]);
272 return rec.fResult.detach().makeTransform(mx);
294 for (
int i = 0;
i < 4; ++
i) {
296 for (
auto&
p : pts) {
299 path.moveTo(pts[0]).quadTo(pts[1], pts[2]).quadTo(pts[3], pts[4]).lineTo(pts[5]);
301 return path.detach();
320 paint.setColor({0.5f, 0.5f, 0.5f, 1.0f},
nullptr);
323 paint.setColor({0, 0, 0, 1},
nullptr);
351 d = mx[3],
e = mx[4],
f = mx[5],
352 g = mx[6],
h = mx[7],
i = mx[8];
387 paint.setColor(0x40FF0000);
392 paint.setStrokeWidth(10);
399 for (
auto&
p : planes) {
407 for (
int i = 0;
i < 4; ++
i) {
442 SkV3 fEye { 0, 0, 1.0f/std::tan(fAngle/2) - 1 };
443 SkV3 fCOA { 0, 0, 0 };
444 SkV3 fUp { 0, 1, 0 };
449 void rotate(
float x,
float y,
float z) {
472 return viewport * perspective * camera * translate * fRot *
inv(viewport);
478 case '8': this->
rotate( delta, 0, 0);
return true;
479 case '2': this->
rotate(-delta, 0, 0);
return true;
480 case '4': this->
rotate(0, delta, 0);
return true;
481 case '6': this->
rotate(0, -delta, 0);
return true;
482 case '-': this->
rotate(0, 0, delta);
return true;
483 case '+': this->
rotate(0, 0, -delta);
return true;
485 case 'i': fTrans.
z += 0.1f;
SkDebugf(
"z %g\n", fTrans.
z);
return true;
486 case 'k': fTrans.
z -= 0.1f;
SkDebugf(
"z %g\n", fTrans.
z);
return true;
488 case 'n': fNear += 0.1f;
SkDebugf(
"near %g\n", fNear);
return true;
489 case 'N': fNear -= 0.1f;
SkDebugf(
"near %g\n", fNear);
return true;
490 case 'f': fFar += 0.1f;
SkDebugf(
"far %g\n", fFar);
return true;
491 case 'F': fFar -= 0.1f;
SkDebugf(
"far %g\n", fFar);
return true;
501 bool fShowUnclipped =
false;
514 case 'u': fShowUnclipped = !fShowUnclipped;
return true;
517 return this->CameraSlide::onChar(uni);
521 SkM44 mx = this->get44({0, 0, 400, 400});
524 paint.setColor({0.75, 0.75, 0.75, 1});
527 paint.setShader(fShader);
529 if (fShowUnclipped) {
532 paint.setAlphaf(0.33f);
534 paint.setAlphaf(1.f);
558 bool onClick(Click* click)
override {
return false; }
565 SkPoint fTex[4] = {{0, 0}, {256, 0}, {256, 256}, {0, 256}};
568 bool fShowHandles =
false;
569 bool fShowSkeleton =
false;
570 bool fShowTex =
false;
576 fPatch[0] = { 0, 0 };
577 fPatch[1] = { 100, 0 };
578 fPatch[2] = { 200, 0 };
579 fPatch[3] = { 300, 0 };
580 fPatch[4] = { 300, 100 };
581 fPatch[5] = { 300, 200 };
582 fPatch[6] = { 300, 300 };
583 fPatch[7] = { 200, 300 };
584 fPatch[8] = { 100, 300 };
585 fPatch[9] = { 0, 300 };
586 fPatch[10] = { 0, 200 };
587 fPatch[11] = { 0, 100 };
597 canvas->
concat(this->get44({0, 0, 300, 300}));
601 if (!fShowSkeleton) {
603 paint.setShader(fShader);
610 paint.setShader(
nullptr);
613 paint.setAntiAlias(
true);
615 paint.setStrokeWidth(8);
618 paint.setStrokeWidth(6);
627 case 'h': fShowHandles = !fShowHandles;
return true;
628 case 'k': fShowSkeleton = !fShowSkeleton;
return true;
629 case 't': fShowTex = !fShowTex;
return true;
632 return this->CameraSlide::onChar(uni);
639 const float tol = 15;
640 for (
int i = 0;
i < 12; ++
i) {
641 if (dist({
x,
y}, fPatch[
i]) <= tol) {
642 return new Click([
this,
i](Click* c) {
643 fPatch[
i] = c->fCurr;
651 bool onClick(Click* click)
override {
return false; }
static const int strokeWidth
void(* CanvasProc)(SkCanvas *, bool)
static SkHalfPlane half_plane_w0(const SkMatrix &m)
static SkScalar randRange(SkRandom &rand, SkScalar min, SkScalar max)
static void draw_halfplane(SkCanvas *canvas, SkPoint p0, SkPoint p1, SkColor c)
static SkPath clip(const SkPath &path, SkPoint p0, SkPoint p1)
static void show_thick(SkCanvas *canvas, bool doAA)
static void show_stroke(SkCanvas *canvas, bool doAA, SkScalar strokeWidth, int n)
static void show_fill(SkCanvas *canvas, bool doAA)
static void compute_half_planes(const SkMatrix &mx, SkScalar width, SkScalar height, SkHalfPlane planes[4])
static SkPath make_path()
static void show_text(SkCanvas *canvas, bool doAA)
static SkM44 inv(const SkM44 &m)
static void show_hair(SkCanvas *canvas, bool doAA)
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static bool rotate(const SkDCubic &cubic, int zero, int index, SkDCubic &rotPath)
static int sign(SkScalar x)
LoopControlFlowInfo fResult
#define SkScalarInvert(x)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
static constexpr bool SkToBool(const T &x)
static const SlideProc gProc[]
static SkPoint rand_pt(SkRandom &rand)
bool onChar(SkUnichar uni) override
SkM44 get44(const SkRect &r) const
void draw(SkCanvas *canvas) override
bool onClick(Click *click) override
void load(SkScalar w, SkScalar h) override
void draw(SkCanvas *canvas) override
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override
bool onChar(SkUnichar uni) override
void draw(SkCanvas *canvas) override
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override
void load(SkScalar w, SkScalar h) override
bool onClick(Click *click) override
void load(SkScalar w, SkScalar h) override
bool onClick(Click *click) override
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey) override
void draw(SkCanvas *canvas) override
bool onChar(SkUnichar uni) override
void load(SkScalar w, SkScalar h) override
bool onClick(Click *click) override
void draw(SkCanvas *canvas) override
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawOval(const SkRect &oval, const SkPaint &paint)
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
void drawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode mode, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
void drawPath(const SkPath &path, const SkPaint &paint)
void concat(const SkMatrix &matrix)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
@ kPoints_PointMode
draw each point separately
static void ClipPath(const SkPath &path, const SkRect &clip, bool canCullToTheRight, void(*consume)(SkEdgeClipper *, bool newCtr, void *ctx), void *ctx)
SkPath::Verb next(SkPoint pts[])
@ kAlias
no transparent pixels on glyph edges
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
static SkM44 LookAt(const SkV3 &eye, const SkV3 ¢er, const SkV3 &up)
static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z=0)
SkM44 & setRotateUnit(SkV3 axis, SkScalar radians)
static SkM44 Perspective(float near, float far, float angle)
static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z=1)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static constexpr int kMPersp1
input y perspective factor
SkMatrix & setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar persp0, SkScalar persp1, SkScalar persp2)
bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count)
bool invert(SkMatrix *inverse) const
static constexpr int kMPersp0
input x perspective factor
static constexpr int kMPersp2
perspective bias
@ kStroke_Style
set to stroke geometry
SkPathBuilder & addRRect(const SkRRect &, SkPathDirection, unsigned startIndex)
static bool PerspectiveClip(const SkPath &src, const SkMatrix &, SkPath *result)
const SkRect & getBounds() const
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
static float max(float r, float g, float b)
static float min(float r, float g, float b)
Optional< SkRect > bounds
clipPath(r.path, r.opAA.op(), r.opAA.aa())) DRAW(ClipRRect
sk_sp< SkBlender > blender SkRect rect
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.
SkSamplingOptions(SkFilterMode::kLinear))
Result test(const SkRect &bounds) const
bool twoPts(SkPoint pts[2]) const
SkScalar operator()(SkScalar x, SkScalar y) const
SkScalar eval(SkScalar x, SkScalar y) const
void toQuad(SkPoint quad[4]) const
void inset(float dx, float dy)
void setXYWH(float x, float y, float width, float height)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
constexpr float centerX() const
constexpr float height() const
constexpr float centerY() const
constexpr float width() const