Created
October 29, 2016 21:11
-
-
Save Zamlox/640a9cbc7a0bd074e45d6808edae3b04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void draw(SkCanvas* canvas) { | |
const SkScalar scale = 256.0f; | |
const SkScalar R = 0.45f * scale; | |
const SkScalar TAU = 6.2831853f; | |
SkPath path; | |
path.moveTo(R, 0.0f); | |
for (int i = 1; i < 7; ++i) { | |
SkScalar theta = 3 * i * TAU / 7; | |
path.lineTo(R * cos(theta), R * sin(theta)); | |
} | |
path.close(); | |
SkPaint p; | |
p.setAntiAlias(true); | |
canvas->clear(SK_ColorWHITE); | |
canvas->translate(0.5f * scale, 0.5f * scale); | |
canvas->clipPath(path); | |
canvas->clear(SK_ColorBLACK); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment