31Application* Application::Create(
int argc,
char** argv,
void* platformData) {
37 : fBackendType(Window::kNativeGL_BackendType),
38#elif defined(SK_VULKAN)
39 : fBackendType(Window::kVulkan_BackendType),
50 fWindow->pushLayer(
this);
52 fWindow->attach(fBackendType);
65void HelloWorld::updateTitle() {
72 title.append(
"Raster");
76#elif defined(SK_VULKAN)
77 title.append(
"Vulkan");
81 title.append(
"Unknown GPU backend");
85 fWindow->setTitle(title.c_str());
95 auto canvas =
surface->getCanvas();
105 canvas->drawRect(rect,
paint);
109 SkPoint linearPoints[] = { { 0, 0 }, { 300, 300 } };
113 paint.setAntiAlias(
true);
115 canvas->drawCircle(200, 200, 64,
paint);
118 paint.setShader(
nullptr);
122 SkFont font(fTypeface, 20);
123 font.setSubpixel(
true);
127 static const char message[] =
"Hello World ";
130 canvas->translate(300, 300);
131 fRotationAngle += 0.2f;
132 if (fRotationAngle > 360) {
133 fRotationAngle -= 360;
135 canvas->rotate(fRotationAngle);
152 fBackendType = Window::kNativeGL_BackendType;
153#elif defined(SK_VULKAN)
154 fBackendType = Window::kVulkan_BackendType;
156 SkDebugf(
"No GPU backend configured\n");
163 fWindow->attach(fBackendType);
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
@ kUTF8
uses bytes to represent UTF-8 or ASCII
void onPaint(SkSurface *) override
void onBackendCreated() override
bool onChar(SkUnichar c, skui::ModifierKey modifiers) override
HelloWorld(int argc, char **argv, void *platformData)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static Window * CreateNativeWindow(void *platformData)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)