OLD | NEW |
1 Creating a Skia "Hello World!" | 1 Creating a Skia "Hello World!" |
2 ============================== | 2 ============================== |
3 | 3 |
4 This tutorial will guide you through the steps to create a Hello World Desktop | 4 This tutorial will guide you through the steps to create a Hello World Desktop |
5 application in Skia. | 5 application in Skia. |
6 | 6 |
7 Who this tutorial is for: | 7 Who this tutorial is for: |
8 ------------------------- | 8 ------------------------- |
9 | 9 |
10 This will be useful to you if you want to create a window that can receive | 10 This will be useful to you if you want to create a window that can receive |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 HelloTutorial(SkExampleWindow* window) | 66 HelloTutorial(SkExampleWindow* window) |
67 : SkExample(window) | 67 : SkExample(window) |
68 { | 68 { |
69 fName = "Tutorial"; // This is how Skia will find your example. | 69 fName = "Tutorial"; // This is how Skia will find your example. |
70 | 70 |
71 fWindow->setupBackend(SkExampleWindow::kGPU_DeviceType); | 71 fWindow->setupBackend(SkExampleWindow::kGPU_DeviceType); |
72 // Another option is the CPU backend: fWindow->setupBackend(kRaster_
DeviceType); | 72 // Another option is the CPU backend: fWindow->setupBackend(kRaster_
DeviceType); |
73 } | 73 } |
74 | 74 |
75 protected: | 75 protected: |
76 void draw(SkCanvas* canvas) SK_OVERRIDE { | 76 void draw(SkCanvas* canvas) override { |
77 // Clear background | 77 // Clear background |
78 canvas->drawColor(SK_ColorWHITE); | 78 canvas->drawColor(SK_ColorWHITE); |
79 | 79 |
80 SkPaint paint; | 80 SkPaint paint; |
81 // Draw a message with a nice black paint. | 81 // Draw a message with a nice black paint. |
82 paint.setFlags(SkPaint::kAntiAlias_Flag); | 82 paint.setFlags(SkPaint::kAntiAlias_Flag); |
83 paint.setColor(SK_ColorBLACK); | 83 paint.setColor(SK_ColorBLACK); |
84 paint.setTextSize(SkIntToScalar(20)); | 84 paint.setTextSize(SkIntToScalar(20)); |
85 | 85 |
86 static const char message[] = "Hello World!"; | 86 static const char message[] = "Hello World!"; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 $> out/Release/SkiaExamples --match Tutorial | 121 $> out/Release/SkiaExamples --match Tutorial |
122 | 122 |
123 Step 5: How to iterate through multiple examples | 123 Step 5: How to iterate through multiple examples |
124 ------------------------------------------------ | 124 ------------------------------------------------ |
125 | 125 |
126 If you did not specify an example with the `--match` flag, or if your match | 126 If you did not specify an example with the `--match` flag, or if your match |
127 string matches more than one example, you can use the *n* key to iterate | 127 string matches more than one example, you can use the *n* key to iterate |
128 through all of the examples registered. | 128 through all of the examples registered. |
129 | 129 |
OLD | NEW |