68 paint.setAntiAlias(
true);
70 paint.setStrokeWidth(2);
71 paint.setColor(0xFF660000);
75 for (
SkScalar angle = 0; angle <= 45; angle += 45) {
76 for (
int oHeight = 2; oHeight >= 1; --oHeight) {
93 paint.setStrokeWidth(5);
94 const SkColor purple = 0xFF800080;
95 const SkColor darkgreen = 0xFF008000;
97 const char* arcstrs[] = {
98 "M250,400 A120,80 0 0,0 250,500",
99 "M250,400 A120,80 0 1,1 250,500",
100 "M250,400 A120,80 0 1,0 250,500",
101 "M250,400 A120,80 0 0,1 250,500"
104 for (
const char* arcstr : arcstrs) {
107 paint.setColor(colors[cIndex++]);
108 canvas->drawPath(path,
paint);
114 path.moveTo(100, 100)
116 canvas->drawPath(path.detach(),
paint);
118 path.moveTo(200, 100)
120 canvas->drawPath(path.detach(),
paint);
146const char gWhiteSpace[] = { 0, 0, 0, 0, 0, 0, 0, 0,
' ',
' ',
' ',
' ', 0x09, 0x0D, 0x0A };
154 for (
int rep = 0; rep < reps; ++rep) {
192 for (
int rep = 0; rep < reps; ++rep) {
193 for (
int index = 0; index < legal.
fScalars; ++index) {
197 if (rep < reps - 1 && index < legal.
fScalars - 1) {
202 if (
'A' == legal.
fSymbol && 1 == index) {
226 paint.setAntiAlias(
true);
231 str.
printf(
"<g transform='translate(%d,%d) scale(%d,%d)'>\n", xStart, yStart,
234 str.
printf(
"<clipPath id='clip_%d_%d'>\n", xStart, yStart);
236 str.
printf(
"<rect width='100' height='100' x='0' y='0'></rect>\n");
238 str.
printf(
"</clipPath>\n");
248 for (uint32_t i = rand.
nextRangeU(0, 10); i--; ) {
255 canvas->drawPath(path,
paint);
258 str.
printf(
"<path d='\n");
261 str.
printf(
"\n' fill='#%06x' fill-opacity='%g'",
paint.getColor() & 0xFFFFFF,
262 paint.getAlpha() / 255.f);
264 str.
printf(
" clip-path='url(#clip_%d_%d)'/>\n", xStart, yStart);
267 }
while (--
count > 0);
272 canvas->translate(0, 100);
275 canvas->translate(100, 0);
278 const char trailer[] =
"</svg>\n";
279 sk_fwrite(trailer,
sizeof(trailer) - 1, file);
285 canvas->translate(111, 0);
288 p.moveTo(-43.44464063610148f, 79.43535936389853f);
292 p.arcTo(oval, 1.25f * 180, .5f * 180,
false);
297 paint.setStrokeWidth(15.36f);
299 canvas->drawPath(p.detach(),
paint);
303 const char*
d=
"M60,60 A50,50 0 0 0 160,60 A50,50 0 0 0 60,60z";
306 p.setStrokeWidth(100);
307 p.setAntiAlias(
true);
308 p.setColor(0xFF008200);
315 int intervalCount = (
int) std::size(intervals);
317 canvas->drawPath(path, p);
#define SkAssertResult(cond)
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
FILE * sk_fopen(const char path[], SkFILE_Flags)
size_t sk_fwrite(const void *buffer, size_t byteCount, FILE *)
static void add_some_white(SkRandom *rand, SkString *atom)
static void add_comma(SkRandom *rand, SkString *atom)
@ kParsePathTestDimension
static constexpr bool GENERATE_SVG_REFERENCE
const struct Legal gLegal[]
static SkString make_random_svg_path(SkRandom *rand)
static void add_white(SkRandom *rand, SkString *atom)
Type::kYUV Type::kRGBA() int(0.7 *637)
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
@ kStroke_Style
set to stroke geometry
static bool FromSVGString(const char str[], SkPath *)
SkPathBuilder & arcTo(const SkRect &oval, SkScalar startAngleDeg, SkScalar sweepAngleDeg, bool forceMoveTo)
SkPathBuilder & moveTo(SkPoint pt)
@ kSmall_ArcSize
smaller of arc pair
@ kLarge_ArcSize
larger of arc pair
float nextRangeF(float min, float max)
uint32_t nextRangeU(uint32_t min, uint32_t max)
void printf(const char format[],...) SK_PRINTF_LIKE(2
void append(const char text[])
void appendScalar(SkScalar value)
void appendU32(uint32_t value)
const char * c_str() const
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
SkScalar fLeft
smaller x-axis bounds
static SkRect MakeIWH(int w, int h)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
void offset(float dx, float dy)
constexpr float height() const
constexpr float right() const
constexpr float width() const
constexpr float bottom() const
SkScalar fTop
smaller y-axis bounds