34 { 556.25000f, 523.03003f },
35 { 556.23999f, 522.96002f },
36 { 556.21997f, 522.89001f },
37 { 556.21997f, 522.82001f }
41 SkScalar tval[] = { 0.33333334f, 0.99999994f };
46 for (
int i = 0;
i < 11;
i++) {
53 const char* str =
"M2242 -590088L-377758 9.94099e+07L-377758 9.94099e+07L2242 -590088Z";
61 SkDebugf(
"[%g %g %g %g] [%x %x %x %x]\n",
68 bitmap.allocN32Pixels(300, 200);
72 paint.setAntiAlias(
true);
78 SkScalar fDStroke, fStroke, fMinStroke, fMaxStroke;
92 fShowHairline =
false;
129 paint.setAntiAlias(
true);
131 paint.setStrokeJoin(j);
132 paint.setStrokeWidth(fStroke);
138 paint.setStrokeWidth(0);
145 paint.setStrokeWidth(0);
150 canvas->
clear(0xFFDDDDDD);
175 fPrevSecs = currSecs;
177 fStroke += fDStroke *
delta;
178 if (fStroke > fMaxStroke || fStroke < fMinStroke) {
179 fDStroke = -fDStroke;
185 fShowHairline = !fShowHairline;
196#include
"include/effects/SkCornerPathEffect.h"
197#include
"src/base/SkRandom.h"
200 bool fDoFrame, fDoCorner, fDoConic;
201 SkPaint fPtsPaint, fSkeletonPaint, fCornerPaint;
210 for (
int i = 0;
i <
N; ++
i) {
236 case '1': this->toggle(fDoFrame);
return true;
237 case '2': this->toggle(fDoCorner);
return true;
238 case '3': this->toggle(fDoConic);
return true;
247 this->makePath(&
path);
260 for (
int i = 0;
i <
N; ++
i) {
276 for (
int i = 1;
i <
N; ++
i) {
284 void toggle(
bool&
value) {
293 bool fClosed, fShowStroke, fShowHidden, fShowSkeleton, fAsCurves =
false;
294 int fJoinType, fCapType;
296 SkPaint fPtsPaint, fHiddenPaint, fSkeletonPaint, fStrokePaint;
308 , fShowSkeleton(
true)
312 for (
int i = 0;
i <
N; ++
i) {
338 case '1': this->toggle(fShowSkeleton);
return true;
339 case '2': this->toggle(fShowStroke);
return true;
340 case '3': this->toggle(fShowHidden);
return true;
341 case '4': this->toggle3(fJoinType);
return true;
342 case '5': this->toggle3(fCapType);
return true;
343 case '6': this->toggle(fClosed);
return true;
344 case 'c': this->toggle(fAsCurves);
return true;
345 case '-': fWidth -= 5;
return true;
346 case '=': fWidth += 5;
return true;
356 this->makePath(&
path);
368 canvas->
drawPath(hidden, fHiddenPaint);
380 for (
int i = 0;
i <
N; ++
i) {
394 void toggle(
bool&
value) {
398 void toggle3(
int&
value) {
405 for (
int i = 1;
i <
N-2; ++
i) {
410 for (
int i = 1;
i <
N; ++
i) {
423 SkVector A = pts[3] - pts[0] + (pts[1] - pts[2]) * 3.0f;
424 SkVector B = (pts[0] - pts[1] - pts[1] + pts[2]) * 3.0f;
435 for (
int i = 0;
i < n; ++
i) {
451 for (
int i = 0;
i <
N; ++
i) {
455 fName =
"CubicCurve";
460 paint.setAntiAlias(
true);
476 for (
int i = 0;
i < n; ++
i) {
481 paint.setStrokeWidth(0.5f);
485 paint.setStrokeWidth(6);
489 paint.setColor(0xFF008800);
512 for (
int i = 0;
i <
N; ++
i) {
528 return a * (1 - t) +
b * t;
553 bool fShowSub =
false;
554 bool fShowFlatness =
false;
555 bool fShowInnerQuads =
false;
560 fPts[0] = { 90, 300 };
561 fPts[1] = { 30, 60 };
562 fPts[2] = { 250, 30 };
563 fPts[3] = { 350, 200 };
569 fName =
"CubicCurve2";
574 case 's': fShowSub = !fShowSub;
break;
575 case 'f': fShowFlatness = !fShowFlatness;
break;
576 case '-': fT -= 1.0f / 32;
break;
577 case '=': fT += 1.0f / 32;
break;
578 case 'q': fShowInnerQuads = !fShowInnerQuads;
break;
579 default:
return false;
587 paint.setAntiAlias(
true);
594 paint.setAntiAlias(
true);
601 path.moveTo(fQuad[0]);
602 path.quadTo(fQuad[1], fQuad[2]);
608 paint.setStrokeWidth(1.7f);
610 this->showFrame(canvas, fQuad, 2,
paint);
619 this->showFlattness(canvas);
622 if (fShowInnerQuads) {
623 this->showInnerQuads(canvas);
627 paint.setStroke(
true);
638 for (
int i = 0;
i < n; ++
i) {
651 for (
int i = 0;
i <
N; ++
i) {
670 for (
int n =
count; n > 0; --n) {
671 for (
int i = 0;
i < n; ++
i) {
681 int n = tmp - storage;
682 for (
int i = 0;
i < n; ++
i) {
687 void showFlattness(
SkCanvas* canvas) {
690 paint.setAntiAlias(
true);
693 paint2.setColor(0xFF008800);
695 paint.setColor(0xFF888888);
699 paint.setColor(0xFF0000FF);
701 pts[0] = (fQuad[0] + fQuad[1] + fQuad[1] + fQuad[2])*0.25;
702 pts[1] = (fQuad[0] + fQuad[2]) * 0.5;
716 canvas->
drawLine(anchor, anchor + v, paint2);
720 canvas->
drawLine(anchor, anchor + v, paint2);
727 void showInnerQuads(
SkCanvas* canvas) {
730 paint.setAntiAlias(
true);
731 paint.setStroke(
true);
739 p2 =
lerp(p0, p1, fT);
748 paint.setAntiAlias(
true);
749 paint.setColor(0xFF008800);
751 Dot(canvas, p2, 4, 0xFF00AA00);
static const char * draw_quad(const BezierRec *rec, int count)
static float prev(float f)
static SkPoint lerp(SkPoint a, SkPoint b, float t)
static void test_cubic2()
static int find_max_deviation_cubic(const SkPoint src[4], SkScalar ts[2])
static int compute_parallel_to_base(const SkPoint pts[4], SkScalar t[2])
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
void SkChopCubicAt(const SkPoint src[4], SkPoint dst[7], SkScalar t)
void SkEvalCubicAt(const SkPoint src[4], SkScalar t, SkPoint *loc, SkVector *tangent, SkVector *curvature)
int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2])
void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint *pt, SkVector *tangent)
int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[2])
#define SkScalarToDouble(x)
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override
bool onClick(ClickHandlerSlide::Click *) override
bool onChar(SkUnichar uni) override
void draw(SkCanvas *canvas) override
bool onClick(ClickHandlerSlide::Click *) override
void draw(SkCanvas *canvas) override
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override
static void Dot(SkCanvas *canvas, SkPoint p, SkScalar radius, SkColor c)
bool onChar(SkUnichar uni) override
void draw(SkCanvas *canvas) override
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override
bool onClick(ClickHandlerSlide::Click *) override
void draw(SkCanvas *canvas) override
bool onClick(ClickHandlerSlide::Click *) override
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override
bool onChar(SkUnichar uni) override
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi) override
void load(SkScalar w, SkScalar h) override
bool onClick(ClickHandlerSlide::Click *) override
void drawPath(SkCanvas *canvas, const SkPath &path, SkPaint::Join j)
void draw(SkCanvas *canvas) override
bool animate(double nanos) override
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
void drawPoint(SkScalar x, SkScalar y, 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 clear(SkColor color)
void drawPath(const SkPath &path, const SkPaint &paint)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
@ kPoints_PointMode
draw each point separately
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
static sk_sp< SkPathEffect > Make(SkScalar radius)
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
void setStrokeCap(Cap cap)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
void setStrokeJoin(Join join)
void setPathEffect(sk_sp< SkPathEffect > pathEffect)
@ kMiter_Join
extends to miter limit
@ kBevel_Join
connects outside edges
void setStrokeWidth(SkScalar width)
static bool FromSVGString(const char str[], SkPath *)
SkPathBuilder & moveTo(SkPoint pt)
SkPathBuilder & quadTo(SkPoint pt1, SkPoint pt2)
SkPath & moveTo(SkScalar x, SkScalar y)
SkPath & lineTo(SkScalar x, SkScalar y)
const char * c_str() const
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
static float max(float r, float g, float b)
static float min(float r, float g, float b)
T __attribute__((ext_vector_type(N))) V
static float Scaled(float time, float speed, float period=0)
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.
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)
int32_t fBottom
larger y-axis bounds
int32_t fTop
smaller y-axis bounds
int32_t fLeft
smaller x-axis bounds
int32_t fRight
larger x-axis bounds
bool setLength(float length)
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
bool intersects(const SkRect &r) const
SkScalar fRight
larger x-axis bounds
void round(SkIRect *dst) const
SkScalar fTop
smaller y-axis bounds