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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 HelloTutorial(SkExampleWindow* window) | 65 HelloTutorial(SkExampleWindow* window) |
66 : SkExample(window) | 66 : SkExample(window) |
67 { | 67 { |
68 fName = "Tutorial"; // This is how Skia will find your example. | 68 fName = "Tutorial"; // This is how Skia will find your example. |
69 | 69 |
70 fWindow->setupBackend(SkExampleWindow::kGPU_DeviceType); | 70 fWindow->setupBackend(SkExampleWindow::kGPU_DeviceType); |
71 // Another option is the CPU backend: fWindow->setupBackend(kRaster_
DeviceType); | 71 // Another option is the CPU backend: fWindow->setupBackend(kRaster_
DeviceType); |
72 } | 72 } |
73 | 73 |
74 protected: | 74 protected: |
75 virtual void draw(SkCanvas* canvas) SK_OVERRIDE { | 75 void draw(SkCanvas* canvas) SK_OVERRIDE { |
76 // Clear background | 76 // Clear background |
77 canvas->drawColor(SK_ColorWHITE); | 77 canvas->drawColor(SK_ColorWHITE); |
78 | 78 |
79 SkPaint paint; | 79 SkPaint paint; |
80 // Draw a message with a nice black paint. | 80 // Draw a message with a nice black paint. |
81 paint.setFlags(SkPaint::kAntiAlias_Flag); | 81 paint.setFlags(SkPaint::kAntiAlias_Flag); |
82 paint.setColor(SK_ColorBLACK); | 82 paint.setColor(SK_ColorBLACK); |
83 paint.setTextSize(SkIntToScalar(20)); | 83 paint.setTextSize(SkIntToScalar(20)); |
84 | 84 |
85 static const char message[] = "Hello World!"; | 85 static const char message[] = "Hello World!"; |
(...skipping 28 matching lines...) Expand all Loading... |
114 * Repeat Step 2 to update our gyp targets and build our example. | 114 * Repeat Step 2 to update our gyp targets and build our example. |
115 * Run the SkiaExamples, specifying the name of our new example: `$> out/Releas
e/SkiaExamples --match Tutorial` | 115 * Run the SkiaExamples, specifying the name of our new example: `$> out/Releas
e/SkiaExamples --match Tutorial` |
116 | 116 |
117 Step 5: How to iterate through multiple examples | 117 Step 5: How to iterate through multiple examples |
118 ------------------------------------------------ | 118 ------------------------------------------------ |
119 | 119 |
120 If you did not specify an example with the --match flag, or if your match | 120 If you did not specify an example with the --match flag, or if your match |
121 string matches more than one example, you can use the *n* key to iterate | 121 string matches more than one example, you can use the *n* key to iterate |
122 through all of the examples registered. | 122 through all of the examples registered. |
123 | 123 |
OLD | NEW |